Jump to content

Help With Money_Gui


Recommended Posts

Hi all i just run my brain and Make this but is it correct ?

local spam = false 
local Money = getPlayerMoney(source) 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
GUIEditor_Window[1] = guiCreateWindow(470,264,608,378,"Money_System By Dev-PoinT",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Image[1] = guiCreateStaticImage(219,20,116,124,"images/money.png",false,GUIEditor_Window[1]) 
GUIEditor_Image[2] = guiCreateStaticImage(37,238,129,91,"images/yes.png",false,GUIEditor_Window[1]) 
GUIEditor_Image[3] = guiCreateStaticImage(421,247,129,79,"images/no.png",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(41,339,196,18,"Yes To Show Your Money",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
guiSetFont(GUIEditor_Label[1],"clear-normal") 
GUIEditor_Label[2] = guiCreateLabel(410,340,158,15,"No To Hide The Window",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[2],255,0,0) 
guiSetFont(GUIEditor_Label[2],"clear-normal") 
GUIEditor_Button[1] = guiCreateButton(195,174,173,36,"Give Me Money",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[1],"clear-normal") 
addEventHandler('onClientGUIClick',root, 
    function() 
            if source == GUIEditor_Image[2] then 
                   if spam then outputChatBox("You have to wait 30 sec",255,0,0) return end 
                   local sound = playSound("sounds/cash.mp3") 
                   setSoundVolume(sound, 0.5) 
                   triggerServerEvent ("showMoney", localPlayer) 
                   spam = true 
                   setTimer(function() spam = false end,30000,1) 
                   elseif source == GUIEditor_Image[3] then 
                   guiSetVisible(GUIEditor_Window[1],false) 
            end 
     end 
) 

Link to comment

what about this ??

local spam = false 
local Money = getPlayerMoney(source) 
local reward = math.random(10,100) 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
GUIEditor_Window[1] = guiCreateWindow(470,264,608,378,"Money_System By Dev-PoinT",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Image[1] = guiCreateStaticImage(219,20,116,124,"images/money.png",false,GUIEditor_Window[1]) 
GUIEditor_Image[2] = guiCreateStaticImage(37,238,129,91,"images/yes.png",false,GUIEditor_Window[1]) 
GUIEditor_Image[3] = guiCreateStaticImage(421,247,129,79,"images/no.png",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(41,339,196,18,"Yes To Show Your Money",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
guiSetFont(GUIEditor_Label[1],"clear-normal") 
GUIEditor_Label[2] = guiCreateLabel(410,340,158,15,"No To Hide The Window",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[2],255,0,0) 
guiSetFont(GUIEditor_Label[2],"clear-normal") 
GUIEditor_Button[1] = guiCreateButton(195,174,173,36,"Give Me Money",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[1],"clear-normal") 
addEventHandler('onClientGUIClick',root, 
    function() 
            if source == GUIEditor_Image[2] then 
                   if spam then outputChatBox("You have to wait 30 sec",255,0,0) return end 
                   local sound = playSound("sounds/cash.mp3") 
                   setSoundVolume(sound, 0.5) 
                   triggerServerEvent ("showMoney", localPlayer) 
                   spam = true 
                   setTimer(function() spam = false end,30000,1) 
                   elseif source == GUIEditor_Image[3] then 
                   guiSetVisible(GUIEditor_Window[1],false) 
            end 
     end 
) 
  
addEventHandler('onClientGUIClick',root, 
    function() 
            if source == GUIEditor_Button[1] then 
            givePlayerMoney(source,reward) 
        end 
    end 
) 

Link to comment

Same incorrect.

Read all.

local spam = false 
local Money = getPlayerMoney(source) -- source use only in event ( NOT OUTSIDE ) 
local reward = math.random(10,100) 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
GUIEditor_Window[1] = guiCreateWindow(470,264,608,378,"Money_System By Dev-PoinT",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Image[1] = guiCreateStaticImage(219,20,116,124,"images/money.png",false,GUIEditor_Window[1]) 
GUIEditor_Image[2] = guiCreateStaticImage(37,238,129,91,"images/yes.png",false,GUIEditor_Window[1]) 
GUIEditor_Image[3] = guiCreateStaticImage(421,247,129,79,"images/no.png",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(41,339,196,18,"Yes To Show Your Money",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
guiSetFont(GUIEditor_Label[1],"clear-normal") 
GUIEditor_Label[2] = guiCreateLabel(410,340,158,15,"No To Hide The Window",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[2],255,0,0) 
guiSetFont(GUIEditor_Label[2],"clear-normal") 
GUIEditor_Button[1] = guiCreateButton(195,174,173,36,"Give Me Money",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[1],"clear-normal") 
addEventHandler('onClientGUIClick',root, 
    function() 
            if source == GUIEditor_Image[2] then 
                   if spam then outputChatBox("You have to wait 30 sec",255,0,0) return end 
                   local sound = playSound("sounds/cash.mp3") 
                   setSoundVolume(sound, 0.5) 
                   triggerServerEvent ("showMoney", localPlayer) 
                   spam = true 
                   setTimer(function() spam = false end,30000,1) 
                   elseif source == GUIEditor_Image[3] then 
                   guiSetVisible(GUIEditor_Window[1],false) 
            end 
     end 
) -- you should add false to argument addEventHandler ( getPropagated = false ) 
  
addEventHandler('onClientGUIClick',root, 
    function() 
            if source == GUIEditor_Button[1] then 
            givePlayerMoney(source,reward) -- you give money button ?  
        end 
    end 
) -- some 
  

viewtopic.php?f=91&t=40807

viewtopic.php?f=91&t=39678

Tabulate code!

Link to comment

-- Client Side --

local spam = false 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
GUIEditor_Window[1] = guiCreateWindow(470,264,608,378,"Money_System By Dev-PoinT",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Image[1] = guiCreateStaticImage(219,20,116,124,"images/money.png",false,GUIEditor_Window[1]) 
GUIEditor_Image[2] = guiCreateStaticImage(37,238,129,91,"images/yes.png",false,GUIEditor_Window[1]) 
GUIEditor_Image[3] = guiCreateStaticImage(421,247,129,79,"images/no.png",false,GUIEditor_Window[1]) 
GUIEditor_Label[1] = guiCreateLabel(41,339,196,18,"Yes To Show Your Money",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[1],255,255,0) 
guiSetFont(GUIEditor_Label[1],"clear-normal") 
GUIEditor_Label[2] = guiCreateLabel(410,340,158,15,"No To Hide The Window",false,GUIEditor_Window[1]) 
guiLabelSetColor(GUIEditor_Label[2],255,0,0) 
guiSetFont(GUIEditor_Label[2],"clear-normal") 
GUIEditor_Button[1] = guiCreateButton(195,174,173,36,"Give Me Money",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[1],"clear-normal") 
  
addEventHandler('onClientGUIClick',root, 
function() 
     if source == GUIEditor_Image[2] then 
          if spam then outputChatBox("You have to wait 30 sec",255,0,0) return end 
          local sound = playSound("sounds/cash.mp3") 
          setSoundVolume(sound, 0.5) 
          triggerServerEvent ("showMoney", localPlayer) 
          spam = true 
          setTimer(function() spam = false end,30000,1) 
     elseif source == GUIEditor_Image[3] then 
          guiSetVisible(GUIEditor_Window[1],false) 
     end 
end) 
  
addEventHandler('onClientGUIClick',root, 
function() 
      if source == GUIEditor_Button[1] then 
           triggerServerEvent ("giveMoney", localPlayer) 
      end 
end) 

-- Server Side --

addEvent("giveMoney", true ) 
addEventHandler("giveMoney", root, 
function() 
     local reward = math.random(10,100) 
     givePlayerMoney(source,reward) 
end) 

Link to comment

both of the events say

cilen triggerd server side event but event is not added to server side what is the problem so i can fix it on the later scripts ?

addEvent("giveMoney", true ) 
addEventHandler("giveMoney", root, 
function() 
     local reward = math.random(10,100) 
     givePlayerMoney(source,reward) 
    outputChatBox(getPlayerName(source)"Money System Has Give Him".. reward.."$", root,255,255,0) 
end) 
  
addEvent("showMoney", true ) 
addEventHandler("showMoney", root, 
function() 
     outputChatBox(getPlayerName(source).." Has Money is $"..getPlayerMoney(source).."!",root,255,255,0) 
     else 
     outputChatBox("You Have To Wait 30 sec for Using this Command again !",source,255,0,0) 
end) 

Link to comment
addEvent("giveMoney", true ) 
addEventHandler("giveMoney", root, 
function() 
     local reward = math.random(10,100) 
     givePlayerMoney(source,reward) 
    outputChatBox(getPlayerName(source).." Money System Has Give Him".. reward.."$", root,255,255,0) 
end) 
  
addEvent("showMoney", true ) 
addEventHandler("showMoney", root, 
function() 
     outputChatBox(getPlayerName(source).." Has Money is $"..getPlayerMoney(source).."!",root,255,255,0) 
end) 

Link to comment
Thanx Tapl Work But what was the problem ??
outputChatBox(getPlayerName(source)"Money System Has Give Him".. reward.."$", root,255,255,0) 

you forgot this (..) after getPlayerName(source)

also you put (else) without (if)

Link to comment

you forgot a thing

you hide the gui on click (no) but you didn't hide the cursor :roll:

addEventHandler('onClientGUIClick',root, 
function() 
     if source == GUIEditor_Image[2] then 
          if spam then outputChatBox("You have to wait 30 sec.. ",255,0,0) return end 
          local sound = playSound("sounds/cash.mp3") 
          setSoundVolume(sound, 1.5) 
          triggerServerEvent ("showMoney", localPlayer) 
          spam = true 
          setTimer(function() spam = false end,30000,1) 
     elseif source == GUIEditor_Image[3] then 
          guiSetVisible(GUIEditor_Window[1],false) 
     end 
end) 

Correct

addEventHandler('onClientGUIClick',root, 
function() 
     if source == GUIEditor_Image[2] then 
          if spam then outputChatBox("You have to wait 30 sec.. ",255,0,0) return end 
          local sound = playSound("sounds/cash.mp3") 
          setSoundVolume(sound, 1.5) 
          triggerServerEvent ("showMoney", localPlayer) 
          spam = true 
          setTimer(function() spam = false end,30000,1) 
     elseif source == GUIEditor_Image[3] then 
          guiSetVisible(GUIEditor_Window[1],false) 
          showCursor(false) 
     end 
end) 

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