AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with name-change plugin (https://forums.alliedmods.net/showthread.php?t=76587)

unique` 08-27-2008 07:33

Problem with name-change plugin
 
Hello !
Yesterday I was working on a pretty simple plugin that puts tags in front of all players name (I thought it was simple, until it didn't work xD). I don't want to talk to much jibber-jabba
here's the code:
PHP Code:

/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"
#define tag_terror "[T]"
#define tag_ct "[CT]"



public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
}
public 
client_connect(id)
{
    new 
CsTeams:team cs_get_user_team(id);
    new 
name[32];
    
get_user_name(id,name,31);
    
    switch(
team)
    {
        case 
CS_TEAM_T:
        {
            
client_cmd(id,"name ^"%%s^"",tag_terror,name);
        }
        case 
CS_TEAM_CT:
        {
            
client_cmd(id,"name ^"%%s^"",tag_ct,name);
        }
    }
    
}

public 
client_infochanged(id)
{    
    new 
newname[32],oldname[32]
    
get_user_info(id"name"newname,31)
    
get_user_name(id,oldname,31)
    
client_cmd(id,"name %s",oldname);


Thanks for reading and for help ! :D

anakin_cstrike 09-02-2008 08:24

Re: Problem with name-change plugin
 
mistake

anakin_cstrike 09-02-2008 08:26

Re: Problem with name-change plugin
 
PHP Code:

new name[32],Buffer[64];
get_user_name(id,name,31);
 
switch(
get_user_team(id))
{
      case 
1format(Buffer,63,"[T] %s",name);
      case 
2format(Buffer,63,"[CT] %s",name);
}
client_cmd(id,"name ^"%s^"",Buffer); 



All times are GMT -4. The time now is 03:16.

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