Help with a get command
#5

Okay if I understood you correctly, you simply want to allow 2 cars instead of 1 right? Then you could do something like so.

pawn Код:
else if(!strcmp(tmp, "get",true))
{
    new str[256];
    new vehcount;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /v get [number[1-5])");
        return 1;
    }
    if(veh1[playerid] != 999) vehcount++;
    if(veh2[playerid] != 999) vehcount++;
    if(veh3[playerid] != 999) vehcount++;
    if(veh4[playerid] != 999) vehcount++;
    if(veh5[playerid] != 999) vehcount++;
    if(vehcount >= 2) return SendClientMessage(playerid,COLOR_LIGHTRED,"You already have 2 cars out please park one before spawning another one"); // Player has 2 or more cars spawned, stop him from spawning more
    if(strcmp(tmp, "1", true) == 0) {
        if(IsVehicleSpawned(veh1[playerid])) {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You have already spawned your vehicle !");
            new vZone[MAX_ZONE_NAME];
            GetVehicleZone(veh1[playerid], vZone, MAX_ZONE_NAME);
            format(string, sizeof(string), "Your %s is now in %s", VehicleNames[GetVehicleModel(veh1[playerid])-400], vZone);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            return 1;
        }
        if(strcmp(PlayerInfo[playerid][pVeh1], "None", true)) {
            format(str, sizeof(str), "Vehicles/Vehicles/%s.cfg",PlayerInfo[playerid][pVeh1]);
            if(dini_Exists(str)) {
                LoadVehicles(playerid, PlayerInfo[playerid][pVeh1]);

            }
            else SendClientMessage(playerid,COLOR_LIGHTRED, "You got bug with this vehicle please go to the admin");
            return 1;
        }
        else {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You don't own any vehicle !");
            return 1;
        }
    }
    if(strcmp(tmp, "2", true) == 0) {
        if(IsVehicleSpawned(veh2[playerid])) {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You have already spawned your vehicle !");
            new vZone[MAX_ZONE_NAME];
            GetVehicleZone(veh2[playerid], vZone, MAX_ZONE_NAME);
            format(string, sizeof(string), "Your %s is now in %s", VehicleNames[GetVehicleModel(veh2[playerid])-400], vZone);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            return 1;
        }
        if(strcmp(PlayerInfo[playerid][pVeh2], "None", true)) {
            format(str, sizeof(str), "Vehicles/Vehicles/%s.cfg",PlayerInfo[playerid][pVeh2]);
            if(dini_Exists(str)) {
                LoadVehicles(playerid, PlayerInfo[playerid][pVeh2]);

            }
            else SendClientMessage(playerid,COLOR_LIGHTRED, "You got bug with this vehicle please go to the admin");
            return 1;
        }
        else {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have a 2nd vehicle!");
            return 1;
        }
    }
    if(strcmp(tmp, "3", true) == 0) {
        if(IsVehicleSpawned(veh3[playerid])) {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You have already spawned your vehicle !");
            new vZone[MAX_ZONE_NAME];
            GetVehicleZone(veh3[playerid], vZone, MAX_ZONE_NAME);
            format(string, sizeof(string), "Your %s is now in %s", VehicleNames[GetVehicleModel(veh3[playerid])-400], vZone);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            return 1;
        }
        else {
            if(strcmp(PlayerInfo[playerid][pVeh3], "None", true)) {
                format(str, sizeof(str), "Vehicles/Vehicles/%s.cfg",PlayerInfo[playerid][pVeh3]);
                if(dini_Exists(str)) {
                    LoadVehicles(playerid, PlayerInfo[playerid][pVeh3]);

                }
                else SendClientMessage(playerid,COLOR_LIGHTRED, "You got bug with this vehicle please go to the admin");
                return 1;
            }
            else {
                SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have a 2nd vehicle!");
                return 1;
            }
        }
    }
    if(strcmp(tmp, "4", true) == 0) {
        if(IsVehicleSpawned(veh4[playerid])) {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You have already spawned your vehicle !");
            new vZone[MAX_ZONE_NAME];
            GetVehicleZone(veh4[playerid], vZone, MAX_ZONE_NAME);
            format(string, sizeof(string), "Your %s is now in %s", VehicleNames[GetVehicleModel(veh4[playerid])-400], vZone);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            return 1;
        }
        else {
            if(strcmp(PlayerInfo[playerid][pVeh4], "None", true)) {
                format(str, sizeof(str), "Vehicles/Vehicles/%s.cfg",PlayerInfo[playerid][pVeh4]);
                if(dini_Exists(str)) {
                    LoadVehicles(playerid, PlayerInfo[playerid][pVeh4]);

                }
                else SendClientMessage(playerid,COLOR_LIGHTRED, "You got bug with this vehicle please go to the admin");
                return 1;
            }
            else {
                SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have a 4th vehicle!");
                return 1;
            }
        }
    }
    if(strcmp(tmp, "5", true) == 0) {
        if(IsVehicleSpawned(veh5[playerid])) {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You have already spawned your vehicle !");
            new vZone[MAX_ZONE_NAME];
            GetVehicleZone(veh5[playerid], vZone, MAX_ZONE_NAME);
            format(string, sizeof(string), "Your %s is now in %s", VehicleNames[GetVehicleModel(veh5[playerid])-400], vZone);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            return 1;
        }
        if(strcmp(PlayerInfo[playerid][pVeh5], "None", true)) {
            format(str, sizeof(str), "Vehicles/Vehicles/%s.cfg",PlayerInfo[playerid][pVeh5]);
            if(dini_Exists(str)) {
                LoadVehicles(playerid, PlayerInfo[playerid][pVeh5]);

            }
            else SendClientMessage(playerid,COLOR_LIGHTRED, "You got bug with this vehicle please go to the admin");
            return 1;
        }
        else {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You don't have a 5th vehicle!!");
            return 1;
        }
    }
    return 1;
}
Reply


Messages In This Thread
Help with a get command - by ihatetn931 - 02.09.2010, 18:36
Re: Help with a get command - by ihatetn931 - 03.09.2010, 06:43
Re: Help with a get command - by ihatetn931 - 03.09.2010, 17:36
Re: Help with a get command - by ihatetn931 - 04.09.2010, 05:16
Re: Help with a get command - by JaTochNietDan - 04.09.2010, 05:34
Re: Help with a get command - by ihatetn931 - 04.09.2010, 05:44
Re: Help with a get command - by JaTochNietDan - 04.09.2010, 05:56
Re: Help with a get command - by ihatetn931 - 04.09.2010, 06:04

Forum Jump:


Users browsing this thread: 1 Guest(s)