SendLua + OpenURL = Open gui for every players...

Yup !

I create a script in LUA to display my collection on Workshop.

I made this :



function ChatCommand(ply, txt)
	if (string.sub(txt, 1, 7) == "!addons") then
		ply:SendLua([[gui.OpenURL("http://steamcommunity.com/sharedfiles/filedetails/?id=268799573")]])
	end
end
hook.Add("PlayerSay", "SayAddon", ChatCommand)

I think its good, but, when i said : !addons, my gui is displayed for every players.

How i can fix this ?

Thx

That shouldn’t happen. ply is the one who chatted and you only sendlua to him.

:frowning: its weird…

37.59.46.110:27065 -> if you want test…



function ChatCommand(ply, txt)
	if (string.sub(txt, 1, 7) == "!addons") then
		ply:SendLua([[gui.OpenURL("http://steamcommunity.com/sharedfiles/filedetails/?id=268799573")]])
                return ""
	end
end
hook.Add("PlayerSay", "SayAddon", ChatCommand)

Try adding that I think. I don’t think you’d need to though. So… hummm.

Where did you put the file?

Solved…

I dont know why, but i made this :




function ChatCommand(ply, text)
	if (string.sub(text, 1, 7) == "!addons") then
		if ply==LocalPlayer() then
			ply:SendLua([[gui.OpenURL("http://steamcommunity.com/sharedfiles/filedetails/?id=268799573")]])
		end
	end
end
hook.Add("PlayerSay", "SayAddon", ChatCommand)



–’ !