GetPlayerName help. - 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: GetPlayerName help. (
/showthread.php?tid=594949)
GetPlayerName help. -
Alpha000 - 26.11.2015
I want to make LandInfo[land][landOwner] = to GetPlayerNameEX how can i do it. when i type : if(LandInfo[land][landOwner] = GetPlayerName(playerid))
i get error : array must be indexed any help?
Re: GetPlayerName help. -
iKarim - 26.11.2015
You can't use '==' in strings, use strcmp.
PHP код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
if(!strcmp(LandInfo[land][landOwner], pName))
{
// player names matches.
}
and your LandOwner variable should be like that
PHP код:
LandOwner[MAX_PLAYER_NAME]
Re: GetPlayerName help. -
Alpha000 - 26.11.2015
my [landOwner] is in enum.....
Re: GetPlayerName help. -
MafiaOink - 26.11.2015
In the enum change to this:
Re: GetPlayerName help. -
Alpha000 - 26.11.2015
in my enum it was like this:
Код:
enum landblabla
{
landOwner[ MAX_PLAYER_NAME ]
}
will it work for your code @pawnhunter ?
Re: GetPlayerName help. -
iKarim - 26.11.2015
Yes @Alpha000, It will work.