Jump to content

Giving money for function


Xabache

Recommended Posts

At the center of the following otherwise fine top half of a function is my first successful code insertion

outputChatBox("This works 002 " .. score .. " okay")

Where it displays in the chat box This works 002 4.25 okay, with 4.25 being any score achieved, typically not a whole number. I want to make this number a whole number, if possible, then give that number in money to the player.

I have tried a thousand times in a thousand ways...

function showText() 
    dxDrawText(string.format("",global_nombre,global_mejor),44,screenHeight-43,screenWidth,screenHeight,Yellow,1,"pricedown") 
     
    vehicle = isValidVehicle() 
    if not vehicle then return end 
     
    if size > 1.3 then  
        modo = -0.01  
    elseif size < 1.2 then  
        modo = 0.01  
    end 
    size = size + modo 
     
    tick = getTickCount() 
    local angulo,velocidad = angle() 
     
    local tempBool = tick - (idleTime or 0) < 750 
    if not tempBool and score ~= 0 then 
        anterior = score 
        setElementData(player, "Last Drift", anterior) 
         
        outputChatBox("This works 002 " .. score .. " okay") 
         
        total = total+anterior 
        setElementData(player, "Total Drift", total) 
        if score > mejor then 
            mejor = score 
            setElementData(player, "Best Score", mejor) 
        end 
        triggerEvent("onVehicleDriftEnd", rootElem, tick-driftTime-750) 
        score = 0 
    end 

Link to comment

thanks i solved that with math.floor(x)

the main question remains unsolved

how to make .. score .. = money

4 points = $4 dollars to $00000000

I have tried a dozen unrelated examples for givePlayerMoney setPlayerMoney and cannot make any work in this example.

outputChatBox("This works 002 " .. score .. " okay")

it should go near this line ^^

Link to comment

little help here... givePlayerMoney ... not working. why> how fix?

addEventHandler("driftNuevoRecord", root, function(score, name) 
  
    outputChatBox("-" .. name .. score .. "-",source,255,255,255,true) 
  
    givePlayerMoney(player name , score ) 
    if score > drift_mejor then 
        drift_mejor = score 
        drift_nombre = name 
        triggerClientEvent(root, "driftActualizarRecord", root, drift_mejor, drift_nombre) 
    end 
end) 

Link to comment
little help here... givePlayerMoney ... not working. why> how fix?

addEventHandler("driftNuevoRecord", root, function(score, name) 
  
    outputChatBox("-" .. name .. score .. "-",source,255,255,255,true) 
  
    givePlayerMoney(player name , score ) 
    if score > drift_mejor then 
        drift_mejor = score 
        drift_nombre = name 
        triggerClientEvent(root, "driftActualizarRecord", root, drift_mejor, drift_nombre) 
    end 
end) 

This is wrong syntax

givePlayerMoney(player name , score ) 

Where is your player element? It's need to be your first variable

If this is server side use client/source

givePlayerMoney(source , score ) 

Edited by Guest
Link to comment
givePlayerMoney(name , score )

Bad arguement @ givePlayerMoney [Expected Element at argument 1, got strng 'ExuberantHarbor7']

You need to give money to element/player which is source

  
  
addEventHandler("driftNuevoRecord", root, function(score, name) 
  
    outputChatBox("-" .. name .. score .. "-",source,255,255,255,true) 
  
    givePlayerMoney(source , score ) 
    if score > drift_mejor then 
        drift_mejor = score 
        drift_nombre = name 
        triggerClientEvent(root, "driftActualizarRecord", root, drift_mejor, drift_nombre) 
    end 
end) 
  
  

Link to comment

Wy do u need to create gui only create a command like

/givemoney [playerName] [Amount]

thats all i have the resource for this command if u need it i can give it for 6 dollars i have many other resources anyone who pays me 6 dollars ill help him to create servers and resources and many more advanced thing Huds,Weapons.etc.

i receive payments from Paypal contact me in pm

HERE IS A LIST OF RESOURCES I GOT

1.Admin shout system

2.Afk system

3.cctv sytem

4.Team system

5.Namestag (Shows name tags only to other players)

6.Crosshair (if a guy is of ur team then when you aim him u will get green sign on ur aim but if not then red) useful

7.Laserponter

8.2 huds means the screen tht appears ur Health Armour etc

9.VIP system panel

10.Team colour (shows ur team colour on ur name in scoreboard and on the minimap as a square or any icon whch i default) easy to recognise the teams on minimap

These are the resources i can keep on sale 6$ for any three resources Thx. skype name (neelansh.mehta)

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