hello, im trying to make a bank system and when i try to withdraw the money it doesnt take away my money in the bank,
this is the client side script
loadstring(exports.dgs:dgsImportFunction())()
local windows = window,label1,label2,button1,button2
sx, sy = dgsGetScreenSize()
easing = "OutBack"
--data
setElementData(localPlayer, "bank", "100")
bank11 = getElementData (localPlayer, "bank")
--window
window = dgsCreateImage(sx*0.360, sy*0.3, sx*0.330, sy*0.2,_,false,_, tocolor(0,0,0,140))
label1 = dgsCreateImage(sx*0.360, sy*0.270, sx*0.330, sy*0.030,_,false,_, tocolor(0,255,255,100))
label2 = dgsCreateLabel(sx*0.450, sy*0.270, sx*0.330, sy*0.030, "Bank !!")
dgsSetProperty(label2,"textSize",{sx*0.004, sy*0.002})
-- buttons
button1 = dgsCreateButton(sx*0.370, sy*0.360, sx*0.150, sy*0.080, "kivetel",false, _, _, _,_,_, _,_,tocolor(0,255,255,100), tocolor(0,255,255,150), tocolor(0,255,255,255))
button2 = dgsCreateButton(sx*0.530, sy*0.360, sx*0.150, sy*0.080, "befektetes",false, _, _, _,_,_, _,_,tocolor(255,255,255,100), tocolor(255,255,255,150), tocolor(255,255,255,255))
--animations
dgsSetAlpha(window, 0)
dgsAlphaTo(window, 1, "OutQuad", 1000)
dgsSetAlpha(label1, 0)
dgsAlphaTo(label1, 1, "OutQuad", 1000)
dgsSetAlpha(label2, 0)
dgsAlphaTo(label2, 1, "OutQuad", 1000)
dgsSetAlpha(button1, 0)
dgsAlphaTo(button1, 1, "OutQuad", 1000)
dgsSetAlpha(button2, 0)
dgsAlphaTo(button2, 1, "OutQuad", 1000)
-- button func 1
addEventHandler("onDgsMouseClickDown", button1, function()
dgsSetVisible(window, false)
dgsSetVisible(label1, false)
dgsSetVisible(label2, false)
dgsSetVisible(button1, false)
dgsSetVisible(button2, false)
window2 = dgsCreateImage(sx*0.360, sy*0.3, sx*0.330, sy*0.2,_,false,_, tocolor(0,0,0,140))
label3 = dgsCreateImage(sx*0.360, sy*0.270, sx*0.330, sy*0.030,_,false,_, tocolor(0,255,255,100))
label4 = dgsCreateLabel(sx*0.360, sy*0.320, sx*0.330, sy*0.030, "a penzed a bankba : " .. tostring(bank11).. "$")
dgsSetProperty(label4,"textSize",{sx*0.002, sy*0.002})
button3 = dgsCreateButton(sx*0.450, sy*0.360, sx*0.150, sy*0.080, "kivetel",false, _, _, _,_,_, _,_,tocolor(0,255,255,100), tocolor(0,255,255,150), tocolor(0,255,255,255))
dgsSetAlpha(label4, 0)
dgsAlphaTo(label4, 1, "OutQuad", 1000)
addEventHandler("onDgsMouseClickDown", button3, function()
if bankmoney == 0 then
dgsSetVisible(window, true)
dgsSetVisible(label1, true)
dgsSetVisible(label2, true)
dgsSetVisible(button1, true)
dgsSetVisible(button2, true)
dgsSetVisible(window2, false)
dgsSetVisible(label3, false)
dgsSetVisible(label4, false)
dgsSetVisible(button3, false)
else
givePlayerMoney(bank11, localPlayer)
setElementData(localPlayer, "bank", "-100")
end
end
)
end
)
this is the server side script
createObject(2942, -30.522729873657 , -1.5657294988632 , 2.70)
createColSphere(-30.522729873657 , -1.90 , 3.05, 1)