AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Set new name (https://forums.alliedmods.net/showthread.php?t=147662)

Jelle 01-12-2011 07:58

Set new name
 
How do I properly set a new name for a client?

I know how to get the name the client already has, but not sure how to set a new one without slowhacking them.

nnajko 01-12-2011 09:04

Re: Set new name
 
PHP Code:

set_user_info(index"name""nnajko"


Jelle 01-12-2011 09:35

Re: Set new name
 
Nice, thanks!

But what if I have an array which contains a name, and I want to give that name to the player, but also something else in front of it?

nikhilgupta345 01-12-2011 09:36

Re: Set new name
 
Use format and for the third parameter of set_user_info put the formatted string in.

Jelle 01-12-2011 09:55

Re: Set new name
 
PHP Code:

new Name[32]
    
get_user_name(idname31)
    
    new 
FormatName
    format
(FormatName31Name

Then do set_user_info(id, "name", "[InFrontOfName]"FormatName)?

Never done this before and I am a bit confused regarding the format stuff.

drekes 01-12-2011 10:32

Re: Set new name
 
PHP Code:

new array[] = "name";
new 
prefix[] = "[prefix]";

new 
Name[35];
formatex(Namecharsmax(Name), "%s %s"prefix, array);
set_user_info(id"name"Name); 


Jelle 01-12-2011 14:34

Re: Set new name
 
Thanks. I think I got it working.


All times are GMT -4. The time now is 02:11.

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