Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google Log In with Steam Sign In
  • Create Account
Photo

Lua Help!

- - - - -

  • Please log in to reply
2 replies to this topic

#1
OFFLINE   PurpleLePro

PurpleLePro

    Newbie

  • Members
  • Pip
  • 2 posts
0
Unknown

So today i was trying to do a few things with lua and just messing around with it but i think something is wrong yet i can't figure it out..

 

Modname = "asd"
Version = "asd"
Author  = "asd"


donguids = { 
"SilentGuid",
}




function et_InitGame(levelTime,randomSeed,restart)
        maxclients = tonumber( et.trap_Cvar_Get( "sv_maxClients" ) )
        et.RegisterModname(Modname .. " by "..Author.." " .. Version)
                       
end
 

function et_ClientCommand(client, command)
	local sguid = et.gentity_get(client, "sess.guid")
	local cmd = string.lower(command)
	
	if sguid == table.getn(donguids) then
		if cmd == "don1" then
			et.trap_SendServerCommand(client, "print \"You are a donator! \n")
		end
	else
		et.trap_SendServerCommand(client, "print \"^1You are not a Donator, Donate to the server to use these commands! \n")
	end

 

What im trying to do is to check the users Silent Guid(silentID) then check if there ID is is the donguids table then if so allow them to use the command, if not tell them you are not a donator. But each time i try it out it just auto prints outs

et.trap_SendServerCommand(client, "print \"^1You are not a Donator, Donate to the server to use these commands! \n")

 

Does anyone have any ideas or suggestions? Would appreciate it thanks c;



#2
OFFLINE   Dragonji

Dragonji

    Advanced Member

  • Members
  • PipPipPipPip
  • 514 posts
142
On the road to fame
  • LocationPoland
Check what sguid returns, you may be surprised.
et.trap_SendConsoleCommand(et.EXEC_APPEND, string.format("chat %s ^8<- full sguid\n", sguid))

Edited by Dragonji, 12 April 2013 - 02:25 PM.


#3
OFFLINE   PurpleLePro

PurpleLePro

    Newbie

  • Members
  • Pip
  • 2 posts
0
Unknown

Thanks now i know whats wrong, total mishap on my part c;






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users