Jump to content

Math Money


Klesh

Recommended Posts

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 
  

Link to comment
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.

Link to comment
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

Link to comment

Could this work maybe :roll:

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 by Guest
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...