SA-MP Forums Archive
Problem with Textdraws - 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)
+--- Thread: Problem with Textdraws (/showthread.php?tid=315566)



Problem with Textdraws - SpiderWalk - 03.02.2012

I got problem i get 8 erros with:
Код:
H:\samp03dsvr_win32(1)\gamemodes\DP.pwn(215) : error 017: undefined symbol "playerid"
H:\samp03dsvr_win32(1)\gamemodes\DP.pwn(216) : error 017: undefined symbol "playerid"
H:\samp03dsvr_win32(1)\gamemodes\DP.pwn(217) : error 017: undefined symbol "playerid"
H:\samp03dsvr_win32(1)\gamemodes\DP.pwn(218) : error 017: undefined symbol "playerid"
H:\samp03dsvr_win32(1)\gamemodes\DP.pwn(219) : error 017: undefined symbol "playerid"
H:\samp03dsvr_win32(1)\gamemodes\DP.pwn(220) : error 017: undefined symbol "playerid"
H:\samp03dsvr_win32(1)\gamemodes\DP.pwn(221) : error 017: undefined symbol "playerid"
H:\samp03dsvr_win32(1)\gamemodes\DP.pwn(222) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
And here are the lines
pawn Код:
Stats[playerid] = TextDrawCreate(499.000000, 110.000000, "~r~Kills: ~w~0 ~g~Deaths: ~w~0");
    TextDrawBackgroundColor(Stats[playerid], 255);
    TextDrawFont(Stats[playerid], 2);
    TextDrawLetterSize(Stats[playerid], 0.159999, 1.000000);
    TextDrawColor(Stats[playerid], -1);
    TextDrawSetOutline(Stats[playerid], 0);
    TextDrawSetProportional(Stats[playerid], 1);
    TextDrawSetShadow(Stats[playerid], 1);
Here is variable
pawn Код:
new Text:Stats[MAX_PLAYERS];
I dont know where is problem if someone know reply here


Re: Problem with Textdraws - Aloushi - 03.02.2012

change place in pawno (new Text:Stats[MAX_PLAYERS]


Re: Problem with Textdraws - SpiderWalk - 03.02.2012

pawn Код:
new Text:Stats[MAX_PLAYERS];
Its allready changed!But Still have that problem!


Re: Problem with Textdraws - [XST]O_x - 03.02.2012

I bet you've placed these lines under OnGameModeInit or OnFilterScriptInit, am I right?


Re: Problem with Textdraws - SpiderWalk - 03.02.2012

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
I bet you've placed these lines under OnGameModeInit or OnFilterScriptInit, am I right?
Yes you are!


Re: Problem with Textdraws - [XST]O_x - 03.02.2012

Quote:
Originally Posted by SpiderWalk
Посмотреть сообщение
Yes you are!
OnGameModeInit() has no such parameter as playerid therefore the compiler sees it as undefined.
You need to create all of the textdraws in a loops, or more effeciantly under OnPlayerConnect.

pawn Код:
public OnGameModeInit()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        Stats[i] = TextDrawCreate(499.000000, 110.000000, "~r~Kills: ~w~0 ~g~Deaths: ~w~0");            
        TextDrawBackgroundColor(Stats[i], 255);    TextDrawFont(Stats[playerid], 2);    
        TextDrawLetterSize(Stats[i], 0.159999, 1.000000);    
        TextDrawColor(Stats[i], -1);    
        TextDrawSetOutline(Stats[i], 0);    
        TextDrawSetProportional(Stats[i], 1);    
        TextDrawSetShadow(Stats[i], 1);
    }
    return 1;
}



Re: Problem with Textdraws - SpiderWalk - 03.02.2012

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
OnGameModeInit() has no such parameter as playerid therefore the compiler sees it as undefined.
You need to create all of the textdraws in a loops, or more effeciantly under OnPlayerConnect.

pawn Код:
public OnGameModeInit()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        Stats[i] = TextDrawCreate(499.000000, 110.000000, "~r~Kills: ~w~0 ~g~Deaths: ~w~0");            
        TextDrawBackgroundColor(Stats[i], 255);    TextDrawFont(Stats[playerid], 2);    
        TextDrawLetterSize(Stats[i], 0.159999, 1.000000);    
        TextDrawColor(Stats[i], -1);    
        TextDrawSetOutline(Stats[i], 0);    
        TextDrawSetProportional(Stats[i], 1);    
        TextDrawSetShadow(Stats[i], 1);
    }
    return 1;
}
Thanks


Re: Problem with Textdraws - Amit_B - 04.02.2012

The code above is really not recommended. Creating 500 (or 800?) text draws, that some of them used for player ids that not really gonna play is a mistake. A better idea is to create the TD under OnPlayerConnect and destroy it later.