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

[REQ] Ban player from spectate the other team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 05-05-2016 , 10:17   [REQ] Ban player from spectate the other team
Reply With Quote #1

ban types :
1 : the player will cant spec the other team
2 : the player will can spec only who killed him
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 06-12-2016 , 23:25   Re: [REQ] Ban player from spectate the other team
Reply With Quote #2

bump !
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
Dr Zayd
Senior Member
Join Date: Jun 2014
Location: forums.alliedmods.net
Old 06-13-2016 , 06:29   Re: [REQ] Ban player from spectate the other team
Reply With Quote #3

Quote:
1 : the player will cant spec the other team
add (mp_forcechasecam "2") to server.cfg or amxx.cfg
__________________
Invisible System | 100%
ـــــــــــــــــــــــــــــ
Anti setinfo check | Ez Plugin and lite
ـــــــــــــــــــــــــــــ
[ZP] Free VIP Menu | Free VIP menu | ZP-Mod |

Last edited by Dr Zayd; 06-13-2016 at 06:29.
Dr Zayd is offline
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 06-14-2016 , 14:22   Re: [REQ] Ban player from spectate the other team
Reply With Quote #4

i wanna do it only for one player not for all the players -.-
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-15-2016 , 12:18   Re: [REQ] Ban player from spectate the other team
Reply With Quote #5

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <orpheu>

new Trie:handleBannedPlayers

public plugin_init()
{
    new 
OrpheuFunction:HandleObserver_IsValidTarget OrpheuGetFunction("Observer_IsValidTarget""CBasePlayer")
    
OrpheuRegisterHook(HandleObserver_IsValidTarget"OnObserver_IsValidTarget"OrpheuHookPre)
    
    
handleBannedPlayers TrieCreate()
    
register_concmd("amx_ban_spectate""ClientCommand_BanFromSpectate"ADMIN_BAN"<target> <type>")
    
    
register_event("DeathMsg""OnDeathMsg_Event""a"
}

public 
OrpheuHookReturn:OnObserver_IsValidTarget(idplayerIndexbool:sameTeam)
{
    new 
userName[32]
    
get_user_name(iduserNamecharsmax(userName))
    
    if(
TrieKeyExists(handleBannedPlayersuserName))
    {
        new 
banType
        TrieGetCell
(handleBannedPlayersuserNamebanType)
        
        switch(
banType)
        {
            case 
1:
            {
                if(
get_user_team(id) != get_user_team(playerIndex))
                {
                    
OrpheuSetReturn(false)
                    return 
OrpheuOverride
                
}
            }
            case 
2:
            {
                
            }
        }
    }
    
    return 
OrpheuIgnored
}

public 
ClientCommand_BanFromSpectate(idlevelcid)
{
    if(!
cmd_access(idlevelcid3))
    {
        return 
PLUGIN_HANDLED
    
}
    
    
enum _:argumentsType
    
{
        
userName[32],
        
banType[2]
    }
    
    new 
arguments[argumentsType]

    
read_argv(1arguments[userName], charsmax(arguments[userName]))
    
read_argv(2arguments[banType ], charsmax(arguments[banType ]))
    
    new 
target cmd_target(idarguments[userName], CMDTARGET_OBEY_IMMUNITY)
    if(!
target)
    {
        return 
PLUGIN_HANDLED
    
}
    
    
TrieSetCell(handleBannedPlayersarguments[userName], str_to_num(arguments[banType]))
    
    return 
PLUGIN_HANDLED
}

public 
OnDeathMsg_Event()
{
    new 
killer read_data(1)
    new 
victim read_data(2)
}

public 
plugin_end()
{
    
TrieDestroy(handleBannedPlayers)

It's not ready, someone has to complete the 2nd request. Currently, it only ban player from spectating the other team.
The hard part is done, so one just have to check for killer and do the same thing as I did above.

Spoiler

Place this into addons/amxmodx/configs/orpheu/functions/CBasePlayer.
__________________

Last edited by HamletEagle; 06-15-2016 at 12:19.
HamletEagle is online now
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 06-17-2016 , 01:22   Re: [REQ] Ban player from spectate the other team
Reply With Quote #6

thnx but how to unban ?
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-17-2016 , 09:12   Re: [REQ] Ban player from spectate the other team
Reply With Quote #7

I did this only to show the method, not to provide a fully functional plugin. Someone can take it from here and add this basic stuff.

Try something like this for basic unban:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <orpheu>

new Trie:handleBannedPlayers

public plugin_init()
{
    new 
OrpheuFunction:HandleObserver_IsValidTarget OrpheuGetFunction("Observer_IsValidTarget""CBasePlayer")
    
OrpheuRegisterHook(HandleObserver_IsValidTarget"OnObserver_IsValidTarget"OrpheuHookPre)
    
    
handleBannedPlayers TrieCreate()
    
register_concmd("amx_ban_spectate""ClientCommand_BanFromSpectate"ADMIN_BAN"<target> <type>")
    
register_concmd("amx_unban_spectate""ClientCommand_UnbanFromSpectate"ADMIN_BAN"<target>")
    
    
register_event("DeathMsg""OnDeathMsg_Event""a"
}

public 
OrpheuHookReturn:OnObserver_IsValidTarget(idplayerIndexbool:sameTeam)
{
    new 
userName[32]
    
get_user_name(iduserNamecharsmax(userName))
    
    if(
TrieKeyExists(handleBannedPlayersuserName))
    {
        new 
banType
        TrieGetCell
(handleBannedPlayersuserNamebanType)
        
        switch(
banType)
        {
            case 
1:
            {
                if(
get_user_team(id) != get_user_team(playerIndex))
                {
                    
OrpheuSetReturn(false)
                    return 
OrpheuOverride
                
}
            }
            case 
2:
            {
                
            }
        }
    }
    
    return 
OrpheuIgnored
}

public 
ClientCommand_BanFromSpectate(idlevelcid)
{
    if(!
cmd_access(idlevelcid3))
    {
        return 
PLUGIN_HANDLED
    
}
    
    
enum _:argumentsType
    
{
        
userName[32],
        
banType[2]
    }
    
    new 
arguments[argumentsType]

    
read_argv(1arguments[userName], charsmax(arguments[userName]))
    
read_argv(2arguments[banType ], charsmax(arguments[banType ]))
    
    new 
target cmd_target(idarguments[userName], CMDTARGET_OBEY_IMMUNITY)
    if(!
target)
    {
        return 
PLUGIN_HANDLED
    
}
    
    
TrieSetCell(handleBannedPlayersarguments[userName], str_to_num(arguments[banType]))
    
    return 
PLUGIN_HANDLED
}

public 
ClientCommand_UnbanFromSpectate(idlevelcid)
{
    if(!
cmd_access(idlevelcid2))
    {
        return 
PLUGIN_HANDLED
    
}
    
    new 
userName[32]
    
read_argv(1userNamecharsmax(userName))
    
    if(
TrieKeyExists(handleBannedPlayersuserName))
    {
        
TrieDeleteKey(handleBannedPlayersuserName)
    }
    
    return 
PLUGIN_HANDLED
}

public 
OnDeathMsg_Event()
{
    new 
killer read_data(1)
    new 
victim read_data(2)
}

public 
plugin_end()
{
    
TrieDestroy(handleBannedPlayers)

__________________

Last edited by HamletEagle; 07-05-2016 at 10:28.
HamletEagle is online now
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 06-17-2016 , 15:55   Re: [REQ] Ban player from spectate the other team
Reply With Quote #8

i will do it thnx man
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School is offline
Old 01-15-2017, 11:55
Old.School
This message has been deleted by Old.School.
Old.School
Senior Member
Join Date: Sep 2015
Location: France
Old 02-12-2017 , 19:35   Re: [REQ] Ban player from spectate the other team
Reply With Quote #10

not work any help?
__________________
You keep bringing B.R down .. He will rise again and kick Enemies asses !
Old.School 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 05:48.


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