AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to detect player changeteam or model? (https://forums.alliedmods.net/showthread.php?t=83090)

xPaw 01-04-2009 04:49

How to detect player changeteam or model?
 
question in title:oops:

zwfgdlc 01-04-2009 05:34

Re: How to detect player changeteam or model?
 
try this.
PHP Code:

register_clcmd("jointeam","clcmd_jointeam");
register_clcmd("joinclass","clcmd_joinclass"); 

or
hook "TeamInfo" events and
cs_get_user_model

anakin_cstrike 01-04-2009 08:58

Re: How to detect player changeteam or model?
 
PHP Code:

#include <amxmodx>

public plugin_init() 
    
register_event("TeamInfo""join_team","a");
    
public 
join_team()
{
    new 
index read_data);
    new 
team], name32 ], msg64 ];
    
get_user_nameindexname31 );
    
    
read_data2team);
    
    switch( 
team] )
    {
        case 
'C'formatex(msgcharsmax(msg), "%s joined CTs"name );
        case 
'T'formatex(msgcharsmax(msg), "%s joined Ts"name );
        case 
'S'formatex(msgcharsmax(msg), "%s joined Spects"name );
    }
    
    
client_print0print_chatmsg );
    return 
0;


EDIT: At change model, cache the model at reset hud and check it in prethink, i think...

xPaw 01-04-2009 09:34

Re: How to detect player changeteam or model?
 
ok thanks :) but i think i can hook the model change, if he join same team, because the TeamInfo will be hooked

anakin_cstrike 01-04-2009 10:08

Re: How to detect player changeteam or model?
 
Quote:

Originally Posted by xPaw (Post 738173)
ok thanks :) but i think i can hook the model change, if he join same team, because the TeamInfo will be hooked

Yea but....there are 4 models at T and other 4 at CT, so the percentaje is very small...

ConnorMcLeod 01-04-2009 10:15

Re: How to detect player changeteam or model?
 
http://www.amxmodx.org/funcwiki.php?go=func&id=8

Check the model each time this forward is called.

MrPickles 06-05-2023 15:39

Re: How to detect player changeteam or model?
 
Quote:

Originally Posted by ConnorMcLeod (Post 738188)
http://www.amxmodx.org/funcwiki.php?go=func&id=8

Check the model each time this forward is called.

which is the forward?

bigdaddy424 06-05-2023 19:48

Re: How to detect player changeteam or model?
 
Quote:

Originally Posted by MrPickles (Post 2805551)
which is the forward?

this triggers whenever someone changes team
Code:
#include <amxmodx> public plugin_init() {     register_plugin("Join Team Message", "0.2", "connorr")     register_logevent("JoinTeam", 3, "1=joined team") } public JoinTeam() {     new loguser[80], name[32]     read_logargv(0, loguser, 79)     parse_loguser(loguser, name, 31)     new id = get_user_index(name)    if( is_user_bot(id) && is_user_hltv(id))         return     new temp[2]     read_logargv(2, temp, 1)     switch(temp[0]){         case "U": ; // 0         case "T": ; // 1         case "C": ; // 2         case "S": ; // 3     } }

MrPickles 06-06-2023 17:03

Re: How to detect player changeteam or model?
 
Quote:

Originally Posted by bigdaddy424 (Post 2805562)
this triggers whenever someone changes team
Code:
#include <amxmodx> public plugin_init() {     register_plugin("Join Team Message", "0.2", "connorr")     register_logevent("JoinTeam", 3, "1=joined team") } public JoinTeam() {     new loguser[80], name[32]     read_logargv(0, loguser, 79)     parse_loguser(loguser, name, 31)     new id = get_user_index(name)    if( is_user_bot(id) && is_user_hltv(id))         return     new temp[2]     read_logargv(2, temp, 1)     switch(temp[0]){         case "U": ; // 0         case "T": ; // 1         case "C": ; // 2         case "S": ; // 3     } }

Yes I know, but isn't there a more exact forward that detects the change from a model to a player?

bigdaddy424 06-06-2023 19:25

Re: How to detect player changeteam or model?
 
JoinTeam will trigger even if you change your appearance. if temp[0] is whether T or C use cs_get_user_model


All times are GMT -4. The time now is 23:51.

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