AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Team Change Event ? (https://forums.alliedmods.net/showthread.php?t=244444)

Balck 07-18-2014 10:00

Team Change Event ?
 
Hi i'm making a plugin and i need to check when a player is changing the team and i mean like this for example if i'm on CT team and i change the team with cs_set_user_team to T how can i check that i have change the team and yes i have test it with register_event( "TeamInfo", "event_team_info", "a" ); but it doesn't work.

PHP Code:

register_clcmd("say /changeteam""changeteam")

public 
changeteam(id)
{
cs_set_user_team(id) == CS_TEAM_T);


Sorry for my bad english :oops:

HamletEagle 07-18-2014 10:41

Re: Team Change Event ?
 
Create a new bool and set it to true when someone is changing team, then reset it when you need ( without more info we can't know what you are trying to do ).

FrOZeN F1rE 07-18-2014 10:47

Re: Team Change Event ?
 
Quote:

Originally Posted by Balck (Post 2169869)
PHP Code:


public changeteam(id)
{
cs_set_user_team(id) == CS_TEAM_T);



Try This :P
PHP Code:

#include <cstrike>

public plugin_init() 
         {
         
register_clcmd("say /changeteam""changeteam")
         }

register_clcmd("say /changeteam""changeteam")

public 
changeteam(id)

if(!
cs_get_user_team(id) == CS_TEAM_T)
{
         
cs_set_user_team(idCS_TEAM_CT)
         
client_print(id"You Were Transferred To The CT's Team!");
}
else
{
         
cs_set_user_team(idCS_TEAM_T)
         
client_print(id"You Were Transferred To The T's Team!");


:wink: :)

Balck 07-18-2014 11:06

Re: Team Change Event ?
 
you dont understand i only want to know how to check when a player is changing the team

PHP Code:

new makesomething[33];

public 
plugin_init()
{
    
register_clcmd(say /team", "changeteam");
    register_event("
EventTeamChange", "eventteamchange");
}

public changeteam(id)
{
    cs_set_user_team(id) == CS_TEAM_T);
}

public eventteamchange(id)
{
    if(get_user_team(id) == 1)
    {
        makesomething[id] == false;
    }



Kz1.0 07-18-2014 13:19

Re: Team Change Event ?
 
Why don't u try to search ?


mottzi 07-18-2014 14:07

Re: Team Change Event ?
 
Because what you posted won't work for him, as you cannot hook the change via cs_set_user_team() with TeamInfo. You'll be able to hook the TeamInfo fired at next spawn though.

fysiks 07-18-2014 14:47

Re: Team Change Event ?
 
If you are changing someone team with a plugin, you already know when they change teams (when you execute the function; which you are not doing correctly BTW).

If you want helpful advice, you should explain in detail of what you are actually trying to do.

Kz1.0 07-18-2014 15:46

Re: Team Change Event ?
 
Quote:

Originally Posted by mottzi (Post 2170031)
Because what you posted won't work for him, as you cannot hook the change via cs_set_user_team() with TeamInfo. You'll be able to hook the TeamInfo fired at next spawn though.

Sorry, beacause his question is not clear for me :).

mottzi 07-18-2014 15:55

Re: Team Change Event ?
 
How would you detect the change without adding custom natives or forwards when you, lets pretend, dont have acess (again: let's just pretend this) to the changing-team plugins sma?

fysiks 07-18-2014 16:24

Re: Team Change Event ?
 
Quote:

Originally Posted by mottzi (Post 2170092)
How would you detect the change without adding custom natives or forwards when you, lets pretend, dont have acess (again: let's just pretend this) to the changing-team plugins sma?

Get the source code or get a different plugin that you have access to the source code.


All times are GMT -4. The time now is 13:20.

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