et_ClientCommand can't get cmd "name" ?

Discussions about ET modding (sdk code, player/weapon modeling)

Moderators: Forum moderators, developers

Post Reply
User avatar
Luk4ward
Posts: 236
Joined: Sun Jul 30, 2006 1:55 pm
Location: Poland
Contact:

et_ClientCommand can't get cmd "name" ?

Post by Luk4ward »

What is going on? Is it connected to the fact that punkbuster or etadmin mod capturing the command before lua or smth?

p.s im talking about client command:

Code: Select all

/name
wolFTeam.pl
Major Zeman
Posts: 16
Joined: Tue Mar 20, 2007 1:37 am
Location: Czech Republic
Contact:

Post by Major Zeman »

I believe the /name command doesn't get sent to the server at all. It should be processed on client side already, and you should only get userinfo changed or sometihng liek that (which you can intercept with lua).
lua > me
User avatar
Luk4ward
Posts: 236
Joined: Sun Jul 30, 2006 1:55 pm
Location: Poland
Contact:

Post by Luk4ward »

i see, thx for reply ! Im trying to create some name limit mod which will not kick a player and instead of it after the limit it will restoring original name. Im using Hadro's code but the only problem is now how to set the nick and block from setting the nick because i can't run et_clientcommand its very complicated ;[

so far i got, but its not working:

Code: Select all

function et.trap_Maxname(clientNum, ret)

local msg = string.format("cpmsay  \"^3ID: ^g" .. clientNum ..  "^7 reached the name change limit. ^1Restoring original name !\n")
et.trap_SendConsoleCommand(et.EXEC_APPEND, msg)
et.trap_SendServerCommand(clientNum, string.format("print \"" .. ret .. "\n"))

local userinfo = et.trap_GetUserinfo( clientNum  )

local infostring = et.Info_RemoveKey( userinfo, "name" )							
local setstring = et.Info_SetValueForKey( infostring, "name", origin_name[clientNum] )

			et.trap_SetUserinfo( clientNum, setstring )
			
end
edit:

debugged it and vars are ok but its not changing the nick ;/
wolFTeam.pl
McSteve
Posts: 113
Joined: Tue Sep 12, 2006 7:41 am

Post by McSteve »

At a glance, I'm not sure you need "et.Info_RemoveKey" at all. Further, I had a look back at Gotenks' rename function in Powermod (because I've used that before and I know it works).

Code: Select all

function RenameUser(PlayerID,Name)
	local userinfo = et.trap_GetUserinfo( PlayerID )
	local PlayerName = et.Q_CleanStr( et.Info_ValueForKey( userinfo, "name" ) )
	userinfo = et.Info_SetValueForKey( userinfo, "name", Name )
	et.trap_SetUserinfo( PlayerID, userinfo )
	
	et.trap_SendConsoleCommand(et.EXEC_APPEND, "mute " .. "\"" .. PlayerName .. "\"" .. "\n" )
	PlayerName = et.Q_CleanStr( et.Info_ValueForKey( userinfo, "name" ) )
	et.trap_SendConsoleCommand(et.EXEC_APPEND, "unmute " .. "\"" .. PlayerName .. "\"" .. "\n" )
end
Your code more or less uses the same lines as his but your problem might be in updating the userinfo. You can see that Gotenks used a little mute/unmute handywork, which I think forces the new info on the client (I'm assuming this since it appears to mute with the old name and then unmute with the newname).

Other than that, I could only suggest spamming your code with debugging print lines, checking all of your variables (inc info) at each step in your code.

Best of luck, hope you get sorted.
GhosT:McSteve
Ghostworks Gaming Community
User avatar
Luk4ward
Posts: 236
Joined: Sun Jul 30, 2006 1:55 pm
Location: Poland
Contact:

Post by Luk4ward »

hey, thx for the help but this code is not working either :<

as u can see setstring got modified name but it is not setting and userinfo is still the same ;/

btw SetUserinfo is putting the name at the end of userinfo, is it ok?
Last edited by Luk4ward on Tue Feb 26, 2008 6:01 am, edited 1 time in total.
wolFTeam.pl
User avatar
Hadr0
Posts: 5
Joined: Thu Dec 15, 2005 11:25 pm
Location: shiven

Post by Hadr0 »

this alternative seems to work for me:

Code: Select all

function RenameUser&#40;clientNum, newname&#41;
  local userinfo = et.trap_GetUserinfo&#40;clientNum&#41;
  userinfo = et.Info_SetValueForKey&#40;userinfo, "name", newname&#41;
  et.trap_SetUserinfo&#40;clientNum, userinfo&#41;
  et.ClientUserinfoChanged&#40;clientNum&#41;
end
User avatar
Luk4ward
Posts: 236
Joined: Sun Jul 30, 2006 1:55 pm
Location: Poland
Contact:

Post by Luk4ward »

Cheers now its working somehow, wooha another module done. Many thx Hadro i have already added you on my credits' list ;)

It will be added into new version of this . Propably tomorrow i will post it to public,

thx for all the help, much appreciated
wolFTeam.pl
Post Reply