Need help with newbie chat
#9

Quote:
Originally Posted by Finn
Why GetTickCount()? The ticks returned by that function are not equal to miliseconds, it fully depends on the speed of the host computer.

I'd just use gettime(), it returns seconds so it's easier to handle aswell as you don't need to deal with miliseconds.
Im 95% sure you are wrong regarding it not equaling milliseconds. It should equal the up time of the server in miliseconds. I highly doubt computer speed has any play what so ever (it does make a little sense to me though, hence the 95).

Either way works, i guess it all depends on your preference.
Quote:
Originally Posted by Finn
Top of the script:
pawn Код:
new newbTime[MAX_PLAYERS];
OnPlayerConnect: (not really a must, but it's good to reset the player arrays in this callback)
pawn Код:
newbTime[playerid] = 0;
In the command:
pawn Код:
new time = gettime();

if((time - newbTime[playerid]) < 50) return SendClientMessage(playerid, COLOR_HERE, "You have to wait 50 seconds blah blah...");

newbTime[playerid] = time;

// Rest of the command.
Timer is not needed.
That will never work. One reason why i do not use gettime is because it requires 3 variable declarations (hours, mins, seconds). If you dont put those three parameters in the function, which you did not, it will return the number of seconds since 1 January 1970.
Reply


Messages In This Thread
Need help with newbie chat - by Rivermate - 09.03.2010, 17:45
Re: Need help with newbie chat - by Onyx09 - 09.03.2010, 17:46
Re: Need help with newbie chat - by Mike Garber - 10.03.2010, 10:56
Re: Need help with newbie chat - by gotenks918 - 10.03.2010, 10:57
Re: Need help with newbie chat - by Kyosaur - 10.03.2010, 11:06
Re: Need help with newbie chat - by Finn - 10.03.2010, 11:20
Re: Need help with newbie chat - by Razvann - 10.03.2010, 11:29
Re: Need help with newbie chat - by Finn - 10.03.2010, 11:39
Re: Need help with newbie chat - by Kyosaur - 10.03.2010, 12:00
Re: Need help with newbie chat - by Finn - 10.03.2010, 12:49

Forum Jump:


Users browsing this thread: 2 Guest(s)