SA-MP Forums Archive
if name == 'Ihsan_Cingisiz' - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: if name == 'Ihsan_Cingisiz' (/showthread.php?tid=154770)



if name == 'Ihsan_Cingisiz' - Ihsan_Cingisiz - 15.06.2010

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


Re: if name == 'Ihsan_Cingisiz' - Niixie - 15.06.2010

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


Re: if name == 'Ihsan_Cingisiz' - Kyosaur - 15.06.2010

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.


Re: if name == 'Ihsan_Cingisiz' - randomkid88 - 15.06.2010

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)



Re: if name == 'Ihsan_Cingisiz' - Kyosaur - 15.06.2010

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


Re: if name == 'Ihsan_Cingisiz' - MastahServers - 15.06.2010

Or easier:

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