Jump to content

[HELP]Script error


Alen141

Recommended Posts

So i'm working on my private vehicle system,but it doesn't work why? here is lua :

local vehicle = createVehicle( 602, 2279.1000976563, -1671.1999511719, 15.10000038147, 0, 0, 272 ) 
  
addEventHandler("onVehicleStartEnter", vehicle, 
    function(player, seat, jacked) 
        if ( source == vehicle ) then 
            local user = getAccountName ( Alen ) 
            if ( user == "Alen" ) then 
                cancelEvent() 
                outputChatBox("This vehicle is private.", player, 255, 0, 0, false) 
            else 
                outputChatBox("Welcome to your vehicle,Sir!", player, 0, 255, 0, false) 
            end 
        end 
    end 
) 
  

Link to comment
local vehicle = createVehicle( 602, 2279.1000976563, -1671.1999511719, 15.10000038147, 0, 0, 272 ) 
  
addEventHandler("onVehicleStartEnter", vehicle, 
    function(player, seat, jacked) 
        if ( source == vehicle ) then 
            local user = getAccountName ( Alen ) 
            if ( user ~= "Alen" ) then 
                cancelEvent() 
                outputChatBox("This vehicle is private.", player, 255, 0, 0, false) 
            else 
                outputChatBox("Welcome to your vehicle,Sir!", player, 0, 255, 0, false) 
            end 
        end 
    end 
) 
  

Link to comment
local vehicle = createVehicle( 602, 2279.1000976563, -1671.1999511719, 15.10000038147, 0, 0, 272 ) 
  
addEventHandler("onVehicleStartEnter", vehicle, 
    function(player, seat, jacked) 
        if ( source == vehicle ) then 
            local user = getAccountName ( Alen ) 
            if ( user ~= "Alen" ) then 
                cancelEvent() 
                outputChatBox("This vehicle is private.", player, 255, 0, 0, false) 
            else 
                outputChatBox("Welcome to your vehicle,Sir!", player, 0, 255, 0, false) 
            end 
        end 
    end 
) 
  

This still wrong.

Link to comment

try this

function idk () 
local X, Y, Z = 2279.1000976563, -1671.1999511719, 15.10000038147 
abcvehicle = createVehicle ( 602, X, Y, Z ) 
addEventHandler("onVehicleStartEnter", abcvehicle, abc ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, idk  ) 
  
function abc ( thePlayer, seat, jacked ) 
local accname = getAccountName ( getPlayerAccount ( thePlayer ) ) 
if accname == "Alen" then 
outputChatBox ("Welcome to your vehicle,Sir!", thePlayer, 0,255,0) 
else 
cancelEvent() 
outputChatBox("This vehicle is private", thePlayer, 255, 0, 0) 
   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...