AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Setting team with fakemeta (https://forums.alliedmods.net/showthread.php?t=57112)

hlstriker 06-28-2007 13:39

Setting team with fakemeta
 
I'm having trouble setting a users team in Counter-Strike with fakemeta.

I tried usingthe following to set to terrorist...
set_pev(id, pev_team, 1);

... but that didn't work.

Can someone let me knowhow to do this please?

XxAvalanchexX 06-28-2007 14:34

Re: Setting team with fakemeta
 
Take a look at the source code to cs_set_user_team. It appears that there are a few private data offsets that you have to update in the player.

VEN 06-28-2007 15:15

Re: Setting team with fakemeta
 
Quote:

Can someone let me knowhow to do this please?
The below line should do that
PHP Code:

set_pdata_int(player_index_here114team_index_here

This will not update the scoreboard. You have to send corresponding TeamInfo message to do that.

hlstriker 06-28-2007 15:37

Re: Setting team with fakemeta
 
Thanks that works perfect.

Are there any good threads telling how pdata works? I tried searching but failed to find anything.

I would really like to understand what pdata is, and how it works, and where to get the offsets (whatever they are!).

hlstriker 06-28-2007 22:06

Re: Setting team with fakemeta
 
I needed this to make custom team menus. I blocked the VGUI and text menu and created my own text menu.

Here is a problem though. When someone using VGUI menus tries to select a team, it doesn't set them on a team. If they are using the text menu style, then it works fine. The funny thing is that I made it so when a team was selected it would also print a message. The message prints, but the team doesn't change.

I'm testing this on a linux server, do you think the offset would have something to do with it?

regalis 06-29-2007 06:14

Re: Setting team with fakemeta
 
The offset depends on the CPU type if it is a 32 or 64 bit CPU
and the OS...windows and linux have different offsets...
In the pdata natives there is a parameter for the linux offset difference.
Code:

#if cellbits == 32
    #define OFFSET_ARMORTYPE 112
#else
    #define OFFSET_ARMORTYPE 137
#endif
#define OFFSET_LINUX 5


....
...
if(!get_pdata_int(id, OFFSET_ARMORTYPE, OFFSET_LINUX)) set_realarmor(id);

....
....

//+++++ Manipulate the user armor ++++++
set_realarmor(id, armor=2)
{
    if(is_module_loaded("cstrike") != -1)
    {
        set_pdata_int(id, OFFSET_ARMORTYPE, armor, OFFSET_LINUX);
        message_begin(MSG_ONE, g_umsgA, {0,0,0}, id);
        write_byte(1);
        message_end();
    }
}

Hope that helps you a bit ;)

greetz regalis


All times are GMT -4. The time now is 21:28.

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