Help !
#1

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
Reply
#2

Код:
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
Reply
#3

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
Reply
#4

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

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

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
Reply
#7

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.
Reply
#8

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 ?
Reply
#9

EDITED - PROBLEM FIXED , THNX FOR YOUR HELP!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)