What am i doing wrong? (Weird Warning) - 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: What am i doing wrong? (Weird Warning) (
/showthread.php?tid=496969)
What am i doing wrong? (Weird Warning) -
$Marco$ - 24.02.2014
SOLVED, Thanks.
AW: What am i doing wrong? (Weird Warning) -
Nero_3D - 24.02.2014
What line cases this warning ? and show us the declaration of HUDNAMESTR
Re: What am i doing wrong? (Weird Warning) - Guest4390857394857 - 24.02.2014
line
Re: What am i doing wrong? (Weird Warning) -
Renaldasj - 24.02.2014
you have to create HUDNAMESTR [ MAX_PLAYERS ] ;then:
PlayerTextDrawShow( playerid, HUDNAMESTR [ playerid ] ) ;
Re: What am i doing wrong? (Weird Warning) -
$Marco$ - 24.02.2014
Thanks for the quick answer but i solved it myself, apparently SA-MP Wiki is a liar.
Re: What am i doing wrong? (Weird Warning) -
Konstantinos - 24.02.2014
There are many problems with your code. You want to use per-player textdraws and you use TextDrawSetString instead of PlayerTextDrawSetString. You don't have an array for each player-text ID but instead you use 1 variable. And the last one is just a pointless thing you do. You get the name and you copy a string to another using format instead of directly use it as a text.
pawn Code:
// global:
new PlayerText: HUDNAMESTR[MAX_PLAYERS];
// OnPlayerConnect:
HUDNAMESTR[playerid] = PlayerText: INVALID_TEXT_DRAW;
// create per-player textdraw..
public OnPlayerSpawn(playerid)
{
PlayerInfo[playerid][pLogged] = 1;
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
PlayerTextDrawSetString(playerid, HUDNAMESTR[playerid], playername);
PlayerTextDrawShow(playerid, HUDNAMESTR[playerid]);
return 1;
}