Posts: 357
Threads: 6
Joined: Feb 2018
Код:
CMD:suicide(playerid)
{
if(pInfo[playerid][pIsPlayerLogged] == false) return SendClientMessage(playerid,-1,"*"COL_RED" You haven't logged-in yet!");
if(pInfo[playerid][pIsPlayerSpawned] == false) return SendClientMessage(playerid,-1,"*"COL_RED" You are not spawned yet!");
if(pInfo[playerid][pHours] < 5) return SendClientMessage(playerid, -1, "*"COL_RED" You need at least 5 hour IG time to use this command!");
if(GetPVarInt(playerid, "UsedSucide") ==1)
{
GameTextForPlayer(playerid, "~w~You can only commit suicide once every 30 minutes", 3000, 3);
return true;
}
SetPVarInt(playerid, "UsedSucide", 1);
SetTimerEx("UsedSucide", 30*60000, false, "i", playerid);
SetPlayerHealth(playerid, 0.0);
SendClientMessage(playerid, -1, "*"COL_RED" You have commited suicide!");
return CMD_SUCCESS;
}
forward UsedSucide(playerid);
public UsedSucide(playerid)
{
if(IsPlayerConnected(playerid)) DeletePVar(playerid, "UsedSucide");
}
try this
Posts: 357
Threads: 6
Joined: Feb 2018
Quote:
Originally Posted by Undef1ned
REALLY? So much for something so simple?
|
Well, let it be an alternative method.
Posts: 716
Threads: 92
Joined: May 2018
pawn Код:
if(GetPVarInt(playerid,"CmdTime")>GetTickCount()) return SCM(playerid,COLOR_RED,"* Please wait before using this command again.");
SetPVarInt(playerid,"CmdTime",GetTickCount()+10000);
Posts: 17
Threads: 2
Joined: Jun 2018
Reputation:
0
I would suggest you to use ILearner's Code.
Using a timer for such a task is not smart