playerid in timer
#1

Hello I have script like this:

Код:
forward Something()
public Something()
{
new name[25];
new string[128];
switch(random(5))
{
case 0: name = "xxx";
case 1: name = "xxx";
case 2: name = "xxx";
case 3: name = "xxx";
case 4: name = "xxx";
}
format(string,sizeof(string),"* %s just did %s",GetPlayerNameEx(playerid),name);
ProxDetector(10.0, playerid, string, COLOR_GREEN, COLOR_GREEN, COLOR_GREEN, COLOR_GREEN, COLOR_GREEN);
return 1;
}
I want to know how to get playername by id because now it says that undefined symbol playerid. When I do it with this:
Код:
for(new i;MAX_PLAYERS>i;i++)
{
Then it shows the string that many times as players in server. I need only to show only one player action
Reply
#2

Use SetTimerEx to pass arguments to a timer. See the wiki.
Reply
#3

pawn Код:
SetTimerEx("MyTimer",50000,0,"i",playerid);
forward MyTimer(playerid);
public MyTimer(playerid)
{
//bla bla
}
Reply
#4

Thank you it works, I have added +rep both of you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)