Jump to content

outputChatBox problem


Recommended Posts

I have a problem with the visibility of outputChatBox. So it's part of a GUI. You press the button on the GUI, it sends the command to the server, the server checks if you have the money for the stuff and if you have, you got a fancy new weapon, but if you don't, the server triggers a clientside event, wich outputs the message, that you don't have enough money. The problem is, that the message, that warns you, that you don't have the money, appears for every online player.

CLIENTSIDE

function nomoney()
outputChatBox("Nincs rá pénzed.")
end
addEvent("nomoney", true)
addEventHandler("nomoney", resourceRoot, nomoney)

SERVERSIDE

function Deagleb()
money = getPlayerMoney(client)
	if money>=100 then
	setPlayerMoney(client, money-100)
	giveWeapon(client, 24, 14, true)
	else
	triggerClientEvent("nomoney", resourceRoot)
	end
end
addEvent("Deagle", true)
addEventHandler("Deagle", resourceRoot, Deagleb)

Thanks for the help.

Link to comment

Instead of triggering a client event which is very inefficient in this situation in the "else" section you can just put the outputChatBox message there and set it visible only to the client so that line 7 would be something like:

outputChatBox ("yourmesaage",client)

 

  • Like 2
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...