Patlik Posted December 29, 2021 Share Posted December 29, 2021 I want to make sure that the menu doesn’t come up on command, but let’s say Marker if someone walks in then come up. I tried to solve it anyway but I failed, I'm new to this. Would anyone help? And Sorry For my bad english. Its server side. Spoiler ---THIS RESOURCE WAS MADE BY Dazee(accname:donbosnian) if you redistribute this resource without permission you may face legal charges contact me at [email protected] if you need any help-- --YOU ARE FREE TO EDIT THIS RESOURCE BUT NOT REDISTRIBUTE IT-- function comma_value(amount) local formatted = amount while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if (k==0) then break end end return formatted end function recieveDeposit(amount) local money = getPlayerMoney(source) local pAcc = getPlayerAccount(source) local checkForBalance = getAccountData(pAcc,"account.bank") if (checkForBalance) then if (tonumber(amount) == nil) then outputChatBox("Please enter a value!",source,0,255,255) elseif (tonumber(amount) > tonumber(money)) then outputChatBox("You can't deposit more money than you already have!",source,0,255,255) elseif (tonumber(amount) == 0) then outputChatBox("You can't deposit $0 dollars, silly you!",source,0,255,255) elseif(tonumber(amount) == tonumber(money) or tonumber(amount) < tonumber(money)) then outputChatBox("You have succesfully deposited: $" ..comma_value(amount).. " into your bank account!",source,0,2500,0) local takenMoney = takePlayerMoney(source,tonumber(amount)) local bankData = getAccountData(pAcc,"account.bank") local convertedData = tonumber(bankData) + tonumber(amount) local setData = setAccountData(pAcc,"account.bank",convertedData) local bankData2 = getAccountData(pAcc,"account.bank") local money2 = getPlayerMoney(source) local depositLimits = tonumber(getAccountData(pAcc,"account.bank.timer")) + 1 local depositLimiter = setAccountData(pAcc,"account.bank.timer",tonumber(depositLimits)) triggerClientEvent(source,"updateLabelData",source,bankData2) triggerClientEvent(source,"updateLabelData2",source,money2) end else outputChatBox("Updated your bank balance to $0 since you are a new player here, you may use the ATM now!",source,0,255,0) setAccountData(pAcc,"account.bank",0) triggerClientEvent(source,"updateLabelData",source,getAccountData(pAcc,"account.bank")) return end end addEvent("depositATM",true) addEventHandler("depositATM",getRootElement(),recieveDeposit) function testfunction(src,cmdname,arg3) pAcc = getPlayerAccount(src) if (pAcc) then setAccountData(pAcc,"account.bank.timer",0) end end addCommandHandler("deptest",testfunction) function withdrawMoney(amount) local pAcc = getPlayerAccount(source) if (amount == nil or not tonumber(amount)) then outputChatBox("Please enter a value!",source,0,255,255) else local pMoney = getPlayerMoney(source) local accountMoney = getAccountData(pAcc,"account.bank") if (accountMoney) then local convertedMoney = tonumber(accountMoney) local lostMoney = tonumber(accountMoney) - tonumber(amount) if (convertedMoney == nil) then outputChatBox("Please enter a value!",source,0,255,255) elseif (amount == nil) then outputChatBox("Please enter a value!",source,0,255,255) elseif (tonumber(amount) > convertedMoney) then outputChatBox("You can't withdraw more money than you actually have in your bank account!",source,0,255,255) elseif (tonumber(amount) == 0) then outputChatBox("You can't withdraw $0 dollars, silly you!",source,0,255,255) elseif (tonumber(pMoney)) == 99999998 then outputChatBox("You have the maximum amount of money on hand you can't withdraw anymore!",source,0,255,255) elseif (tonumber(amount) + tonumber(pMoney) >= 99999999) then outputChatBox("You can't withdraw more than $99,999,998 because that is the maximum you can carry on hand!",source,0,255,255) elseif (tonumber(amount) == convertedMoney or tonumber(amount) < convertedMoney) then outputChatBox("You successfully withdrew: $" ..comma_value(amount).. " from your bank account!",source,0,2500,0) givePlayerMoney(source,tonumber(amount)) setAccountData(pAcc,"account.bank",lostMoney) local bankData = getAccountData(pAcc,"account.bank") local onhandmoney = getPlayerMoney(source) triggerClientEvent(source,"updateLabelData",source,bankData) triggerClientEvent(source,"updateLabelData2",source,onhandmoney) end else setAccountData(pAcc,"account.bank",0) convertedMoney = 0 triggerClientEvent(source,"updateLabelData",source, convertedMoney) outputChatBox("Updated your bank balance to $0 since you are a new player here, you may use the ATM now!",source,0,255,0) return end end end addEvent("withdrawATM",true) addEventHandler("withdrawATM",getRootElement(),withdrawMoney) function getAccountFromName ( name ) return getAccount ( name ) or false end function transferMoney(account,amount) local pAcc = getPlayerAccount(source) local money = getAccountData(pAcc, "account.bank") if (account) then local account2 = getAccountFromName(account) if (account2) == false or nil then outputChatBox("Invalid account entered!",thePlayer,255,0,0) else if (amount == nil or not tonumber(amount)) then outputChatBox("You need to enter the amount you want to transfer!",source,0,255,255) elseif (account2 == pAcc) then outputChatBox("You can't transfer money to yourself!",source,0,255,255) elseif (tonumber(amount) > tonumber(getAccountData(pAcc, "account.bank"))) then outputChatBox("You can't transfer more than you have in your bank account!",source,0,255,255) elseif (tonumber(amount) == 0) then outputChatBox("You can't transfer $0 dollars!",source,0,255,255) elseif (tonumber(money) == tonumber(amount) or tonumber(amount) < tonumber(money)) and (account2) then local settingsAcc2 = getAccountData(account2, "settings.bank") if (settingsAcc2 == true) then outputChatBox("Account ("..getAccountName(account2)..") has disabled receiving transfers!",thePlayer,255,0,0) elseif (settingsAcc2 == false) then local player1Money = tonumber(getAccountData(pAcc, "account.bank")) local transferTarget = tonumber(getAccountData(account2, "account.bank")) local player1Transfered = player1Money - tonumber(amount) local setMoneyDataSender = setAccountData(pAcc, "account.bank", player1Transfered) local player2Recieved = tonumber(getAccountData(account2,"account.bank")) + tonumber(amount) local targetRecieved = setAccountData(account2, "account.bank",player2Recieved) outputChatBox("You have transfered $"..comma_value(amount).." to account "..account.."",source,0,2500,0) triggerClientEvent(source,"updateLabelData",source,getAccountData(pAcc,"account.bank")) end end end end end addEvent("transferATM",true) addEventHandler("transferATM",getRootElement(),transferMoney) function openGUI(thePlayer) if isGuestAccount(getPlayerAccount(thePlayer)) then outputChatBox("You have to be logged in to use the ATM!",thePlayer) elseif getElementData(thePlayer,"gui.atm",true) then outputChatBox("You can't open two ATM windows, nice try!",thePlayer,0,255,255) else triggerClientEvent(thePlayer, "openTheATMGUI",thePlayer) end end addEvent("openTheATMGUIServer",true) addEventHandler("openTheATMGUIServer",getRootElement(),openGUI) function updateBalanceOnOpenGUI() local pAcc = getPlayerAccount(source) local onhandmoney = getPlayerMoney(source) local transferStatus = getAccountData(pAcc,"settings.bank") if (pAcc) then local money = getAccountData(pAcc,"account.bank") triggerClientEvent(source,"updateLabelData",source,money) triggerClientEvent(source,"updateLabelData2",source,onhandmoney) triggerClientEvent(source,"updateLabelData3",source,transferStatus) end end addEvent("updateBalanceOnGUI",true) addEventHandler("updateBalanceOnGUI",getRootElement(),updateBalanceOnOpenGUI) function simpleSettings(thePlayer,commandname,atr3) pAcc = getPlayerAccount(thePlayer) if atr3 == nil then outputChatBox("You have to insert a setting!",thePlayer,0,255,0) elseif atr3 == "bank" then if getAccountData(pAcc, "settings.bank") == true then outputChatBox("You have enabled recieving bank transfers!",thePlayer,0,255,0) setAccountData(pAcc, "settings.bank",false) elseif getAccountData(pAcc, "settings.bank") == false then outputChatBox("You have disabled recieving bank transfers!",thePlayer,255,0,0) setAccountData(pAcc, "settings.bank",true) end --Settings bank closer else outputChatBox("Invalid setting!",thePlayer,255,0,0) end --atr3 closer end --Function closer addCommandHandler("settings",simpleSettings) addCommandHandler("atm",openGUI) Link to comment
The_GTA Posted December 29, 2021 Share Posted December 29, 2021 (edited) Hello Patlik, have you tried asking the resource creator for help? Judging by his legal statement he does want you to contact him in case of such need that you describe. Since I think that he would know best how to support you I have asked him to come here. Have you tried using the MTA marker functions in connection with onMarkerHit to open the GUI? I don't see anything that would indicate that you tried. atm_system | Multi Theft Auto | Community Dazee - Multi Theft Auto: Forums (mtasa.com) I recommend you to use the createMarker function, the getElementType function, the addEventHandler function and the onMarkerHit event. Then inside of your own event handler check for any player element that has hit the marker you created and call the provided openGUI function with the player as first parameter. Edited December 29, 2021 by The_GTA 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now