Two small problems
#1

Well, I have two problems.

My command /signal or when I press Crouch key, activating the signal sign works but the cooldown timer doesnt.
-/signal command, cooldown not working and so as the key crouch doesnt have the cooldown too.
-There is timer of 5 seconds which is destroying the object = not working

Code:

Код:
//top of the script
new Cooldown[MAX_PLAYERS];

//bellow on game mode init
SetTimer("CooldownTimer",1000,true);

//command
if (strcmp("/signal", cmdtext, true) == 0 || strcmp("/s", cmdtext, true) == 0)
	{
 		if(Cooldown[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"<!>Please Wait Before Using This Command Again!");
  		{
	    	new Float:x, Float:y, Float:z, SignalObj;
		    GetPlayerPos(playerid, x, y, z);
		    SetTimerEx( "Signal", 5000, false, "i", SignalObj );
		    SignalObj = CreateObject(18714,x,y,z, 0.0, 0.0, 96.0);
		    GameTextForPlayer(playerid, "Signal started", 1, 1);
		    SendClientMessage(playerid, COLOR_LIGHTBLUE, "<!>You can also press 'Crouch' button to activate this!");
		}
  		return 1;
	}

//On Key Press
    if (PRESSED(KEY_CROUCH))
    {
        if(Cooldown[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"<!>Please Wait Before Using This Command Again!");
  		{
	    	new Float:x, Float:y, Float:z, SignalObj;
		    GetPlayerPos(playerid, x, y, z);
		    SetTimerEx( "Signal", 5000, false, "i", SignalObj );
		    SignalObj = CreateObject(18714,x,y,z, 0.0, 0.0, 96.0);
		    GameTextForPlayer(playerid, "Signal started", 1, 1);
		}
		return 1;
	}
	return 1;
}

//forwards
forward CooldownTimer();

forward Signal( objectid );
public Signal( objectid )
{
    DestroyObject( objectid );
    return 1;
}
Reply
#2

Bump.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)