if name == 'Ihsan_Cingisiz'
#1

Hello, how can i make that a filterscript can detect
what my name is? I want to do like this :

Quote:

if(pName[playerid] == "Ihsan_Cingisiz")
{
SetPlayerWalkingStyle(playerid, 3);
}

I need something like this but i don't know how, please help
Reply
#2

Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(strcmp(pname, "Ihsan_Cingisiz", true))
{
SetPlayerWalkingStyle(playerid, 3);
}
Guess that should work
Reply
#3

Quote:
Originally Posted by [MWR
Niixie ]
Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(strcmp(pname, "Ihsan_Cingisiz", true))
{
SetPlayerWalkingStyle(playerid, 3);
}
Guess that should work
That will work for everything BUT "Ihsan_Cingisiz". Strcmp returns zero if the strings are the same, so you need to add a ! in front of the strcmp statement, or a == 0 at the end of it.
Reply
#4

Quote:
Originally Posted by Kyosaur!!
Quote:
Originally Posted by [MWR
Niixie ]
Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(strcmp(pname, "Ihsan_Cingisiz", true))
{
SetPlayerWalkingStyle(playerid, 3);
}
Guess that should work
That will work for everything BUT "Ihsan_Cingisiz". Strcmp returns zero if the strings are the same, so you need to add a ! in front of the strcmp statement, or a == 0 at the end of it.
Yea, this is true. strmp is kind of stupid in that it returns "true" if the strings are different. So like he said, it needs to be
pawn Код:
if(!strcmp(pname, "Ihsan_Cingisiz", true))
or
pawn Код:
if(strcmp(panme, "Ihsan_Cingisiz", true) == 0)
Reply
#5

Ohh also, change the true into a false. If your comparing a name, you DONT want to ignore casing.
Reply
#6

Or easier:

pawn Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(!strcmp(pname, "Ihsan_Cingisiz", true))
{
SetPlayerWalkingStyle(playerid, 3);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)