.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > SDK Programming discussions > Half-Life 1 SDK
Half-Life 1 SDK For developments focused around Half-Life (and its mods) Half-Life

Reply
 
Thread Tools
Changing a players team
Old
  (#1)
brooks
Member
 
Status: Offline
Posts: 2
Join Date: Sep 2006
Default Changing a players team - 13-09-2006

I've been searching around these forums and other sites for a few days and I can't seem to figure out how to change a players team. Anyone have any simple ways of changing a players team?

Last edited by brooks; 13-09-2006 at 03:32..
  
Reply With Quote
Re: Changing a players team
Old
  (#2)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,620
Join Date: Jul 2004
Location: Bulgaria
Default Re: Changing a players team - 13-09-2006

If you tell us a mod maybe someone will be able to help you...
  
Reply With Quote
Re: Changing a players team
Old
  (#3)
brooks
Member
 
Status: Offline
Posts: 2
Join Date: Sep 2006
Default Re: Changing a players team - 13-09-2006

My bad bro, I'm working with metamod. I cracked open amx and got some stuff from that. Not suy why I didn't think about it earlier.

Code:
void Player::changeSide()
{
    int team =0;
    int model =0;

    char strTeam[100];

    strcpy( strTeam, getTeam() );

    if( !strcmp( strTeam, "TERRORIST") )
        team = 2;
    else if( !strcmp( strTeam, "CT") )
        team = 1;
    else
        team = 3;

    *((int *)entity->pvPrivateData + OFFSET_TEAM) = team;
    if (model != 0)
        *((int *)entity->pvPrivateData + OFFSET_INTERNALMODEL) = model;
    
    // And update scoreboard by sending TeamInfo msg.
    char teaminfo[32];
    switch (team) {
        case TERRORIST:
            setTeam("TERRORIST");
            strcpy(teaminfo, "TERRORIST");
            break;
        case CT:
            setTeam("CT");
            strcpy(teaminfo, "CT");
            break;
        case SPECTATOR:
            setTeam("SPECTATOR");
            strcpy(teaminfo, "SPECTATOR");
            break;
    }

    MESSAGE_BEGIN(MSG_ALL, GET_USER_MSG_ID(PLID, "TeamInfo", NULL));
    WRITE_BYTE(0);
    WRITE_STRING(teaminfo);
    MESSAGE_END();

    CLIENT_COMMAND(entity, "kill\n");

}
Thank you anyway
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com