PDA

View Full Version : Help with a lua script!



Jemstar
13-06-2012, 10:04
Hi,

Need some help with a lua for autosetlevel written by "Perlo_0ung?!" for N!tmod

it works fine on NQ except for thew noguid function, Here is what it was:


function noGuid(playerID)
local userinfo = et.trap_GetUserinfo( playerID )
local guid = et.Info_ValueForKey( userinfo, "cl_guid" )
if guid == "unkown" then

The issue is NQ uses "NO_GUID" so I changed it to:


function noGuid(playerID)
local userinfo = et.trap_GetUserinfo( playerID )
local guid = et.Info_ValueForKey( userinfo, "cl_guid" )
if guid == "NO_GUID" then

It works well except that some players remain as "unkown" unless they do the /pb_cl_enable command. So I added:


function noGuid(playerID)
local userinfo = et.trap_GetUserinfo( playerID )
local guid = et.Info_ValueForKey( userinfo, "cl_guid" )
if guid == "NO_GUID" then
return true
elseif guid == "unkown" then
return true
end
end

It still blocks "NO_GUID" how ever "unkown" still gets promoted!!

Any suggestions?

Was thinking about loading a lua to get the client to send a server command thru:


function et_ClientBegin( _clientNum )
et.trap_SendConsoleCommand(et.EXEC_NOW, "csay " .. _clientNum .. "\"/pb_cl_enable"\n")
end

Im new at writting (my first attempt - well second first was way tooooo ambitious!) can edit ok tho, is this something that would work? Or am I way off the mark!!(probably).

Or is it possible to get the original edit to work for both "NO_GUID" and "unkown"?

Any advice is very appreciated,
Jem.

testforecho
15-06-2012, 22:35
I don't think you can force a client to do pb_cl_enable, and anyway it would disconnect them from the server when they do it

you typed 'unkown' instead of 'unknown', I didn't spot it at first, maybe that? :p

Jemstar
16-06-2012, 00:34
you typed 'unkown' instead of 'unknown', I didn't spot it at first, maybe that? :p

LOLOL I did too, I should stop editing stuff when I drunk and with no sleep. The number of times I looked at that and didnt see my typo!!

Thanks for pointing that out...fresh eyes FTW. Will see how it goes!!

BTW yep it did disconnect me with that additional script LOL. Was just an idea!!

Thanks again for your help, will see if it works now!!

Jem.

Jemstar
16-06-2012, 01:07
Yep works a treat, so besides the typo the original edit was fine!!

Dam me and my dyslexai!!! jk

testforecho
16-06-2012, 11:06
Yep works a treat, so besides the typo the original edit was fine!!
good


Dam me and my dyslexai!!! jk
well, it took me a while to find out as well :p
I had even tested it, and I even added a debug function to print the guid,



function print_debug( text )
et.trap_SendConsoleCommand(et.EXEC_APPEND, "qsay \"" .. text .. "\"\n")
end

when I realized it was just a typo...

btw I never got the 'NO_GUID' text (I've tested it with an etkey but pb disabled, and I got 'unknown'), when is that 'NO_GUID' supposed to happen, just curious

Jemstar
20-06-2012, 10:32
on our server it seems to be after /pb_cl_enable is typed in console (if there is no key ofc). The shrubb was filling up with admin levels for players with guid "NO_GUID" and a few "unknown" so was deleting them nightly after saving as lvl 0!! but since typo fixed all is good..so thanks for your fresh eyes hehe.