15.02.2018, 09:46
I made some commands, the commands to respawn factions vehicle, but the problem is, It respawned the occupied faction vehicle too, so when players are driving, their vehicle dissapears when i do /respawnarmyveh.
Can someone fix it for me?
The /respawnarmyvehCan someone fix it for me?
Код:
CMD:respawnarmy(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 1) { SendClientMessageEx(playerid, COLOR_WHITE, "Dibutuhkan admin LVL 1+"); } else { for(new x;x<sizeof(ARMYVehicles);x++) { if(!IsVehicleOccupied(x)) { SetVehicleToRespawn(ARMYVehicles[x]); } } SendClientMessageToAll(COLOR_REALRED,"[Information] {FFFFFF}Kendaraan faction ARMY telah Direspawn."); } return 1; }
Код:
stock IsVehicleOccupied(vehicleid) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER) { return 1; } } return 0; }