17.09.2016, 11:19
Hi'.
I created this thread to talk about commands optimization.
I mean, post your command and let's other users to give them her opinion.
So, there is mine:
Any suggestions? Optimization? This code seem too much repetitive. :/
I created this thread to talk about commands optimization.
I mean, post your command and let's other users to give them her opinion.
So, there is mine:
PHP Code:
new TimeRespawn;
CMD:respawncall(playerid)
{
if(pAccount[playerid][pAdmin] < ADMIN) return ErrorMsg(playerid, _, false);
TimeRespawn = gettime()+20;
SetTimer("AllVehicleRespawn", 5000, false);
AdminMessage(playerid, "Vous avez dйmarrй le respawn de tous les vйhicules.");
SendMessageToAdmins(RED, "%s a dйmarrй le respawn de tous les vйhicules.", GetName(playerid));
ServeurAnnonce(_, "20 secondes avant le respawn de tous les vйhicules.");
return 1;
}
PUBLIC:AllVehicleRespawn()
{
if(TimeRespawn - gettime() > 13)
{
ServeurAnnonce(_, "15 secondes avant le respawn de tous les vйhicules.");
// 15 seconds before every vehicle's respawn.
SetTimer("AllVehicleRespawn", 5000, false);
return 1;
}
else if(TimeRespawn - gettime() > 9)
{
ServeurAnnonce(_, "10 secondes avant le respawn de tous les vйhicules.");
SetTimer("AllVehicleRespawn", 5000, false);
return 1;
}
else if(TimeRespawn - gettime() > 4)
{
ServeurAnnonce(_, "5 secondes avant le respawn de tous les vйhicules.");
SetTimer("AllVehicleRespawn", 5000, false);
return 1;
}
ServeurAnnonce(_, "Tous les vйhicules ont йtй respawn par un administrateur.");
for(new i; i < GetVehiclePoolSize()+1; i++)
{
SetVehicleToRespawn(i);
}
return 1;
}