Raised This Month: $32 Target: $400
 8% 

[1.8.3] cs_set_user_team issue


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 06-29-2016 , 15:26   [1.8.3] cs_set_user_team issue
Reply With Quote #1

After being sent to a team the player is treated as he is unasigned even tho he is alive
The player is being teleported to certain places on the map every few seconds

Steps to reproduce:

1. Compile
2. Install the plugin
3. Start cs_assault
4. Observe how the player is being treated as a spectator even tho he is alive


Test Script:
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.23"
#define AUTHOR "123"

#define TASK_JOIN 7640

#define flag_get(%1,%2) (%1 & (1 << (%2 & 31)))
#define flag_get_boolean(%1,%2) (flag_get(%1,%2) ? true : false)
#define flag_set(%1,%2) %1 |= (1 << (%2 & 31))
#define flag_unset(%1,%2) %1 &= ~(1 << (%2 & 31))

new g_Joined

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_message(get_user_msgid("ShowMenu"), "message_team_menu")
    
register_message(get_user_msgid("VGUIMenu"), "message_team_menu")
    
    
register_clcmd("jointeam""handle_join_command")
    
    
register_clcmd("say /spe""spectator")
    
register_clcmd("say /joi""JoinGame")
}

public 
message_team_menu(msgiddestid)
{
    return 
PLUGIN_HANDLED;
}

public 
handle_join_command(id)
{
    if(
flag_get(g_Joinedid))
    {
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}

public 
client_putinserver(id)
{
    
set_task(5.1"JoinGame"id+TASK_JOIN)
}

public 
client_disconnect(id)
{
    if(
flag_get(g_Joinedid))
    {
        
flag_unset(g_Joinedid)
    }
    
    
remove_task(id+TASK_JOIN)
}

public 
JoinGame(taskid)
{
    new 
id taskid TASK_JOIN
    
    
if(is_user_connected(id))
    {
        if(!
flag_get(g_Joinedid))
        {
            
cs_set_user_team(idCS_TEAM_CT)
            
//engclient_cmd(id, "jointeam", "5")
            //engclient_cmd(id, "joinclass","5")
            
flag_set(g_Joinedid)    
        }
    }

__________________
Depresie is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-29-2016 , 15:50   Re: [1.8.3] cs_set_user_team issue
Reply With Quote #2

The native sets only internally the player's team and updates HUD. Your issue is more a lack of game knowledge.
If you're using the native when player has not joined the game yet (no team/class), for sure it's not going to work properly as the game internally still expects and waits that you choose a team and class (typically the state is in m_iJoinginState offset).
Not sure what you're trying to do, using the native at this context is bad idea.
__________________

Last edited by Arkshine; 06-29-2016 at 15:53.
Arkshine is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 06-29-2016 , 16:05   Re: [1.8.3] cs_set_user_team issue
Reply With Quote #3

I'm trying to block the team menu and vgui of all the players and automatically assign them on a team
I wanted to do it with the cstrike native instead of using client_cmd to avoid overflow since i'm planning to assign the all players in teams at the same time
__________________

Last edited by Depresie; 06-29-2016 at 16:07.
Depresie is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-29-2016 , 16:13   Re: [1.8.3] cs_set_user_team issue
Reply With Quote #4

On connection, there is already a plugin for that: https://forums.alliedmods.net/showth...38587?p=438587
__________________
Arkshine is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 06-29-2016 , 17:10   Re: [1.8.3] cs_set_user_team issue
Reply With Quote #5

I see i can't make myself clear enough of what i'm trying to do..
In order to solve my doubts, can i get a straight answer on this?

Is this going to produce overflow?

PHP Code:
Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "123"

#define TASK_WAITING_PLAYERS 13567

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
client_cmd("jointeam""HandleCommand")
    
    
register_message(get_user_msgid("ShowMenu"), "message_team_menu")
    
register_message(get_user_msgid("VGUIMenu"), "message_team_menu")
}

public 
plugin_cfg()
{
    
set_task(30.0"HandleTeams"TASK_WAITING_PLAYERS)
}

public 
client_putinserver(id)
{
    if( 
task_exists(TASK_WAITING_PLAYERS) ) 
        return;
    
    
set_task(0.1"JoinGame"id)
}

public 
HandleCommand(id)
{
    if( 
task_exists(TASK_WAITING_PLAYERS) ) 
        return 
PLUGIN_HANDLED
}

public 
HandleTeams()
{
    new 
iPlayers[32] , iNum Player;
    
get_playersiPlayers iNum "h" );
    
    for ( new 
iNum i++ )
    {    
        
Player iPlayers[i];
        
        
JoinGame(Player)
    }
}

public 
JoinGame(id)
{
    if(!
is_user_connected(id)) 
        return;
    
    
engclient_cmd(id"jointeam""5")
    
engclient_cmd(id"joinclass","5")
}

public 
message_team_menu(msgiddestid)
{
    return 
PLUGIN_HANDLED;

__________________

Last edited by Depresie; 06-29-2016 at 17:12.
Depresie is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-30-2016 , 01:57   Re: [1.8.3] cs_set_user_team issue
Reply With Quote #6

I think you just do things that you don't understand( About your question ... why you don't try? )
Craxor is offline
Send a message via ICQ to Craxor
Depresie
Veteran Member
Join Date: Nov 2013
Old 06-30-2016 , 03:46   Re: [1.8.3] cs_set_user_team issue
Reply With Quote #7

Because i would need a fucking open server with 32 players

Case closed

https://forums.alliedmods.net/showthread.php?t=284591
__________________

Last edited by Depresie; 06-30-2016 at 03:49.
Depresie is offline
Reply



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 22:18.


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