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=431351)
Timer Problem -
klaus1n3 - 17.04.2013
Hi,
my problem is, that the Event don't stop. So the last timer (Minigunestop) don't get triggert or the noswitchgun timer don't get destroied. Hope you can help me, here the code.
PHP код:
forward Minigunevent(playerid);
forward noswitchgun(playerid);
forward Minigunestop(playerid);
PHP код:
public Minigunevent(playerid)
{
SendClientMessage(playerid,Grьn,"Minigun-Event wurde gestartet.");
GameTextForAll("~g~MINIGUN-EVENT!",3500,3);
noswitchgunminitimer = SetTimer("noswitchgun",1,true);
SetTimer("Minigunestop",1000*5,false);
return 1;
}
public noswitchgun(playerid)
{
GivePlayerWeapon(playerid,38,99999);
return 1;
}
public Minigunestop(playerid)
{
KillTimer(noswitchgunminitimer);
RemovePlayerWeapon(playerid,38);
GameTextForAll("~g~Das Event wurde beendet",3000,3);
return 1;
}
PHP код:
public OnGameModeInit()
{
SetTimer("Minigunevent",1000*10,true);
Re: Timer Problem -
HurtLocker - 17.04.2013
My question is, whats the point in giving every 1 milisecond a specific weapon? I think that in this way, the player that this timer effects, won't be ever able to aim. Anyway, define globally new noswitchgunminitimer[MAX_PLAYERS] and then
pawn Код:
noswitchgunminitimer[playerid] = SetTimer("noswitchgun",1,true);
KillTimer(noswitchgunminitimer[playerid]);
AW: Timer Problem -
klaus1n3 - 17.04.2013
It don't works
Re: Timer Problem -
HurtLocker - 17.04.2013
Das ist alles ich kann machen:
pawn Код:
forward Minigunevent(playerid);
//forward noswitchgun(playerid); //dieser Stoppuhr ist nutzlos, losch es
forward Minigunestop(playerid);
public Minigunevent(playerid)
{
SendClientMessage(playerid,Gru"n,"Minigun-Event wurde gestartet.");
GameTextForAll("~g~MINIGUN-EVENT!",3500,3);
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i)) //wenn du "public Minigunevent" aktivierst
{ //jeder Spieler bekommt ein Minigun
GivePlayerWeapon(i),38,99999);
}
}
SetTimer("Minigunestop",5*1000,false); //Hier kannst du die Zeit verandern,
return 1; //zeit ist in miliseconds vermesst
}
public Minigunestop(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i)) //wenn du "public Minigunevent" aktivierst
{ //jeder Spieler bekommt ein Minigun
ResetPlayerWeapon(i,38); //ich hab "Remove" zu "Reset" verandert
}
}
GameTextForAll("~g~Das Event wurde beendet",3000,3);
return 1;
}