SA-MP Forums Archive
Auto fire spawn system. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Auto fire spawn system. (/showthread.php?tid=257850)



Auto fire spawn system. - Robert_Crawford - 28.05.2011

Okay. How would i go about making fire spawn at certian locations randomly and also send the fire dept a message.

i know i would need a timer
i also know i would need the fire spawns
i also need the groups of objects
i also know i need to set a map icon?
also how would i apply fire health?

So can anybody give me a outline as to how this would be done?


Re: Auto fire spawn system. - Lynn - 28.05.2011

Hello old friend Robert(If you remember me still from way back.)
Pretty much,
You would need the following:
For spawns, look at pretty much any script which uses gRandomSpawns etc.
Replace that, with:
pawn Код:
new RandomFireSpawn
{X, Y, Z },
{X, Y, Z},
{X, Y, Z};//This is of the X, Y, Z of fire spawns.
Once you have created the timer, you would do the following.
pawn Код:
public TimerName()
{
    if(IsPlayerConnected(playerid))
    {
        CreateObject(ObjectID, RandomFireSpawn[0], RandomFireSpawn[1], RandomFireSpawn[2],0, 0, 0, 0);
        SetPlayerMapIcon(playerid, IConID, RandomFireSpawn[1],RandomFireSpawn[1],RandomFireSpawn[1], 55, COLOR_WHITE, 0);
        SendFactionMessage(factionID, COLOR_PINK, " Dispatch: There has been a fire located within the city of LS");//This is a example code, the code you would use is what ever you use, as for /®adio for the LSFMD. Same thing, minus the string. You already have the preset text.
        KillTimer(TimerName);
    }
    return 1;
}

//Now, for the health.
new FireHPTimer[MAX_PLAYERS];
forward HealthFire(playerid)
public HealthFire(playerid);
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid,5.0,RandomFireSpawn[0],RandomFireSpawn[1],RandomFireSpawn[2]))
        {
            FireHPTimer[playerid] = SetTimerEx("FireHealthTime", 25000, false, "i", playerid);//Set for 25 seconds.
        }
    }
    return 1;
}
forward FireHealthTime(playerid)
public FireHealthTime(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:health;
        GetPlayerHealth(playerid, health);
        SetPlayerHealth(playerid, health-25.0);//In 25 seconds, if not treated he will loose 25 HP
    }
    return 1;
}
If that doesn't work, or I am missing something, sorry. A Bit tired mate :P
Also I don't have Pawno etc. on this computer so had to do it by memory.


Re: Auto fire spawn system. - Robert_Crawford - 28.05.2011

Hey thanks mate ill talk to yah on msn


Re: Auto fire spawn system. - Robert_Crawford - 14.06.2011

Hey sorry, how would i make the fire into groups like 4 or five particle objects at one time?


Re: Auto fire spawn system. - The_J0ker - 17.06.2011

anyway to make it at different locations can you explain it more


Re: Auto fire spawn system. - The_J0ker - 26.06.2011

BUMP


Re: Auto fire spawn system. - Tommy_Mandaz - 26.06.2011

Just change the X,Y,Z to coords you want the fire to spawn in and you should be set, make sure to change the timer's name.