#1

I want a command which when u write /kill u cant write it again for another 5 mins.

Код:
	if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 0);
		GameTextForPlayer(playerid, "~w~Grim Reaper~n~~r~Has Taken Your Soul!", 4500, 2);
		return 1;
	}
Reply
#2

can some help?
Reply
#3

At the top of the script;
Код:
new Kill[MAX_PLAYERS] = 1;
Somewhere in script;
Код:
forward KillTimer(playerid);
public KillTimer(playerid)
{
	Kill[playerid] = 1;
	return 1;
}
Код:
	if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
              If (Kill[playerid] == 1)
             {
		SetPlayerHealth(playerid, 0);
		GameTextForPlayer(playerid, "~w~Grim Reaper~n~~r~Has Taken Your Soul!", 4500, 2);
                SetTimerEx("KillTimer", 1000*60*5, false, "i", playerid);
                Kill[playerid] = 0;
            }
		else return SendClientMessage(playerid, 0xFF0000FF, "You can only use this command once every 5 minutes!");
               return 1;
	}
I think that's about right.
Reply
#4

pawn Код:
new KillCommandTime[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/kill", cmdtext, true, 10) == 0)
    {
                if(GetTickCount() - KillCommandTime[playerid] > 300000)
                {
                    KillComandTime[playerid] = GetTickCount();  
            SetPlayerHealth(playerid, 0);
            GameTextForPlayer(playerid, "~w~Grim Reaper~n~~r~Has Taken Your Soul!", 4500, 2);
                    KillCommandTime[playerid] = GetTickCount();
                }
                return 1;
    }
}

public OnPlayerDisconnect(playerid)
{
    KillCommandTime[playerid] = 0;
}
@Rillo: A timer? That is the worst way to do it! Not to mention this SetTimerEx("KillTimer", 1000*60*5, false, "i", playerid); is more on the order of 5 minutes 30 seconds.
Reply
#5

Use timestamps
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)