Quote:
Originally Posted by xXmAn40100Xx
From what I understood, you want a command that is toggled by the player every few minutes. If that's the case, I'd recommend that you use a timeout instead of using timers if you're gonna use something that is especifically toggled by the player, although you would have to calculate the time left if you're gonna make it something like "you can't use this command until x minutes have passed".
pawn Код:
//Check the tickcount function in SA-MP Wiki. setPlayerTimeout(playerid, timeoutname[]) { return SetPVarInt(playerid, timeoutname, tickcount()); }
getPlayerTimeout(playerid, timeoutname[], time) { return (tickcount() - GetPVarInt(playerid, coolname)) > (time * 1000); //The time argument is used in seconds, then it's converted to ms. //This will also return true if the timeout hasn't been set. }
destroyPlayerTimeout(playerid, timeoutname[]) { return DeletePVar(playerid, timeoutname); }
//In a command... public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/suicide", true)) { if(getPlayerTimeout(playerid, "player-suicidecmd", 1800)) { //Check if 1800 secs (30 mins) have passed since using the command. SetPlayerHealth(playerid, 0.0); setPlayerTimeout(playerid, "player-suicidecmd"); } else SendClientMessage(playerid, -1, "Unavailable: You must wait until using this command again"); } return 1; }
|
This would work, thanks.
Quote:
Originally Posted by d1git
You have no idea what you meant yourself, you told us that you couldn't figure it out, meaning, you already had something written out, a concept.
|
Nope, it's basically just your poor understanding on what I've asked and what I've just replied.
No need for further replies, someone already helped, stop power-posting lol.
Thanks again.