gytisan Posted February 4, 2012 Share Posted February 4, 2012 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 Link to comment
Orange Posted February 4, 2012 Share Posted February 4, 2012 setElementRotation() setElementHealth() addVehicleUpgrade() Link to comment
gytisan Posted February 4, 2012 Author Share Posted February 4, 2012 setElementRotation() setElementHealth() addVehicleUpgrade() I am noob on scripting pls help Link to comment
Xeno Posted February 4, 2012 Share Posted February 4, 2012 function flipVeh( thePlayer ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) setElementRotation(theVehicle,0,0,0) end addCommandHandler("flip",flipVeh) Link to comment
gytisan Posted February 4, 2012 Author Share Posted February 4, 2012 function flipVeh( thePlayer ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) setElementRotation(theVehicle,0,0,0) end addCommandHandler("flip",flipVeh) And where is price ? Thx For That Link to comment
Xeno Posted February 4, 2012 Share Posted February 4, 2012 function flipVeh( thePlayer ) local theVehicle = getPedOccupiedVehicle ( thePlayer ) setElementRotation(theVehicle,0,0,0) takePlayerMoney(500) end addCommandHandler("flip",flipVeh) Link to comment
Agon Posted February 4, 2012 Share Posted February 4, 2012 (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 February 4, 2012 by Guest Link to comment
drk Posted February 4, 2012 Share Posted February 4, 2012 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) Link to comment
Kenix Posted February 4, 2012 Share Posted February 4, 2012 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 ) Link to comment
drk Posted February 4, 2012 Share Posted February 4, 2012 lol, why you need to create function takeMoney?? Link to comment
Kenix Posted February 4, 2012 Share Posted February 4, 2012 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. Link to comment
BinSlayer1 Posted February 4, 2012 Share Posted February 4, 2012 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 Link to comment
gytisan Posted February 4, 2012 Author Share Posted February 4, 2012 Big Thanks To all. U're great peoples Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now