Raised This Month: $ Target: $400
 0% 

Team Name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tyin
Member
Join Date: Jun 2011
Location: Macedonia
Old 01-13-2013 , 22:17   Team Name
Reply With Quote #1

What should plugin do:
This is CSO Like connect announce to other users.
When new player connect on server other players will see this message
"name" connected
When new player choose team and join the server other players will see this message
"name" joined the "teamname" force
When player left the server other players will see this message
"name" has left the game

Problem with my plugin is @ client_putinserver
When new player choose a team and class other players don't see
"name" joined the "teamname" force

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

public client_connect(id)
{
    new 
name[32];
    
get_user_name(idnamecharsmax(name));

    
client_print(0print_chat"%s connected"name);
}

public 
client_putinserver(id)
{
    new 
name[32], teamname[32], arg1[32];
    new 
player cmd_target(idarg12);
    
get_user_name(idnamecharsmax(name));
    
read_argv(1arg131)

    if ( 
cs_get_user_team(player) == CS_TEAM_T )
    {
        
teamname "Terrorist"
    
}
    else if ( 
cs_get_user_team(player) == CS_TEAM_CT )
    {
        
teamname "Counter-Terrorist"
    
}

    
client_print(0print_chat"%s is joining the %s force"nameteamname);
}

public 
client_disconnect(id)
{
    new 
name[32];
    
get_user_name(idnamecharsmax(name));

    
client_print0print_chat"%s has left the game"name );

tyin is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-14-2013 , 01:22   Re: Team Name
Reply With Quote #2

Quote:
Originally Posted by tyin View Post
When new player connect on server other players will see this message
"name" connected
When new player choose team and join the server other players will see this message
"name" joined the "teamname" force
When player left the server other players will see this message
"name" has left the game
This is how it already works IIRC.

About the code, it is all written wrong. client_putinserver() is called when the player is put in the server, not when they join a team. You are using cmd_target() wrong, the variable "player" is always 0 and will cause a run-time error. You should not assign strings to arrays with the equal sign. In this case, you should use a global array of strings for your team names. Use a switch() statement when using cs_get_user_team() instead of inefficiently using two if statements.
__________________
fysiks 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 13:44.


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