Jump to content

Bounty


Parazitas

Recommended Posts

You can use element data to determine the player with a bounty.

setElementData and getElementData 

you can get all players in the server

allPlayers = getPlayersCount ()  

and assign a random number with

randomplayer = math.random (1, allPlayers)  

then you can do this to assign the player as bounty

for k, player in ipairs (getElementsByType ("player")) do 
if (k == randomplayer) then 
setElementData (player, "bounty", true) -- or anything you like 
end 
end 
  

Let me know for any problem

Link to comment

Look:

meta.xml

  

  "Simple01" title="Simple Bounty Script"/> 
   
  

main.lua

  
ps = { } 
  
function bountyThatGuy() 
 local p = getRandomPlayer() 
 local players = getElementsByType("player") 
 for i = 1, #players do 
  local v = players[ i ] 
  ps[ v ] = false 
  outputChatBox( "Wow! " .. getPlayerName( p ) .." has a bounty of 1kk! KILL HIM!", v, 0, 255, 0) 
 end 
 ps[ p ] = true 
end 
setTimer( bountyThatGuy, 1800000, 0 ) 
  
function checkBounty( _, attacker ) 
 if ( ps[ source ] == true ) and (getElementType( attacker ) == "player") then 
  givePlayerMoney( attacker,  1000000) 
  outputChatBox('Congratulations! ' .. getPlayerName( attacker ) .. ' you killed the bounty guy! ', attacker, 0, 255, 0) 
end 
addEventHandler("onPlayerWasted", root, checkBounty) 
  
  
  
  

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...