03.06.2018, 06:19
Quote:
There should be a ! before strcmp.
strcmp returns value 0 if the strings match. And the loop should not be <= MAX_PLAYERS. The playerid starts from 0 and ends at MAX_PLAYERS - 1. That's how the indexing is done. |
Also, strcmp function will check if your name contains that name or not in whole, so that works that way.
Also, If you are checking IsPlayerConnected inside the GetID function, you dont have to use it at the place where you check if he is online or not. Because, It will only return the ID if player is online.
What you can do is, Use "u" format specifier for sscanf for exact name.
Код:
sscanf(params, "u",player)