pTempVIP length left
#1

Hello, i am currently trying to get the /stats command to show how many days, hours, minutes and seconds you got left of your membership, please be aware of that when you input pTempVIP = 3600 it is seconds.

This is how it looks alike, however it returns the seconds you got straight away to the ''days'' instead of the days, and doesnt ends up with anything into the remaining spots at all.

Код:
format(coordsstring, sizeof(coordsstring), "VIP time left: %d days %d hours %d minutes %d seconds.", ((PlayerInfo[targetid][pTempVIP]/3600)/24,PlayerInfo[targetid][pTempVIP]/60,PlayerInfo[targetid][pTempVIP]/3600,PlayerInfo[targetid][pTempVIP]));
SendClientMessage(playerid, COLOR_GRAD1, coordsstring);
Reply
#2

Anyone ?
Reply
#3

I'm having doubts about the method you showed above. Instead I would do something like:

I quickly came up with this method:
pawn Код:
new days, hours, minutes, seconds = PlayerInfo[targetid][pTempVIP];
days = seconds / 86400;
seconds -= days * 86400;
hours = seconds / 3600;
seconds -= hours * 3600;
minutes = seconds / 60;
seconds -= minutes * 60;
format(coordsstring, sizeof(coordsstring), "VIP time left: %d days %d hours %d minutes %d seconds.", days, hours, minutes, seconds);
SendClientMessage(playerid, COLOR_GRAD1, coordsstring);
I doubt this is the best way to do it. So if anyone with more experience or with better code sees this, I'd love your input!
Reply
#4

Thanks, i will try this out once i get home and see what happends

Edit: It works perfectly, thank you very much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)