SA-MP Forums Archive
timer dont work - 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: timer dont work (/showthread.php?tid=68879)



timer dont work - Schock - 14.03.2009

hey guys ...
in my code a timer wont work can someone help me?
pawn Код:
//on top
forward GatesOpen();
forward GatesClose();

new side;
new fronta;
new frontb;
new frontc;

//public OnFilterScriptInit()
side = CreateObject(975, -1734.655151, 28.273335, 4.204377, 0.0000, 0.0000, 90.0000);
fronta = CreateObject(980, -1675.952881, 9.499218, 5.328079, 0.0000, 0.0000, 135.0000);
frontb = CreateObject(980, -1667.801880, 1.350600, 5.328079, 0.0000, 0.0000, 135.0000);
frontc = CreateObject(980, -1659.689209, -6.770653, 5.328079, 0.0000, 0.0000, 135.0000);

//a function
public ...(playerid)
{
    new string[128];
    new pname[24];
    GetPlayerName(playerid, pname, sizeof(pname));
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 451)
    {
        ...// my function
        SetTimer("GatesClose",3000,0);
        SetTimer("...", 120000, 0); // ... means the name of my functions (i dont want tell the name of this funtion)
    }
    return 1;
}

//the SetTimer("...", 120000, 0);
public ...(playerid) // ... only because i dont want tell his name
{
    SetPlayerCheckpoint(playerid, -1539.262817, 133.987518, 2.613937, 8);
    SendClientMessageToAll(YELLOW, "..."); // this text will displayed
    SetTimer("GatesOpen",8000,0); // this function will called
    return 1;
}

// called function SetTimer("GatesOpen",8000,0);
public GatesOpen()
{
    SendClientMessageToAll(RED,"hi ho"); // not displayed ( only to test if its work)
    MoveObject(side,-1734.655518, 37.611330, 4.204377, 3); // not work
    MoveObject(fronta,-1675.952881, 9.499218, 5.328060, 3); // not work
    MoveObject(frontb,-1667.801880, 1.350600, 5.328060, 3); // not work
    MoveObject(frontc,-1659.689209, -6.770653, 5.328060, 3); // not work
    return 0;
}
Someone know why its wont work?


Re: timer dont work - Weirdosport - 14.03.2009

You have 3 different functions there that COULD be operated by a timer, but you have no timer that tells them to start.

Also two of the functions are called "..."

And there is no function called "GatesClosed", despite the fact you try to start it.


Re: timer dont work - Schock - 14.03.2009

the funtion GatesClose i havnt posted because my problem is the
pawn Код:
SetTimer("GatesOpen",8000,0);
that wont call the function
pawn Код:
public GatesOpen()
i need help to find out why he dont start "GatesOpen"


Re: timer dont work - Weirdosport - 14.03.2009

Try this instead:

pawn Код:
SetTimer("GatesOpen",8000,false);



Re: timer dont work - Schock - 14.03.2009

hehe false is the same like 0
its dont work


Re: timer dont work - Weirdosport - 14.03.2009

I find my timers work with false and not with 0.