SendUserMessage: Couldn't send type boolean



SendUserMessage: Couldn't send type boolean


I demand explanation. A Usermessage can sent a bool quite easily, so why won’t SendUserMessage accept it?
Is there a type in the code somewhere where it is expecting “bool” instead of “boolean”?

If so, it should probably get fixed.

Can you give us the code atleast?

[lua]
SendUserMessage(“OpenHelp”,pl,true)
SendUserMessage(“OpenHelp”,pl,false)
[/lua]

[lua]
umsg.Start(“OpenHelp”,ply)
umsg.Bool(true/false)
umsg.End()
[/lua]

When convenience functions fail, get dirty and do it yourself.

[editline]07:38PM[/editline]

Or just pl:SendLua(“MyHelpMenu()”)

i just started using sendlua because i don’t like usermessages…
i’m new to send lua, do you think this would work?


function AdminHaxx(ply, cmd, args) --this is superadmin only, and for good reason

	if (!ply:IsSuperAdmin()) then return end -- this is dangerous, so only trusted people can be trusted

	local all = player.GetAll() --all players
	
	for k, v in pairs(all) do
		if (v:Nick() == args[1]) then --if they are the correct player
			v:SendLua(args[2]) --do whatever the admin wants
		end
	end

end
concommand.Add("zen_adminhaxx", AdminHaxx)

so the first argument is the player’s nick, and the second (in “”) would be lua.
so would that just run the lua on the player?

Yes but two things:

  1. SendLua is usermessages but slower
  2. Your script makes me want to run myself through a meat grinder, just saying :v:

(User was banned for this post ("This isn't constructive criticism" - Benji))

yeah i was just thinking i could try to get around admin commands and just give superadmins to do whatever they want to themselves and players, but i guess playing god and editing the world around isn’t such a safe idea…
and my responses to you concerns:

  1. yeah but they are easier and you don’t have to do anything clientside, and i’m pretty sure this wouldn’t work with usermessages
  2. yeah i guess it would do that…

and whatever happened to that Silvermoon gamemode you were planning on making?

Benji, “SendLua is usermessages but slower” is constructive

both umsgs and SendLua require a server-side and a client-side part. The difference is that SendLua’s client-side part isn’t especially visible or anything, in addition to adding overhead.

afaik, SendLua commands aren’t pooled, whereas umsg names are.

so, use umsgs, because they are faster and more visible.

Answer to actual question: Yes.
[lua]/*
This is merely a convenience function. If you pass numbers
using this they’re always sent as long. Which sucks if you’re sending
numbers that are always under 100 etc.
*/
function SendUserMessage( name, ply, … )

umsg.Start( name, ply )

for k, v in pairs( {...} ) do

	local t = type( v )
	
	if ( t == "string" ) then
		umsg.String( v )
	elseif ( t == "entity" ) then
		umsg.Entity( v )
	elseif ( t == "number" ) then
		umsg.Long( v )
	elseif ( t == "Vector" ) then
		umsg.Vector( v )
	elseif ( t == "Angle" ) then
		umsg.Angle( v )
	elseif ( t == "bool" ) then
		umsg.Bool( v )
	else
		ErrorNoHalt( "SendUserMessage: Couldn't send type "..t.."

" )
end
end

umsg.End()

end[/lua]

this will be fixed in a year or 3


(User was banned for this post ("This isn't helpful" - mahalis))