banimod / etpro / ettv forums Forum Index banimod / etpro / ettv forums
Bani's Discussion Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

et_ClientCommand can't get cmd "name" ?

 
Post new topic   Reply to topic    banimod / etpro / ettv forums Forum Index -> ET Modding
View previous topic :: View next topic  
Author Message
Luk4ward



Joined: 30 Jul 2006
Posts: 236
Location: Poland

PostPosted: Wed Feb 20, 2008 10:48 am    Post subject: et_ClientCommand can't get cmd "name" ? Reply with quote

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:

/name

_________________
wolFTeam.pl
Back to top
View user's profile Send private message Visit poster's website
Major Zeman



Joined: 20 Mar 2007
Posts: 16
Location: Czech Republic

PostPosted: Wed Feb 20, 2008 3:13 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Luk4ward



Joined: 30 Jul 2006
Posts: 236
Location: Poland

PostPosted: Fri Feb 22, 2008 5:13 am    Post subject: Reply with quote

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:
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
Back to top
View user's profile Send private message Visit poster's website
McSteve



Joined: 12 Sep 2006
Posts: 113

PostPosted: Fri Feb 22, 2008 8:42 am    Post subject: Reply with quote

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:
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
Back to top
View user's profile Send private message
Luk4ward



Joined: 30 Jul 2006
Posts: 236
Location: Poland

PostPosted: Fri Feb 22, 2008 9:58 am    Post subject: Reply with quote

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?
_________________
wolFTeam.pl


Last edited by Luk4ward on Tue Feb 26, 2008 6:01 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Hadr0



Joined: 15 Dec 2005
Posts: 5
Location: shiven

PostPosted: Fri Feb 22, 2008 2:13 pm    Post subject: Reply with quote

this alternative seems to work for me:
Code:

function RenameUser(clientNum, newname)
  local userinfo = et.trap_GetUserinfo(clientNum)
  userinfo = et.Info_SetValueForKey(userinfo, "name", newname)
  et.trap_SetUserinfo(clientNum, userinfo)
  et.ClientUserinfoChanged(clientNum)
end
Back to top
View user's profile Send private message
Luk4ward



Joined: 30 Jul 2006
Posts: 236
Location: Poland

PostPosted: Fri Feb 22, 2008 5:05 pm    Post subject: Reply with quote

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

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    banimod / etpro / ettv forums Forum Index -> ET Modding All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group