SA-MP Forums Archive
Help with zcmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with zcmd (/showthread.php?tid=275329)



Help with zcmd - Tigerkiller - 09.08.2011

hi all i made my first command like /kick <playeri> <reason>
but when i type /kick server says unknown command why that ? i havent it under onplayercommandtext!

pawn Код:
CMD:kick(playerid,params[])
{
    new pID,Grund[50];
    if(Acc[playerid][Adminlevel]<2) return SendClientMessage(playerid,COLOR_RED,"You cannot use this Command");
    else if(sscanf(params,"uz",pID,Grund)) return SendClientMessage(playerid,COLOR_ORANGE,"Usage: /kick [playerid] ([reason])");
    else if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"This Player is not Connected");
    else if(Acc[pID][Adminlevel] >3) return SendClientMessage(playerid,COLOR_RED,"You cannot kick this Admin");
    else
    {
        new Admin[24];
        GetPlayerName(playerid,Admin,sizeof Admin);
        new player[24];
        GetPlayerName(playerid,player,sizeof player);
        new s[100];
        format(s,sizeof s,"Server: %s (ID: %d) has kicked %s (ID: %d), reason: %s",Admin,playerid,player,pID,Grund[0] ? Grund : "No reason specified");
        SendClientMessageToAll(Color_AdmCmd,s);
        Kick(pID);
    }
    return 1;
}



Re: Help with zcmd - Darnell - 09.08.2011

What is your admin system ? I can try help.
Try this :
pawn Код:
CMD:kick(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
            new kicked, reason[50];
            if(sscanf(params, "us[50]", kicked, reason)) return SendClientMessage(playerid, 0x00FF00AA, "USAGE: /kick [ID] [Reason]");
            if(kicked == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0x00FF00AA, "Invalid ID");
            new message[128];
            format(message, sizeof(message), "AdmCMD: %s was kicked by %s, reason: %s", ReturnPlayerName(kicked), ReturnPlayerName(playerid), reason);
            SendClientMessageToAll(0x00FF00AA, message);
            Kick(kicked);
    }
    return 1;
}



AW: Help with zcmd - Tigerkiller - 09.08.2011

my Admin Verrialbe are Acc[playerid][Adminlevel]


Re: Help with zcmd - emokidx - 09.08.2011

try this
pawn Код:
CMD:kick(playerid,params[])
{
    new pID,Grund[50];
    if(Acc[playerid][Adminlevel]<2) return SendClientMessage(playerid,COLOR_RED,"You cannot use this Command");
    if(sscanf(params,"uz",pID,Grund)) return SendClientMessage(playerid,COLOR_ORANGE,"Usage: /kick [playerid] ([reason])");
    if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"This Player is not Connected");

        new Admin[24];
        GetPlayerName(playerid,Admin,sizeof Admin);
        new player[24];
        GetPlayerName(playerid,player,sizeof player);
        new s[100];
        format(s,sizeof s,"Server: %s (ID: %d) has kicked %s (ID: %d), reason: %s",Admin,playerid,player,pID,Grund[0] ? Grund : "No reason specified");
        SendClientMessageToAll(Color_AdmCmd,s);
        Kick(pID);
        else if(Acc[pID][Adminlevel] >3) return SendClientMessage(playerid,COLOR_RED,"You cannot kick this Admin");
   
    return 1;
}



Re: Help with zcmd - Darnell - 09.08.2011

Be sure to write it under main() and OnGameModeInIt.


Re: Help with zcmd - Markx - 09.08.2011

Quote:
Originally Posted by Darnell
Посмотреть сообщение
Be sure to write it under main() and OnGameModeInIt.
ZCMD or any other command processors do not go in any callback.


Re: Help with zcmd - Jack_Leslie - 09.08.2011

Don't have it within OnPlayerCommandText.. have it after it. A good way of doing CMD is putting the whole command at the end of your gamemode.


Re: Help with zcmd - Darnell - 09.08.2011

Well, sorry, I'm new to scripting.
I just thought about it and you need to write it in the end of the gamemode.
EDIT:
Seems like Jack told him already :\.