get player name and verify [+1 rep]
#1

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..
	}
Reply
#2

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);
Reply
#3

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.
Reply
#4

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

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...
}
Reply
#6

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
}
Reply
#7

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


Forum Jump:


Users browsing this thread: 1 Guest(s)