Raised This Month: $ Target: $400
 0% 

[HELP] Detect Team Change (cstrike)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-15-2016 , 10:48   Re: [HELP] Detect Team Change (cstrike)
Reply With Quote #9

Edit: Updated per Arkshine & Klippy's comments.

Signature created using cstrike module from 1.8.3 dev+4748

I only tested this on Windows.
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <orpheu>
#include <orpheu_memory>

new const Version[] = "0.2";

const 
CellSizeBytes = ( cellbits );

#define GetParams(%1,%2)    (%1 + (%2 * CellSizeBytes))

public plugin_init()
{
    
register_plugin"cs_set_user_team hook" Version Version );
    
    
OrpheuRegisterHookOrpheuGetFunction"cs_set_user_team" ) , "Hook_cs_set_user_team" );
    
    
register_clcmd"say test" "test" );
}

public 
testid )
{
    
cs_set_user_teamid CS_TEAM_SPECTATOR CS_DONTCHANGE );
}

public 
OrpheuHookReturn:Hook_cs_set_user_teamamx params )
{
    
//From cstrike module: CstrikeNatives.cpp
    //  static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params) // cs_set_user_team(index, team, model = 0); = 3 params
    //  {
          // params[1] = user index
          // params[2] = team
          // params[3] = model = 0
        
    
new iPlayer OrpheuMemoryGetAtAddressGetParamsparams ) , "int" );
    new 
iTeam OrpheuMemoryGetAtAddressGetParamsparams ) , "int" );
    new 
iModel OrpheuMemoryGetAtAddressGetParamsparams ) , "int" );
    
    
client_printiPlayer print_chat "cs_set_user_team was called: id=%d Team=%d Model=%d" iPlayer iTeam iModel );

Output:
Code:
cs_set_user_team : id=1 Team=3 Model=0
File: amxmodx\configs\orpheu\functions\cs_set_user_ team
Code:
{
    "name" : "cs_set_user_team",
    "library" : "cstrike",
    "arguments" :
    [
        {
            "type" : "int"
        },
        {
            "type" : "int"
        }
    ],
    "identifiers":
    [
        {
            "os" : "windows",
            "mod" : "cstrike",
            "value" : [0x55,0x8B,"*",0x83,"*","*",0xA1,0xB8,"*","*","*",0x33,0xC5,0x89,0x45,"*",0x56,0x8B,"*","*",0x8B,0x46,"*",0x57,0x8B,"*","*",0x83,0xF8]
        },
        {
            "os"    : "linux",
            "mod"   : "cstrike",
            "value" : "cs_set_user_team"
        }
    ]
}
File: amxmodx\configs\orpheu\memory\int
Code:
{
    "name"        : "int",
    "type"        : "int",
    "memoryType"  : "data",
    "identifiers" :
    [
        {
            "os"    : "windows",
            "value" : 0
        },
        {
            "os"    : "linux",
            "value" : 0
        }
    ]
}
__________________

Last edited by Bugsy; 10-16-2016 at 14:42.
Bugsy is offline
 



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 09:56.


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