ABu-ALi_ Posted January 26, 2011 Share Posted January 26, 2011 hi all .. I have a problem i want if player win in Race givin hem money Please help me !!! Link to comment
Castillo Posted January 26, 2011 Share Posted January 26, 2011 This is not a "problem", you want us to make it for you, we don't accept request. https://wiki.multitheftauto.com/wiki/Scr ... troduction Link to comment
ABu-ALi_ Posted January 26, 2011 Author Share Posted January 26, 2011 I want it right if he won the player gives him money please help me !! Link to comment
Castillo Posted January 26, 2011 Share Posted January 26, 2011 Try something first, if you have errors post what you have done here. Link to comment
ABu-ALi_ Posted January 26, 2011 Author Share Posted January 26, 2011 look this: function Win(mapInfo) local alivePlayers = getAlivePlayers() info = mapInfo.modename if info == "Destruction derby" then if #alivePlayers == 1 then local playername = getPlayerName(alivePlayers[1]) local amount = math.random(1,9999) local money = getPlayerMoney ( source ) if ( money >= 0 ) then givePlayerMoney( source, amount ) outputChatBox(playername.." Win and give hem $"..amount.." !",getRootElement(),255,255,0) end end end addEventHandler("onPlayerWasted", getRootElement(), Win) but, this is not working help me please ! Link to comment
proracer Posted January 26, 2011 Share Posted January 26, 2011 You have to create a table first. alivePlayers = {} function Win(mapInfo) local alivePlayers = getAlivePlayers() info = mapInfo.modename if info == "Destruction derby" then if #alivePlayers == 1 then local playername = getPlayerName(alivePlayers[1]) local amount = math.random(1,9999) local money = getPlayerMoney ( source ) if ( money >= 0 ) then givePlayerMoney( source, amount ) outputChatBox(playername.." Win and give hem $"..amount.." !",getRootElement(),255,255,0) end end end addEventHandler("onPlayerWasted", getRootElement(), Win) Before you start the script, type ' /debugscript 3 ' and than start the script than tell us any errors found. Link to comment
ABu-ALi_ Posted January 27, 2011 Author Share Posted January 27, 2011 thank you .. but this: alivePlayers = {} function Win(mapInfo) local alivePlayers = getAlivePlayers() info = mapInfo.modename if info == "Destruction derby" then if #alivePlayers == 1 then local playername = getPlayerName(alivePlayers[1]) local amount = math.random(1,9999) local money = getPlayerMoney ( source ) if ( money >= 0 ) then givePlayerMoney( source, amount ) outputChatBox(playername.." Win and give hem $"..amount.." !",getRootElement(),255,255,0) end end end addEventHandler("onPlayerWasted", getRootElement(), Win) working now ..? 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