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

    [PARTAGE] Addons RP - Montre meurtre flag Z


    xyellowhdx

    Recommended Posts

    Salut, je vous partage un plugin qui montre qui a tué qui, car comme vous le savez, sur le plugin RP l'affichage des kills a été désactivé, et bien la, pour les admins avec le flag ROOT (z), et bien ils auront un message,

    exemple

    [CSS-RP] Yellow a tué Yellow2

    [CSS-RP] Yellow s'est suicidé.

     

    Voila, le code

    #include <sourcemod>
    #include <morecolors>
    
    public Plugin:myinfo =
    {
       name = "RP - Kills",
       author = " A definir",
       description    = "A definir",
       version    = "1.0",
       url    = "A definir"
    };
    
    public OnPluginStart()
    {
       PrintToServer("---------- [CSS-RP] Affichage des meurtres correctement effectué ----------");
       HookEvent("player_death", Event_PlayerDeath);
    }
    
    public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
    {
       decl String:killer_name[100];
       decl String:victim_name[100];
    
       new killer = GetClientOfUserId(GetEventInt(event, "attacker"));
       new victim = GetClientOfUserId(GetEventInt(event, "userid"));
    
       GetClientName(killer, killer_name, sizeof(killer_name));
       GetClientName(victim, victim_name, sizeof(victim_name));
    
       for(new i = 1; i < MaxClients; i++)
       {
           if(CheckCommandAccess(i, "sm_admin", ADMFLAG_ROOT,true) && IsValidClient(i))
           {
               if(killer == victim)
               {
                   CPrintToChat(i, "{white}[CSS-RP]{default} %s s'est {fullred}suicidé", victim_name);
                   PrintToConsole(i, "[CSS-RP] %s s'est suicidé", victim_name);
               }
               else
               {
                   CPrintToChat(i, "{white}[CSS-RP]{default} %s a tué %s", killer_name, victim_name);
                   PrintToConsole(i, "[CSS-RP] %s a tué %s !", killer_name, victim_name);
               }
           }
       }
    
       return Plugin_Continue
    }
    
    stock bool:IsValidClient(client)
    {
       if(client <= 0 ) return false;
       if(client > MaxClients) return false;
       if(!IsClientConnected(client)) return false;
       return IsClientInGame(client);
    }
    
    

     

    Cadeau.

     

    Morecolor est nécessaire a la compilation

    Link to comment
    Share on other sites

    Utile ;)

     

    Tu peut optimisé ton code comme ceci :

     

    #include <sourcemod>
    #include <morecolors>
    
    public Plugin:myinfo =
    {
       name = "RP - Kills",
       author = "A definir",
       description    = "A definir",
       version    = "1.0",
       url    = "A definir"
    };
    
    public OnPluginStart()
    {
       PrintToServer("---------- [CSS-RP] Affichage des meurtres correctement effectué ----------");
       HookEvent("player_death", Event_PlayerDeath);
    }
    
    public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
    {
       new killer = GetClientOfUserId(GetEventInt(event, "attacker"));
       new victim = GetClientOfUserId(GetEventInt(event, "userid"));
    
       for(new i = 1; i < MaxClients; i++)
       {
           if(IsValidClient(i) && GetUserFlagBits(client) & ADMFLAG_ROOT)
           {
               if(killer == victim)
               {
                   CPrintToChat(i, "{white}[CSS-RP]{default} %N s'est {fullred}suicidé", victim);
                   PrintToConsole(i, "[CSS-RP] %N s'est suicidé", victim);
               }
               else
               {
                   CPrintToChat(i, "{white}[CSS-RP]{default} %N a tué %N", killer, victim);
                   PrintToConsole(i, "[CSS-RP] %N a tué %N !", killer, victim);
               }
           }
       }
    
       return Plugin_Continue
    }
    
    stock bool:IsValidClient(client)
    {
       if(client <= 0 ) return false;
       if(client > MaxClients) return false;
       if(!IsClientConnected(client)) return false;
       return IsClientInGame(client);
    } 
    

     

    Sinon pas mal comme idée ;)

    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...