20.09.2016, 18:03
(
Последний раз редактировалось Dayrion; 20.09.2016 в 19:44.
)
Alright, foreach doesn't work anymore. Woa.
The code doesn't perform. He is like ignored.
EDIT:
Alriiiight! I changed the foreach include and the function!
Final version:
Thanks a lot Konstantinos for your help and precious code!
I was wondering if I can use char for every array which can be divided by 4 ? Why nobody use this instead of normal array? This is optimization but it's interesting!
The code doesn't perform. He is like ignored.
EDIT:
Alriiiight! I changed the foreach include and the function!
Final version:
PHP код:
CMD:respawncall(playerid, params[])
{
if(pAccount[playerid][pAdmin] < ADMIN) return ErrorMsg(playerid, _, false);
new time;
if(sscanf(params, "I(20)", time)) return SCM(playerid, LBLUE, "/respawncall [temps avant respawn]");
if(RespawnAllVehicle != -1)
{
ServeurAnnonce(_, "Le respawn des vйhicules a йtй annulй par un administrateur.");
SendMessageToAdmins(ARED, "%s a annulй le respawn des vйhicules", GetName(playerid));
KillTimer(RespawnAllVehicle);
RespawnAllVehicle = -1;
return 1;
}
RespawnAllVehicle = SetTimerEx("AllVehicleRespawn", 5000, false, "i", time);
AdminMessage(playerid, "Vous avez dйmarrй le respawn de tous les vйhicules.");
SendMessageToAdmins(ARED, "%s a dйmarrй le respawn de tous les vйhicules.", GetName(playerid));
ServeurAnnonce(_, "%i secondes avant le respawn de tous les vйhicules.", time);
return 1;
}
PUBLIC:AllVehicleRespawn(interval)
{
if((interval -= 5) > 0)
{
ServeurAnnonce(_, "%i secondes avant le respawn de tous les vйhicules.", interval);
RespawnAllVehicle = SetTimerEx("AllVehicleRespawn", 5000, false, "i", interval);
return 1;
}
KillTimer(RespawnAllVehicle);
RespawnAllVehicle = -1;
ServeurAnnonce(_, "Tous les vйhicules ont йtй respawn par un administrateur.");
RespawnVehicles();
return 1;
}
RespawnVehicles()
{
new bool: occupied_vehicle[MAX_VEHICLES char], vehicleid;
foreach(new i : Player)
{
if ((vehicleid = GetPlayerVehicleID(i)) != 0)
{
occupied_vehicle{vehicleid} = true;
occupied_vehicle{GetVehicleTrailer(vehicleid)} = true;
}
}
foreach(new v : Vehicle)
{
if (!occupied_vehicle{v}) SetVehicleToRespawn(v);
}
}
I was wondering if I can use char for every array which can be divided by 4 ? Why nobody use this instead of normal array? This is optimization but it's interesting!