Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- client side
- addEventHandler( "onClientGUIClick", resourceRoot,
- function()
- if (source == GUIEditor.button[1]) then -- The button to buy
- guiSetVisible(GUIEditor.window[1], true) -- The window to buy
- showCursor(true)
- elseif (source == buyButton) then -- add your button to buy
- buyFish()
- end
- end)
- function buyFish()
- local money = getPlayerMoney(localPlayer)
- if (money >= 300) then
- outputChatBox("You have bought a fish food.")
- triggerServerEvent("buyFish", resourceRoot)
- else
- outputChatBox("You don't have enough money.")
- end
- end
- -- server side
- function buyFish()
- takePlayerMoney(client, 300)
- end
- addEvent("buyFish", true)
- addEventHandler("buyFish", root, buyFish)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement