Jump to content

[HELP]Script error


Alen141

Recommended Posts

Posted

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 
) 
  

Posted
use
addEventHandler("onVehicleStartEnter", getRootElement(), 

if it dosnt work, sumbit a debug

not working

DEBUG : expected to close at line 3 near function

Posted

getAccountName requires an account element, you are using a variable that is not even defined.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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 
) 
  

اسمي القديم

sultanalbalawi

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

CiTLh.png
Posted

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 
  

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