SA-MP Forums Archive
Help ! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help ! (/showthread.php?tid=663058)



Help ! - PoniStar - 20.01.2019

Hi, so i want to create a command , i want to create a var for player who i want and it should not delete or change to other player who entered with that player id , for exp : i want to give a timer to player (this : TempTimer[playerid] = 300; and it will decrease on server time , decrease every sec) so i want if the player was not in game this var decrease and also if server restarted that var for selected players not delete sorry for my bad english if is it possible helpme with showing some codes not only explains


Re: Help ! - Jeffry - 20.01.2019

Код:
new tempTimer[MAX_PLAYERS];
Where you start the timer:
Код:
tempTimer[playerid] = gettime() + 300;
Where you want to ask for it:
Код:
if(tempTimer[playerid] > gettime()) return SendClientMessage(playerid, 0xFF0000FF, "Error: You are not allowed to use this command yet.");
Save this Variable in your stats and load it when logging in, then it will also work, when the player leaves the server.

For more info, read: https://sampforum.blast.hk/showthread.php?tid=662298


Re: Help ! - PoniStar - 21.01.2019

Dude i want to that var decrease even if the player was not in server , attention , this should not match with the player id , it should match with player name ! So when another player joined with same id (when other left) the var decrease for the first one not the new player with same playerid


Re: Help ! - Jeffry - 21.01.2019

That is what it does. Save it in the player file or MySQL Database, like any other Stat, for example kills, money or whatever.


Re: Help ! - PoniStar - 22.01.2019

Yeah, but i think it will just decrease when he is online !


Re: Help ! - Banditul18 - 22.01.2019

Quote:
Originally Posted by PoniStar
Посмотреть сообщение
Yeah, but i think it will just decrease when he is online !
If you save/use it as timestamp (gettime) the time decreses automatic. Also if you save it into his account and when he log in the time that he have saved will be lower than the time after 5 min(he quited for 5 min) so he can use what ever he is restricted from


Re: Help ! - Jeffry - 22.01.2019

Quote:
Originally Posted by PoniStar
Посмотреть сообщение
Yeah, but i think it will just decrease when he is online !
Don't "think", just give it a try.

As Banditul18 said, it will save the timestamp.


Re: Help ! - PoniStar - 15.02.2019

hi i just test this today and its worked now i have a question , i want to get the time that for exp the vip rank will expire , i mean i want to show that date and time to player when he want , how can i get them ?


Re: Help ! - PoniStar - 15.02.2019

EDITED - PROBLEM FIXED , THNX FOR YOUR HELP!