SA-MP Forums Archive
Whys my timer not working in my FilterScript? - 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: Whys my timer not working in my FilterScript? (/showthread.php?tid=177071)



Whys my timer not working in my FilterScript? - FluffyPawZ - 16.09.2010

I cant figure out why my timers not working?
Help!

Код:
#pragma tabsize 0
#include <a_samp>
#include <core>
#include <float>

#include "../include/gl_common.inc"

#define FILTERSCRIPT
#if defined FILTERSCRIPT

// PRESSED(keys)
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
	
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFFF



forward SendPlayerFormattedText(playerid, const str[], define);
forward Nos(playerid);
//------------------------------------------------------------------------------------------------------

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Nos FilterScript");
print("--------------------------------------\n");
return 1;
}
//------------------------------------------------------------------------------------------------------

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if (PRESSED(KEY_FIRE))
	{
		new
			vehicleid = GetPlayerVehicleID(playerid);
		if (vehicleid)
		{
			SetTimer("Nos", 2000, 0);//Nos Added After 1 Sec
		}
	}
	return 1;
}

public Nos(playerid)
{
 	new vehicleid = GetPlayerVehicleID(playerid);
  	SendPlayerFormattedText(playerid,"Nos Added",0);
  	AddVehicleComponent(vehicleid, 1010);//Nos
	return 1;
}

public SendPlayerFormattedText(playerid, const str[], define)
{
	new tmpbuf[256];
	format(tmpbuf, sizeof(tmpbuf), str, define);
	SendClientMessage(playerid, 0xFF004040, tmpbuf);
}

public OnFilterScriptExit()
{
print("Nos FilterScript Unloaded");
return 0;
}

#endif



Re: Whys my timer not working in my FilterScript? - cessil - 16.09.2010

if you want to send an id with a timer you need SetTimerEx


Re: Whys my timer not working in my FilterScript? - [HiC]TheKiller - 16.09.2010

As Cessil said, you need SetTimerEx, here is a example of that.

pawn Код:
SetTimer("Nos", 2000, false, "d", playerid);//Nos Added After 1 Sec
For more information visit https://sampwiki.blast.hk/wiki/SetTimerEx