Jump to content

help with command


TroyBoy

Recommended Posts

look when i try to do this command to only two teams it give me an error with the first if:

    addCommandHandler ( "addupgrade", 
        function ( thePlayer, commandName, id ) 
            if ( isPedInVehicle ( thePlayer ) ) then 
            local id = tonumber ( id ) 
            local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local success = addVehicleUpgrade ( theVehicle, id ) 
            local playerTeam = getPlayerTeam ( player ) 
            if ( success ) then 
                outputConsole ( getVehicleUpgradeSlotName ( id ) .. " upgrade added.", thePlayer ) 
            else 
                outputConsole ( "Failed to add upgrade.", thePlayer ) 
            end 
        else 
            outputConsole ( "You must be in a vehicle!", thePlayer ) 
        end 
end 

Link to comment
addCommandHandler ( "addupgrade", 
    function ( thePlayer, commandName, id ) 
        if ( isPedInVehicle ( thePlayer ) ) then 
            local id = tonumber ( id ) 
            local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local success = addVehicleUpgrade ( theVehicle, id ) 
            local playerTeam = getPlayerTeam ( player ) 
            if ( success ) then 
                outputConsole ( getVehicleUpgradeSlotName ( id ) .. " upgrade added.", thePlayer ) 
            else 
                outputConsole ( "Failed to add upgrade.", thePlayer ) 
            end 
        else 
            outputConsole ( "You must be in a vehicle!", thePlayer ) 
        end 
    end 
)    

https://wiki.multitheftauto.com/wiki/Scr ... troduction

http://www.lua.org/manual/5.1/

Link to comment

OK and i have problem with this function:

addCommandHandler ( "vr", 
    function ( theplayer, thevehicle ) 
        if ( isPedInVehicle ( thePlayer ) ) then 
        fixVehicle ( theVehicle ) 
        end 

and make it to the ownerteam and adminteam please

Link to comment

ty and when i debug with this command:

addCommandHandler ( "nos", 
    function ( thePlayer, commandName, id ) 
        if ( isPedInVehicle ( thePlayer ) ) then 
            local id = tonumber ( id ) 
            local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local success = addVehicleUpgrade ( theVehicle, "1010" ) 
            local playerTeam = getPlayerTeam ( player ) 
            if playerTeam then 
            local name = getTeamName ( playerTeam ) 
            if name == "Owner" or name == "Admin" then 
            if ( success ) then 
                outputConsole ( getVehicleUpgradeSlotName ( id ) .. " upgrade added.", thePlayer ) 
            else 
                outputConsole ( "Failed to add upgrade.", thePlayer ) 
            end 
        else 
            outputConsole ( "You must be in a vehicle!", thePlayer ) 
        end 
    end  
  end  
)    

its sais to me that there is unxepted symbol near the last ) why?

Link to comment
addCommandHandler ( "nos", 
    function ( thePlayer, commandName, id ) 
        if ( isPedInVehicle ( thePlayer ) ) then 
            local id = tonumber ( id ) 
            local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local success = addVehicleUpgrade ( theVehicle, "1010" ) 
            local playerTeam = getPlayerTeam ( thePlayer ) 
              if playerTeam then 
                   local name = getTeamName ( playerTeam ) 
                    if name == "Owner" or name == "Admin" then 
                      if ( success ) then 
                           outputConsole ( getVehicleUpgradeSlotName ( id ) .. " upgrade added.", thePlayer ) 
                      else 
                           outputConsole ( "Failed to add upgrade.", thePlayer ) 
                     end 
                    else 
                           outputConsole ( "You must be in a vehicle!", thePlayer ) 
                    end 
             end 
      end 
end   
) 

Edited by Guest
Link to comment
addCommandHandler ( "nos", 
    function ( thePlayer, commandName, id ) 
        if ( isPedInVehicle ( thePlayer ) ) then 
            local id = tonumber ( id ) 
            local theVehicle = getPedOccupiedVehicle ( thePlayer ) 
            local playerTeam = getPlayerTeam ( thePlayer ) 
            if (not playerTeam) then return end 
            local name = getTeamName ( playerTeam ) 
            if (name == "Owner" or name == "Admin") then 
                local success = addVehicleUpgrade ( theVehicle, 1010 ) 
                if ( success ) then 
                    outputChatBox ( getVehicleUpgradeSlotName ( 1010 ) .. " upgrade added.", thePlayer ) 
                else 
                    outputChatBox ( "Failed to add upgrade.", thePlayer ) 
                end 
            end 
        else 
            outputChatBox ( "You must be in a vehicle!", thePlayer ) 
        end 
    end 
) 

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