/veh destroyall doesn't work
#1

Hey guys, I tried to script a CMD to delete every vehicle created by admin
Full CMD: (including single vehicle destroy, vehicle create and destroy all)
Anyone ?

PHP код:
CMD:veh(playeridparams[])
{
    new 
idFloat:pos[4], col[2];
       if(!
IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playeridCOLOR_GREY"You are not allowed to use this command.");
    if(
PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playeridCOLOR_GREY"You are not authorized to use this command.");
    if(!
strcmp(params"destroy"))
    {
        if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playeridCOLOR_GREY"You must be inside a vehicle to destroy it.");
        for(new 
i=0i<MAX_CUSTOM_VEHICLESi++)
        {
            if(
GetPlayerVehicleID(playerid) == cVeh[i])
            {
                
//format(string, sizeof(string), "AdmWarn: %s has destroyed a vehicle model %d.", RPN(playerid), GetVehicleModel(i));
                //SendAdminMessage(COLOR_DARKRED, 1, string);
                
DestroyVehicle(cVeh[i]);
                
MAX_CUSTOM_VEHICLES;
                return 
1;
            }
        }
        
SendClientMessage(playeridCOLOR_GREY"You can't destroy this vehicle.");
        return 
1;
    }
    if(!
strcmp(params"destroyall"))
    {
        for(new 
i=0i<MAX_CUSTOM_VEHICLESi++)
        {
            
DestroyVehicle(cVeh[i]);
            
cVeh[i] = 0;
            return 
1;
        }
        return 
1;
    }
    if(
sscanf(params"iii"idcol[0], col[1])) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /veh [vehicleid/destroy] [color1] [color2]");
    if(
id 400 || id 611) return SendClientMessage(playeridCOLOR_GREY"Vehicles are between 400 and 611.");
    
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
    
GetPlayerFacingAngle(playeridpos[3]);
    for(new 
i=0i<MAX_CUSTOM_VEHICLESi++)
    {
        if(!
cVeh[i])
        {
            
cVeh[i] = CreateVehicle(idpos[0], pos[1], pos[2], pos[3], col[0], col[1], 1200);
            
MAX_CUSTOM_VEHICLES;
        }
    }
    new 
string[128];
    
format(stringsizeof(string), "AdmWarn: %s has spawned a vehicle model %d."RPN(playerid), id);
    
SendAdminMessage(COLOR_DARKRED1string);
    return 
1;

Reply


Messages In This Thread
/veh destroyall doesn't work - by NeXoR - 29.03.2016, 21:33
Re: /veh destroyall doesn't work - by Golden96 - 29.03.2016, 21:41
Re: /veh destroyall doesn't work - by NeXoR - 29.03.2016, 22:25

Forum Jump:


Users browsing this thread: 2 Guest(s)