Jump to content

Nitro command


myyusuf

Recommended Posts

Posted

function nitro(source, command) 
        local points = getElementData(source,"points") 
            if points >= 10 then 
        if (isPedInVehicle(source)) then 
        addVehicleUpgrade(getPedOccupiedVehicle(source), 1010) 
        setTimer(outputChatBox,50,1,"#c0c0c0* #abcdef"..getPlayerName (source).." #c0c0c0bought nitro for #abcdef10#c0c0c0 points!",root, 255, 255, 255, true ) 
        savePlayerData( nitro, "points", playerPoints - 10 )  
    else 
        outputChatBox ("#c0c0c0* You must sit in a car to buy nitro it!",source, 255, 255, 255, true ) 
    cancelEvent()                        
        end     
    else 
        outputChatBox ("#c0c0c0* You can't buy nitro, you need #abcdef10#c0c0c0 points first!",source, 255, 255, 255, true ) 
    cancelEvent() 
        end 
    end 
addCommandHandler("nitro", nos) 
addCommandHandler("nos", nos) 

server.lua:17 bad argument @ 'addCommandHandler' [Expected function at argument 2, got nil]

server.lua:18 bad argument @ 'addCommandHandler' [Expected function at argument 2, got nil]

i have got this error. what is wrong?

Posted (edited)

???

You named the function 'nitro' and you called the function 'nos'

Next time use wiki..

  
function nos(source, command) 
        local points = getElementData(source,"points") 
            if points >= 10 then 
        if (isPedInVehicle(source)) then 
        addVehicleUpgrade(getPedOccupiedVehicle(source), 1010) 
        setTimer(outputChatBox,50,1,"#c0c0c0* #abcdef"..getPlayerName (source).." #c0c0c0bought nitro for #abcdef10#c0c0c0 points!",root, 255, 255, 255, true ) 
        savePlayerData( nitro, "points", playerPoints - 10 )  
    else 
        outputChatBox ("#c0c0c0* You must sit in a car to buy nitro it!",source, 255, 255, 255, true ) 
    cancelEvent()                        
        end     
    else 
        outputChatBox ("#c0c0c0* You can't buy nitro, you need #abcdef10#c0c0c0 points first!",source, 255, 255, 255, true ) 
    cancelEvent() 
        end 
    end 
addCommandHandler("nitro",nos) 
addCommandHandler("nos",nos) 

Edited by Guest
Posted

function nitro(source, command) 
        local points = getElementData(source,"points") 
            if points >= 10 then 
        if (isPedInVehicle(source)) then 
        addVehicleUpgrade(getPedOccupiedVehicle(source), 1010) 
        setTimer(outputChatBox,50,1,"#c0c0c0* #abcdef"..getPlayerName (source).." #c0c0c0bought nitro for #abcdef10#c0c0c0 points!",root, 255, 255, 255, true ) 
        savePlayerData( nitro, "points", playerPoints - 10 )  
    else 
        outputChatBox ("#c0c0c0* You must sit in a car to buy nitro it!",source, 255, 255, 255, true ) 
    cancelEvent()                        
        end     
    else 
        outputChatBox ("#c0c0c0* You can't buy nitro, you need #abcdef10#c0c0c0 points first!",source, 255, 255, 255, true ) 
    cancelEvent() 
        end 
    end 
addCommandHandler("nitro", nitro) 
addCommandHandler("nos", nitro) 

You are calling a nil function nos.

Posted

oh my bad :D

but i have got this problem now.

  
function nitro(source, command) 
        local points = getElementData(source,"points") 
            if points >= 10 then 
        if (isPedInVehicle(source)) then 
        addVehicleUpgrade(getPedOccupiedVehicle(source), 1010) 
        setTimer(outputChatBox,50,1,"#c0c0c0* #abcdef"..getPlayerName (source).." #c0c0c0bought nitro for #abcdef10#c0c0c0 points!",root, 255, 255, 255, true ) 
            local cashToNos = 10 
            savePlayerData(nitro, "points", points - cashToNos ) 
    else 
        outputChatBox ("#c0c0c0* You must sit in a car to buy nitro it!",source, 255, 255, 255, true ) 
    cancelEvent()                       
        end    
    else 
        outputChatBox ("#c0c0c0* You can't buy nitro, you need #abcdef10#c0c0c0 points first!",source, 255, 255, 255, true ) 
    cancelEvent() 
        end 
    end 
addCommandHandler("nitro", nitro) 
addCommandHandler("nos", nitro) 
  

code works great but it doenst effect to "points". whats wrong?

Posted
nitro = nil

You are trying to savePlayerData of element "nitro".

i dont understand. i am new at lua coding. can you explain me? :?

edit: ıh i got it. thank you so much for helping :D

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