DSC-L|Gr00vE[Ger]

[REQ] : Money Pickups ?

Recommended Posts

Hey everyone, i´ve got another request :

is it possible to have these $ - pickups like in gta : sa singleplayer in mta ?

... that when a player dies he drops a $ - pickup with all his money in it. and when someone else pick it up

he will get this money ...^^ ;)

so, is it possible and could somebody please try to make it for me ? :)

ps: it would be nice, if the pickup will be the same like in gta sp ^^

THX Gr00vE

Share this post


Link to post

try

function createMoney(mx,my,mz,level) 
    local x1=(mx-2)+(math.random()*4) 
    local y1=(my-2)+(math.random()*4) 
    local x2=(mx-2)+(math.random()*4) 
    local y2=(my-2)+(math.random()*4) 
    local moneyamount=math.floor(200*level^0.2) 
    setElementData(createPickup(x1,y1,mz,3,1212),"amount",moneyamount) 
    setElementData(createPickup(x2,y2,mz,3,1212),"amount",moneyamount) 
end 

and

function pickup(player) 
    local money=getElementData(source,"amount") 
    if ( money ) then 
        givePlayerMoney(player,money) 
        destroyElement(source) 
    end 
end 
  
addEventHandler("onPickupUse",root,pickup) 

and

function playerWasted ( ammo, attacker, weapon, bodypart ) 
    local px,py,pz = getElementPosition(source) 
    createMoney(px,py,pz,getElementData(source,"level")) --The last argument should be changed. Unless you have levels on your server (that are stored this way). 
end 
  
addEventHandler ( "onPlayerWasted", root, playerWasted ) 

Share this post


Link to post

I have the uppest script and that works great! only not all my money... can someone helps me to drop all the money..!

Share this post


Link to post
I have the uppest script and that works great! only not all my money... can someone helps me to drop all the money..!

Please tell me and be honest: did you even try thinking for a whole 10 seconds before giving up and asking?

Share this post


Link to post

Jammie:

I give you one tip about the ammount of the money pickup, it is in one of these three lines. And by the way, next time you will need your glasses in other to read the script.

local y2=(my-2)+(math.random()*4)
local moneyamount=math.floor(200*level^0.2)
setElementData(createPickup(x1,y1,mz,3,1212),"amount",moneyamount)

Share this post


Link to post

Hey Alexander, do you know jim & wappie? about the script, I have try to fill in a value but nothing changed.

local y2=(my-2)+(math.random()*4)
local moneyamount=math.floor(200*level^0.2)
setElementData(createPickup(x1,y1,mz,3,1212),"amount",moneyamount)

Maybe

3,1212

or

amount

or

(200*level^0.2)

I think these 3 are the amount what you drop..

Share this post


Link to post
Hey Alexander, do you know jim & wappie? about the script, I have try to fill in a value but nothing changed.

local y2=(my-2)+(math.random()*4)
local moneyamount=math.floor(200*level^0.2)
setElementData(createPickup(x1,y1,mz,3,1212),"amount",moneyamount)

Maybe

3,1212

or

amount

or

(200*level^0.2)

I think these 3 are the amount what you drop..

Today's reclame: goto hans anders for glasses!

I said, it is one of the 3 lines that tells you wich makes the ammount of money.

local moneyammount = math.floor(200*level^0.2)

Now if you change moneyammount to getPlayerMoney then you've got it! Simple he?

Yes, i know jim and wappie.

Share this post


Link to post

Alexander, it doens't work.

Maybe we need both glasses of Hans anders :P

I have this now but the same effect:

function createMoney(mx,my,mz,level)
local x1=(mx-2)+(math.random()*4)
local y1=(my-2)+(math.random()*4)
local x2=(mx-2)+(math.random()*4)
local y2=(my-2)+(math.random()*4)
local getPlayerMoney=math.floor(200*level^0.2)
setElementData(createPickup(x1,y1,mz,3,1212),"amount",moneyamount)
setElementData(createPickup(x2,y2,mz,3,1212),"amount",moneyamount)
end

And I have try this:

function createMoney(mx,my,mz,level)
local x1=(mx-2)+(math.random()*4)
local y1=(my-2)+(math.random()*4)
local x2=(mx-2)+(math.random()*4)
local y2=(my-2)+(math.random()*4)
local getPlayerMoney=math.floor(200*level^0.2)
setElementData(createPickup(x1,y1,mz,3,1212),"amount",getPlayerMoney)
setElementData(createPickup(x2,y2,mz,3,1212),"amount",getPlayerMoney)
end

But the same effect...

Share this post


Link to post

Here, this is the complete script. And really learn the basic of lua scripting!

function createMoney(player)
local x, y, z = getElementPosition(player);
local x1, y1, x2, y2;
x1 = (x-2)+(math.random()*4);
y1 = (y-2)+(math.random()*4);
x2 = (x-2)+(math.random()*4);
y2 = (y-2)+(math.random()*4);
local moneyAmmount = getPlayerMoney(player);
-- it is not fair too get all the player money.
moneyAmmount = math.floor(moneyAmmount/3);
 
takePlayerMoney(player, moneyAmmount);
 
-- We are going to create 2 pickups, zo we are just cut the ammount in half
moneyAmmount = math.floor(moneyAmmount/2);
 
-- Create the pickups
setElementData(createPickup(x1, y1, z, 3, 1212), "ammount", moneyAmmount));
setElementData(createPickup(x2, y2, z, 3, 1212), "ammount", moneyAmmount));
end
 
function moneyPickupHit(player)
local money = getElementData(source, "ammount");
if money then
givePlayerMoney(player, money);
destroyElement(source);
end
end
 
function playerJustGotDied(ammo, attacker, weapon, bodypart)
createMoney(source);
end
 
addEventHandler("onPickupUse", getRootElement(), moneyPickupHit);
addEventHandler("onPlayerWasted", getRootElement(), playerJustGotDied);

Share this post


Link to post

Thanks Alexander,

I have put this script on the same place: server side but now he drops nothing anymore... its very strange..

Share this post


Link to post

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.