Home » Renegade Discussions » Mod Forum » Questions (player objects, stealth vehs)
Questions (player objects, stealth vehs) [message #413375] |
Mon, 07 December 2009 09:29 |
Hubba
Messages: 40 Registered: October 2009
Karma:
|
Recruit |
|
|
Question 1: I have build commands on my server so now i have been wondering when you for example use !ramp which create a ramp. How can i make so the object belongs to a player-id? So it would store all objects a player has made in an array or something? Then when the user type !cleanup it would remove all the objects he have made.
Question 2: I have a "!ssv" command which sets the current vehicle a player is inside to stealth. Now i want to make so when an another player join the game later he should see them stealth. So i need somehow to add and store all the vehicles in an array so it would loop that array when the other play joins and set stealth to all these vehicles. But the problem is how could i make so when i type !ssv it would add the vehicle to the array? And how can i remove that vehicle from the array when it gets destroyed?
Now i don't know if arrays is the best way to do it. But if you have a better idea then please tell it ?
Code in spoilers.
!ramp
Toggle Spoiler
class RampChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType)
{
GameObject *obj = Get_GameObj(ID);
Vector3 position;
float Credits = Commands->Get_Money(obj);
position = Commands->Get_Position(obj);
position.Z += +0.0;
position.X += (float)(5*cos(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180))); // 3.14
position.Y += (float)(5*sin(Commands->Get_Facing(Get_GameObj(ID))*(3.14 / 180))); //3.14
if(Credits >= 450)
{
Commands->Give_Money(obj,-450,false);
char message[256];
sprintf(message,"msg [BOT]: %s just purchased a Ramp", Get_Player_Name_By_ID(ID));
Console_Input(message);
GameObject *turret = Commands->Create_Object("M09_Rnd_Door", position);
Commands->Set_Model(turret, "dsp_ramp");
Set_Max_Health(turret, 500);
Set_Max_Shield_Strength(turret, 0);
Commands->Set_Health(turret,250);
Commands->Set_Facing(turret, Commands->Get_Facing(obj)-180);
}
else
{
Console_Input(StrFormat("ppage %d You need $450.",Get_Player_ID(obj)).c_str());
}
}
};
ChatCommandRegistrant<RampChatCommand> RampChatCommandReg("!ramp",CHATTYPE_ALL,0,GAMEMODE_AOW);
!ssv
Toggle Spoiler
class SsVChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType)
{
GameObject *obj = Get_GameObj(ID);
GameObject *X = Get_Vehicle(obj);
float Credits = Commands->Get_Money(obj);
if(Credits >= 1500)
{
Commands->Give_Money(obj,-1500,false);
char message[256];
sprintf(message,"msg [BOT]: %s just Bought a Stealthsuit his Vehicle", Get_Player_Name_By_ID(ID));
Console_Input(message);
Commands->Enable_Stealth(X,true);
}
else
{
Console_Input(StrFormat("ppage %d You need $1500.",Get_Player_ID(obj)).c_str());
}
}
};
ChatCommandRegistrant<SsVChatCommand> SsVChatCommandReg("!ssv",CHATTYPE_ALL,0,GAMEMODE_AOW);
Thanks,
Hubba
|
|
|
|
|
Questions (player objects, stealth vehs)
By: Hubba on Mon, 07 December 2009 09:29
|
|
|
Re: Questions (player objects, stealth vehs)
By: reborn on Wed, 09 December 2009 02:52
|
|
|
Re: Questions (player objects, stealth vehs)
By: Hubba on Thu, 10 December 2009 08:20
|
|
|
Re: Questions (player objects, stealth vehs)
By: reborn on Thu, 10 December 2009 08:43
|
|
|
Re: Questions (player objects, stealth vehs)
By: Hubba on Thu, 10 December 2009 09:00
|
|
|
Re: Questions (player objects, stealth vehs)
By: Hubba on Sat, 02 January 2010 14:05
|
|
|
Re: Questions (player objects, stealth vehs)
By: reborn on Sun, 03 January 2010 04:09
|
|
|
Re: Questions (player objects, stealth vehs)
By: Hubba on Sun, 03 January 2010 05:27
|
Goto Forum:
Current Time: Sat Dec 14 20:05:00 MST 2024
Total time taken to generate the page: 0.00718 seconds
|