Aller au contenu
News ticker
  • Bienvenue sur le nouveau forum VeryGames
  • Welcome to the new VeryGames forum
  • VeryNews

    Probleme de emitsoundtoall


    Skuzy

    Messages recommandés

    je vous explique le probleme : le son se télecharge bien mais lors du lancement du son rien ne se passe :/

    voici le code :

    
    #include <sourcemod>
    #include <sdktools>
    #include <morecolors>
    #include <sdktools_sound>
    
    
    #pragma semicolon 1
    #define MAX_FILE_LEN 80
    new Handle:g_CvarSoundName = INVALID_HANDLE;
    new String:g_soundName[MAX_FILE_LEN];
    
    
    
    
    public OnPluginStart()
    {
    
       g_CvarSoundName = CreateConVar("sm_join_sound", "star/starz.mp3", "The sound to play");
    }
    
    
    public OnMapStart()
    {
       AddFileToDownloadsTable("star/starz.mp3");
       PrecacheSound("star/starz.mp3");
    }
    
    
    public OnClientPutInServer(client)
    {
       new String:steamID[32];
       GetClientAuthString(client, steamID, sizeof(steamID));
       if(StrEqual(steamID, "STEAM_0:1:9924530"))
       {
       EmitSoundToAll(g_soundName, client, SNDCHAN_AUTO, SNDLEVEL_MINIBIKE);
       CPrintToChatAll("Phrase d'accueil");    
       }else{
    
       }
    }
    
    
    public OnConfigsExecuted()
    {
       GetConVarString(g_CvarSoundName, g_soundName, MAX_FILE_LEN);
       decl String:buffer[MAX_FILE_LEN];
       PrecacheSound(g_soundName, true);
       Format(buffer, sizeof(buffer), "sound/%s", g_soundName);
       AddFileToDownloadsTable(buffer);
    }
    
    
    

     

    si quelqu'un vois l'erreur n'hesité pas :)

    Lien vers le commentaire
    Partager sur d’autres sites

    mdr je pense que tu n'as pas compris le code ... bref je t'explique le plugin fait que lorsque le steam id que jai renseigner se connecte ca envoie la phrase sur le serveur ainsi qu'une musique

    et non il n'y a pas de commande

     

    Si je n'ai pas compris le code c'est parce que je ne connais pas le langage, c'est si difficile que ça à corréler ? Bref, si il ne marche pas comme tu veut c'est que tu l'as mal fait, va sur alliedmodders pour demander de l'aide à ce niveau là.

    Lien vers le commentaire
    Partager sur d’autres sites

    public OnMapStart()
    {
       AddFileToDownloadsTable("star/starz.mp3");
       PrecacheSound("star/starz.mp3");
    }
    

     

    Te sert à rien car tu pré-cache le son et tu l'ajoute aux téléchargement dans le OnConfigsExecuted.

     

    Je doute que ça fonctionne mais essaye ça, j'ai lancé un AutoExecConfig.

     

    #pragma semicolon 1
    
    #include <sourcemod>
    #include <sdktools>
    #include <morecolors>
    #include <sdktools_sound>
    
    #define MAX_FILE_LEN 80
    
    new Handle:g_CvarSoundName = INVALID_HANDLE;
    new String:g_soundName[MAX_FILE_LEN];
    
    public Plugin:myinfo = 
    {
       name = "Welcome Sound",
       author = "R-Hehl (Modif Skuzy)",
       description = "Plays Welcome Sound to connecting Players",
       version = PLUGIN_VERSION,
       url = "http://www.compactaim.de/"
    };
    
    public OnPluginStart()
    {
       g_CvarSoundName = CreateConVar("sm_join_sound", "star/starz.mp3", "The sound to play");
    
       AutoExecConfig(true, "join_sound");
    }
    
    public OnConfigsExecuted()
    {
       GetConVarString(g_CvarSoundName, g_soundName, MAX_FILE_LEN);
       decl String:buffer[MAX_FILE_LEN];
    
       PrecacheSound(g_soundName, true);
    
       Format(buffer, sizeof(buffer), "sound/%s", g_soundName);
       AddFileToDownloadsTable(buffer);
    }
    
    public OnClientPutInServer(client)
    {
       decl String:sSteamID[32];
       GetClientAuthString(client, sSteamID, sizeof(sSteamID));
       if(StrEqual(sSteamID, "STEAM_0:1:9924530"))
       {
           EmitSoundToAll(g_soundName, client, SNDCHAN_AUTO, SNDLEVEL_MINIBIKE);
           CPrintToChatAll("{cyan}Phrase d'accueil");    
       }
    }
    

     

    Si ça fonctionne pas fait un test, avec une commande tu lance le son, si il se lance pas tu devrais savoir d'où viens l'erreur, je te laisse réfléchir ^^

     

    @Aspirine :

    Tu as raison ;)

     

    Kriax.

    Lien vers le commentaire
    Partager sur d’autres sites

    public OnMapStart()
    {
       AddFileToDownloadsTable("star/starz.mp3");
       PrecacheSound("star/starz.mp3");
    }
    

     

    Te sert à rien car tu pré-cache le son et tu l'ajoute aux téléchargement dans le OnConfigsExecuted.

     

    Je doute que ça fonctionne mais essaye ça, j'ai lancé un AutoExecConfig.

     

    #pragma semicolon 1
    
    #include <sourcemod>
    #include <sdktools>
    #include <morecolors>
    #include <sdktools_sound>
    
    #define MAX_FILE_LEN 80
    
    new Handle:g_CvarSoundName = INVALID_HANDLE;
    new String:g_soundName[MAX_FILE_LEN];
    
    public Plugin:myinfo = 
    {
       name = "Welcome Sound",
       author = "R-Hehl (Modif Skuzy)",
       description = "Plays Welcome Sound to connecting Players",
       version = PLUGIN_VERSION,
       url = "http://www.compactaim.de/"
    };
    
    public OnPluginStart()
    {
       g_CvarSoundName = CreateConVar("sm_join_sound", "star/starz.mp3", "The sound to play");
    
       AutoExecConfig(true, "join_sound");
    }
    
    public OnConfigsExecuted()
    {
       GetConVarString(g_CvarSoundName, g_soundName, MAX_FILE_LEN);
       decl String:buffer[MAX_FILE_LEN];
    
       PrecacheSound(g_soundName, true);
    
       Format(buffer, sizeof(buffer), "sound/%s", g_soundName);
       AddFileToDownloadsTable(buffer);
    }
    
    public OnClientPutInServer(client)
    {
       decl String:sSteamID[32];
       GetClientAuthString(client, sSteamID, sizeof(sSteamID));
       if(StrEqual(sSteamID, "STEAM_0:1:9924530"))
       {
           EmitSoundToAll(g_soundName, client, SNDCHAN_AUTO, SNDLEVEL_MINIBIKE);
           CPrintToChatAll("{cyan}Phrase d'accueil");    
       }
    }
    

     

    Si ça fonctionne pas fait un test, avec une commande tu lance le son, si il se lance pas tu devrais savoir d'où viens l'erreur, je te laisse réfléchir ^^

     

    @Aspirine :

    Tu as raison ;)

     

    Kriax.

    Comme dit precedamment le probleme été deja regler mais merci qd meme

    Lien vers le commentaire
    Partager sur d’autres sites

    Rejoindre la conversation

    Vous pouvez publier maintenant et vous inscrire plus tard. Si vous avez un compte, connectez-vous maintenant pour publier avec votre compte.

    Invité
    Répondre à ce sujet…

    ×   Collé en tant que texte enrichi.   Coller en tant que texte brut à la place

      Seulement 75 émoticônes maximum sont autorisées.

    ×   Votre lien a été automatiquement intégré.   Afficher plutôt comme un lien

    ×   Votre contenu précédent a été rétabli.   Vider l’éditeur

    ×   Vous ne pouvez pas directement coller des images. Envoyez-les depuis votre ordinateur ou insérez-les depuis une URL.

    ×
    ×
    • Créer...