+rep Server Crash if i tape /stopbreach
#1

when i tape /breach it is doing the command normally but when i do /stopbreach it's crashing my server there is the code
PHP код:
CMD:breach(playeridparams[])
{
    if(
IsPlayerAdmin(playerid))
    {
        if (
GetPVarInt(playerid"BREACH") == 1) return SendClientMessage(playerid0xAA3333AA"[ERREUR]Il y a dйjа une brиche en cours!");
        
SendClientMessage(playerid0x0000BBAA"Vous avez bien lancez une brиche /stopbreach pour l'arrиter.");
        for(new 
0MAX_PLAYERSi++)
            {
                
PlayAudioStreamForPlayer(i"http://vignette2.wikia.nocookie.net/containmentbreach/images/c/cb/Intro3.ogg/revision/latest?cb=20130914185619");
                
halte(17);
                
PlayAudioStreamForPlayer(i"http://vignette4.wikia.nocookie.net/containmentbreach/images/2/22/Alarm2.ogg/revision/latest?cb=20130914185645");
                
halte(7);
                
PlayAudioStreamForPlayer(i"https://hydra-media.cursecdn.com/scpcb.gamepedia.com/f/f3/HCZ_Background.ogg");
                
halte(46);
                
StopAudioStreamForPlayer(i);
            }
    }
    else
    {
        
SendClientMessage(playerid0xAA3333AA,"[ERREUR]Vous devez кtre administrateur.");
        return 
1;
    }
    return 
1;
}
CMD:stopbreach(playeridparams[])
{
    if(
IsPlayerAdmin(playerid))
        {
            if (
GetPVarInt(playerid"BREACH") == 0) return SendClientMessage(playerid0xAA3333AA"[ERREUR]Vous n'avez pas dйmarer de brиche !");
            
SendClientMessage(playerid0x0000BBAA"Vous avez bien arreter la brиche.");
            for(new 
0MAX_PLAYERSi++)
                {
                    
PlayAudioStreamForPlayer(i"http://k003.kiwi6.com/hotlink/khpcjp7zmg/682battle.ogg");
                    
halte(54);
                    
PlayAudioStreamForPlayer(i"http://k003.kiwi6.com/hotlink/0k00bwkd58/Alarm3.ogg");
                    
halte(5);
                    
PlayAudioStreamForPlayer(i"http://k003.kiwi6.com/hotlink/jygnbu8r2i/nuke1.ogg");
                    
halte(7);
                    
StopAudioStreamForPlayer(i);
                }
        }
        else
        {
            
SendClientMessage(playerid0xAA3333AA,"[ERREUR]Vous devez кtre administrateur.");
            return 
1;
        }
    return 
1;

and that it's the same :
PHP код:
CMD:scp106(playeridparams[])
{
    if (
GetPVarInt(playerid"SCP106") == 1) return SendClientMessage(playerid0xAA3333AA"[ERREUR]Tu est dйjа en SCP 106!");
// later SetPlayerPos(playerid, 0.0, 0.0, 0.0);
    
SetPlayerSkin(playerid160);
    for(new 
0MAX_PLAYERSi++)
    {
        
PlayAudioStreamForPlayer(i"http://k003.kiwi6.com/hotlink/pea0l5s90k/SCP_Containment_Breach_-_SCP-106_Theme_Bump_In_The_Night.ogg");
        
halte(123);
        
PlayAudioStreamForPlayer(i"http://k003.kiwi6.com/hotlink/pea0l5s90k/SCP_Containment_Breach_-_SCP-106_Theme_Bump_In_The_Night.ogg");
        
halte(123);
        
StopAudioStreamForPlayer(i);
    }
    return 
1;
}
CMD:stopscp106(playeridparams[])
{
    if (
GetPVarInt(playerid"SCP106") == 0) return SendClientMessage(playerid0xAA3333AA"[ERREUR]Tu n'est pas en SCP 106!");
    for(new 
0MAX_PLAYERSi++)
    {
        
StopAudioStreamForPlayer(i);
    }
    return 
1;

+rep if you see the what does it crash
edit : oh i have forget that :
PHP код:
halte(seconds)
{
    new 
_nouveauTemps[4], _ancienTemps[4];
    
gettime(_ancienTemps[0], _ancienTemps[1],_ancienTemps[2]);
    
_ancienTemps[3] = _ancienTemps[2] + (_ancienTemps[1] * 60) + (_ancienTemps[0] * 600);
    while(
_nouveauTemps[3] != (_ancienTemps[3] + seconds))
    {
        
gettime(_nouveauTemps[0], _nouveauTemps[1], _nouveauTemps[2]);
        
_nouveauTemps[3] = _nouveauTemps[2] + (_nouveauTemps[1] * 60) + (_nouveauTemps[0] * 600);
    }

Reply
#2

Do you know what "halte" meant to do? It's like "sleep" function that halts the server and when executing the command, the main thread stops for 2 minutes and 3 seconds. That means that the server MUST wait that long without updating anything. Remove it as soon as possible from your scripts.
Reply
#3

yeah how replace it ?
Reply
#4

Is it about changing the audio after those 2 minutes? Just set a timer (not repeated to be called) and in its callback, loop through the players and play the next song or whatever it is. Then do the same for stopping the audio stream.
Reply
#5

i have set timer but it didn't work at all
PHP код:
CMD:breach(playeridparams[])
{
    if(
IsPlayerAdmin(playerid))
    {
        if (
GetPVarInt(playerid"BREACH") == 1) return SendClientMessage(playerid0xAA3333AA"[ERREUR]Il y a dйjа une brиche en cours!");
        
SendClientMessage(playerid0x0000BBAA"Vous avez bien lancez une brиche /stopbreach pour l'arrиter.");
        for(new 
0MAX_PLAYERSi++)
            {
                
PlayAudioStreamForPlayer(i"http://vignette2.wikia.nocookie.net/containmentbreach/images/c/cb/Intro3.ogg/revision/latest?cb=20130914185619");
                
SetTimer("audio"17000false);
                
PlayAudioStreamForPlayer(i"http://vignette4.wikia.nocookie.net/containmentbreach/images/2/22/Alarm2.ogg/revision/latest?cb=20130914185645");
                
PlayAudioStreamForPlayer(i"https://hydra-media.cursecdn.com/scpcb.gamepedia.com/f/f3/HCZ_Background.ogg");
                
StopAudioStreamForPlayer(i);
            }
    }
    else
    {
        
SendClientMessage(playerid0xAA3333AA,"[ERREUR]Vous devez кtre administrateur.");
        return 
1;
    }
    return 
1;

Reply
#6

You can do it by this way:
PHP код:
SetTimerEx("Aduioz"170000"di"playerid0); // set the timer for player with audio id 0 
PHP код:
forward public Aduioz(playeridaudioz);
public 
Aduioz(playeridaudioz) {
   switch(
audioz) { // switch audio idz
      
case 0: { // check if id is 0
         
PlayAudioStreamForPlayer(playerid"http://vignette4.wikia.nocookie.net/containmentbreach/images/2/22/Alarm2.ogg/revision/latest?cb=20130914185645"); // player song 1
         
SetTimerEx("Aduioz"170000"di"playerid1); // set timer to play song 2
      
}
      case 
1: { // check if song id is 1
         
PlayAudioStreamForPlayer(playerid"https://hydra-media.cursecdn.com/scpcb.gamepedia.com/f/f3/HCZ_Background.ogg"); // player song 2
         
SetTimerEx("Aduioz"170000"di"playerid175566); // set timer to stop song
      
}
      case 
175566,default: // check if id match with stop audio id
         
StopAudioStreamForPlayer(playerid); // stop song for player
      
}
   }

Reply
#7

i want do it in the /breach
Reply
#8

anyone please ?
Reply
#9

Its impossible to tape that command and will never be.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)