Jump to content
News ticker
  • Bienvenue sur le nouveau forum VeryGames
  • Welcome to the new VeryGames forum
  • VeryNews

    [Partage] Script de dernier ct + son + espion


    Steven-NSNF

    Recommended Posts

    En faites, tant pis si le code est crade, pas optimisé, et vieux

     

    certains ont insistés

     

    #include <sdktools>
    #define MAX_FILE_LEN 256
    
    
    new bool:dct_sound_etat = false;
    
    
    new String:dct_sound[256];
    
    
    new Handle:g_dct_etat
    new Handle:g_dct_sound;
    new Handle:g_dct_centermsg;
    new Handle:g_dct_chatmsg;
    new Handle:g_dct_spy;
    
    
    
    
    
    
    public Plugin:myinfo = 
    {
       name = "*~ Plugin de dernier CT ~*",
       author = "Steven",
       description = "Modifie le GP lors du dernier ct",
       version = "1.0",
       url = "http://nsnf-clan.net/"
    }
    public OnMapStart()
    {
       GetConVarString(g_dct_sound, dct_sound, sizeof(dct_sound));
       if(!StrEqual(dct_sound, ""))
       {
           dct_sound_etat = true;
           PrecacheSound(dct_sound, true);
           decl String:g_sDownload[128];
           Format(g_sDownload, 128, "sound/%s",dct_sound);
           AddFileToDownloadsTable(g_sDownload);
       }
    }
    
    
    
    
    public OnPluginStart()
    {
       /* ++++++++++++++++++++++++++++++++++++++++ 
                       Hook des events
       ++++++++++++++++++++++++++++++++++++++++ */
    
       HookEvent("player_death", Event_PlayerDeath);
    
       /* ++++++++++++++++++++++++++++++++++++++++ 
                       Liste des variables
       ++++++++++++++++++++++++++++++++++++++++ */
    
       g_dct_etat = CreateConVar("sm_dct_etat", "1.0", "Mode activé (1), ou désactivé (0)", _, true, 0.0, true, 1.0);    
       g_dct_sound = CreateConVar("sm_dct_sound", "dct_default.mp3", "Musique/son à jouer lors du dernier ct (laisser vide si vous n'en souhaitez pas)", FCVAR_NONE);
       g_dct_centermsg = CreateConVar("sm_dct_centermsg", "1.0", "Affiche un message au centre de l ecran", _, true, 0.0, true, 1.0);    
       g_dct_chatmsg = CreateConVar("sm_dct_chatmsg", "1.0", "Affiche un message dans le chat", _, true, 0.0, true, 1.0);    
       g_dct_spy = CreateConVar("sm_dct_espion", "1.0", "Le dernier ct prend l'apparence d'un terro", _, true, 0.0, true, 1.0)
    
    
       /* ++++++++++++++++++++++++++++++++++++++++ 
                   Configuration du plugin
       ++++++++++++++++++++++++++++++++++++++++ */
    
       AutoExecConfig(true, "dernier-ct"); 
    }
    
    
    
    
    
    
    
    
    
    
    public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
    {
       new victim = GetClientOfUserId(GetEventInt(event, "userid"));
       if (GetClientTeam(victim) == 3 && GetConVarInt(g_dct_etat) > 0) 
       {
           // On compte le nombre de CT suite au deces involontaire d'un d'entre eux
           new CTs, only;
           for(new i=1; i <= GetMaxClients(); i++)
           {
               if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3)
               {
                   CTs++;
                   only = i;
               }
           }
    
           /* Il reste un seul ct vivant */
           if (CTs == 1)
           {
               if (GetConVarInt(g_dct_spy) > 0)
               {
                   decl String:buffer[PLATFORM_MAX_PATH];
                   for(new i=1; i <= GetMaxClients(); i++)
                   {
                       if ((IsClientInGame(i)) && (IsPlayerAlive(i)) && (GetClientTeam(i) == 2) )
                       {
                           GetClientModel(i,buffer,sizeof(buffer)); // on recupere le skin d'un terro aleatoirement
                           i = 999;
                       }
                   }
                   SetEntityModel(only, buffer); // on applique le skin au CT (si la feature espion est activee)
    
               }
               if (GetConVarInt(g_dct_centermsg) > 0) 
                   PrintCenterTextAll("==========> DERNIER CT <=========="); // on affiche le message au centre de l'ecran
               if (GetConVarInt(g_dct_chatmsg) > 0)
                   {
                       PrintToChatAll("\x03======== DERNIER CT ========");// On affiche le message dans le tchat
                       PrintToChatAll("\x03Le dernier CT peut tuer tout le monde");//bis ^^
                       if (GetConVarInt(g_dct_spy) > 0)
                               PrintToChatAll("\x03Le dernier CT est un ESPION!!!");//Le dernier ct est un espion, on l'annonce
                       PrintToChatAll("\x03======== DERNIER CT ========");//bis
                   }
               if (dct_sound_etat)
                   EmitSoundToAll(dct_sound, _, _, _, _, 0.9);//la musique pour le dct est activee, on la joue
           }
       }
    }
    

     

    have fun =)

    Link to comment
    Share on other sites

    Delachambre je pense que tu peux mais il faut modifier cette ligne :

     

    [font=monospace]    g_dct_sound = CreateConVar("sm_dct_sound", "dct_default.[u]mp3[/u]", "Musique/son à jouer lors du dernier ct (laisser vide si vous n'en souhaitez pas)", FCVAR_NONE);

     

    Tu remplaces mp3 en wav[/font]

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...