Need Help With Setting a Timer For /Stuck [fixed]
#1

Hello ,
Because Of The Abusing Of /Stuck in my server , I Want To Put A Timer For it

Код:
 	if(strcmp(cmd, "/stuck", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
		{
			new Float:slx, Float:sly, Float:slz;
			GetPlayerPos(playerid, slx, sly, slz);
			SetPlayerPos(playerid, slx, sly, slz+2);
			TogglePlayerControllable(playerid, 1);
			return 1;
		}
Could you help me how to make it please ?
Thanks
Reply
#2

i dont understand what want to do but i can help with timer

example
Код:
if(strcmp(cmd, "/stuck", true) == 0)
{
   if(IsPlayerConnected(playerid))
   {
   SetTimerEx("stucktime", 15000, false, "d", playerid);//15000 = 15 sec
   }
   return 1;
}
add this at the end of your script
Код:
forward stucktime();
public stucktime()
{
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+2);
TogglePlayerControllable(playerid, 1);
return 1;
}
Reply
#3

i think he wants a cooldown timer not a delay timer
Reply
#4

Thanks For The Delaytimer ,
But I Need A Cool Downtimer . Could you help me with that please ?
Thanks .
Reply
#5

Put this in the beginning of the script

pawn Код:
new StuckDelay[MAX_PLAYERS];
and then the command

pawn Код:
if(strcmp(cmd, "/stuck", true) == 0)
    {
        if(GetTickCount() - StuckDelay[playerid] > 10000) // 10000 is 10 seconds in milliseconds
        {
            new Float:slx, Float:sly, Float:slz;
            GetPlayerPos(playerid, slx, sly, slz);
            SetPlayerPos(playerid, slx, sly, slz+2);
            TogglePlayerControllable(playerid, 1);
            StuckDelay[playerid] = GetTickCount();
        }
        else
        {
            SendClientMessage(playerid, 0xFFFFFFFF, "Don't spam!");
        }
        return 1;
    }
You don't need IsPlayerConnected check there.
Reply
#6

Thanks So Much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)