Raised This Month: $51 Target: $400
 12% 

[REQ] Any help would be appriciated


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sharkyyy
New Member
Join Date: Nov 2018
Old 12-16-2018 , 01:44   [REQ] Any help would be appriciated
Reply With Quote #1

hello guys im having trouble with this plugin i finally found a version that protects admin from the kick vote but i have another problem i want to give 5 or 10 min temporarely ban on !nospec vote since when vote pass and spectators get kicked they can rejoin server instantly and it makes it kinda pointless the old version i had ban them for 10 min but there admin immunity is missing and they could kick admins too with !nospec so i dont wanna go back to the old one any help would be greatly appriciated .. i am pretty new to this thanks in advance here is the .sp

Code:
#include <sourcemod>
#include <nativevotes>

public Plugin myinfo =
{
    name = "[NativeVotes] KickSpec",
    author = "Keith Warren (Sky Guardian)",
    description = "Vote to kick all spectators from the server.",
    url = "http://www.sourcemod.com/"
}

public OnPluginStart()
{
    RegConsoleCmd("sm_kickspec", OnCallVote, "Vote to kick all spectators from the server.");
    RegConsoleCmd("sm_kickspecs", OnCallVote, "Vote to kick all spectators from the server.");
}

public Action OnCallVote(int client, int args)
{
    
    if ((GetClientTeam(client) == 1) && (!IsGenericAdmin(client)))
    {
        PrintToChat(client, "\x04You must be on the survivor or infected team to use this command.");
        return Plugin_Handled;
    }

    if (IsVoteInProgress())
    {
        PrintToChat(client, "\x04[SM] You cannot start a vote while one is currently going.");
        return Plugin_Handled;
    }

    Handle vote = NativeVotes_Create(MenuHandler_VoteCallback, NativeVotesType_Custom_YesNo);
    NativeVotes_SetInitiator(vote, client);

    char sDetails[256];
    FormatEx(sDetails, sizeof(sDetails), "Kick spectators from the server?");
    NativeVotes_SetDetails(vote, sDetails);
    NativeVotes_SetResultCallback(vote, VoteResultHandler);
    NativeVotes_DisplayToAllNonSpectators(vote, 20);

    return Plugin_Handled;
}

public int MenuHandler_VoteCallback(Menu menu, MenuAction action, int param1, int param2)
{
    switch (action)
    {
    case MenuAction_VoteCancel:
        {
            if (param1 == VoteCancel_NoVotes)
            {
                NativeVotes_DisplayFail(menu, NativeVotesFail_NotEnoughVotes);
            }
            else
            {
                NativeVotes_DisplayFail(menu, NativeVotesFail_Generic);
            }
        }
        
    case MenuAction_End:
        {
            NativeVotes_Close(menu);
        }
    }
}

public int VoteResultHandler(Handle vote, int num_votes, int num_clients, const int[] client_indexes, const int[] client_votes, int num_items, const int[] item_indexes, const int[] item_votes)
{
    for (int i = 0; i < num_items; i++)
    {
        if (item_indexes[i] == NATIVEVOTES_VOTE_YES && item_votes[i] > (num_clients / 2))
        {
            char sDetails[256];
            FormatEx(sDetails, sizeof(sDetails), "Kicking non-admin spectators from the server...");
            NativeVotes_DisplayPass(vote, sDetails);
            
            for (int x = 1; x <= MaxClients; x++)
            {
                if (IsClientInGame(x) && GetClientTeam(x) == 1 && !CheckCommandAccess(x, "kickspec_immune", ADMFLAG_RESERVATION, true))
                {
                    KickClient(x, "You have been kicked for being a spectator.");
                }
            }
            
            return;
        }
    }

    NativeVotes_DisplayFail(vote, NativeVotesFail_Loses);
} 

static bool:IsGenericAdmin(client) {
    return CheckCommandAccess(client, "generic_admin", ADMFLAG_GENERIC, false); 
}


i assume it has anything to do with this line but thats my random guess just
"KickClient(x, "You have been kicked for being a spectator.");"
sharkyyy is offline
Reply



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 08:33.


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