Jump to content

Bounty


Parazitas

Recommended Posts

Posted

Hello guys! I making some freeroam server for fun play with friends.. But i don't know how make scripts.. :/ I need resource: which Auto set 1000000$ bouny on random player every 30 minutes,

Maybe someone can help me?:) sorry for bad English.. :x

Posted

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

Posted

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) 
  
  
  
  

Posted
And.. how make full script.. ? xD

This topic is created to help people with scripting problems,not to make full scripts for others

Before you start scripting please learn at least the basics and then request help

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