Fury Posted July 18, 2012 Share Posted July 18, 2012 addEvent("sendMoney", true) addEventHandler("sendMoney", getRootElement(), function ( playerNick, amount ) toWho = getPlayerFromName(playerNick) local source = getPlayerAccount( source ) local toWho = getPlayerAccount( toWho ) local kaynak = getAccountData( source, "points" ) or 0 local alici = getAccountData( toWho, "points" ) or 0 if (kaynak > tonumber(amount)) then if (toWho ~= false) then local kaynak = getAccountData( source, "points" ) or 0 local alici = getAccountData( toWho, "points" ) or 0 setAccountData( toWho, "points", alici + amount ) name = getPlayerName(source) setAccountData( source, "points", kaynak - amount ) outputChatBox("#c0c0c0* You've given point amount of: #abcdef" .. amount .. "#c0c0c0 to: #abcdef" .. playerNick,source,255,255,150,true) outputChatBox("#c0c0c0* #abcdef" ..name .. " #c0c0c0has given you point amount of: #abcdef" .. amount .. "#c0c0c0 points!",toWho,255,255,245,true) else outputChatBox("#c0c0c0* Player did not exist",source,255,0,0,true) end else outputChatBox("#c0c0c0* Insufficient founds!",source,255,0,0,true) end end) i have got an error in line 14 and 16. nil. Link to comment
TwiX! Posted July 18, 2012 Share Posted July 18, 2012 addEvent("sendMoney", true) addEventHandler("sendMoney", getRootElement(), function ( playerNick, amount ) toWho = getPlayerFromName(playerNick) local playerAC = getPlayerAccount( source ) local toPlayerAC = getPlayerAccount( toWho ) local kaynak = getAccountData( playerAC, "points" ) or 0 local alici = getAccountData( toPlayerAC, "points" ) or 0 if (kaynak > tonumber(amount)) then if (toWho ~= false) then local kaynak = getAccountData( playerAC, "points" ) or 0 local alici = getAccountData( toPlayerAC, "points" ) or 0 setAccountData( toPlayerAC, "points", alici + amount ) name = getPlayerName(source) setAccountData( playerAC, "points", kaynak - amount ) outputChatBox("#c0c0c0* You've given point amount of: #abcdef" .. amount .. "#c0c0c0 to: #abcdef" .. playerNick,source,255,255,150,true) outputChatBox("#c0c0c0* #abcdef" ..name .. " #c0c0c0has given you point amount of: #abcdef" .. amount .. "#c0c0c0 points!",toWho,255,255,245,true) else outputChatBox("#c0c0c0* Player did not exist",source,255,0,0,true) end else outputChatBox("#c0c0c0* Insufficient founds!",source,255,0,0,true) end end ) you confused system source - is event (player) source - in your code (it's account) so you getPlayerName from account same for toWho 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