ALways Returns not appropriate level but i am!
#1

ok so i have this cmd, when i tpye /gedit GATEID open it just says you are not allowed to use this command when in fact im 2 admin levels higher

pawn Код:
CMD:gedit(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 4)
    {
        SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use that command!");
        return 1;
    }
    if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
    {
        SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
        return 1;
    }

    new string[128], choice[32], gateid, Float:ofloat;
    if(sscanf(params, "s[32]iF", choice, gateid, ofloat))
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gedit [name] [gateid] [value]{AFAFAF}(Put (0) at Object to delete the gate)");
        SendClientMessage(playerid, COLOR_GREY, "OPTIONS: object | close | open | speed | range | hid");
        return 1;
    }

    if(gateid >= MAX_GATES)
    {
        SendClientMessage(playerid, COLOR_WHITE, "Invalid Gate ID!");
        return 1;
    }
    if(strcmp(choice, "open", true) == 0)
    {
        gEdit[playerid] = 2;
        gEditID[playerid] = gateid;
        GetDynamicObjectPos(GateInfo[gateid][gGate], gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
        GetDynamicObjectRot(GateInfo[gateid][gGate], gRot[playerid][0], gRot[playerid][1], gRot[playerid][2]);
        EditDynamicObject(playerid, GateInfo[gateid][gGate]);
        format(string, sizeof(string), " You are now editing gate ID %d's opening position.", gateid);
        SendClientMessage(playerid, COLOR_WHITE, string);

        format(string, sizeof(string), " %s has set the gate ID %d's open position", GetPlayerNameEx(playerid), gateid);
        Log("logs/gedit.log", string);
    }
    if(strcmp(choice, "close", true) == 0)
    {
        gEdit[playerid] = 1;
        gEditID[playerid] = gateid;
        GetDynamicObjectPos(GateInfo[gateid][gGate], gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
        GetDynamicObjectRot(GateInfo[gateid][gGate], gRot[playerid][0], gRot[playerid][1], gRot[playerid][2]);
        EditDynamicObject(playerid, GateInfo[gateid][gGate]);
        format(string, sizeof(string), " You are now editing gate ID %d's Close position.", gateid);
        SendClientMessage(playerid, COLOR_WHITE, string);

        format(string, sizeof(string), " %s has set the gate ID %d's close position", GetPlayerNameEx(playerid), gateid);
        Log("logs/gedit.log", string);
    }
    else if(strcmp(choice, "object", true) == 0)
    {
        new value = floatround(ofloat, floatround_round);
        if(value == 0)
        {
            format(string, sizeof(string), "%d", value);
            GateInfo[gateid][gModel] = 0;
            GateInfo[gateid][gCX] = 0;
            GateInfo[gateid][gCY] = 0;
            GateInfo[gateid][gCZ] = 0;
            GateInfo[gateid][gCRX] = 0;
            GateInfo[gateid][gCRY] = 0;
            GateInfo[gateid][gCRZ] = 0;
            GateInfo[gateid][gOX] = 0;
            GateInfo[gateid][gOY] = 0;
            GateInfo[gateid][gOZ] = 0;
            GateInfo[gateid][gORX] = 0;
            GateInfo[gateid][gORY] = 0;
            GateInfo[gateid][gORZ] = 0;
            GateInfo[gateid][gRange] = 0;
            GateInfo[gateid][gHID] = -1;
            GateInfo[gateid][gStatus] = 0;
            format(GateInfo[gateid][gPassword], 256, "");
            GateInfo[gateid][gSpeed] = 0;
            DestroyDynamicObject(GateInfo[gateid][gGate]);
//          DestroyDynamic3DTextLabel(GateInfo[gateid][gText]);
            return 1;
        }
        GateInfo[gateid][gModel] = value;
        DestroyDynamicObject(GateInfo[gateid][gGate]);
        GateInfo[gateid][gGate] = CreateDynamicObject(GateInfo[gateid][gModel], GateInfo[gateid][gCX], GateInfo[gateid][gCY], GateInfo[gateid][gCZ], GateInfo[gateid][gCRX], GateInfo[gateid][gCRY], GateInfo[gateid][gCRZ]);
        format(string, sizeof(string), " You have set gate ID %d's object ID to %d.", gateid, value);
        SendClientMessage(playerid, COLOR_WHITE, string);
        SaveGates();

        format(string, sizeof(string), " %s has set the gate ID %d's object id to %d.", GetPlayerNameEx(playerid), gateid, value);
        Log("logs/gedit.log", string);
        return 1;
    }
    if(strcmp(choice, "speed", true) == 0)
    {
        new value = floatround(ofloat, floatround_round);
        GateInfo[gateid][gSpeed] = value;
        format(string, sizeof(string), " You have set gate ID %d's moving speed to %d.", gateid, value);
        SendClientMessage(playerid, COLOR_WHITE, string);
        SaveGates();

        format(string, sizeof(string), " %s has set the gate ID %d's speed to %d.", GetPlayerNameEx(playerid), gateid, value);
        Log("logs/gedit.log", string);
        return 1;
    }
    if(strcmp(choice, "range", true) == 0)
    {
        new value = floatround(ofloat, floatround_round);
        GateInfo[gateid][gRange] = value;
        format(string, sizeof(string), " You have set gate ID %d's Range to %d.", gateid, value);
        SendClientMessage(playerid, COLOR_WHITE, string);
        SaveGates();

        format(string, sizeof(string), " %s has set the gate ID %d's speed to %d.", GetPlayerNameEx(playerid), gateid, value);
        Log("logs/gedit.log", string);
        return 1;
    }
    if(strcmp(choice, "hid", true) == 0)
    {
        new value = floatround(ofloat, floatround_round);
        GateInfo[gateid][gHID] = value;
        format(string, sizeof(string), " You have set gate ID %d's gate owner to house ID %d.", gateid, value);
        SendClientMessage(playerid, COLOR_WHITE, string);
        SaveGates();

        format(string, sizeof(string), " %s has set the gate ID %d's speed to %d.", GetPlayerNameEx(playerid), gateid, value);
        Log("logs/gedit.log", string);
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use that command!");
    }
    return 1;
}
Reply
#2

This is Made by You Or just Made by any Tut ?

When it is By a Tut.

pawn Код:
if(PlayerInfo[playerid][pAdmin] < 4)    {        SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use that command!");        return 1;
You have to Find How this Lines in Your GM.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)