.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Half-Life 1 SDK (http://forums.bots-united.com/forumdisplay.php?f=33)
-   -   Changing a players team (http://forums.bots-united.com/showthread.php?t=5700)

brooks 13-09-2006 02:10

Changing a players team
 
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?

The Storm 13-09-2006 15:30

Re: Changing a players team
 
If you tell us a mod maybe someone will be able to help you...

brooks 13-09-2006 18:58

Re: Changing a players team
 
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 :clap:


All times are GMT +2. The time now is 00:40.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.