11.04.2017, 17:28
After reading that, I thought that would be the case for you so I have created a code you can use which was based off the codes I saw in your main thread, it will randomly select one explosion, then use that, then after around five minutes (if you set the timer on it) will change to a differnt explosion and will carry on doing this until it reaches the 100 mark then will cut it's timer off, I have also added in some codes which will help you more with your development, they're simple to understand and easier to do than making a mess of your systems:
pawn Код:
new ExplosionCount; // This will keep count of how many explosions have occured
new ExplosionTimer; // This will be used to kill the timer after the count has reached its limit
ExplosionTimer = SetTimer("BurgerShotExplosion", 1000, true); // This starts the timer, place this whereever you want
forward BurgerShotExplosion();
public BurgerShotExplosion()
{
if(ExplosionCount == 0) // If the Timer is set on 0, this is where it will start! I also suggest adding a smoking object on the building!
{
if(IsPlayerConnected(playerid)) // This will check if the player is connected
{
new string[300];
format(string, sizeof(string), "HQ: All Units APB, Reporter: {FFFFFF} Un Incediu a fost depistat! Mergeti pentru a-l stinge.");
SendMedicMessage(COLOR_DBLUE, string); // This will only send to the medics and not to the player who started the fire!
SetMedicCheckPoint(2438.04688, -1271.21838, 23.22764,1.0); // This will only set a checkpoint on the medics radar and not the civilians
}
}
else if(ExplosionCount < 100) // This checks to see if the explosions are under 100, if it is, it will carry on!
{
switch(random(3)) // This will randomly select one explosion, then change to another explosion.
{
case 0:
{
CreateExplosion(2438.04688, -1271.21838, 23.22764,2,100);
}
case 1:
{
CreateExplosion(432.4224, -1297.9946, 25.0137,1,100);
}
case 2:
{
CreateExplosion(2427.9363, -1288.8926, 30.2144,1,100);
}
}
ExplosionCount++; // Adds 1 explosion count to the variable
}
else if(ExplosionCount == 100) // Once the explosion count hits 100, it will stop the timer
{
ExplosionCount = 0; // Resets the count for the next time it happens
KillTimer(ExplosionTimer); // This will kill the timer and end the explosions
// You can also add a dispatch message saying the fire is out and units can return to base! :D
}
return 1;
}
stock SendMedicMessage(colour, string[]) // This will send a mass message to the Medic Faction only!
{
for(new i = 0; i < MAX_PLAYERS; i++) // This will go through each player ID
{
if(PlayerInfo[i][pMember] == 14 || PlayerInfo[i][pLeader] == 14) // This will check if that player ID is in the medic faction
{
SendClientMessage(i, colour, string); // This will send the message to the medics in that faction
}
}
return 1;
}
stock SetMedicCheckPoint(Float: x, Float: y, Float: z, Float: size) // This will send a mass checkpoint to the Medic Faction only!
{
for(new i = 0; i < MAX_PLAYERS; i++) // This will go through each player ID
{
if(PlayerInfo[i][pMember] == 14 || PlayerInfo[i][pLeader] == 14) // This will check if that player ID is in the medic faction
{
SetPlayerCheckpoint(i, x, y, z, size); // This will set a checkpoint for the medics in that faction
}
}
return 1;
}