Quote:
Originally Posted by Slice
Personally, I really don't like the way people use "return SendClientMessage". The return value of SendClientMessage has nothing to do with the return value of a command - it just happens to be the value you want to return anyway.
I'd say something like this is better:
pawn Код:
CMD:connected(playerid, params[]) { if (!IsPlayerConnected(playerid)) SendClientMessage(playerid, -1, "For some reason, you are not connected."); else SendClientMessage(playerid, -1, "You are connected."); return 1; }
CMD:kick(playerid, params[]) { new otherid = strval(params); if (!HasPermission(playerid)) SendClientMessage(playerid, -1, "You don't have permission."); else if (!IsPlayerConnected(otherid)) SendClientMessage(playerid, -1, "Invalid player id given."); else if (IsPlayerAdmin(otherid)) SendClientMessage(playerid, -1, "Other player is admin."); else { Kick(otherid); SendClientMessage(playerid, -1, "KDONE"); } return 1; }
|
I never thought of it that way, I'll most likely script similar to that, seems more efficient, which is what I was aiming to get from posting this thread, thank you!