AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [help]Why doesn't it work? (https://forums.alliedmods.net/showthread.php?t=320446)

iamyounghill 12-22-2019 23:40

[help]Why doesn't it work?
 
I made a sample amxx ,but it doesn't work well .When clients connected ,it makes clients change their name many times,cyclically!
But I just want them to change one time .

[.sma]
..
public client_infochanged( id )
{
if( is_user_admin(id) )
{
format( newname, charsmax( newname ), "%s %s", tag1, oldname );
set_user_info( id, "name", newname );
return PLUGIN_HANDLED;
}

else
{
format( newname, charsmax( newname ), "%s %s", tag2, oldname );
set_user_info( id, "name", newname ) ;
return PLUGIN_HANDLED;
}

return PLUGIN_HANDLED;

}
..

Is the code "return PLUGIN_HANDLED" has some thing worng?

iceeedr 12-23-2019 06:42

Re: [help]Why doesn't it work?
 
client_infochanged is a fakemeta forward so you use return return FMRES_ *

OciXCrom 12-23-2019 07:41

Re: [help]Why doesn't it work?
 
client_infochanged isn't called when the client connects. It's called when the player's info changes, which happens quite often.

fysiks 12-26-2019 03:48

Re: [help]Why doesn't it work?
 
Probably need to use client_putinserver() or client_authorized() (which ever one happens first). Note that the order is indeterminate so you'll have to implement it so that it happens in that later one.


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

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