SA-MP Forums Archive
[Tutorial] How to make a fire script - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to make a fire script (/showthread.php?tid=367426)



How to make a fire script - calzo2011 - 09.08.2012

Hey guys,

Toady in this tutorial you will learn how to make your own custom fire script, now this is my first ever tutorial so I won't be that good at it. This is a tutorial on how to use the include from this link.

Okay lets start...

Make sure to put at the top of you filterscript the include, if you do not have this include you can get it from here.
Код:
#include <fire2>
Now to create a hand made one and not ones like in that include, so before we do anything make sure to add these codes to your OnGameModeInit() & OnPlayerUpdate(playerid).
OnGameModeInit
Код:
public OnGameModeInit()
{
    f_init();
	return 1;
}
OnPlayerUpdate(playerid)
Код:
public OnPlayerUpdate(playerid)
{
    f_OnPlayerUpdate(playerid);
	return 1;
}
Now to create random fires we will use some timers for this so then you do not have to use commands, so first we need to forward the timer so insert this code some where in your script:
Код:
forward fire1();
Now to make the timer, so put this code in the OnGamemodeInit, make sure to add this under the f_init():
Код:
SetTimer("fire1", 19200, false);
Now to make the fire spawns (NOTE: this fire spawns infront of LSPD):
Код:
public fire1()
{
    AddFire(1530.28, -1691.66, 12.97, 100);
    AddFire(1535.53, -1676.05, 12.97, 100);
    AddFire(1528.93, -1669.97, 12.97, 100);
    AddFire(1532.94, -1662.82, 12.97, 100);
    AddFire(1536.51, -1668.26, 12.97, 100);
    AddFire(1529.57, -1681.05, 12.97, 100);
    AddFire(1526.92, -1658.31, 12.97, 100);
    AddFire(1532.86, -1657.56, 12.97, 100);
}
This is the code for the fire --> AddFire(Float:X, Float:Y, Float:Z, Firehealth);

And all that coding should look like this:
Код:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Fire script by calzo100
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#include <a_samp>
#include <fire2>
#if defined FILTERSCRIPT

forward fire1();

public OnFilterScriptInit()
{
	print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
	print("		   Fire Script by calzo100		   ");
	print("			      Has loaded!              ");
	print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}
#endif

public OnGameModeInit()
{
	// fire init
    f_init();
    
    // Timers
    SetTimer("fire1", 19200, false);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
    f_OnPlayerUpdate(playerid);
	return 1;
}

// All the fires
public fire1()
{
    AddFire(1530.28, -1691.66, 12.97, 100);
    AddFire(1535.53, -1676.05, 12.97, 100);
    AddFire(1528.93, -1669.97, 12.97, 100);
    AddFire(1532.94, -1662.82, 12.97, 100);
    AddFire(1536.51, -1668.26, 12.97, 100);
    AddFire(1529.57, -1681.05, 12.97, 100);
    AddFire(1526.92, -1658.31, 12.97, 100);
    AddFire(1532.86, -1657.56, 12.97, 100);
}
I hope this has helped you, and enjoy your fire script


Re: How to make a fire script - TaLhA XIV - 10.08.2012

What does this do?Can you post ss please.


Re: How to make a fire script - Roddan - 11.08.2012

It adds a campfire i think.


Re: How to make a fire script - Sinner - 11.08.2012

U just say where the code goes? This is not a tutorial!


Re: How to make a fire script - phillip875 - 11.08.2012

Add an explanation to what is doing what.


Re: How to make a fire script - thefatshizms - 11.08.2012

Doesnt really explain but then again its alright for noobs if they want it 5/10 and also use the [ pawn ] [/ pawn] tags please