SA-MP Forums Archive
get player name and verify [+1 rep] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: get player name and verify [+1 rep] (/showthread.php?tid=307757)



get player name and verify [+1 rep] - driftpower - 01.01.2012

I'm getting this error: 123.pwn(102) : error 033: array must be indexed (variable "-unknown-")


Код:
new pname[MAX_PLAYER_NAME];


	if (GetPlayerName(playerid, pname, sizeof(pname)) == "playersname")
	{
	do something..
	}



Re: get player name and verify [+1 rep] - Ironboy - 01.01.2012

You mean this?
pawn Код:
new pname[MAX_PLAYER_NAME];
   
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s ", pname); //do something here
    SendClientMessageToAll(COLOR_YELLOW, string);



Re: get player name and verify [+1 rep] - driftpower - 01.01.2012

Quote:
Originally Posted by Ironboy
Посмотреть сообщение
You mean this?
pawn Код:
new pname[MAX_PLAYER_NAME];
   
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s ", pname); //do something here
    SendClientMessageToAll(COLOR_YELLOW, string);
No, I wanna check the players name and then if its X player, it will do X thing.


Re: get player name and verify [+1 rep] - diego_p11 - 01.01.2012

Try to express more what. U try to say, i can help you. But i dont understand what r u trying to do


Re: get player name and verify [+1 rep] - driftpower - 01.01.2012

Quote:
Originally Posted by diego_p11
Посмотреть сообщение
Try to express more what. U try to say, i can help you. But i dont understand what r u trying to do
I'm trying to make someone receive X level if that someone has Y name.

if ( playername == "samp")
{
give him level...
}


Re: get player name and verify [+1 rep] - SchurmanCQC - 01.01.2012

Quote:
Originally Posted by driftpower
Посмотреть сообщение
I'm trying to make someone receive X level if that someone has Y name.

if ( playername == "samp")
{
give him level...
}
pawn Код:
if(strcmp(playername, "samp") == 0)
{
    //code here
}



Re: get player name and verify [+1 rep] - driftpower - 01.01.2012

Quote:
Originally Posted by Schurman
Посмотреть сообщение
pawn Код:
if(strcmp(playername, "samp") == 0)
{
    //code here
}
Thank you!