my timer doesnt work :s
#1

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;
    }
Reply
#2

Where's the timer itself?
Reply
#3

It was already placed in the script, i think.

Does that code look alright though?
Reply
#4

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

And how to stop the anim when it finishes?
Reply
#6

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.
Reply
#7

[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]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)