Jump to content

outputChatBox problem


Recommended Posts

Posted

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.

Posted

That's because the triggerClientEvent is being triggered on all clients. You have to specify the actual client. Try this:

triggerClientEvent(client, "nomoney", resourceRoot)

 

Discord: its.tails

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...