Server-side
function customEventHandler(thePlayer, givenAmount)
if isElement(thePlayer) then
givePlayerMoney(thePlayer, givenAmount)
end
end
addEvent("customEvent", true)
addEventHandleR("customEvent", getRootElement(), customEventHandler)
Client side
triggerServerEvent("customEvent", getRootElement(), localPlayer, ironMoney)
Just supposed to work.
givePlayerMoney on client-side does give money to the player, but only on his side. Use a custom event and trigger it with the player and the amount of the money as an arg.
function SaveClientCash(quitType, reason, responsibleElement)
if not (isGuestAccount (getPlayerAccount (source))) then
local account = getPlayerAccount (source)
if (account) then
local MyIronMoneyz = getElementData( source, "moneyz.set" )
if (MyIronMoneyz) then
setAccountData (account, "moneyz.saved", MyIronMoneyz)
end
end
end
end
addEventHandler("onPlayerQuit", getRootElement(), SaveClientCash)
Why did you try to use the "MyIronMoneyz" variable as a function?
You know that you have to upload your files with .lua extension only, right? You cant upload a whole directory, you have to do it manually with each file.