Home » Renegade Discussions » Mod Forum » Stealth command help
Re: Stealth command help [Solved] [message #407971 is a reply to message #407893] |
Thu, 22 October 2009 06:12 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma:
|
General (3 Stars) |
|
|
If you decide to carry on use YazooGang's timer example, then I encourage you to take the actual timer itself down from 0.01f to say 0.5f. It's not really neccessary to have it loop like that every 0.01 seconds...
I would however like to encourage you to consider making a global array for the players...
bool IsPlayerStealth[128]; // global array
On the level_loaded event I would for loop through the array and set all the elements to false (just to make sure they are all false at the start of the map).
for (int i = 1; i < 128; i++){
IsPlayerStealth[i] = false;
}
You would need to set the players to true in this array when they become stealth, and false when they die. I would do something like this:
class StealthChatCommand : public ChatCommandClass {
void Triggered(int ID,const TokenClass &Text,int ChatType) {
GameObject *obj = Get_GameObj(ID);
float Credits = Commands->Get_Money(obj);
if(Credits >= 1000){
Commands->Give_Money(obj,-1000,false);
char message[256];
sprintf(message,"msg %s bought a Stealthsuit", Get_Player_Name_By_ID(ID));
Console_Input(message);
//Commands->Enable_Stealth(obj,true);
Commands->Attach_Script(obj,"Hubba_Stealth","");
}
else {
Console_Input(StrFormat("ppage %d You need $1000.",ID).c_str());
}
}
};
ChatCommandRegistrant<StealthChatCommand> StealthChatCommandReg("!ss;!StealthSuit;!SS;!stealthsuit",CHATTYPE_ALL,0,GAMEMODE_AOW);
void Hubba_Stealth::Created(GameObject *obj)
{
Commands->Enable_Stealth(obj,true);
IsStealthPlayer[Get_Player_ID(obj)] = true;
}
void Hubba_Stealth::Killed(GameObject *obj,GameObject *shooter)
{
IsStealthPlayer[Get_Player_ID(obj)] = false;
}
ScriptRegistrant<Hubba_Stealth> Hubba_Stealth_Registrant("Hubba_Stealth","");
class Hubba_Stealth : public ScriptImpClass {
void Created(GameObject *obj);
void Killed(GameObject *obj,GameObject *shooter);
};
Then on the player join event, you would do a similar loop to the level_loaded event, and just loop through the array, and if any of them are true, then apply the stealth tot hem again...
for (int i = 1; i < 128; i++){
if(IsPlayerStealth[i] == true){
Commands->Enable_Stealth(Get_GameObj(i),true);
}
}
Plus, this way you have a method of keeping track of who is currently stealthed, meaning you could add more functionaility.. You could add a command like !currentlystealthed, and it messages you who is stealthed...
Or you could add a conditional to your chat command, so if they are already stealthed, it pages them saying they are already stealthed.
I'm not fond of these sort of comamnds really if I am honest, but perhaps if you must do this, you could at least ensure the HON is alive, or they are at least a Nod player?
[Updated on: Thu, 22 October 2009 06:13] Report message to a moderator
|
|
|
|
|
Stealth command help
By: Hubba on Wed, 21 October 2009 10:49
|
|
|
Re: Stealth command help
By: ErroR on Wed, 21 October 2009 11:09
|
|
|
Re: Stealth command help
By: Hubba on Wed, 21 October 2009 11:47
|
|
|
Re: Stealth command help
By: ErroR on Wed, 21 October 2009 11:54
|
|
|
Re: Stealth command help
|
|
|
Re: Stealth command help
By: Hubba on Wed, 21 October 2009 12:31
|
|
|
Re: Stealth command help
|
|
|
Re: Stealth command help
|
|
|
Re: Stealth command help
By: Hubba on Wed, 21 October 2009 20:41
|
|
|
Re: Stealth command help [Solved]
By: cAmpa on Thu, 22 October 2009 00:22
|
|
|
Re: Stealth command help [Solved]
|
|
|
Re: Stealth command help [Solved]
By: reborn on Thu, 22 October 2009 06:12
|
|
|
Re: Stealth command help [Solved]
|
|
|
Re: Stealth command help [Solved]
|
|
|
Re: Stealth command help [Solved]
By: reborn on Thu, 22 October 2009 12:33
|
|
|
Re: Stealth command help [Solved]
By: Hubba on Thu, 22 October 2009 13:08
|
|
|
Re: Stealth command help
By: reborn on Thu, 22 October 2009 13:19
|
|
|
Re: Stealth command help
By: Hubba on Thu, 22 October 2009 13:27
|
|
|
Re: Stealth command help
By: reborn on Thu, 22 October 2009 13:38
|
|
|
Re: Stealth command help
By: Hubba on Thu, 22 October 2009 13:44
|
|
|
Re: Stealth command help
By: cAmpa on Thu, 22 October 2009 13:42
|
|
|
Re: Stealth command help
By: reborn on Fri, 23 October 2009 03:46
|
|
|
Re: Stealth command help
By: jonwil on Fri, 23 October 2009 04:52
|
|
|
Re: Stealth command help
|
|
|
Re: Stealth command help
By: raven on Fri, 23 October 2009 13:21
|
|
|
Re: Stealth command help
By: Hubba on Sat, 24 October 2009 05:44
|
|
|
Re: Stealth command help
By: cAmpa on Sat, 24 October 2009 05:47
|
|
|
Re: Stealth command help
By: Hubba on Sat, 24 October 2009 06:02
|
|
|
Re: Stealth command help
By: Hubba on Sun, 25 October 2009 13:17
|
|
|
Re: Stealth command help
By: reborn on Sun, 25 October 2009 13:44
|
|
|
Re: Stealth command help
By: Hubba on Sun, 25 October 2009 14:18
|
|
|
Re: Stealth command help
By: reborn on Sun, 25 October 2009 15:54
|
|
|
Re: Stealth command help
By: nopol10 on Sun, 25 October 2009 17:08
|
|
|
Re: Stealth command help
By: reborn on Sun, 25 October 2009 23:35
|
|
|
Re: Stealth command help
By: Hubba on Mon, 26 October 2009 09:01
|
|
|
Re: Stealth command help
By: reborn on Mon, 26 October 2009 11:44
|
|
|
Re: Stealth command help
|
|
|
Re: Stealth command help
By: Hubba on Mon, 26 October 2009 12:26
|
|
|
Re: Stealth command help
By: reborn on Mon, 26 October 2009 12:43
|
|
|
Re: Stealth command help
By: Hubba on Mon, 26 October 2009 12:48
|
|
|
Re: Stealth command help
By: nopol10 on Mon, 26 October 2009 16:31
|
|
|
Re: Stealth command help
By: reborn on Mon, 26 October 2009 23:24
|
|
|
Re: Stealth command help
By: Hubba on Tue, 27 October 2009 07:04
|
|
|
Re: Stealth command help
By: reborn on Tue, 27 October 2009 10:11
|
|
|
Re: Stealth command help
By: Hubba on Tue, 27 October 2009 11:18
|
|
|
Re: Stealth command help
By: reborn on Tue, 27 October 2009 11:30
|
|
|
Re: Stealth command help
By: Hubba on Tue, 27 October 2009 11:56
|
|
|
Re: Stealth command help
By: reborn on Tue, 27 October 2009 12:29
|
|
|
Re: Stealth command help
By: Hubba on Tue, 27 October 2009 13:10
|
|
|
Re: Stealth command help
By: reborn on Tue, 27 October 2009 13:30
|
|
|
Re: Stealth command help
By: reborn on Wed, 28 October 2009 01:37
|
|
|
Re: Stealth command help
By: Hubba on Wed, 28 October 2009 07:58
|
|
|
Re: Stealth command help
By: reborn on Wed, 28 October 2009 08:19
|
|
|
Re: Stealth command help
By: Hubba on Wed, 28 October 2009 08:59
|
|
|
Re: Stealth command help
By: reborn on Wed, 28 October 2009 10:31
|
|
|
Re: Stealth command help
By: Hubba on Wed, 28 October 2009 11:09
|
|
|
Re: Stealth command help
By: reborn on Wed, 28 October 2009 11:17
|
|
|
Re: Stealth command help
|
Goto Forum:
Current Time: Sat Dec 21 20:20:15 MST 2024
Total time taken to generate the page: 0.01600 seconds
|