Whys my timer not working in my FilterScript?
#1

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)