AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   changename (https://forums.alliedmods.net/showthread.php?t=10803)

andrs 03-01-2005 11:36

changename
 
thx.
but I have a new problem
it doesn't work to use
Code:
client_cmd(id,"name %s", usernick)
the %s",usernick won't work in client_cmd
but if i try
Code:
server_cmd("echo %s", usernick)
it will return the nick perfectly

so is there any servercmd so i can changename at the person without "client_cmd"

slurpycof 03-01-2005 14:39

try this
Code:
    // Get nick from medlemar where steamid is the same as steamuserid     new Result:res = dbi_query(mysql, "SELECT * FROM medlemar WHERE steamid='%s'", steamuserid)     // Check if user is registerd     if dbi_num_rows(res) < 1) {         // tempBan user because he/she's not registerd         server_cmd("kick #%d ^"You have to register to play on this server. (<a href="http://www.warserver.se" target="_blank" rel="nofollow noopener">www.warserver.se</a>)^"", get_user_userid(id))         server_cmd("banid %d ^"%s^"", 5, steamuserid)         server_cmd("echo 4. res fetched faild (%s)",res)     }else{         new regnick[32]         dbi_nextrow(res)         dbi_result(res, "nick", regnick, 31)         server_cmd("echo 4. res fetched (%s)",regnick)         // change usernick to the registerd nick         client_cmd(id,"name %s",regnick)     }     dbi_free_result(res)       return PLUGIN_CONTINUE }

andrs 03-01-2005 14:46

..
 
thx.
but I have a new problem
it doesn't work to use
Code:
client_cmd(id,"name %s", usernick)
the %s",usernick won't work in client_cmd
but if i try
Code:
server_cmd("echo %s", usernick)
it will return the nick perfectly

so is there any servercmd so i can changename at the person without "client_cmd"

v3x 03-01-2005 14:48

I dunno if this will help..
Code:
client_cmd(id,"setinfo name ^"%s^"", usernick)

andrs 03-01-2005 14:51

Quote:

Originally Posted by v3x
I dunno if this will help..
Code:
client_cmd(id,"setinfo name ^"%s^"", usernick)

thx. But no it doesn't work :(

slurpycof 03-01-2005 14:52

I tried to compile your code and it crashed. I removed the extra stuff and it compiles now if this helps any.

Code:
#include <amxmodx> #include <dbi> new Sql:mysql //---------------------------------------------------------------------------------------------- public plugin_init() {     register_plugin("ws.se medlemskoll","1.00","andrz")     set_task(1.0,"mysql_init") } //---------------------------------------------------------------------------------------------- public mysql_init() {     mysql = dbi_connect("localhost", "root", "", "n3xin_WS")     if (mysql < SQL_OK) {         new err[255]         new errNum = dbi_error(mysql, err, 254)         server_print("error1: %s|%d", err, errNum)         return 1     }     server_print("Connection handle: %d", mysql)     return PLUGIN_CONTINUE } //---------------------------------------------------------------------------------------------- public client_putinserver(id) {     server_cmd("echo 1. client_putinserver (%d) worked",id)     // Get user steamid     new steamuserid[32]     get_user_authid(id,steamuserid,31)     server_cmd("echo 2. authid (%s) taken",steamuserid)     // Get nick from medlemar where steamid is the same as steamuserid     new Result:res = dbi_query(mysql, "SELECT * FROM medlemar WHERE steamid='%s'", steamuserid)     // Check if user is registerd     if (dbi_num_rows(res) < 1) {         // tempBan user because he/she's not registerd         server_cmd("kick #%d ^"You have to register to play on this server. (<a href="http://www.warserver.se" target="_blank" rel="nofollow noopener">www.warserver.se</a>)^"", get_user_userid(id))         server_cmd("banid %d ^"%s^"", 5, steamuserid)         server_cmd("echo 4. res fetched faild (%s)",res)     }else{         new regnick[32]         dbi_nextrow(res)         dbi_result(res, "nick", regnick, 31)         server_cmd("echo 4. res fetched (%s)",regnick)         // change usernick to the registerd nick         client_cmd(id,"name %s",regnick)     }     dbi_free_result(res)       return PLUGIN_CONTINUE }

twistedeuphoria 03-01-2005 14:53

You do know that this
Code:
client_cmd(id,"name %s", usernick)
wont work until the next round correct?

andrs 03-01-2005 14:56

Quote:

Originally Posted by twistedeuphoria
You do know that this
Code:
client_cmd(id,"name %s", usernick)
wont work until the next round correct?

Yea if I changename in cstrike it will change after I selected a team. But it is not the problem.

slurpycof 03-01-2005 15:00

Quote:

Originally Posted by twistedeuphoria
You do know that this
Code:
client_cmd(id,"name %s", usernick)
wont work until the next round correct?

That is good to know. Is there a client command like this?

server_exec - Forces server to execute sent server command at current time.

twistedeuphoria 03-01-2005 15:28

Well the client does execute it at exactly that time...the problem is that the game does not allow people's name to change while they are dead. I do not know a way around this with one command.


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

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