Ohoy, Need help with SetTimerEx or SetTimer -
Goobiiify - 25.10.2009
Hello, I working on doing a firework script for Halloween but needs some help with Timers. I'm a newbie in scripting and would be really thankful if someone could give me a example.
It's going to send flares every 2 seconds and don't really know how to do..
Re: Ohoy, Need help with SetTimerEx or SetTimer -
Battleskull - 25.10.2009
forward fireworks()
public OnGameModeInit()
{
SetTimer("fireworks",2000,1);//2 second looping timer
return 1;
}
fireworks()
{
//what happens when timer goes off
flare1 = CreateObject(354,X,Y,Z,0,0,0) //set X , Y, Z to cordinates you want
MoveObject(flare1,X,Y,Z+30,speed); //set speed to speed of the fireworks going up
}
Re: Ohoy, Need help with SetTimerEx or SetTimer -
JonyAvati - 25.10.2009
Make a callback with a timer
pawn Код:
forward Fireworks(playerid);
public Fireworks(playerid)
{
// The content (Like SendClientMessage, etc)
return 1;
}
// In a command or where you want the timer to start
SetTimerEx("Fireworks",100,false, "d", playerid); // 100 = The time that will take to load the callback -- false = The timer wont repeat (true for repeating) playerid = Just dont change this.
If I wasnt busy I would make you the code, but i'm busy now
Re: Ohoy, Need help with SetTimerEx or SetTimer -
Goobiiify - 25.10.2009
hehe...
pawn Код:
if (strcmp("/firework", cmdtext, true) == 0)
{
SetTimer(fireworks,2000,1);
SendClientMessage(playerid,YELLOW,"Firework activated");
return 1;
}
pawn Код:
public fireworks()
{
new flare1;
new Float: X, Float: Y, Float: Z;
flare1 = CreateObject(354,X,Y,Z,0,0,0); //set X , Y, Z to cordinates you want
MoveObject(flare1,X,Y,Z+30,20); //set speed to speed of the fireworks going up
}
: error 076: syntax error in the expression, or invalid function call
Re: Ohoy, Need help with SetTimerEx or SetTimer -
member - 25.10.2009
That syntax error is most probably this:
pawn Код:
SetTimer(fireworks,2000,1);
change it to:
pawn Код:
SetTimer("fireworks",2000,1);
Re: Ohoy, Need help with SetTimerEx or SetTimer -
Goobiiify - 25.10.2009
Quote:
Originally Posted by [B2K
Hustler ]
That syntax error is most probably this:
pawn Код:
SetTimer(fireworks,2000,1);
change it to:
pawn Код:
SetTimer("fireworks",2000,1);
|
It worked, No errors, Now I'm going to see how it is in-game D;
Re: Ohoy, Need help with SetTimerEx or SetTimer -
Goobiiify - 26.10.2009
I got a other issues now, the timer seems. It's goes out flares 30m up in the sky where ever i goes. :/