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

[Solved]How to block "Only 1 team change is allowed"


Post New Thread Reply   
 
Thread Tools Display Modes
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-05-2011 , 01:04   Re: [Solved]How to block "Only 1 team change is allowed"
Reply With Quote #11

That is for a specific player.

Disllow team change:
Code:
set_pdata_int(id, 125, (get_pdata_int(id, 125, 5) | (1<<8)), 5)

Allow team change:
Code:
set_pdata_int(id, 125, (get_pdata_int(id, 125, 5) & ~(1<<8)), 5)
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Apollyon
SourceMod Donor
Join Date: Dec 2007
Location: California
Old 05-05-2011 , 01:49   Re: [Solved]How to block "Only 1 team change is allowed"
Reply With Quote #12

This isn't working for me. Am I missing something?

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Apo"


public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("chooseteam""BlockChangeTeam");
}

public 
BlockChangeTeam(id)
{
    
set_pdata_int(id125, (get_pdata_int(id1255) | (1<<8)), 5);

__________________
Apollyon is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-05-2011 , 07:00   Re: [Solved]How to block "Only 1 team change is allowed"
Reply With Quote #13

Apollyon
This code should work fine. What exactly do you want to do?
__________________

SonicSonedit is offline
Apollyon
SourceMod Donor
Join Date: Dec 2007
Location: California
Old 05-06-2011 , 00:17   Re: [Solved]How to block "Only 1 team change is allowed"
Reply With Quote #14

Quote:
Originally Posted by SonicSonedit View Post
Apollyon
This code should work fine. What exactly do you want to do?
Well... I'm using this code to pick a random player each round to be VIP and want to block this selected player from changing teams.

PHP Code:
new g_iVIPid 0;
new 
CsTeams:g_VIPteam;


public 
plugin_init()
{
    
register_event("HLTV""NewRound""a""1=0""2=0");
}

public 
NewRound()
{
    new 
vPlayers[32], vPlayerNumvName[32];
    
get_players(vPlayersvPlayerNum"ac");
    
g_BombPlanted false;
    
    if(
vPlayerNum)
    {
        
g_iVIPid vPlayers[(vPlayerNum 1) ? random(vPlayerNum) : 0]; //Set random human player to VIP
        
        
g_VIPteam cs_get_user_team(g_iVIPid); //Get team VIP is on
        
        
get_user_name(g_iVIPidvNamecharsmax(vName));
        
ColorChat(0,RED"[%s] ^4%s ^1is VIP this round. Stick together team!"PrefixNamevName);
    }

__________________
Apollyon is offline
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 05-06-2011 , 07:05   Re: [Solved]How to block "Only 1 team change is allowed"
Reply With Quote #15

PHP Code:
const OFFSET_CSTEAMINFO 125
const FLAG_ALREADY_JOINED_TEAM = (1<<8)
const 
OFFSET_LINUX 5

new g_iVIPid 0;
new 
CsTeams:g_VIPteam;


public 
plugin_init()
{
    
register_event("HLTV""NewRound""a""1=0""2=0");
}

public 
NewRound()
{
    new 
vPlayers[32], vPlayerNumvName[32];
    
get_players(vPlayersvPlayerNum"ac");
    
g_BombPlanted false;
    
    if(
vPlayerNum)
    {
        
g_iVIPid vPlayers[(vPlayerNum 1) ? random(vPlayerNum) : 0]; //Set random human player to VIP
        
        
g_VIPteam cs_get_user_team(g_iVIPid); //Get team VIP is on
        
set_pdata_int(g_iVIPidOFFSET_CSTEAMINFO, (get_pdata_int(g_iVIPidOFFSET_CSTEAMINFOOFFSET_LINUX) | FLAG_ALREADY_JOINED_TEAM), OFFSET_LINUX);
        
        
get_user_name(g_iVIPidvNamecharsmax(vName));
        
ColorChat(0,RED"[%s] ^4%s ^1is VIP this round. Stick together team!"PrefixNamevName);
    }

Doesn't work?
__________________


Last edited by SonicSonedit; 05-06-2011 at 07:08.
SonicSonedit is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 05-06-2011 , 19:10   Re: [Solved]How to block "Only 1 team change is allowed"
Reply With Quote #16

Would It be different for windows server? That might be why its not working?

Last edited by Doc-Holiday; 05-07-2011 at 05:35.
Doc-Holiday 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 02:14.


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