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



my timer doesnt work :s - |CrippinBloodDrippin| - 05.04.2009

Hello i came across this script after a friend helped me make it because my internet is fucked so i cant DL pawno or anything so im trying to make this work because it aint workin

What i want it do is, When the timer ends the anim ends..


pawn Код:
forward AnimTimer();

new gPlayerUsingLoopingAnim[MAX_PLAYERS];

LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
  gPlayerUsingLoopingAnim[playerid] = 1;
  ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
}

main()
{
    print("\n----------------------------------");
    print(" bla bla.");
    print("----------------------------------\n");
}

public OnGameModeInit()
{
    SetTimer("Anim timer.", 5000, 1);
    return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
    if (strcmp("/blabla",cmdtext,true) == 0)
    {
    SetTimer("Anim timer.", 50,1);
    LoopingAnim(playerid,"ped", "ARRESTgun", 4.0, 0, 1, 1, 1, -1);
    return 1;
    }
    return 1;
    }



Re: my timer doesnt work :s - MenaceX^ - 05.04.2009

Where's the timer itself?


Re: my timer doesnt work :s - |CrippinBloodDrippin| - 05.04.2009

It was already placed in the script, i think.

Does that code look alright though?


Re: my timer doesnt work :s - Bardokas - 05.04.2009

You should call SetTimer("AnimTimer", 5000, 1);
Here is example: https://sampwiki.blast.hk/wiki/SetTimer


Re: my timer doesnt work :s - |CrippinBloodDrippin| - 05.04.2009

And how to stop the anim when it finishes?


Re: my timer doesnt work :s - MenaceX^ - 05.04.2009

Quote:
Originally Posted by Bardokas
You should call SetTimer("AnimTimer", 5000, 1);
Here is example: https://sampwiki.blast.hk/wiki/SetTimer
Why are you saying so?



You don't even have a timer.. I mean to the public itself.


Re: my timer doesnt work :s - Bardokas - 05.04.2009

[code=pawn]new gPlayerUsingLoopingAnim[MAX_PLAYERS];
LoopingAnim(playerid,animlib[],animname[], Float:Speed, looping, lockx, locky, lockz, lp)
{
gPlayerUsingLoopingAnim[playerid] = 1;
ApplyAnimation(playerid, animlib, animname, Speed, looping, lockx, locky, lockz, lp);
}

main()
{
print("\n----------------------------------");
print(" bla bla.");
print("----------------------------------\n");
}

public OnGameModeInit()
{
return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
if (strcmp("/blabla",cmdtext,true) == 0)
{
LoopingAnim(playerid,"ped", "ARRESTgun", 4.0, 0, 1, 1, 1, -1);
SetTimerEx("StopAnim",5*1000,0,"i",playerid); //stop animation after 5 seconds
return 1;
}
return 1;
}

forward StopAnim(playerid);
public StopAnim(playerid){
ClearAnimations(playerid);
}[/code]