Admin Commands
#1

can someone show me how i can make admin commands with zcmd

thanks.
Reply
#2

its my cmd

for exmaple



pawn Код:
CMD:get(playerid,params[])
{
    if(pInfo[playerid][pLogged] == 1)
    {
        if(pInfo[playerid][pAdminLevel] >= 2)
        {
            new targetid;
            if(sscanf(params, "u", targetid)) SendClientMessage(playerid,-1,""chat" /get [playerid]");
            if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, x, y, z);
            SetPlayerPos(targetid, x+1, y+1, z);

            if(IsPlayerInAnyVehicle(targetid))
            {
                SetVehiclePos(GetPlayerVehicleID(targetid),x,y,z);
            }
        }
        else {
            SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!");
        }
    }
    else if(pInfo[playerid][pLogged] == 0)
    {
        SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" Nice try u fucking fag gay!");
        printf("%s has been kicked for trying to use a command without being logged in!", PlayerName(playerid));
        Kick(playerid);
    }
    return 1;
}

if(pinfo[playerid][pAdminLevel] >= 2)

you should something like that
Reply
#3

i get errors with it i need one thats more simple then that
Reply
#4

Go to TUTORIAL section

http://forum.sa-mp.com/forumdisplay.php?f=70
Reply
#5

Yeah but its kind of hard for me
and i get errors when doing as the tutorial said
Reply
#6

pawn Код:
//=====[Set HP]=====
CMD:sethp(playerid, params[])
{
        if(PlayerInfo[playerid][Adminlevel] < 4) return SendClientMessage(playerid,COLOR_RED,"You're not allowed to use this command!");
        new targetid,
                health;
        if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"[ERROR] Player not connected!");
        if(sscanf(params, "ui", targetid, health)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /sethp [PlayerID/PartOfName] [Amount]");

        SetPlayerHealth(targetid, health);

        return 1;
}
if(PlayerInfo[playerid][Adminlevel] < 4 reads the players admin level - you should obviously replace it with your function for getting the players admlvl. Other than that, this function is quite simple. Remember to define the colors at top of your script, else it will return errors, aswell as including sscanf.
Reply
#7

i am getting 4 errors:

C:\Documents and Settings\KillZone\Desktop\TDM\gamemodes\TDMv1.0.pw n(260) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\KillZone\Desktop\TDM\gamemodes\TDMv1.0.pw n(260) : warning 215: expression has no effect
C:\Documents and Settings\KillZone\Desktop\TDM\gamemodes\TDMv1.0.pw n(260) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\KillZone\Desktop\TDM\gamemodes\TDMv1.0.pw n(260) : error 029: invalid expression, assumed zero
C:\Documents and Settings\KillZone\Desktop\TDM\gamemodes\TDMv1.0.pw n(260) : fatal error 107: too many error messages on one line
Reply
#8

Read what I wrote under the code for understanding your error ..
Reply
#9

Alternatively you can change the line 3 in my code if(playerinfo etc. to:
pawn Код:
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"You're not allowed to use this command!");
Then the command will work for you if you're RCON logged in.
Reply
#10

i dont want the command only for rcons i also want it for level admins

But i want to set it as levels and dont double post
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)