Alen141 Posted December 26, 2012 Posted December 26, 2012 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 )
MatXpl Posted December 26, 2012 Posted December 26, 2012 use addEventHandler("onVehicleStartEnter", getRootElement(), if it dosnt work, sumbit a debug MTA:SA scripts/gamemodes/misc: http://www.mtasa.xn.pl
Alen141 Posted December 26, 2012 Author Posted December 26, 2012 use addEventHandler("onVehicleStartEnter", getRootElement(), if it dosnt work, sumbit a debug not working DEBUG : expected to close at line 3 near function
MatXpl Posted December 26, 2012 Posted December 26, 2012 it should working have you another code in this script ? MTA:SA scripts/gamemodes/misc: http://www.mtasa.xn.pl
Castillo Posted December 26, 2012 Posted December 26, 2012 getAccountName requires an account element, you are using a variable that is not even defined. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
MatXpl Posted December 26, 2012 Posted December 26, 2012 Solidsnake14 have right you should use https://wiki.multitheftauto.com/wiki/GetPlayerAccount MTA:SA scripts/gamemodes/misc: http://www.mtasa.xn.pl
TAPL Posted December 26, 2012 Posted December 26, 2012 And i guess that you was meant this: if ( user == "Alen" ) then To be: if ( user ~= "Alen" ) then
فتى تبوك Posted December 27, 2012 Posted December 27, 2012 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
TAPL Posted December 27, 2012 Posted December 27, 2012 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.
ali Posted December 27, 2012 Posted December 27, 2012 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 LUA Scripter [Tut]How to add maps using in-game script editor [Tut]How to get a hosted MTA Sa Server for free
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now