21.12.2012, 16:43
How can I add stirng in 'if' statements?
I am trying to check if a certain var contains 'None'...
I am trying to check if a certain var contains 'None'...
new Lname[MAX_PLAYER_NAME];
GetPlayerName(playerid, Lname, sizeof(Lname));
if(!strcmp(Lname, "None", true)) return SendClientMessageToAll(-1, "None");
No, for the reason you need it - use strcmp(like in the example above).
|
What the hell is the problem with you? If your property does not have an owner, make the string "*" by simply assigning the value (no format, no strcat, no whatsoever, just simply = to assign).
To check if the property is unowned, do if(hInfo[h][hOwner][0] == '*'). Simple and quick, voila. And there's really nothing to justify using strfind instead of strcmp if you've designed the system yourself and are aware of the array contents ![]() |