Jump to content

[RACE]Commands Help


gytisan

Recommended Posts

Posted

Hey all can someone help me to make code to:

/flip flips car for 500$

/repair repairs car for 500$

/nitro adds nitro x10 to car for 500$

Help please :)

Posted
function flipVeh( thePlayer ) 
   local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
setElementRotation(theVehicle,0,0,0) 
end 
addCommandHandler("flip",flipVeh) 

Posted
function flipVeh( thePlayer ) 
   local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
setElementRotation(theVehicle,0,0,0) 
end 
addCommandHandler("flip",flipVeh) 

And where is price ? :D

Thx For That

Posted
function flipVeh( thePlayer ) 
   local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
setElementRotation(theVehicle,0,0,0) 
takePlayerMoney(500) 
end 
addCommandHandler("flip",flipVeh) 

Posted (edited)
function repairVeh( thePlayer ) 
   local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
----i don't know what max health is so i made it 1000 
setElementHealth(theVehicle,1000) 
takePlayerMoney(500) 
end 
addCommandHandler("repair",repairVeh) 

function addNitro( thePlayer ) 
local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
addVehicleUpgrade(theVehicle, 1010) 
takePlayerMoney(500) 
end 
addCommandHandler("nitro",addNitro) 

Better, lol.

|

|

|

\/

Edited by Guest
Posted
function repairVehicle(thePlayer) 
   local veh = getPedOccupiedVehicle(thePlayer) 
   local money = getPlayerMoney(thePlayer) 
    if (money < 500) then 
       outputChatBox("You don't have money!",thePlayer,255,0,0,true) 
    else 
       setElementHealth(veh,1000) 
       takePlayerMoney(thePlayer,500) 
     end 
  end 
end 
addCommandHandler('repair',repairVehicle) 

function addNitro(thePlayer) 
    local theveh = getPedOccupiedVehicle(thePlayer) 
    local money = getPlayerMoney(thePlayer) 
     if (money < 500) then 
       outputChatBox("You don't have money!",thePlayer,255,0,0,true) 
     else 
       addVehicleUpgrade(theveh,1010) 
       takePlayerMoney(thePlayer,500) 
     end 
  end 
end 
addCommandHandler('nitro',addNitro) 
  

Posted
takeMoney = function( player,cash ) 
    if getPlayerMoney ( player ) >= tonumber( cash ) then 
        return takePlayerMoney ( player,cash ) 
    end 
    return false 
end 
  
errorOutput = function( text,player ) 
    return outputChatBox( text,player,255,0,0 ) 
end  
  
addCommandHandler( 'nitro', 
    function( player ) 
        local veh = getPedOccupiedVehicle( player ) 
        if veh then 
            if takeMoney( player,500 ) then 
                addVehicleUpgrade( veh,1010 ) 
            else 
                errorOutput ( "You don't have money!",player ) 
            end 
        end 
    end 
)    
  
addCommandHandler( 'flip', 
    function( player ) 
        local veh = getPedOccupiedVehicle( player ) 
        if veh then 
            if takeMoney( player,500 ) then 
                setElementRotation( veh,0,0,0 ) 
            else 
                errorOutput ( "You don't have money!",player ) 
            end 
        end 
    end 
)    
  
addCommandHandler( 'repair', 
    function( player ) 
        local veh = getPedOccupiedVehicle( player ) 
        if veh then 
            if takeMoney( player,500 ) then 
                setElementHealth( veh,1000 ) 
            else 
                errorOutput ( "You don't have money!",player ) 
            end 
        end 
    end 
)    
  

Posted
lol, why you need to create function takeMoney??

For easy check money and take.

Why write the same thing?

If you can call function and check --> take money.

Posted
lol, why you need to create function takeMoney??

When you script something big, you'll want to use as many functions as possible so you don't waste much time.

Maybe you should start learning more about scripting concepts before you "lol" at people for no reason

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