Jump to content

Locking script for the team


Unique23

Recommended Posts

function speedup ( thePlayer ) 
    if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Unique" ) and ( getElementModel ( source ) == 470 ) then 
        local handlingTable = getVehicleHandling ( source ) 
        local newVelocity = ( handlingTable [ "maxVelocity" ] + ( handlingTable [ "maxVelocity" ] / 100 * 200 ) ) 
        setVehicleHandling ( source, "numberOfGears", 5 ) 
        setVehicleHandling ( source, "driveType", 'awd' ) 
        setVehicleHandling ( source, "maxVelocity", newVelocity ) 
        setVehicleHandling ( source, "engineAcceleration", handlingTable [ "engineAcceleration" ] + 8 ) 
    end 
end 
addEventHandler ( "onVehicleEnter", root, speedup ) 

Errors I found:

1: You put the event handler inside the function.

2: You had one extra 'end'.

3: You were using getElementType for the wrong purpose.

Link to comment
  
function speedup ( thePlayer ) 
    if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Unique" ) and ( getElementModel ( source ) == )  then 
        local handlingTable = getVehicleHandling ( source ) 
        local newVelocity = ( handlingTable [ "maxVelocity" ] + ( handlingTable [ "maxVelocity" ] / 100 * 700 ) ) 
        setVehicleHandling ( source, "numberOfGears", 5 ) 
        setVehicleHandling ( source, "driveType", 'awd' ) 
        setVehicleHandling ( source, "maxVelocity", newVelocity ) 
        setVehicleHandling ( source, "engineAcceleration", handlingTable [ "engineAcceleration" ] + 8 ) 
    end 
end 
addEventHandler ( "onVehicleEnter", root, speedup ) 
  
  

Okay, It gives error

Unexpected symbol near ')'

Link to comment
      
    function speedup ( thePlayer ) 
        if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Unique" ) then 
            local handlingTable = getVehicleHandling ( source ) 
            local newVelocity = ( handlingTable [ "maxVelocity" ] + ( handlingTable [ "maxVelocity" ] / 100 * 700 ) ) 
            setVehicleHandling ( source, "numberOfGears", 5 ) 
            setVehicleHandling ( source, "driveType", 'awd' ) 
            setVehicleHandling ( source, "maxVelocity", newVelocity ) 
            setVehicleHandling ( source, "engineAcceleration", handlingTable [ "engineAcceleration" ] + 8 ) 
        end 
    end 
    addEventHandler ( "onVehicleEnter", root, speedup ) 
      
      

Link to comment

@mint3d

  
function speedup ( thePlayer ) 
    if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Unique" ) and ( getElementModel ( source ) == )  then 
        local handlingTable = getVehicleHandling ( source ) 
        local newVelocity = ( handlingTable [ "maxVelocity" ] + ( handlingTable [ "maxVelocity" ] / 100 * 700 ) ) 
        setVehicleHandling ( source, "numberOfGears", 5 ) 
        setVehicleHandling ( source, "driveType", 'awd' ) 
        setVehicleHandling ( source, "maxVelocity", newVelocity ) 
        setVehicleHandling ( source, "engineAcceleration", handlingTable [ "engineAcceleration" ] + 8 ) 
    end 
end 
addEventHandler ( "onVehicleEnter", root, speedup ) 
  

It says:

ERROR:Loading script failed: Enes\speed.lua:3: unexpected symbol near ')'

Link to comment

Try (not tested)

function speedup ( thePlayer ) 
    if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Unique" )  then 
        local handlingTable = getVehicleHandling ( source ) 
        local newVelocity = ( handlingTable [ "maxVelocity" ] + ( handlingTable [ "maxVelocity" ] / 100 * 700 ) ) 
        setVehicleHandling ( source, "numberOfGears", 5 ) 
        setVehicleHandling ( source, "driveType", 'awd' ) 
        setVehicleHandling ( source, "maxVelocity", newVelocity ) 
        setVehicleHandling ( source, "engineAcceleration", handlingTable [ "engineAcceleration" ] + 8 ) 
    end 
end 
addEventHandler ( "onVehicleEnter", root, speedup ) 

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