Why am i getting this error!
#1

pawn Код:
error 017: undefined symbol "playerid"

pawn Код:
TextDrawShowForPlayer(playerid, BlackTD); // Error line
Reply
#2

I'm going to take a wild guess, once again:
You're placing it under OnGameModeInit(), which is wrong.
You have to place it on a callback that contains the playerid parameter.. such as: OnPlayerSpawn/Connect/RequestSpawn(playerid).
Reply
#3

Thanks for the reply no here is where it is:

pawn Код:
public scavengetimer()
{
    TextDrawShowForPlayer(playerid, BlackTD);
    return 1;
}
Reply
#4

Exactly, you're missing the playerid parameter.
Can you show me where you're calling this function? do you execute it with a timer?
Reply
#5

pawn Код:
public scavengetimer()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
       TextDrawShowForPlayer(i, BlackTD);
       return 1;
    }
}
Try that
Reply
#6

Quote:
Originally Posted by shitbird
Посмотреть сообщение
Exactly, you're missing the playerid parameter.
Can you show me where you're calling this function? do you execute it with a timer?
Yes it is in my scavenge command here:

pawn Код:
command(scavenge, playerid, params[])
{
    if(PlayerInfo[playerid][Srt] >= 1)
    {
        SendClientMessage(playerid, COLOUR_ORANGE, "Hint: You need to wait 10 minutes!" );
    }
    else
    {
        if(IsPlayerInRangeOfPoint(playerid, 100,637.3656, 838.5986, -42.9609))
        {
            {
                new string[ 128 ];

                format( string, sizeof( string ), "* %s has started to scavenge.", GetName( playerid ) );
                NearByMessage( playerid, COLOUR_YELLOW, string );
                SetTimer("scavengetimer",5000, false); //Here
                PlayerInfo[playerid][Srt] = 1;

                new rand = random(20);


                switch(rand)
                {
                    case 0, 3, 5, 7:
                    {
                        SendClientMessage(playerid, COLOUR_WHITE, "You found a Stimpack!");
                        PlayerInfo[playerid][Stimpack]++;
                    }
                    case 1, 4, 6, 8:
                    {
                        SendClientMessage(playerid, COLOUR_WHITE, "You found 300 caps!");
                    }
                    case 2, 10, 13, 16, 18, 15, 19:
                    {
                        SendClientMessage(playerid, COLOUR_WHITE, "Your hands are dirty but you find nothing!");
                    }
                    case 9, 11, 12, 14, 17:
                    {
                        SendClientMessage(playerid, COLOUR_WHITE, "You have found 100 scrap metal!");
                        PlayerInfo[playerid][Metal] += 100;
                    }
                }
            }
        }
    }
    return 1;
}
The idea is that the screen goes black and once it returns they "Find nothing" or "FInd a stimpack" using the random cases.



Quote:
Originally Posted by Hashski
Посмотреть сообщение
pawn Код:
public scavengetimer()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
       TextDrawShowForPlayer(i, BlackTD);
       return 1;
    }
}
Try that
Thanks for the reply but wouldn't that make the screen black for everyone?
Reply
#7

Use "SetTimerEx" to do that.
"SetTimer" is commonly used for functions that does something for everyone(by creating a loop through all playerids). -- Not for a single player.

pawn Код:
SetTimer("scavengetimer",5000, false); //Here
Change it to:
pawn Код:
SetTimerEx("scavengetimer", 5000, false, "i", playerid);
pawn Код:
public scavengetimer()
{
       TextDrawShowForPlayer(playerid, BlackTD);
       return true;
}
Change it to:
pawn Код:
public scavengetimer(playerid)
{
       TextDrawShowForPlayer(playerid, BlackTD);
       return true;
}
Reply
#8

Hmm thanks it solved the error but no textdraw is appearing?
Reply
#9

Did you wait 5 seconds? :P
- Show me the Textdraw, and how you've created it.
Reply
#10

pawn Код:
new Text:BlackTD;
pawn Код:
public OnGameModeInit()
{
       BlackTD = TextDrawCreate(0.0, 0.0, "_");
    TextDrawUseBox(BlackTD, true);
    TextDrawColor(BlackTD, 0);
    TextDrawBoxColor(BlackTD, 0x00000000);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)