Help with a loop.
#1

So I have this code:

pawn Код:
if(strcmp(cmdtext, "/deleteusercar", true) == 0)
    {
        new vehid = GetPlayerVehicleID(playerid);
        for(new i = 0; i < sizeof(CarInfo); i++)
        {
            if(vehid != CarInfo[i][ownedvehicle])
            {
                SendClientMessage(playerid, COLOR_GREY, "* This car is not owned by a player.");
                return 1;
            }
            else {
                CarInfo[vehid][vModel] = 0;
                CarInfo[vehid][vLocationx] = 0;
                CarInfo[vehid][vLocationy] = 0;
                CarInfo[vehid][vLocationz] = 0;
                CarInfo[vehid][vAngle] = 0;
                CarInfo[vehid][vColorOne] = 0;
                CarInfo[vehid][vColorTwo] = 0;
                CarInfo[vehid][vOwner] = 0;
                CarInfo[vehid][vValue] = 0;
                CarInfo[vehid][vLicense] = 0;
                CarInfo[vehid][vOwned] = 0;
                CarInfo[vehid][vLock] = 0;
                CarInfo[vehid][vMod1] = 0;
                CarInfo[vehid][vMod2] = 0;
                CarInfo[vehid][vMod3] = 0;
                CarInfo[vehid][vMod4] = 0;
                CarInfo[vehid][vMod5] = 0;
                CarInfo[vehid][vMod6] = 0;
                CarInfo[vehid][vMod7] = 0;
                CarInfo[vehid][vMod8] = 0;
                CarInfo[vehid][vMod9] = 0;
                CarInfo[vehid][vMod10] = 0;
                CarInfo[vehid][vMod11] = 0;
                CarInfo[vehid][vMod12] = 0;
                CarInfo[vehid][vMod13] = 0;
                CarInfo[vehid][vMod14] = 0;
                CarInfo[vehid][vMod15] = 0;
                CarInfo[vehid][vMod16] = 0;
                CarInfo[vehid][vMod17] = 0;
                CarInfo[vehid][vPlate] = 0;
                DestroyVehicle(vehid);
                SaveCars();
                SendClientMessage(playerid, COLOR_GREY, "* This car has been deleted !");
            }
        }
        return 1;
    }
But it doesn't work. I know I haven't done it properly but I'm not sure how to do it properly, you see I loop through CarInfo. createvehicle comes from the enum, it's how the cars id is defined. So I need it to ask, if the vehid is ANY "CarInfo[i][createvehicle]".
Reply


Messages In This Thread
Help with a loop. - by Jack_Leslie - 22.09.2011, 07:15
Re: Help with a loop. - by PrawkC - 22.09.2011, 07:57
Re: Help with a loop. - by Jack_Leslie - 22.09.2011, 08:00
Re: Help with a loop. - by PrawkC - 22.09.2011, 08:09
Re: Help with a loop. - by Jack_Leslie - 22.09.2011, 08:37
Re: Help with a loop. - by PrawkC - 22.09.2011, 09:10
Re: Help with a loop. - by Jack_Leslie - 22.09.2011, 09:13
Re: Help with a loop. - by GrimR - 22.09.2011, 09:35
Re: Help with a loop. - by PrawkC - 22.09.2011, 10:37

Forum Jump:


Users browsing this thread: 2 Guest(s)