SA-MP Forums Archive
I want to make this cmd for admins only... - 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)
+--- Thread: I want to make this cmd for admins only... (/showthread.php?tid=558035)



I want to make this cmd for admins only... - Eonik - 15.01.2015

I need this command for admin lvl 1337. Pls

pawn Код:
CMD:arefuel(playerid, params[]) {
    if(!IsPlayerAdmin(playerid)) return 0;
   
    new
        vehid = strval(params);
    if(!vehid) {
        SendClientMessage(playerid, -1, "/arefuel [Car ID] (Use /dl)");
        return 1;
    } else

    if(!GetVehicleModel(vehid)) {
        SendClientMessage(playerid, -1, "Invalid vehicle id.");
        return 1;
    }

    new buf[128];
    format(buf, sizeof(buf), "Vehicle %d refuel!", vehid);
    SetVehicleParamsEx(vehid, VEHICLE_PARAMS_ON, 0, 0, 0, 0, 0, 0);
    SendClientMessage(playerid, -1, buf);
    g_vehGas[vehid] = 100.0;
    return 1;
}
Thanks!


Re: I want to make this cmd for admins only... - Lynn - 15.01.2015

I assume it's a GF Edit..
pawn Код:
CMD:arefuel(playerid, params[]) {
    if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1337) {
        new
            vehid = strval(params);
        if(!vehid) return SendClientMessage(playerid, -1, "/arefuel [Car ID] (Use /dl)");
        if(!GetVehicleModel(vehid)) return SendClientMessage(playerid, -1, "Invalid vehicle id.");
        new buf[128];
        format(buf, sizeof(buf), "Vehicle %d refuel!", vehid);
        SetVehicleParamsEx(vehid, VEHICLE_PARAMS_ON, 0, 0, 0, 0, 0, 0);
        SendClientMessage(playerid, -1, buf);
        g_vehGas[vehid] = 100.0;
    }
    else return SendClientMessage(playerid, -1, #You are not a admin.);
    return 1;
}



Re: I want to make this cmd for admins only... - xVIP3Rx - 15.01.2015

it's already for rcon-admins only, Check if their AdminLevel variable equal 1337, using if


Re: I want to make this cmd for admins only... - Eonik - 15.01.2015

Thanks.

And no, its not a GF edit.


Re: I want to make this cmd for admins only... - Eonik - 15.01.2015

4 errors

error 017: undefined symbol "PlayerInfo"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line


Re: I want to make this cmd for admins only... - xVIP3Rx - 15.01.2015

post your enums.


Re: I want to make this cmd for admins only... - Eonik - 15.01.2015

CODE: http://pastebin.com/F08E0JZJ its a FS


Re: I want to make this cmd for admins only... - SammyVA - 15.01.2015

Lel dude you can't make this for Admin Level 1337 only if you don't have an admin system.
Anyway, i suppose that in your gamemode an admin system is alive so you have to make this in your gamemode and not as an FS.
Post enums of player/admin system of your GAMEMODE

enums are like:
Код:
enum PlayerInfo{
pID,
pScore,
pAdmin,
}



Re: I want to make this cmd for admins only... - Eonik - 15.01.2015

Enum pInfo: http://pastebin.com/DPteKPkf


Re: I want to make this cmd for admins only... - Lynn - 16.01.2015

You have to use IsPlayerAdmin(playerid) // Rcon Admin.
For Filterscripts, otherwise you can't define if their a Admin or not.
There is a way to hook the two together and read data from one anther using Y_Hooks
But it's obvious you're new to scripting so I wouldn't suggest tackling hooking yet.
Not atleast until you have the fundamentals down.