Raised This Month: $248 Target: $400
 62% 

[ZR] Leader


Post New Thread Reply   
 
Thread Tools Display Modes
Author
AntiTeal
Junior Member
Join Date: Sep 2015
Plugin ID:
5903
Plugin Version:
2.9
Plugin Category:
General Purpose
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    9 
    Plugin Description:
    Old 11-07-2017 , 03:11   [ZR] Leader
    Reply With Quote #1

    [ZR] Leader

    Description
    Allows for an admin to select or for regular players to vote for a human to be the leader for the current round. The leader gets special perks, like the ability to put defend here / follow me sprites above their head, place defend markers, toggle a rainbow beacon, custom chat, custom radio commands, and maybe more in the future.

    Requirements
    This plugin requires Zombie:Reloaded.

    Server ConVars
    • sm_leader_version - Leader Version (2.9)
    • sm_leader_allow_votes - Determines whether players can vote for leaders. (Default: "1")
    • sm_leader_defend_vmt - The defend here .vmt file (Default: "materials/sg/sgdefend.vmt")
    • sm_leader_defend_vtf - The defend here .vtf file (Default: "materials/sg/sgdefend.vtf")
    • sm_leader_follow_vmt - The follow me .vmt file (Default: "materials/sg/sgfollow.vtf")
    • sm_leader_follow_vtf - The follow me .vtf file (Default: "materials/sg/sgfollow.vtf")

    Commands
    • sm_leader - Access the leader menu OR Set a player to be leader (ADMFLAG_GENERIC)
    • sm_currentleader - Shows the current leader.
    • sm_voteleader <player> - Votes for the specified player to be leader. Required votes is current player count / 10.
    • sm_removeleader (ADMFLAG_GENERIC) - Removes the current leader.

    Planned Features
    • Config
    • More extensive API
    • More rainbow stuff

    API
    Spoiler


    Screenshots
    Spoiler


    Changelog
    • 2.9 - Plugin Release

    If you find any bugs, feel free to give feedback so I can fix the plugin.
    Attached Files
    File Type: sp Get Plugin or Get Source (leader2.sp - 644 views - 23.2 KB)
    File Type: zip leader.zip (177.6 KB, 406 views)
    File Type: smx leader2.smx (18.7 KB, 456 views)

    Last edited by AntiTeal; 11-07-2017 at 03:13.
    AntiTeal is offline
    Elitcky
    AlliedModders Donor
    Join Date: Jun 2016
    Location: Antofagasta, Chile
    Old 11-07-2017 , 03:54   Re: [ZR] Leader
    Reply With Quote #2

    Cool! Going to try it

    Edit: All working!

    Defend (spanish sv)


    Follow me (spanish sv)


    Bugs: If you are an admin, the plugin doesn't care if you are zombie or not... Please set than just "HUMAN ADMINS" can use the !leader because "ZOMBIE ADMINS" can type !leader and they get the leader being zombie...

    i know i said the bug at the top but well i fixed it in my sv making it this way :v
    PHP Code:
    public Action Leader(int clientint args)
    {
        if(
    CheckCommandAccess(client"sm_admin"ADMFLAG_GENERICfalse) && !ZR_IsClientZombie(client))
        {
            if(
    args == 1)
            {
                
    char arg1[65];
                
    GetCmdArg(1arg1sizeof(arg1));
                
    int target FindTarget(clientarg1falsefalse);
                if (
    target == -1)
                {
                    return 
    Plugin_Handled;
                }

                if(
    target == leaderClient)
                {
                    
    LeaderMenu(target);
                }
                else
                {
                    if(
    IsPlayerAlive(target))
                    {
                        
    SetLeader(target);
                        
    PrintToChatAll("[SM] %N is the new leader!"target);
                        
    PrintToChat(target"[SM] You are now the leader! Type !leader to open up the leader menu.");
                        
    LeaderMenu(target);
                    }
                    else
                    {
                        
    ReplyToCommand(client"[SM] The target has to be alive!");
                    }
                }
            }
            else if(
    args == 0)
            {
                if(
    client == leaderClient)
                {
                    
    LeaderMenu(client);
                    return 
    Plugin_Handled;
                }
                if(
    IsPlayerAlive(client))
                {
                    
    SetLeader(client);
                    
    PrintToChatAll("[SM] %N is the new leader!"client);
                    
    PrintToChat(client"[SM] You are now the leader! Type !leader to open up the leader menu.");
                    
    LeaderMenu(client);
                }
                else
                {
                    
    ReplyToCommand(client"[SM] The target has to be alive!");
                }
            }
            else
            {
                
    ReplyToCommand(client"[SM] Usage: sm_leader <optional: client|#userid>");
            }
        }
        else if(
    CheckCommandAccess(client"sm_admin"ADMFLAG_GENERICfalse) && ZR_IsClientZombie(client))
        {
            
    PrintToChat(client"[SM] You are admin but you are not human, do not try to abuse.");
        }
        
        if(
    client == leaderClient)
        {
            
    LeaderMenu(client);
        }
        return 
    Plugin_Handled;

    __________________

    Last edited by Elitcky; 11-07-2017 at 06:01. Reason: hmm
    Elitcky is offline
    Franc1sco
    Veteran Member
    Join Date: Oct 2010
    Location: Spain (Madrid)
    Old 11-07-2017 , 07:53   Re: [ZR] Leader
    Reply With Quote #3

    Good job! finally someone that did the zr commander project that I was pending.

    Some improvements that I saw:

    -About Precache things and add to download tables is enought if you keep it only OnMapStart.
    -In line 150 you create a new handle on every new map and this can cause memory leak. You should close it when you finished with it.
    -Is recommended to upload the plugin on github or other git plataform for a good follow-up and support.


    Really you made a good contributation to the ZE community, keep up the good job
    __________________
    Veteran SourceMod Coder -> Activity channel
    Taking some paid jobs and selling some private stuff.
    Contact: Steam, Telegram or discord ( Franc1sco#7876 ).

    You like my work? +Rep in my steam profile comments or donate.

    Franc1sco is offline
    Send a message via MSN to Franc1sco
    Zeddy_god
    Senior Member
    Join Date: May 2015
    Location: Mumbai, India
    Old 11-09-2017 , 01:01   Re: [ZR] Leader
    Reply With Quote #4

    Hey antiteal, great release!
    Is it possible to make the !leader menu bound to a simple key such as +use automatically? So leaders can just press e to open menu and use instead of typing commands again and again! Cheers.
    __________________
    Zeddy_god is offline
    Rale
    AlliedModders Donor
    Join Date: Sep 2010
    Old 11-09-2017 , 06:28   Re: [ZR] Leader
    Reply With Quote #5

    Quote:
    Originally Posted by Zeddy_god View Post
    Hey antiteal, great release!
    Is it possible to make the !leader menu bound to a simple key such as +use automatically? So leaders can just press e to open menu and use instead of typing commands again and again! Cheers.

    Did you tried bind "e" sm_leader

    Last edited by Rale; 11-09-2017 at 06:29.
    Rale is offline
    Elitcky
    AlliedModders Donor
    Join Date: Jun 2016
    Location: Antofagasta, Chile
    Old 11-09-2017 , 07:31   Re: [ZR] Leader
    Reply With Quote #6

    Quote:
    Originally Posted by Rale View Post
    Did you tried bind "e" sm_leader
    He can do that, but he is going to overwrite the "+use" he should do something like
    Bind e "+use;say /leader"
    But a bind is not very efficient if you can actually edit the plugin and make the leader menu equals to +use command. So you can still have the bind e "+use"
    __________________

    Last edited by Elitcky; 11-09-2017 at 07:32.
    Elitcky is offline
    andrew13
    AlliedModders Donor
    Join Date: Jul 2010
    Old 02-15-2018 , 01:23   Re: [ZR] Leader
    Reply With Quote #7

    Would you be able to make it so the playermodel changes once a user is leader and removes the playermodel when they are no longer leader?
    andrew13 is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 06:13.


    Powered by vBulletin®
    Copyright ©2000 - 2020, vBulletin Solutions, Inc.
    Theme made by Freecode