Raised This Month: $ Target: $400
 0% 

Help with a simple team switch blocker


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sauron_pk
Junior Member
Join Date: Oct 2011
Old 11-25-2011 , 02:02   Help with a simple team switch blocker
Reply With Quote #1

Hi i want to make a team switch blocker for TFC(hl1 mod).

Basically i made this code:
Code:
#include <amxmodx>

public plugin_init()
{
    register_plugin("TSBlock", "1.0", "TSBlock");
    register_clcmd("jointeam", "cmdjointeam");
}

public cmdjointeam(id)
{
    client_print(id, print_chat, "[AMXX] Team switch isn't allowed.");
    
    return PLUGIN_HANDLED;
}
The problem is that when anyone enter the game they can't choose any team and i don't want to use the auto team assign...

So i need to basically "validate" that if the user isn't in a team(or in spect) they can choose a team, and if the user is in a team (red blue green yellow, 1, 2, 3, 4) they can't use the jointeam command....


Anyone can help me?

THanks!!
sauron_pk is offline
gamer99
Senior Member
Join Date: Jul 2011
Old 11-25-2011 , 05:51   Re: Help with a simple team switch blocker
Reply With Quote #2

Code:
#include <amxmodx>

public plugin_init()
{
    register_plugin("TSBlock", "1.0", "TSBlock");
    register_clcmd("jointeam", "cmdjointeam");
}

public cmdjointeam(id)
{
   if (get_user_team(id) == 0 || get_user_team(id) == 3)
       return PLUGIN_CONTINUE
   
 client_print(id, print_chat, "[AMXX] Team switch isn't allowed.");    
 return PLUGIN_HANDLED;
}
Untested ..please test it by urself
__________________
Thanks and regards,
Gamer99
gamer99 is offline
sauron_pk
Junior Member
Join Date: Oct 2011
Old 11-25-2011 , 14:22   Re: Help with a simple team switch blocker
Reply With Quote #3

Hey thanks

it worked but with a little problem..

when i choose a team and i am in red blue or green i can't change the teams, so it's ok

but when i am in the yellow team the plugin don't work so i can change the team.

(jointeam 1 = blue, jointeam 2 = red, jointeam 3 = yellow, jointeam = 4 green)



and another little question,

if i want to make a similar plugin that instead of blocking Team switch i allow to team switch but adding a 5 seconds penalty to respawn, is it possible ?

thanks!!
sauron_pk is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 11-26-2011 , 04:27   Re: Help with a simple team switch blocker
Reply With Quote #4

Quote:
Originally Posted by sauron_pk View Post
if i want to make a similar plugin that instead of blocking Team switch i allow to team switch but adding a 5 seconds penalty to respawn, is it possible ?
Yes.

Last edited by Devil259; 11-26-2011 at 04:27.
Devil259 is offline
sauron_pk
Junior Member
Join Date: Oct 2011
Old 11-27-2011 , 11:28   Re: Help with a simple team switch blocker
Reply With Quote #5

can you tell me what function should i use or whatever to do this?

and if you know how to fix the bug that the yellow team can change and the others no, i think something is wrong in the if structure

thanks a lot
sauron_pk is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 11-27-2011 , 11:55   Re: Help with a simple team switch blocker
Reply With Quote #6

If you don't know how to do, you can freeze the player who changed team with this stocks :

Code:
Freeze( id ) {     if( is_user_alive(id) )     {         new iFlags = pev(id, pev_flags)         if( ~iFlags & FL_FROZEN )         {             set_pev(id, pev_flags, iFlags | FL_FROZEN)         }     } } UnFreeze( id ) {     if( is_user_alive(id) )     {         new iFlags = pev(id, pev_flags)         if( iFlags & FL_FROZEN )         {             set_pev(id, pev_flags, iFlags & ~FL_FROZEN)         }     } }
Devil259 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:23.


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