#Paper Posted March 29, 2011 Posted March 29, 2011 When i press the btn nothing happen... -------------------SERVER SIDE addEvent("onMoneyTrasfer", true) function gotPlayerFromName(theSender, theReiciver, theMoney) local getSenderCash = getElementData(theSender, "Money") local getReiciverCash = getElementData(theReiciver, "Money") if not theMoney <= getSenderCash then setElementData(theSender, "Money", getSenderMoney - theMoney) setElementData(theReiciver, "Money", getReiciverCash + theMoney) outputChatBox( "#ccf7fcMoney Trasfer: #ffffff"..getPlayerName(theSender).." #9ACD32gave you #43CD80$"..tonumber(money).."#9ACD32!", thePlayer, 255,255,255,true) else outputChatBox( "#ccf7fcShop: #9ACD32You have not enough money!", thePlayer, 255,255,255,true) end end addEventHandler("onMoneyTrasfer", getRootElement(), gotPlayerFromName) ------------------------CLIENT SIDE if not getMoney == "" then local getMoney = guiGetText(GUIEditor_Edit[3]) local selectedPlayer = guiGridListGetItemText(GUIEditor_Grid[3], guiGridListGetSelectedItem(GUIEditor_Grid[3]), 1) triggerServerEvent("onMoneyTrasfer", getLocalPlayer(), getLocalPlayer(), getPlayerFromName(selectedPlayer), getMoney) else outputChatBox( "#ccf7fcYou must insert an import!", getLocalPlayer(), 255,255,255,true) end My skype: skiper964 I helped you? Help me! ^^ Help me bro! ^^
XFawkes Posted March 29, 2011 Posted March 29, 2011 Script don't know who is: thePlayer change it to theSender European Pro Gamers Member LUA Programmer
Moderators Citizen Posted March 29, 2011 Moderators Posted March 29, 2011 At the moment I can see just one error here: if not getMoney == "" then local getMoney = guiGetText(GUIEditor_Edit[3]) you use the getMoney variable before their declaration; so: local getMoney = guiGetText(GUIEditor_Edit[3]) if not getMoney == "" then local selectedPlayer = guiGridListGetItemText(GUIEditor_Grid[3], guiGridListGetSelectedItem(GUIEditor_Grid[3]), 1) triggerServerEvent("onMoneyTrasfer", getLocalPlayer(), getLocalPlayer(), getPlayerFromName(selectedPlayer), getMoney) else outputChatBox( "#ccf7fcYou must insert an import!", getLocalPlayer(), 255,255,255,true) end And here make some tonumber ( just for security ^^ ): addEvent("onMoneyTrasfer", true) function gotPlayerFromName(theSender, theReiciver, theMoney) local getSenderCash = tonumber( getElementData(theSender, "Money") ) local getReiciverCash = tonumber( getElementData(theReiciver, "Money") ) theMoney = tonumber( theMoney ) if ( theMoney <= getSenderCash ) then setElementData(theSender, "Money", getSenderMoney - theMoney) setElementData(theReiciver, "Money", getReiciverCash + theMoney) outputChatBox( "#ccf7fcMoney Trasfer: #ffffff"..getPlayerName(theSender).." #9ACD32gave you #43CD80$"..tonumber(money).."#9ACD32!", theSender, 255,255,255,true) else outputChatBox( "#ccf7fcShop: #9ACD32You have not enough money!", theSender, 255,255,255,true) end end addEventHandler("onMoneyTrasfer", getRootElement(), gotPlayerFromName) The rEvolution is coming ...
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