07.10.2014, 10:34
I am trying to make it so if you type, /destoryveh it will remove all the spawned admin cars on the server. Currently it is only destroying the last spawned admin car, if they are higher than level 8 admin...
Please help me.
Need all the admin cars to be removed from the server.
Thanks
Code:
Please help me.
Need all the admin cars to be removed from the server.
Thanks
Code:
Код:
new AdminCars[MAX_PLAYERS] = 0; new AdminCars2[10], carid2; CMD:veh(playerid, params[]) { if(pInfo[playerid][pAdminLevel] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorised to use that command."); if(GetPVarInt(playerid, "AdminDuty") == 1 || pInfo[playerid][pAdminLevel] == 8) { new carid, col1, col2; if(sscanf(params, "iii", carid, col1, col2)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /veh [ID] [COL1] [COL2]"); if(carid2 > sizeof(AdminCars2)-1) return SendClientMessage(playerid, COLOR_GREY, "You must use /vehdestroy because is now maximum Admin cars"); if(carid < 400 || carid > 611) return SendClientMessage(playerid, COLOR_GREY, "Vehicle number can't be below 400 or above 611!"); if(col1 < 0 || col1 > 256) return SendClientMessage(playerid, COLOR_GREY, "Color number can't be below 0 or above 256!"); if(pInfo[playerid][pAdminLevel] == 8) { new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z); new vehicleid; vehicleid = AdminCars2[carid2] = AddStaticVehicleEx(carid, X+2,Y+2,Z+1, 0.0, col1, col2, 60000); gVehicleFuel[vehicleid] = 100; new string[128]; format(string, sizeof(string), "Vehicle %d spawned.", AdminCars2[carid2]); SendClientMessage(playerid, COLOR_GREY, string); return 1; } else if(AdminCars[playerid] == 0) { new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid, X,Y,Z); new vehicleid; vehicleid = AdminCars[playerid] = AddStaticVehicleEx(carid, X+2,Y+2,Z+1, 0.0, col1, col2, 60000); AdminCars2[carid2] = carid2+1; gVehicleFuel[vehicleid] = 100; } else return SendClientMessage(playerid, COLOR_GREY, "You already have a spawned vehicle."); } else return SendClientMessage(playerid, COLOR_GREY, "You need to be on admin duty to use the commands."); return 1; } CMD:vehdestroy(playerid, params[]) { if(pInfo[playerid][pAdminLevel] <= 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorised to use that command."); if(GetPVarInt(playerid, "AdminDuty") == 0 && pInfo[playerid][pAdminLevel] < 8) return SendClientMessage(playerid, COLOR_GREY, "You need to be on admin duty to use that command."); for(new i = 0; i < sizeof(AdminCars2); i++) { if(AdminCars2[i] > 0) { DestroyVehicle(AdminCars2[i]); AdminCars2[i] -= 1; } } for(new i = 0; i < sizeof(AdminCars); i++) { if(AdminCars[i] > 0) { DestroyVehicle(AdminCars2[i]); AdminCars[i] -= 1; } } carid2 = 0; SendClientMessage(playerid, COLOR_GREY, "All admin cars have been removed."); return 1; }