Need help with SetCargroup CMD
#1

Well Heres my command
pawn Code:
command(setcargroup, playerid, params[])
{
    new id, string[128];
    if(sscanf(params, "d", id))
    {
        if(Player[playerid][AdminLevel] >= 1)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /setcargroup [Group ID] [Group Rank]");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 4)
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                if(id >= 0 && id < MAX_GROUPS)
                {
                    if(GetVehicleFileID(GetPlayerVehicleID(playerid))  == 0)
                    {
                        SendClientMessage(playerid, WHITE, "That doesn't seem to be a saved vehicle.");
                    }
                    else
                    {
                        if(id == 0)
                        {
                            SendClientMessage(playerid, WHITE, "You have unlocked this vehicle.");
                            Vehicles[GetVehicleFileID(GetPlayerVehicleID(playerid))][CarGroup] = 0;
                        }
                        else
                        {
                            Vehicles[GetVehicleFileID(GetPlayerVehicleID(playerid))][CarGroup] = id;
                            format(string, sizeof(string), "You have locked this vehicle to Group %s.", Groups[id][GroupName]);
                            SendClientMessage(playerid, WHITE, string);
                            SaveExistingVehicle(GetPlayerVehicleID(playerid));
                        }
                    }
                }
                else
                {
                    format(string, sizeof(string), "Invalid Group ID (groups vary from ID 1 to ID %d).", MAX_GROUPS);
                    SendClientMessage(playerid, WHITE, string);
                }
            }
            else
            {
                SendClientMessage(playerid, WHITE, "You're not in a valid vehicle.");
            }
        }
    }
    return 1;
}
Its from VXRP 1 script, How would I make it so a player in a faction is REQUIRED to be a certain rank to drive it, and to set that certain rank on the /setcargroup, thanks.!
Reply
#2

pawn Code:
command(setcargroup, playerid, params[])
{
    new id, string[128];
    if(Player[playerid][AdminLevel] < 4/* || Playerrank[playerid] < x*/) return SendClientMessage(playerid, WHITE, "Error.");
    if(sscanf(params, "d", id)) return SendClientMessage(playerid, WHITE, "SYNTAX: /setcargroup [Group ID] [Group Rank]");//You only extract to 1 variable??
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(0 <= id < MAX_GROUPS)
        {
            if(GetVehicleFileID(GetPlayerVehicleID(playerid))  == 0)
            {
                SendClientMessage(playerid, WHITE, "That doesn't seem to be a saved vehicle.");
            }
            else
            {
                if(id == 0)
                {
                    SendClientMessage(playerid, WHITE, "You have unlocked this vehicle.");
                    Vehicles[GetVehicleFileID(GetPlayerVehicleID(playerid))][CarGroup] = 0;
                }
                else
                {
                    Vehicles[GetVehicleFileID(GetPlayerVehicleID(playerid))][CarGroup] = id;
                    format(string, sizeof(string), "You have locked this vehicle to Group %s.", Groups[id][GroupName]);
                    SendClientMessage(playerid, WHITE, string);
                    SaveExistingVehicle(GetPlayerVehicleID(playerid));
                }
            }
        }
        else
        {
            format(string, sizeof(string), "Invalid Group ID (groups vary from ID 1 to ID %d).", MAX_GROUPS);
            SendClientMessage(playerid, WHITE, string);
        }
    }
    else
    {
        SendClientMessage(playerid, WHITE, "You're not in a valid vehicle.");
    }
    return 1;
}
Reply
#3

Edit: Doesnt work ingame.. but compiles fine..
Reply
#4

Did you change "/* || Playerrank[playerid] < x*/"?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)