AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Change name points behind (https://forums.alliedmods.net/showthread.php?t=135546)

MrMaCEEE 08-17-2010 10:36

Change name points behind
 
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);
    



GXLZPGX 08-17-2010 11:14

Re: Change name points behind
 
Quote:

Originally Posted by MrMaCEEE (Post 1273386)
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.

RedRobster 08-17-2010 11:18

Re: Change name points behind
 
You don't have to hook it. client_infochanged(id)

fysiks 08-17-2010 18:40

Re: Change name points behind
 
That code looks familiar. However, you changed it to be an inconsiderate server operator! Remove that code and leave it how I had it.

RedRobster 08-17-2010 18:46

Re: Change name points behind
 
Quote:

Originally Posted by fysiks (Post 1273884)
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 :wink: as always. :P

fysiks 08-17-2010 18:47

Re: Change name points behind
 
Quote:

Originally Posted by RedRobster (Post 1273891)
I didn't even look at the stock that fysiks gave you. Haha. He is right :wink: as always. :P

Yeah, I could have sworn I answered this question once already in the thread that it was requested in.

MrMaCEEE 08-17-2010 19:44

Re: Change name points behind
 
Quote:

Originally Posted by fysiks (Post 1273884)
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

fysiks 08-17-2010 20:12

Re: Change name points behind
 
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.

platzpatrone 08-17-2010 21:04

Re: Change name points behind
 
http://forums.alliedmods.net/showthread.php?t=128498 :shock:

the problem is that he never do what u're trying to say him. xD

GXLZPGX 08-17-2010 21:10

Re: Change name points behind
 
Quote:

Originally Posted by fysiks (Post 1274008)
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>


All times are GMT -4. The time now is 21:50.

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