Help with timer
#1

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

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

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

yes

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


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

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

return 1;
}
Reply
#5

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;
}
Reply
#6

thats what i asked for.
Thank you very much
Reply
#7

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

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)