AlliedModders

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

andrs 02-28-2005 16:42

get_user_authid error
 
I'm a newbie at this so plz be nice.
What is wrong?

I get this error:
Client with that name or userid not found

note this is only a small part of the code
Code:
public client_connect(id) {     new steamuserid[32]     get_user_authid(id,steamuserid,31)     new Result:res = dbi_query(mysql, "SELECT nick FROM medlemar WHERE steamid='%s'", steamuserid)     if (res <= RESULT_NONE) {         server_cmd("amx_ban %s 1 reason",id)         return 1     }     client_cmd(id,"nick %s",res)     return PLUGIN_CONTINUE }

xeroblood 02-28-2005 16:49

Code:
//... server_cmd("amx_ban #%d reason", get_user_userid(id) ) //...

andrs 02-28-2005 18:09

More help
 
Code:
public client_connect(id) {     new steamuserid[32]     get_user_authid(id,steamuserid,31)     if (equal(steamuserid,"STEAM_ID_PENDING")) return PLUGIN_CONTINUE     new Result:res = dbi_query(mysql, "SELECT nick FROM medlemar WHERE steamid='%s'", steamuserid)     if (res <= RESULT_NONE) {         server_cmd("amx_ban #%d %d %s", get_user_userid(id), 5, "www.warserver.se" )         return PLUGIN_CONTINUE     }     client_cmd(id,"nick %s",res)     return PLUGIN_CONTINUE }

It wont work. why?

Table: medlemar
steamid: STEAM_0 : 1 : 33067
nick: andrs

My steam id is STEAM_0:1:33067

I've echo the authid and it returned "STEAM_0 : 1 : 33067"

xeroblood 02-28-2005 18:19

Why is there spaces in the steam id u posted??

And maybe try putting in some trace code, like print to console in every block to see where things are going...

andrs 02-28-2005 18:23

Quote:

Originally Posted by xeroblood
Why is there spaces in the steam id u posted??

And maybe try putting in some trace code, like print to console in every block to see where things are going...

It ends with a ban. And why I have spaces i becouse it's spaces in auth (for a sick reason)

v3x 02-28-2005 18:29

Try..
Code:
server_cmd("amx_ban #%d 5 ^"www.warserver.de^"", get_user_userid(id))

BlueRaja 02-28-2005 19:27

wtf
Don't use amx commands when using server_cmd() - That's EXTREMELY bad coding practice...

Try this:
Code:
new id,iMinutes,szSteamid[32] get_user_authid(id,szSteamid,31) server_cmd("kick #%d ^"Your steamid has been banned, because I hate you.^"", get_user_userid(id)) server_cmd("banid %d ^"%s^"", iMinutes, szSteamid)
or
Code:
new id,iMinutes,ip[32] get_user_ip(id,ip,31,1) server_cmd("kick #%d ^"Your ip has been banned, because you're ugly and you smell funny^"", get_user_userid(id)) server_cmd("addip %d %s", iMinutes, ip)

There may or may not be quotes around "ip" - I honestly don't remember.

andrs 03-01-2005 10:28

res return wrong value
 
sry dubble post

andrs 03-01-2005 10:28

Re: res return wrong value
 
Code:
new Result:res = dbi_query(mysql, "SELECT `nick` FROM `medlemar` WHERE `steamid`='%s'", steamuserid) server_cmd("echo 4. res fetched (%s)",res)

res will return the steamid NOT `nick` for the "medlemar" table.

Why? and how do I get it to work?

Code:
public client_putinserver(id) {     server_cmd("echo 1. client_putinserver(%d) worked", id)     new steamuserid[32]     get_user_authid(id,steamuserid,31)     server_cmd("echo 2. authid (%s) taken",steamuserid)     if (equal(steamuserid,"STEAM_ID_PENDING")) return PLUGIN_CONTINUE     server_cmd("echo 3. steamid is not Steam_id_pending")     new Result:res = dbi_query(mysql, "SELECT `nick` FROM `medlemar` WHERE `steamid`='%s'", steamuserid)     if (res <= RESULT_NONE) {         server_cmd("echo 4. res fetched faild (%s)",res)         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)         return PLUGIN_CONTINUE     }     server_cmd("echo 4. res fetched (%s)",res)     client_cmd(id,"name %s",res)     return PLUGIN_CONTINUE }


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

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