Problem with a timer - playerid not defined.
#1

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?



Reply
#2

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)