07.01.2010, 12:28
Hiya, I am trying to make a kick command with sscanf for some practise but now I am stuck. Could anyone help out? Thanks.
Code so far:
See the comment in the code up.
Is this the right way or should it be like:
Thanks, any help will be appreciated. ;o
Code so far:
Код:
COMMAND:kick(playerid, params[]) { new kickid, reason[64]; if (!sscanf(params, "uz", kickid, reason;)) SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /kick <playerid> <reason>"); else if (kickid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFFFFFFFF, "Player not found"); else if (!IsPlayerAdmin(playerid)) SendClientMessage(playerid, 0xFFFFFFFF, "You need to be admin"); else { Kick(kickid, reason); // What do I need to do here? } return 1; }
Is this the right way or should it be like:
Код:
COMMAND:kick(playerid, params[]) { new kickid, reason; if(sscanf(params, "uz", kickid, reason)) SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /ban <playerid> <reason>"); { if(kickid != INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFFFFFFFF, "Player not found"); else if(!IsPlayerAdmin(playerid)) SendClientMessage(playerid, 0xFFFFFFFF, "You need to be admin"); else { Kick(kickid, reason); // Same as the other code, what do I need to do here? } return 1; }