Remove Admin Cars
#1

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:

Код:
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;
}
Reply


Messages In This Thread
Remove Admin Cars - by Blademaster680 - 07.10.2014, 10:34
Re: Remove Admin Cars - by MasonSFW - 07.10.2014, 12:26
Re: Remove Admin Cars - by Blademaster680 - 07.10.2014, 13:47
Re: Remove Admin Cars - by rodrijose2009 - 07.10.2014, 15:14
Re: Remove Admin Cars - by Blademaster680 - 07.10.2014, 19:53
Re: Remove Admin Cars - by Threshold - 08.10.2014, 01:24
Re: Remove Admin Cars - by Blademaster680 - 08.10.2014, 21:14
Re: Remove Admin Cars - by Threshold - 08.10.2014, 22:35
Re: Remove Admin Cars - by Blademaster680 - 13.10.2014, 19:45
Re: Remove Admin Cars - by Threshold - 13.10.2014, 22:43

Forum Jump:


Users browsing this thread: 1 Guest(s)