SA-MP Forums Archive
Problem with a timer - playerid not defined. - 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: Problem with a timer - playerid not defined. (/showthread.php?tid=94746)



Problem with a timer - playerid not defined. - Striker_Moe - 31.08.2009

Hey there again (lol),

Ive got some weird errors and would like to know why..

This is in a command:

Код:
 	SetTimer("aduty",2000,false);
And this is pretty at the bottom in a public.

Код:
public aduty()
{
	SetPlayerColor(playerid, 0xE60000FF);
}
And thats at the top.

Код:
forward aduty();
Here is my error:

Код:
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\admin.pwn(2831) : error 017: undefined symbol "playerid"
o.O?






Re: Problem with a timer - playerid not defined. - JaTochNietDan - 31.08.2009

public aduty()

There's your answer, it doesn't have a playerid variable defined in it nor anywhere in the callback.

It can be fixed like so:

pawn Код:
SetTimerEx("aduty",2000,false,"i",playerid);
pawn Код:
public aduty(playerid)
{
    SetPlayerColor(playerid, 0xE60000FF);
}
pawn Код:
forward aduty(playerid);



Re: Problem with a timer - playerid not defined. - JR ! - 31.08.2009

Код:
public aduty()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
	   SetPlayerColor(i, 0xE60000FF);
    }
    return 1;
}



Re: Problem with a timer - playerid not defined. - JaTochNietDan - 31.08.2009

Quote:
Originally Posted by JR !
Код:
public aduty()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
	   SetPlayerColor(i, 0xE60000FF);
    }
    return 1;
}
This code will set it for every single player in the server. I do not believe this is what he was looking for judging by his dynamic code.