SA-MP Forums Archive
Problem with GetName - 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 GetName (/showthread.php?tid=428267)



Problem with GetName - Salim_Karaja - 05.04.2013

So I did something like this:
on the top of the mod:
pawn Код:
enum pInfo
{
    pUserName[24],
    //etc ...
};
new pData[MAX_PLAYERS][pInfo];
OnPlayerConnect:
pawn Код:
GetPlayerName(playerid, pData[playerid][pUserName], 24);
stock GetName:
pawn Код:
stock GetName(playerid) return pData[playerid][pUserName];
but when im trying to use this, i get error: argument type mismatch (argument 2)
line:
pawn Код:
NameTD[playerid] = TextDrawCreate(37.000000, 320.000000, GetName(playerid));
Any solutions ?


Re: Problem with GetName - Rohan_Ubhare - 05.04.2013

Will u show me ur script I mean I'm confused as t where u r using the TD . is it when you log on to game?


Re: Problem with GetName - MP2 - 05.04.2013

Are you sure that's the error line? Looks fine to me.

Also, you should use MAX_PLAYER_NAME+1 as your length and string size. Max name is 24, but strings require one more cell for a 'null-terminating' character to denote the end of the string. Either that of set it to 25.


Re: Problem with GetName - JaKe Elite - 05.04.2013

show us the line where the error comes from