Raised This Month: $ Target: $400
 0% 

can't change players name...??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Enigmaya
Member
Join Date: Aug 2005
Old 08-21-2005 , 15:51   can't change players name...??
Reply With Quote #1

i want to add userid before player's name, like this " #12 abc",

and add new userid before the oldname if some reconnect the server.

but there is a bizarrerie problem .

i want to change player's name in the functions of client_connect .

and there are 2 part will change name in the functions .

but one of them can't work ,(no error and warning in compiling),

So i add 2 display sentence before and after the

" client_cmd(id, "name ^"%s^"",name) " ,

find this sentence didn't work.

i don't know it......one of them work fine,and another didn't work...

...why??? Also no error, what can i do ???

work on cs 1.5

code:
============================

public client_connect(id)
{
if ( !get_cvar_num("amx_idname") )
return PLUGIN_HANDLED

if( !is_user_bot(id) )
{
get_user_ip ( id, ip_str, 15, 1 )
for(new x=0 ;x<50;x++)
{
if( equali(ip[x],ip_str) )
{
uid=get_user_userid ( id )
format(name, 31, "#%i %s", uid,ip_name[x])
client_cmd(id, "name ^"%s^"",name) //**********problem
return PLUGIN_HANDLED
}
}
get_user_info(id,"name",oldname,31)
copy(ip_name[id],32,oldname)
copy(ip[id],15,ip_str)
}

if( !is_user_admin(id) )
{
uid=get_user_userid ( id )
format(name, 31, "#%i %s", uid,oldname)
client_cmd(id, "name ^"%s^"", name)//-------------work fine
}

return PLUGIN_HANDLED
}
==============================


this is my first time write amxx plugins.

thank you for you help .
Enigmaya is offline
Send a message via MSN to Enigmaya
JuXas
Member
Join Date: Jul 2005
Location: Panavezys, Lithuania
Old 08-21-2005 , 16:00  
Reply With Quote #2

format(name, 31, "#%i %s", uid,ip_name[x])
there's a space between "i" and "%".
Maybe this is the problem...
__________________
-- Nothing Here --
JuXas is offline
Enigmaya
Member
Join Date: Aug 2005
Old 08-21-2005 , 16:02  
Reply With Quote #3

why another part work fine ???
__________________
==Enigma==
If you believe in Light, it's because of Obscurity
If you believe in Joy, it's because of Sadness
And if you believe in God, it's because of the Devil !

==蜻 蜓==
Enigmaya is offline
Send a message via MSN to Enigmaya
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 08-21-2005 , 16:12  
Reply With Quote #4

JuXaS, the % should come before the i, he has it correct.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Enigmaya
Member
Join Date: Aug 2005
Old 08-22-2005 , 00:50  
Reply With Quote #5

hello.....

need help.........
__________________
==Enigma==
If you believe in Light, it's because of Obscurity
If you believe in Joy, it's because of Sadness
And if you believe in God, it's because of the Devil !

==蜻 蜓==
Enigmaya is offline
Send a message via MSN to Enigmaya
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 08-22-2005 , 01:21  
Reply With Quote #6

Post your entire code and use the tags
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Enigmaya
Member
Join Date: Aug 2005
Old 08-22-2005 , 02:00  
Reply With Quote #7

sma:

Code:
#include <amxmodx> #include <amxmisc> #include <fun> new oldname[32] new newname[32] new name[32] new uid new ip[50][15] new ip_str[15] new ip_name[50][32] public plugin_init() {     register_plugin("Amx_idname","0.1","Enigmaya")     register_cvar("amx_idname","1") } public client_connect(id) {         if ( !get_cvar_num("amx_idname") )             return PLUGIN_HANDLED         if( !is_user_bot(id) )         {             get_user_ip ( id, ip_str, 15, 1 )             for(new x=0 ;x<50;x++)             {                  if( equali(ip[x],ip_str) )                  {                            server_cmd(" amx_tsay green ^" %s ( %s ) is coming again.^" ",ip_name[x],ip_str)                           uid=get_user_userid ( id )                           format(name, 31, "#%i  %s", uid,ip_name[x])                           client_cmd(id, "name ^"%s^"",name)                                       return PLUGIN_HANDLED                   }              }              get_user_info(id,"name",oldname,31)              copy(ip_name[id],32,oldname)              copy(ip[id],15,ip_str)              server_cmd(" amx_tsay green ^" %s ( %s ) is coming^" ",ip_name[uid],ip[uid])              uid=get_user_userid ( id )              format(name, 31, "#%i  %s", uid,oldname)            client_cmd(id, "name ^"%s^"", name)         }                     return PLUGIN_HANDLED }     public  client_infochanged ( id ) {     if ( !get_cvar_num("amx_idname") )          return PLUGIN_HANDLED               if( is_user_alive ( id ) )         {             get_user_info( id, "name", newname,31 )             get_user_name( id, oldname, 31 )             if( !equali( oldname , newname ) )             {                       uid=get_user_userid ( id )                       format(name, 31, "#%i  %s", uid,newname)                       set_user_info(id, "name", name)             }          }     return PLUGIN_HANDLED }
__________________
==Enigma==
If you believe in Light, it's because of Obscurity
If you believe in Joy, it's because of Sadness
And if you believe in God, it's because of the Devil !

==蜻 蜓==
Enigmaya is offline
Send a message via MSN to Enigmaya
Enigmaya
Member
Join Date: Aug 2005
Old 08-22-2005 , 11:58  
Reply With Quote #8

.........555555555
__________________
==Enigma==
If you believe in Light, it's because of Obscurity
If you believe in Joy, it's because of Sadness
And if you believe in God, it's because of the Devil !

==蜻 蜓==
Enigmaya is offline
Send a message via MSN to Enigmaya
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 08-22-2005 , 13:46  
Reply With Quote #9

Code:
#include <amxmodx> public name_check(id) {    new idstring[32], currname[32];    format(idstring,31,"#%i",get_user_userid(id));    get_user_name(id,currname,31);    if(containi(currname,idstring) != -1) {       return;    }    client_cmd(id,"name ^"%s %s^"",idstring,currname);    return; } public client_putinserver(id) {    name_check(id); } public client_infochanged(id) {    name_check(id); } public client_disconnect(id) {    new idstring[32], currname[48];    format(idstring,31,"#%i ",get_user_userid(id));    get_user_name(id,currname,47);    if(containi(currname,idstring) == -1) {       return;    }    replace(currname,47,idstring,"");    client_cmd(id,"name ^"%s^"",currname);    return; }

Try that.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Enigmaya
Member
Join Date: Aug 2005
Old 08-22-2005 , 15:35  
Reply With Quote #10

thank you ...

but there is a error ,

undefined "oldname" ???


ps: why my code didn't work? have any suggest??
__________________
==Enigma==
If you believe in Light, it's because of Obscurity
If you believe in Joy, it's because of Sadness
And if you believe in God, it's because of the Devil !

==蜻 蜓==
Enigmaya is offline
Send a message via MSN to Enigmaya
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 14:36.


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