SA-MP Forums Archive
Timer problem - 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)
+--- Thread: Timer problem (/showthread.php?tid=483736)



Timer problem - rocky2500 - 27.12.2013

Hi all, I have a problema with a timer, when I start mi server on Windows the timer run, but when I upload the script to the Linux server the timer not work, here is the code. Can you help me please?


Quote:

#include <a_samp>
#include <streamer>

new nav, rep;
#define TIEMPO 74000


public OnFilterScriptInit()
{
nav = CreateDynamicRectangle(1439.881713, -1725.621459, 1511.881713, -1613.621459, -1, -1, -1);
return 1;
}

public OnPlayerEnterDynamicArea(playerid, areaid)
{
if(areaid == nav)
{
PlayAudioStreamForPlayer(playerid,"https://dl.dropboxusercontent.com/u/63921548/Navidad.mp3");
rep = SetTimer("repetir", TIEMPO, true);
}
return 1;
}

public OnPlayerLeaveDynamicArea(playerid, areaid)
{
if(areaid == nav)
{
StopAudioStreamForPlayer(playerid);
KillTimer(rep);
}
return 1;
}


forward repetir(playerid);
public repetir(playerid)
{
PlayAudioStreamForPlayer(playerid,"https://dl.dropboxusercontent.com/u/63921548/Navidad.mp3");
}




Re: Tmer problem - Jefff - 27.12.2013

https://sampwiki.blast.hk/wiki/SetTimerEx


Re: Timer problem - rocky2500 - 27.12.2013

I already did, but when I leave dinamic area the music keeps repeating.


Re: Timer problem - Jefff - 27.12.2013

You must use array for every single player

Top
pawn Код:
new rep[MAX_PLAYERS];
Enter
pawn Код:
KillTimer(rep[playerid]);
rep[playerid] = SetTimerEx(...
Leave
pawn Код:
KillTimer(rep[playerid]);



Re: Timer problem - rocky2500 - 27.12.2013

Perfect!, it works!, thanks man