Klesh Posted January 25, 2011 Posted January 25, 2011 Here is my script but i dont know what i have tu put now, only i need when someones win get random money. thanks resourceRoot = getResourceRootElement() function onPlayerDestructionDerbyWin () end addEventHandler ("onResourceStart", resourceRoot, chooserandom) function give () local Player = getPlayerDestructionDerbyWin ( ) randomMoney = math.random ( 1, 1000 ) givePlayerMoney ( randomPlayer, randomMoney ) outputChatBox ( '*' .. getPlayerName ( randomPlayer ) .. ' Has Won $' .. randomMoney .. ' !', getRootElement(), 255, 255, 0 ) end
Castillo Posted January 25, 2011 Posted January 25, 2011 This doesn't makes any sense.. it's just a mess.
Kenix Posted January 25, 2011 Posted January 25, 2011 You can use this way. local money ={} money[0] = { "10"} -- amount of money money[1] = { "20"} money[2] = {"100"}
Castillo Posted January 25, 2011 Posted January 25, 2011 (edited) volk-rus, he could actually do: math.random(100,500) and will do a random between 100 and 500 Edited January 26, 2011 by Guest
proracer Posted January 25, 2011 Posted January 25, 2011 addEventHandler ("onPlayerJoin", getRootElement(), giveRandomMoney) function giveRandomMoney () local randomPlayer = getRandomPlayer ( ) randomMoney = math.random ( 1, 1000 ) givePlayerMoney ( randomPlayer, randomMoney ) outputChatBox ( '*' .. getPlayerName ( randomPlayer ) .. ' Has Won $' .. randomMoney .. ' !', getRootElement(), 255, 255, 0 ) end Just an a example for to give random money on every player who joins.I didn't tested so I'm not completely sure it's correct. But I think the main base is like that.
proracer Posted January 25, 2011 Posted January 25, 2011 I just gave him an example how it looks like.Because I don't know for what he wants to use 'givePlayerMoney' EDIT: I have a sense I have written a stupid non-explanatary code.
Aibo Posted January 25, 2011 Posted January 25, 2011 I just gave him an example how it looks like.Because I don't know for what he wants to use 'givePlayerMoney'EDIT: I have a sense I have written a stupid non-explanatary code. well your code wont work, because giveRandomMoney is nil when you call addEventHandler. :3
proracer Posted January 25, 2011 Posted January 25, 2011 (edited) Could this work maybe function giveRandomMoney() local randomPlayer = getRandomPlayer() local randomMoney = math.random(1,1000) givePlayerMoney (randomPlayer, randomMoney) outputChatBox("*" ..randomPlayer.. "has won $" ..randomMoney.. "*", getRootElement(), 255,140,0) end addEventHandler("onResourceStart", getResourceRootElement, giveRandomMoney) setTimer(giveRandomMoney, 60000, 0) Edited January 26, 2011 by Guest
Castillo Posted January 26, 2011 Posted January 26, 2011 lol? you attach the event to a non existing function name o_o
SDK Posted January 26, 2011 Posted January 26, 2011 It's not very clear, but I think the TS wants to give a player a random amount of money when he wins a DD/DM. He should explain himself better
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