SA-MP Forums Archive
Help with timer - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with timer (/showthread.php?tid=141753)



Help with timer - [eF]ThundeR - 15.04.2010

I want to know how i can make when the player for example write the command /lvairport and then for 10seconds to show him message(you dont need to write about the message,i need help only with timer,i gived this for example) like You are not allowed to teleport to the lv airport at this moment.


Re: Help with timer - adsy - 15.04.2010

i think ill be adding this to my signature soon. added

Код:
SetTimer("function", timeinmilliseconds, repeating);
Function

Код:
forward functionnamehere();
public functionnamehere(){
//what the function does here
return 1;
}
Milliseconds

1 second = 1000 milliseconds
1 minute = 60000 milliseconds

you can use maths in your SetTimer("MyFunction", 10*60000, 0);

Repeating

1 = yes
0 = no


Re: Help with timer - [eF]ThundeR - 15.04.2010

thanks,but i didn't mean on that.
I want for example when the player spawn ,after 10seconds to write to him like Welcome to the server(just to him)

if you can understand me..


Re: Help with timer - adsy - 15.04.2010

yes

under OnPlayerConnect()
add this
Код:
SetTimer("MyFunction",10000, 0);


forward MyFunction(playerid);
public MyFunction(playerid){

SendClientMessage(playerid, COLOR, "Welcome to the server!");

return 1;
}



Re: Help with timer - Adil - 15.04.2010

Quote:
Originally Posted by adsy
yes

under OnPlayerConnect()
add this
SetTimer("MyFunction",10000, 0);


forward MyFunction(playerid);
public MyFunction(playerid){

SendClientMessage(playerid, COLOR, "Welcome to the server!");

return 1;
}
You should use (PAWN) (/PAWN) for the codes.

Quote:
Originally Posted by NightKiller
thanks,but i didn't mean on that.
I want for example when the player spawn ,after 10seconds to write to him like Welcome to the server(just to him)

if you can understand me..
Put this below the other #define's:
pawn Код:
forward Welcomemsg(playerid);
Put this under public OnPlayerSpawn(playerid):
pawn Код:
SetTimer("Welcomemsg",10000, 0);
Put this on the end of your script:
pawn Код:
public Welcomemsg(playerid)
{
   SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to (your server's name here)");
   return 1;
}



Re: Help with timer - [eF]ThundeR - 17.04.2010

thats what i asked for.
Thank you very much


Re: Help with timer - Adil - 17.04.2010

Quote:
Originally Posted by NightKiller
thats what i asked for.
Thank you very much
Your welcome.


Re: Help with timer - FUNExtreme - 17.04.2010

I don't want to spoil the FUN but those examples will only work correctly using SetTimerEx (Click)


Re: Help with timer - Adil - 17.04.2010

Quote:
Originally Posted by FUNExtreme
I don't want to spoil the FUN but those examples will only work correctly using SetTimerEx (Click)
Go test the code.


Re: Help with timer - FUNExtreme - 17.04.2010

Nah, try this. Join the server and in the first 10 seconds (when timer is running) get someone else to join.
You'll see what I mean