How To Delete Car
#1

Hello Guys :
- How Can I Make A CMD to delete all car uninhabited vehicles in, on the server
- This Is My Spawn Car Command
Код:
CMD:layxe(playerid, params[]) 
{ 
    new Float:x,  
        Float:y, 
        Float:z, 
        Float:Angle, 
        vehicleid, 
        name[20 + EOS]; 

    if(!sscanf(params,"i", vehicleid)) 
     { 
        if(611 < vehicleid || vehicleid < 400)  
            return SendClientMessage(playerid, COLOR_RED, "ID Xe [400-611]"); 
    } 

    else if(!sscanf(params, "s[20]", name)) 
    { 
        if((vehicleid = GetVehicleIDFromName(name)) == INVALID_VEHICLE_ID) 
            return SendClientMessage(playerid, COLOR_RED, "Ten Khong Hop Le"); 
    } 
     
    else return SendClientMessage(playerid, COLOR_RED, "/layxe [id xe hoac ten xe]"); 
     
    if(IsPlayerInAnyVehicle(playerid)) RemovePlayerFromVehicle(playerid); 
    DestroyVehicle(vehicleid);
    GetPlayerPos(playerid, x, y, z); 
    GetPlayerFacingAngle(playerid, Angle); 
    vehicleid = CreateVehicle(vehicleid, x, y, z, Angle, -1, -1, -1); 
    PutPlayerInVehicle(playerid, vehicleid, 0);
    return 1; 
}
Reply
#2

any one
Reply
#3

You can do this way:


PHP код:
IsVehicleEmpty(vehicleid)
{
    for(new 
0GetPlayerPoolSize(); <= ji++)
    {
        if(
IsPlayerInVehicle(ivehicleid)) return 0;
    }
    return 
1;
}
COMMAND:destroyveh(playerid,params[])
{
    for(new 
1GetVehiclePoolSize(); <= ji++) // vehicleids start at 1
    
{
        if(
IsVehicleEmpty(i)) DestroyVehicle(i);
    }
    return 
1;

Reply
#4

PHP код:
COMMAND:destroycar(playerid,params[]) 
     {
          new 
vehicleid GetPlayerVehicleID(playerid);
          
DestroyVehicle(vehicleid);
          return 
1;
     }
 
     return 
0;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)