STRCMP problem
#7

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

Does it work like this?
PHP код:
if(!strcmp(DOF2_GetString(pFile(playerid),"Clan"), "None")) return SetPlayerColor(playerid,C_WHITE);
if(!
strcmp(DOF2_GetString(pFile(playerid),"Clan"), "Accuracy")) return SetPlayerColor(playerid,C_A); 
Quote:
Originally Posted by Mencent
Посмотреть сообщение
The operator "!" means the same as == 0.
Look here:
PHP код:
if(strcmp(DOF2_GetString(pFile(playerid),"Clan"), "None") == 0) return SetPlayerColor(playerid,C_WHITE);// with == 0
if(!strcmp(DOF2_GetString(pFile(playerid),"Clan"), "Accuracy")) return SetPlayerColor(playerid,C_A);// with the operator "!" 
There are both options.

EDIT:
If strcmp return 0, the both strings are equal.
Both strings aren't equal, if strcmp return 1.
Ahh thanks

btw.. what can I do if I want to Get color from a file?
example:
pawn Код:
if(!strcmp(DOF2_GetString(pFile(playerid),"Clan"),"Accuracy")) return SetPlayerColor(playerid,DOF2_GetString,"Clans/Accuracy.ini","Color");
error 076: syntax error in the expression, or invalid function call :3
Reply


Messages In This Thread
STRCMP problem - by Lirbo - 10.05.2015, 07:10
AW: STRCMP problem - by Mencent - 10.05.2015, 07:13
Re: STRCMP problem - by X337 - 10.05.2015, 07:14
Re: AW: STRCMP problem - by Lirbo - 10.05.2015, 07:22
AW: STRCMP problem - by Mencent - 10.05.2015, 07:25
Re: AW: STRCMP problem - by Macluawn - 10.05.2015, 07:30
Re: AW: STRCMP problem - by Lirbo - 10.05.2015, 07:30
AW: STRCMP problem - by Mencent - 10.05.2015, 07:32
Re: STRCMP problem - by J4Rr3x - 10.05.2015, 08:17

Forum Jump:


Users browsing this thread: 2 Guest(s)