AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to allow unlimited team changes? (https://forums.alliedmods.net/showthread.php?t=87267)

spfc 03-09-2009 01:07

how to allow unlimited team changes?
 
hi, im trying to avoid the message in CS "Only one team change is allowed" (#Only_1_Team_Change) and allow to player changes team.

I canīt hook the message/event to disable this role.
do i need some more sophisticate function like register_forward or set a flag in the player's entity? how the server knows the teams changes?

i don't want to 'force' using cs_set_user_team and dllfunc(DLLFunc_Spawn, id), etc.

:|

TheRadiance 03-09-2009 01:32

Re: how to allow unlimited team changes?
 
This will remove "Only 1 Team Change Is allowed" message:
PHP Code:

#include < amxmodx >

public plugin_init( )
{
    
register_plugin"HookChooseTeam""1.0""Radiance" )
    
register_messageget_user_msgid"TextMsg" ), "MessageSayText" )
}

public 
MessageSayText( )
{
    new 
szMsgInfo32 ]
    
get_msg_arg_string2szMsgInfosizeof szMsgInfo ) - )

    if ( 
equaliszMsgInfo"#Only_1_Team_Change" ) )
        return 
PLUGIN_HANDLED

    
return PLUGIN_CONTINUE



BOYSplayCS 03-09-2009 05:57

Re: how to allow unlimited team changes?
 
Be careful about adding continues in directly after a handle, it could encounter errors. I'm not sure if it goes for Pawn though.

TheRadiance 03-09-2009 06:20

Re: how to allow unlimited team changes?
 
Quote:

Be careful about adding continues in directly after a handle, it could encounter errors. I'm not sure if it goes for Pawn though.
Hmm.. It works fine on my server.

Dores 03-09-2009 06:59

Re: how to allow unlimited team changes?
 
Quote:

Originally Posted by BOYSplayCS (Post 776972)
Be careful about adding continues in directly after a handle, it could encounter errors. I'm not sure if it goes for Pawn though.

In Pawn it's the opposite in most cases.

BOYSplayCS 03-09-2009 07:00

Re: how to allow unlimited team changes?
 
I thought so, I wasn't to sure though so I was just saying.

spfc 03-09-2009 20:13

Re: how to allow unlimited team changes?
 
Quote:

Originally Posted by TheRadiance (Post 776940)
This will remove "Only 1 Team Change Is allowed" message:
PHP Code:

#include < amxmodx >

public plugin_init( )
{
    
register_plugin"HookChooseTeam""1.0""Radiance" )
    
register_messageget_user_msgid"TextMsg" ), "MessageSayText" )
}

public 
MessageSayText( )
{
    new 
szMsgInfo32 ]
    
get_msg_arg_string2szMsgInfosizeof szMsgInfo ) - )

    if ( 
equaliszMsgInfo"#Only_1_Team_Change" ) )
        return 
PLUGIN_HANDLED

    
return PLUGIN_CONTINUE



this just remove the message, do not allow to change team :|

if ( equali( szMsgInfo, "#Only_1_Team_Change" ) ) {
// in this point i cant execute a command like jointeam or chooseteam because it's recursive and we're 'inside' the message 'TextMsg', we cant send another message

return PLUGIN_HANDLED
}

spfc 03-12-2009 00:01

Re: how to allow unlimited team changes?
 
So...
The message #Only_1_Team_Change is just a consequence of try change team more than one time in a round

Is there a message before #Only_1_Team_Change for intercept? Or do i need set a flag on server or client?
I don't know where is this control (server side / client side).

I tried search on HL SDK but don't have success, i'm noob :(

MeRcyLeZZ 03-12-2009 14:57

Re: how to allow unlimited team changes?
 
There probably is an offset for that, but I don't think anyone knows about it (yet).
So the best way right now would be to change the player's team manually by hooking the change team menu and detecting whenever they select a different team...

ConnorMcLeod 03-12-2009 15:01

Re: how to allow unlimited team changes?
 
Quote:

Originally Posted by MeRcyLeZZ (Post 779187)
There probably is an offset for that

That is what i thought, haven't tested yet :D

-edit-
PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Unlimited ChooseTeam"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

public plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR )
    
register_clcmd("chooseteam""ClientCommand_ChooseTeam")
}

public 
ClientCommand_ChooseTeamid )
{
    
set_pdata_int(id125get_pdata_int(id1255) & ~(1<<8), 5)




All times are GMT -4. The time now is 08:59.

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