28.09.2011, 09:43
(
Последний раз редактировалось iggy1; 28.09.2011 в 09:51.
Причина: Little code mistake
)
Here's a way, there is no need for a timer. You will need to edit make the "iLastRobbery" var an array and assign robbery shops ids to it.
You need to keep in mind that a player will be able to rob cash at any checkpoint since you only check if they are in a checkpoint and not in a specific checkpoint.
pawn Код:
new iLastRobbery;
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/rob", true) == 0) // If they type /rob
{
if(IsPlayerInCheckpoint(playerid))
{
if(GetTickCount() > iLastRobbery) //if iLastRobbey is less than tickcount. ie. iLastRobbey = GetTickCount + 60 seconds.
{
GivePlayerMoney(playerid, random(2000+1));
iLastRobbery = GetTickCount() + 60000;//iLastRobbery is GetTickCount plus 60 secons
return 1;
}
else {
SendClientMessage(playerid, 0xFF0000AA, "ERROR: That shop has only recently been robbed.");
return 1;
}
}
}
return 0;
}

