12.03.2015, 20:31
I just want a command for example if i use /fire it will set all nearby vehicles on fire but only if there are players in vehicles. Problem is i don't know what functions to use
#define DESTROY_VEHICLE_DISTANCE 50.0 COMMAND:fire(playerid, params[]) { for(new i = 0; i < MAX_VEHICLES; i++) { if(IsValidVehicle(i)) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); if(GetVehicleDistanceFromPoint(i, x, y, z) < DESTROY_VEHICLE_DISTANCE && IsVehicleOccupied(i)) { SetVehicleHealth(i, 0); SendClientMessage(playerid, -1, "Nearby vehicles are destroyed"); } } } return 1; } stock IsVehicleOccupied(vehicleid) { for(new i = 0; i < MAX_PLAYERS; i++) { if(!IsPlayerConnected(i)) continue; if(vehicleid == GetPlayerVehicleID(i)) return true; } return false; }