Raised This Month: $32 Target: $400
 8% 

Solved Block jointeam T but allow CT and SPEC


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MihailoZ
Member
Join Date: Aug 2013
Old 09-15-2019 , 17:16   Block jointeam T but allow CT and SPEC
Reply With Quote #1

Hello,

is it possible to block joining Terrorists but allow joining CT and SPEC?

Thanks.
__________________
mhvtnns

Last edited by MihailoZ; 09-17-2019 at 15:19. Reason: Solved
MihailoZ is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 09-15-2019 , 18:09   Re: Block jointeam T but allow CT and SPEC
Reply With Quote #2

Auto join also blocked :
Code:
#include <amxmodx> public plugin_init() {     register_clcmd("jointeam", "join_team") } public join_team(id) {     new arg[2]     read_argv(1, arg, charsmax(arg))     if ( str_to_num(arg) == 1 || str_to_num(arg) == 5)     {         engclient_cmd(id,"chooseteam")         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }

Last edited by LearninG; 09-16-2019 at 13:52.
LearninG is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-16-2019 , 00:03   Re: Block jointeam T but allow CT and SPEC
Reply With Quote #3

Quote:
Originally Posted by LearninG View Post
Auto join also blocked :
Code:
#include <amxmodx> public plugin_init() {     register_clcmd("jointeam", "join_team") } public join_team(id) {     new arg[2]     read_argv(1, arg, charsmax(arg))     if ( str_to_num(arg)-1 == 0 || str_to_num(arg)-1 == 4)     {         engclient_cmd(id,"chooseteam")         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }
Why hard coding stuff ?

Instead of

str_to_num(arg)-1 == 0

Simply str_to_num(arg) == 1

And also this won't block joining team fully.

OP : plugins such like are already exists don't be lazy to search for them.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 09-16-2019 at 00:15.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
MihailoZ
Member
Join Date: Aug 2013
Old 09-16-2019 , 13:09   Re: Block jointeam T but allow CT and SPEC
Reply With Quote #4

Well, I tried searching forums and google but I was not lucky but I think this plugin works just fine.
__________________
mhvtnns

Last edited by MihailoZ; 09-16-2019 at 13:16.
MihailoZ is offline
MihailoZ
Member
Join Date: Aug 2013
Old 09-16-2019 , 13:30   Re: Block jointeam T but allow CT and SPEC
Reply With Quote #5

Quote:
Originally Posted by LearninG View Post
Auto join also blocked :
Code:
#include <amxmodx> public plugin_init() {     register_clcmd("jointeam", "join_team") } public join_team(id) {     new arg[2]     read_argv(1, arg, charsmax(arg))     if ( str_to_num(arg)-1 == 0 || str_to_num(arg)-1 == 4)     {         engclient_cmd(id,"chooseteam")         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }
Can you explain to me what is what, so I can add some custom code? Thanks.
__________________
mhvtnns
MihailoZ is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 09-16-2019 , 13:51   Re: Block jointeam T but allow CT and SPEC
Reply With Quote #6

hooking "jointeam" cmd
Code:
register_clcmd("jointeam", "join_team")
retrieving arguments of client command as string
Code:
new arg[2] read_argv(1, arg , charsmax(arg))
converting string (arg ) to num and checking if it matches with some numbers : (1= Team T , 2= Team CT , 5=Auto join and 6=Team Spectate)
Code:
if ( str_to_num(arg) == 1 || str_to_num(arg) == 5)
showing them chooseteam menu again , and blocking user from joining that team
Code:
engclient_cmd(id,"chooseteam") return PLUGIN_HANDLED
allow joining
Code:
return PLUGIN_CONTINUE
LearninG is offline
MihailoZ
Member
Join Date: Aug 2013
Old 09-16-2019 , 14:13   Re: Block jointeam T but allow CT and SPEC
Reply With Quote #7

Quote:
Originally Posted by LearninG View Post
hooking "jointeam" cmd
Code:
register_clcmd("jointeam", "join_team")
retrieving arguments of client command as string
Code:
new arg[2] read_argv(1, arg , charsmax(arg))
converting string (arg ) to num and checking if it matches with some numbers : (1= Team T , 2= Team CT , 5=Auto join and 6=Team Spectate)
Code:
if ( str_to_num(arg) == 1 || str_to_num(arg) == 5)
showing them chooseteam menu again , and blocking user from joining that team
Code:
engclient_cmd(id,"chooseteam") return PLUGIN_HANDLED
allow joining
Code:
return PLUGIN_CONTINUE
This is a bit new for me.

What if I wanted to do this:

IF CT wants to join T; return PLUGIN_HANDLED;
IF CT wants to join CT; return PLUGIN_HANDLED;
IF SPEC wants to join T; return PLUGIN_HANDLED;
IF SPEC wants to join CT; return PLUGIN_CONTINUE;

How would I write this?
__________________
mhvtnns
MihailoZ is offline
LearninG
Senior Member
Join Date: Apr 2019
Location: Iran
Old 09-16-2019 , 14:21   Re: Block jointeam T but allow CT and SPEC
Reply With Quote #8

Code:
#include <cstrike>
IF CT wants to join T; return PLUGIN_HANDLED;
Code:
if (cs_get_user_team(id) == CS_TEAM_CT && str_to_num(arg) == 1) {     engclient_cmd(id , "chooseteam")     return PLUGIN_HANDLED }
IF CT wants to join CT; return PLUGIN_HANDLED;
Code:
if (cs_get_user_team(id) == CS_TEAM_CT && str_to_num(arg) == 2) {     engclient_cmd(id , "chooseteam")     return PLUGIN_HANDLED }
IF SPEC wants to join T; return PLUGIN_HANDLED;
Code:
if (cs_get_user_team(id) == CS_TEAM_SPECTATOR && str_to_num(arg) == 1) {     engclient_cmd(id , "chooseteam")     return PLUGIN_HANDLED }
IF SPEC wants to join CT; return PLUGIN_CONTINUE;
Code:
if (cs_get_user_team(id) == CS_TEAM_SPECTATOR && str_to_num(arg) == 2) {     return PLUGIN_CONTINUE }
this means "and"
Code:
&&

Last edited by LearninG; 09-16-2019 at 14:26.
LearninG is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-16-2019 , 14:43   Re: Block jointeam T but allow CT and SPEC
Reply With Quote #9

Quote:
Originally Posted by MihailoZ View Post
Well, I tried searching forums and google but I was not lucky but I think this plugin works just fine.
https://forums.alliedmods.net/showthread.php?t=69819
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
MihailoZ
Member
Join Date: Aug 2013
Old 09-16-2019 , 14:56   Re: Block jointeam T but allow CT and SPEC
Reply With Quote #10

Quote:
Originally Posted by Natsheh View Post
That plugin blocks every changeteam try.
__________________
mhvtnns
MihailoZ 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 19:26.


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