23.02.2011, 10:16
Hey. I am creating a kick command with zcmds. The kick itself seems to be working fine. Just the message it's supposed to send is quite messy and I really don't know how to continue.
An other question.. at first I used "s" in the code below instead of "z", can someone explain why I have put "z" there? I just copied it somewhere and didn't really understand why I put it there.
I am aware what u means.
pawn Код:
COMMAND:kick(playerid, params[]) //using ZCMD this is how your command will start off looking like.
{
if(PlayerInfo[playerid][pAdminlevel] >= 1) // player level more (>) 0
{
new otherplayerid, reason[128];
if(sscanf(params, "uz", otherplayerid, reason)) // split input string and check level value 0 to 5
SendClientMessage(playerid, 0xFFFFFFFF, "/kick [playerid/name] [reason]");
else if(otherplayerid == INVALID_PLAYER_ID) // Check player connected
SendClientMessage(playerid, 0xFFFFFFFF, "This player is not connected");
else
{
new string[32];
format(string, sizeof(string), "Admin %s kicked %s | Reason: %s", GetPlayerNameEx(playerid), GetPlayerNameEx(otherplayerid), reason);
SendClientMessageToAll(0xFFFFFFFF,string);
Kick(otherplayerid);
}
}
else
{
SendClientMessage(playerid, 0xAAAAAAAA, "You are not admin or the required level.");
}
return 1;
}
pawn Код:
if(sscanf(params, "uz", otherplayerid, reason))