Having troubles with timers again
#1

Okay, I'm so confused again, how can I make a
command to be not used after a minute? or 60000?

I have it like that :
pawn Код:
forward robagain(playerid);
public robagain(playerid)
{
AbleToRob[playerid] = 0;
return 1;
}
But where do I put the SetTimerEx?
Reply
#2

OnGameModeInit
Or if you want it to do it after the player use the command to not beable to do it again for 60 seconds
put it at the end of the command
Reply
#3

Quote:
Originally Posted by DevilRP
OnGameModeInit
Or if you want it to do it after the player use the command to not beable to do it again for 60 seconds
put it at the end of the command
Wait, actually I've got the command working a while ago,
except, it doesn't warn the player On command that he
can only rob the a player at a certain time, it says the
error message every 60secs. IDK, how to make it say the
error, on command.
Reply
#4

i suggest to write the actual GetTickCount() into a PVarInt, and when he types the command (again), then divide the old tick value from the new one. if its >60000 difference, then he may use it again. this way you get rid of one more timer.
Reply
#5

I'm not sure about this but-
if you put at top of the script
Код:
new Timerstarted;
and on the timer part-
Код:
Timerstarted[playerid] = 1;
And you put at the command part-
Код:
	if (strcmp("/BLABLA", cmdtext, true) == 0)
	{
	if(Timerstarted[playerid] == 1) return SendClientMessage(playerid,COLOR_PURPLE,"I have a big penis");
else
....
return 1;
}
Reply
#6

When you create a variable it's automaticly set to 0/false, so you can choose adding it onplayerconnect for example or not. Then on the command if is 0 or 1 depending in your choince the command is executed, after that you put the variable to the oposite that you have set and put a timer for enable the use the command again. In the callback you may use again 0 or 1.

Eg:

new count;

onplayerconnect count == 1

in cmd - if(count == 1 execute the command. then you put count == 0

timer

callback of timer count == 1

Or you can what babul said: http://forum.sa-mp.com/index.php?topic=164646.0
Reply
#7

Okay, lol I found the problem, but
pawn Код:
dcmd_fish(playerid, params[])
{
if(AbleToFish[playerid] == 0) return SendClientMessage(playerid, Red, "ERROR : You must be in the water and in a boat to Fish!");
AbleToFish[playerid] = 1;
SetTimerEx ("fishagain", 60000, false, "i", playerid);
{
AbleToFish[playerid] = 0;
The timers work perfect, but I don't know how to make it say "You have to wait to fish again"
not SendClientMessage(playerid, Red, "ERROR : You must be in the water and in a boat to Fish!");
Reply
#8

Are you using Abbletofish? If yes you could use another variable and when it's setted to 0 for example says you must wait 1 minute before using the commnand again.

Edit: Help me: http://forum.sa-mp.com/index.php?top...416#msg1039416

Reply
#9

Quote:
Originally Posted by russooooo
Are you using Abbletofish? If yes you could use another variable and when it's setted to 0 for example says you must wait 1 minute before using the commnand again.

Edit: Help me: http://forum.sa-mp.com/index.php?top...416#msg1039416

Yes I know that, but my current problem is,
it keeps saying SendClientMessage(playerid, Red, "ERROR : You must be in the water and in a boat to Fish!");
and how can I make it say "You have to wait before using that command again"

PS. The timers works great, the problem is that ^
Reply
#10

ohh now i get it i think..
Do the same as AbleToFish just with a different var, and put the timer not on AbleToFish but on the new var you made.
the new var must be just like the AbleToFish just with a different name.
Код:
SetTimerEx ("fishagain", 60000, false, "i", playerid);
{
new var[playerid] = 0;
as the abletofish already has a part of the script right? its suposed to check if a player is in water etc..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)