Random Fires script = fail.
#1

Under OnGameModeInit
pawn Код:
// Fire Explosions
    SetTimer("OnBurgerExplosion", 1000000, true);
for the other timers, and explosions
pawn Код:
public OnBurgerExplosion(playerid)
{
    format(szMessage, sizeof(szMessage), "DISPATCH: We need dispatch at Main Street, Burger Shot. Flames are blazing, careful!");
    SendToGroupType(4, COLOR_RED, szMessage);
    SendToGroupType(1, COLOR_RED, szMessage);
    OnBurgerExplosion98 = SetTimer("OnBurgerExplosion2", 3000, true);
    return 1;
}

public OnBurgerExplosion2(playerid)
{
    CreateExplosion(-174.3882,1065.7659,19.7422, 2, 50.0);
    CreateExplosion(-169.6261,1088.7214,19.7422, 2, 50.0);
    OnBurgerExplosionStop99 = SetTimer("OnBurgerExplosionStop", 300000, true);
    return 1;
}

public OnBurgerExplosionStop(playerid)
{
    KillTimer(OnBurgerExplosion98);
    KillTimer(OnBurgerExplosionStop99);
    return 1;
}
See, it all works the first time. but the times after it doesn't... Anyone have any ideas on how to fix it, I have a feeling that KillTimer is affecting it.. But idk

And if you help me, how would I add MORE and MORE random fires you know?
Reply
#2

BUMP!
Reply
#3

Hmm, can you guys please help?
Reply
#4

There was no need to have so many public functions.
The only one you need is this one:
pawn Код:
public OnBurgerExplosion(playerid)
{
    static explode;
    if(explode == 0) {
        format(szMessage, sizeof(szMessage), "DISPATCH: We need dispatch at Main Street, Burger Shot. Flames are blazing, careful!");
        SendToGroupType(4, COLOR_RED, szMessage);
        SendToGroupType(1, COLOR_RED, szMessage);
    }
    explode++;
    if(explode < 100)
        SetTimer("OnBurgerExplosion", 3000, false);
    else
        explode = 0;
    CreateExplosion(-174.3882,1065.7659,19.7422, 2, 50.0);
    CreateExplosion(-169.6261,1088.7214,19.7422, 2, 50.0);
    return 1;
}
Reply
#5

Thanks, so I don't need OnBurgerExplosionStop or OnBurgerExplosion2?
Reply
#6

No, you only need the one that I posted.
Reply
#7

And this will keep going every time the timer activates basically?
Reply
#8

Yeah, this will loop forever, just make sure to keep the timer under OnGameModeInit.
pawn Код:
SetTimer("OnBurgerExplosion", 1000000, true);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)