Raised This Month: $ Target: $400
 0% 

Change name points behind


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MrMaCEEE
Senior Member
Join Date: Apr 2010
Location: PortugaL
Old 08-17-2010 , 10:36   Change name points behind
Reply With Quote #1

Change name points behind

Hi, i have one problem on my code, this function add points behind your name/nick
eg: MACE<100>

When someone player connect to the server the points works fine on the name/nick, but if i change the name, the new name dont have points
eg on console: name LOL
MACE<100> changed name to LOL
its supposed add the points behind the new name/nick
eg: LOL<100>
eg: MACE<100> changed name to LOL<100>

Thanks for help

PHP Code:
stock points_in_name(id)  
{   
    new 
szName[32]  
    
get_user_name(idszNamecharsmax(szName))  
    new 
iLen strlen(szName)  
      
    
/* Finds and removes "<####>" */  
    
new iPos iLen 1  
    
if( szName[iPos] == '>' )  
    {  
        for( new 
16i++)  
        {  
            if( 
szName[iPos i] == '<' )  
            {  
                
iLen iPos i  
                szName
[iLen] = '^0'  
                
break  
            }  
        }  
    }  
      
    
format(szName[iLen], charsmax(szName) - iLenszName[iLen-1] == ' ' "<%d>" "<%d>"points[id])  
    
//set_user_info(id, "name", szName)
    
server_cmd("amx_nick #%d ^"%s^""get_user_userid(id), szName);
    

__________________

#include ++ by MACE
MrMaCEEE is offline
Send a message via MSN to MrMaCEEE
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-17-2010 , 11:14   Re: Change name points behind
Reply With Quote #2

Quote:
Originally Posted by MrMaCEEE View Post
Change name points behind

Hi, i have one problem on my code, this function add points behind your name/nick
eg: MACE<100>

When someone player connect to the server the points works fine on the name/nick, but if i change the name, the new name dont have points
eg on console: name LOL
MACE<100> changed name to LOL
its supposed add the points behind the new name/nick
eg: LOL<100>
eg: MACE<100> changed name to LOL<100>

Thanks for help

PHP Code:
stock points_in_name(id)  
{   
    new 
szName[32]  
    
get_user_name(idszNamecharsmax(szName))  
    new 
iLen strlen(szName)  
      
    
/* Finds and removes "<####>" */  
    
new iPos iLen 1  
    
if( szName[iPos] == '>' )  
    {  
        for( new 
16i++)  
        {  
            if( 
szName[iPos i] == '<' )  
            {  
                
iLen iPos i  
                szName
[iLen] = '^0'  
                
break  
            }  
        }  
    }  
      
    
format(szName[iLen], charsmax(szName) - iLenszName[iLen-1] == ' ' "<%d>" "<%d>"points[id])  
    
//set_user_info(id, "name", szName)
    
server_cmd("amx_nick #%d ^"%s^""get_user_userid(id), szName);
    

If you can find the event for when the player changes their name, I'm sure you can hook the same event.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-17-2010 , 11:18   Re: Change name points behind
Reply With Quote #3

You don't have to hook it. client_infochanged(id)
RedRobster is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-17-2010 , 18:40   Re: Change name points behind
Reply With Quote #4

That code looks familiar. However, you changed it to be an inconsiderate server operator! Remove that code and leave it how I had it.
__________________

Last edited by fysiks; 08-23-2010 at 14:01.
fysiks is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 08-17-2010 , 18:46   Re: Change name points behind
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
That code looks familiar. However, you change it to be an inconsiderate server operator! Remove that code and leave it how I had it.

PHP Code:
public client_infochanged(id)
{
    
points_in_name(id)

I didn't even look at the stock that fysiks gave you. Haha. He is right as always.
RedRobster is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-17-2010 , 18:47   Re: Change name points behind
Reply With Quote #6

Quote:
Originally Posted by RedRobster View Post
I didn't even look at the stock that fysiks gave you. Haha. He is right as always.
Yeah, I could have sworn I answered this question once already in the thread that it was requested in.
__________________
fysiks is offline
MrMaCEEE
Senior Member
Join Date: Apr 2010
Location: PortugaL
Old 08-17-2010 , 19:44   Re: Change name points behind
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
That code looks familiar. However, you change it to be an inconsiderate server operator! Remove that code and leave it how I had it.

PHP Code:
public client_infochanged(id)
{
    
points_in_name(id)

Doesnt work, yes this is your code fysiks but now i have this code please see and fix:

PHP Code:
public client_infochanged(id)
{
    new 
newname[34], setname[34]
    
get_user_info(id"name"newname33)
 
    
formatex(setname33"%s <%i>"newnamepoints[id])
 
    
//set_user_info(id, "name", setname)
    
server_cmd("amx_nick #%d ^"%s^""get_user_userid(id), setname);
 

but have bug, on client connect add very <points> on name
eg: MACE<10><10><10>< ...

if i change the name/nick this change but add very <points> on name
eg: *MACE<10><10><10>< changed name to LOL<10><10><10><

screenshot: http://antoniomacedo.net/de_dust20000.jpg
__________________

#include ++ by MACE

Last edited by MrMaCEEE; 08-17-2010 at 19:47.
MrMaCEEE is offline
Send a message via MSN to MrMaCEEE
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-17-2010 , 20:12   Re: Change name points behind
Reply With Quote #8

It should work fine if you just do what typed. I'm quite sure I tested this code well when I made it. Find that thread.
__________________
fysiks is offline
platzpatrone
Veteran Member
Join Date: Apr 2007
Location: Germany
Old 08-17-2010 , 21:04   Re: Change name points behind
Reply With Quote #9

http://forums.alliedmods.net/showthread.php?t=128498

the problem is that he never do what u're trying to say him. xD
platzpatrone is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-17-2010 , 21:10   Re: Change name points behind
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
It should work fine if you just do what typed. I'm quite sure I tested this code well when I made it. Find that thread.
I think the new problem he found, is every time the player rejoins, it adds another point system to his name.

Original Name:
TGIFridays

Name after first join:
TGIFridays<10>

Name after he leaves and comes back:
TGIFridays<10><10>
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX 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 00:38.


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