25.10.2016, 03:05
Hello, I'm having some problems with commands. I have make a command to check for user in DB.
It works fine if I do /checkuserdb Name_Surname (if exists shows me success, if not, shows me that is not registred.)
But the server crashes when I do, for example: /checkuserdb testforstringblabla
Or if I exceed the MAX_PLAYER_NAME (I think it's the problem).
I have used:
But still crashing and don't send that message.
Anyone?
Код:
CMD:checkuserdb(playerid, params[]) { new id[MAX_PLAYER_NAME]; if(sscanf(params, "s", id)) return SendClientMessage(playerid, -1, "Use: /checkuserdb [Name_Surname]"); if(!PlayerExist(id)) return SendClientMessage(playerid, green, "This name is not registred."); if(IsPlayerConnected(GetPlayerIdFromName(id))) return SendClientMessage(playerid, red, "Player exist and is connected."); if(PlayerExist(id)) return SendClientMessage(playerid, red, "This name is registred."); return 1;
But the server crashes when I do, for example: /checkuserdb testforstringblabla
Or if I exceed the MAX_PLAYER_NAME (I think it's the problem).
I have used:
Код:
if(strlen(id) > MAX_PLAYER_NAME) return SendClientMessage(playerid, -1, "Error with string");
Anyone?