22.09.2011, 07:15
So I have this code:
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]".
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;
}