Timer Problem
#1

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

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]);
Reply
#3

It don't works
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)