Raised This Month: $ Target: $400
 0% 

name blocking, changing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
m0v3
Member
Join Date: May 2009
Old 11-20-2010 , 20:18   name blocking, changing
Reply With Quote #1

Hi,

I have this function , using which you can change player name to the one you want , also blocking name changing for players. It works also for dead people , what is pretty handy for me, but causes server lags , chokes , sometimes (not always ) even svc_bad's. Is there a better solution for the aim I want, or can my function be optimised in any ways? Thank You.

Working, but still laggy solution:
PHP Code:
public plugin_init() {
    
    
register_plugin("test","0.1","m0v3")
    
    
register_forward(FM_ClientUserInfoChanged"forward_client_userinfochanged"
}

public 
forward_client_userinfochanged(idbuffer) {

    if ( !
IsConnected[id] )
        return 
FMRES_IGNORED
        
    
static val[32];
    static 
name[33];
    static 
neimas[36];
   
formatex(neimascharsmax(neimas), "[%03i].%s"SKILLplayer_name[id])
    
get_user_name(idnamecharsmax(name))
    
    
engfunc(EngFunc_InfoKeyValuebuffer"name"valsizeof val 1);
    
    if ( 
equal(name neimas) && equal(val neimas) )
        return 
FMRES_IGNORED
        

    engfunc
(EngFunc_SetClientKeyValueidbuffer"name"neimas);
   
    
engclient_cmdid "name ^"%s^"" player_name[id] );

    return 
FMRES_SUPERCEDE


Last edited by m0v3; 11-22-2010 at 04:54.
m0v3 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-20-2010 , 21:52   Re: name blocking, changing
Reply With Quote #2

If you are going to be putting stats in someones name then you should do it using engclient_cmd(id, "name", newname) and you can also, when they change their name just re-add the stats to it. (not really helping on your issue but that's my thoughts).

You can also change:

Code:
    if ( SKL < 100 )
            format( neimas , 35 , "[0%i].%s" , SKL , player_name[id] )
    else
            format( neimas , 35 , "[%i].%s" , SKL , player_name[id] )
to just:
Code:
formatex(neimas, charsmax(neimas), "[%03i].%s", SKL, player_name[id])
__________________

Last edited by fysiks; 11-21-2010 at 16:58. Reason: Fixed code noted by Exolent.
fysiks is offline
m0v3
Member
Join Date: May 2009
Old 11-21-2010 , 07:14   Re: name blocking, changing
Reply With Quote #3

Whats the difference between engclient_cmd ant client_cmd ?

Quote:
and you can also, when they change their name just re-add the stats to it
It could be , but in my situation , the name is fixed.

Code:
formatex(neimas, charsmax(neimas), "[%02i].%s", SKL, player_name[id])

%02i - what exactly does this do ?
m0v3 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 11-21-2010 , 09:44   Re: name blocking, changing
Reply With Quote #4

Quote:
Originally Posted by m0v3 View Post
%02i - what exactly does this do ?
Formats an integer.
2 = minimum length ("3" -> " 3". notice the space)
0 = replace spacers with zeros ("3" -> "03")

It actually should be "%03i" for 3 digits.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 11-21-2010 , 09:53   Re: name blocking, changing
Reply With Quote #5

#manager @aitvaras ???
reinert is offline
m0v3
Member
Join Date: May 2009
Old 11-21-2010 , 16:25   Re: name blocking, changing
Reply With Quote #6

@Exolent[jNr]
Thank You, will use

@reinert
Taip ;)

To thread

Still lagg problem exists.

Last edited by m0v3; 11-21-2010 at 16:27.
m0v3 is offline
Reply


Thread Tools
Display Modes

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 11:20.


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