Jump to content

Help! I need to add a script(Drift with money)


OGPrettyMF

Recommended Posts

I used this script:https://community.multitheftauto.com/index.php?p=resources&s=details&id=556 but he didn`t give money.

Ok...Then I found this lua

addEventHandler("onElementDataChange",getRootElement(), 
    function ( ElementData ) 
        if ( ElementData == "Last Drift" ) then 
            givePlayerMoney(source,getElementData(source,ElementData)) 
    end 
end 
) 

https://forum.multitheftauto.com/viewtopic.php?f=91&t=59018

and it works!

But it gives me money for the "Last score"(10000 drift points =10000$).

So...

I need a script that will give the money according to the principle : 10drift points =2$,100 drift points =20$,1000 drift points =200$ and so on.

Please!Help me! :D

Link to comment
I used this script:https://community.multitheftauto.com/index.php?p=resources&s=details&id=556 but he didn`t give money.

Ok...Then I found this lua

addEventHandler("onElementDataChange",getRootElement(), 
    function ( ElementData ) 
        if ( ElementData == "Last Drift" ) then 
            givePlayerMoney(source,getElementData(source,ElementData)) 
    end 
end 
) 

https://forum.multitheftauto.com/viewtopic.php?f=91&t=59018

and it works!

But it gives me money for the "Last score"(10000 drift points =10000$).

So...

I need a script that will give the money according to the principle : 10drift points =2$,100 drift points =20$,1000 drift points =200$ and so on.

Please!Help me! :D

givePlayerMoney gives the player amount of drift points in money

Try to use somethingl like this

  
local moneyToGive 
  
addEventHandler("onElementDataChange",getRootElement(), 
    function ( ElementData ) 
        if ( ElementData == "Last Drift" ) then 
            loca driftPoints = getElementData(source,ElementData) 
            If driftPoints >= 10 and driftPoints <= 100 then 
                     moneyToGive = 2 
            elseif .... --you can continue as long as you want 
  
            end 
            givePlayerMoney(source,moneyToGive) 
    end 
end 
) 
  

Link to comment
addEventHandler("onElementDataChange",getRootElement(), 
    function ( ElementData ) 
        if ( ElementData == "Last Drift" ) then 
            local money = getElementData(source,ElementData)/5; 
            givePlayerMoney(source,money); 
    end 
end 
) 

Link to comment
addEventHandler("onElementDataChange",getRootElement(), 
    function ( ElementData ) 
        if ( ElementData == "Last Drift" ) then 
            local money = getElementData(source,ElementData)/5; 
            givePlayerMoney(source,money); 
    end 
end 
) 

Good idea,i didnt saw that is possible that

Link to comment

Guys, thank you very much for your help!

Now another question : is it possible to link the drift counter only to certain maps(my uploading maps) ?

Coz some people may farming in different places

( under the water or in airports).

What I need to white in the script in order so that I could get paid for drift at certain tracks ?

Like "map1- paid for drift" City- fasle

Link to comment

You can use createColPolygon to make zones for drift. But you should add checks, player inside any zone or no.

You can create zone and add event onColShapeHit/Leave, edit player element data

setElementData(player,"inzone",true/false) 

and use it

if getElementData(player,"inzone") then  
--drift work  
end 

or i somewhat not understand and you wanna not this :D

Link to comment
You can use createColPolygon to make zones for drift. But you should add checks, player inside any zone or no.

You can create zone and add event onColShapeHit/Leave, edit player element data

setElementData(player,"inzone",true/false) 

and use it

if getElementData(player,"inzone") then  
--drift work  
end 

or i somewhat not understand and you wanna not this :D

Oh... :)

Well, yes ! I need certain area on the map but there is another question:

What if my drift track is over the map ?On the main map under my track drift will also be counted against ?Or no? :D

Link to comment
You can use createColPolygon to make zones for drift. But you should add checks, player inside any zone or no.

You can create zone and add event onColShapeHit/Leave, edit player element data

setElementData(player,"inzone",true/false) 

and use it

if getElementData(player,"inzone") then  
--drift work  
end 

or i somewhat not understand and you wanna not this :D

Oh... :)

Well, yes ! I need certain area on the map but there is another question:

What if my drift track is over the map ?On the main map under my track drift will also be counted against ?Or no? :D

Oops ... I made a mistake...

There are some another question*

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