#Al-Ha[J]aRii Posted February 23, 2013 Share Posted February 23, 2013 hi all what wrong with this script it's for window button Lock-Unlock addEventHandler( "onClientGUIClick", root, function () if ( source == Lock-UnLock ) then local playervehicle = getPedOccupiedVehicle ( thePlayer ) if playervehicle then setVehicleLocked ( playervehicle, true ) outputChatBox ( "Your Vehicle Lock !",255, 0, 0, true ) else setVehicleLocked ( playervehicle, false ) outputChatBox ( " Your Vehicle UnLock !",255, 0, 0, true ) end end end ) Link to comment
Jaysds1 Posted February 23, 2013 Share Posted February 23, 2013 Is this the full script??? Because the Lock-Unlock isn't defined! Link to comment
Baseplate Posted February 23, 2013 Share Posted February 23, 2013 Lock-Unlock is a gui button, show us the gui script Link to comment
Max+ Posted February 23, 2013 Share Posted February 23, 2013 (edited) Edited Thank's Fhoode addEventHandler( "onClientGUIClick", root, function () if ( source == Lock-UnLock ) then if (isPedInVehicle ) then local playervehicle = getPedOccupiedVehicle(localPlayer) if(isVehicleLocked ( playervehicle )) then setVehicleLocked ( playervehicle, false ) outputChatBox ( "Your Vehicle UnLocked !",255, 0, 0, true ) else setVehicleLocked ( playervehicle, true ) outputChatBox( " Your Vehicle Locked !", 255, 0, 0 , true) end end end end ) Edited February 23, 2013 by Guest Link to comment
#Al-Ha[J]aRii Posted February 23, 2013 Author Share Posted February 23, 2013 Is this the full script???Because the Lock-Unlock isn't defined! it's for panel in button Lock-Unlock this is not full of the my script just the code lock unlock Car Link to comment
iPrestege Posted February 23, 2013 Share Posted February 23, 2013 If You Use - Syntax The Script Won't Work And The Code Isn't Right . Link to comment
Max+ Posted February 23, 2013 Share Posted February 23, 2013 If You Use - Syntax The Script Won't Work And The Code Isn't Right . if you use - as a Button Name well say error But if You Use it in onClientGUIClick wont say anyting Link to comment
Baseplate Posted February 23, 2013 Share Posted February 23, 2013 addEventHandler( "onClientGUIClick", Lock-UnLock, function () local vehicle = getPedOccupiedVehicle(localPlayer) setVehicleLocked ( vehicle, true ) outputChatBox ( "Your Vehicle Lock !",255, 0, 0, true ) else setVehicleLocked ( vehicle, false ) outputChatBox ( "Your Vehicle unLock !",255, 0, 0, true ) end ) Link to comment
iPrestege Posted February 23, 2013 Share Posted February 23, 2013 If You Use - Syntax The Script Won't Work And The Code Isn't Right . if you use - as a Button Name well say error But if You Use it in onClientGUIClick wont say anyting Yes That's Right @ Max Also You're Script Won't Open The Vehilce After Locked It You Should To Check if isVehicleLocked or Not . Link to comment
Max+ Posted February 23, 2013 Share Posted February 23, 2013 addEventHandler( "onClientGUIClick", Lock-UnLock, function () local vehicle = getPedOccupiedVehicle(localPlayer) setVehicleLocked ( vehicle, true ) outputChatBox ( "Your Vehicle Lock !",255, 0, 0, true ) else setVehicleLocked ( vehicle, false ) outputChatBox ( "Your Vehicle unLock !",255, 0, 0, true ) end ) Samer shortcut for it Link to comment
Jaysds1 Posted February 23, 2013 Share Posted February 23, 2013 (edited) try this: addEventHandler( "onClientGUIClick",guiRoot,function() if ( source == Lock-UnLock ) then local playervehicle = getPedOccupiedVehicle (localPlayer) if playervehicle then if isVehicleLocked(playervehicle) then setVehicleLocked ( playervehicle, false ) outputChatBox ( " Your Vehicle UnLock !",255, 0, 0, true ) else setVehicleLocked ( playervehicle, true ) outputChatBox ( "Your Vehicle Lock !",255, 0, 0, true ) end else outputChatBox("Sorry, but you aren't in a vehicle!",255,0,0,true) end end end) Edited February 23, 2013 by Guest Link to comment
#Al-Ha[J]aRii Posted February 23, 2013 Author Share Posted February 23, 2013 addEventHandler( "onClientGUIClick", Lock-UnLock, function () local vehicle = getPedOccupiedVehicle(localPlayer) setVehicleLocked ( vehicle, true ) outputChatBox ( "Your Vehicle Lock !",255, 0, 0, true ) else setVehicleLocked ( vehicle, false ) outputChatBox ( "Your Vehicle unLock !",255, 0, 0, true ) end ) lol ur code wrong samer thanx max and all Link to comment
Baseplate Posted February 23, 2013 Share Posted February 23, 2013 How come?? did you test it? Link to comment
Max+ Posted February 23, 2013 Share Posted February 23, 2013 Your Welcome Dont Forget to Copy My Last Post Link to comment
#Al-Ha[J]aRii Posted February 23, 2013 Author Share Posted February 23, 2013 How come?? did you test it? yea go check it in MTA Script editor there wrong in him Link to comment
Jaysds1 Posted February 23, 2013 Share Posted February 23, 2013 Try my script I posted! Link to comment
iPrestege Posted February 23, 2013 Share Posted February 23, 2013 All This Code Won't Work And Wrong . Link to comment
Max+ Posted February 23, 2013 Share Posted February 23, 2013 Samer i think because you forget this Part if vehicle then --Code And Jaysd1 it's Alredy sloved . Link to comment
iPrestege Posted February 23, 2013 Share Posted February 23, 2013 Jaysd1 Script Should Work But You Should To Be in A Vehicle To Un-Lock it ! Link to comment
Max+ Posted February 23, 2013 Share Posted February 23, 2013 Mr.Pres[T]ege My Script Worked But it's Stupied if you lock it and out and want to get in car you cant lol Link to comment
Jaysds1 Posted February 23, 2013 Share Posted February 23, 2013 ok, the problem is already solved, it's done! Link to comment
iPrestege Posted February 23, 2013 Share Posted February 23, 2013 ok, the problem is already solved, it's done! No it,s not you know why? Becuase if he wasn't on the vehicle the vehicle won't open again ^ . Link to comment
Max+ Posted February 23, 2013 Share Posted February 23, 2013 Yeah Tha'ts Right He Should make an bind key or you know what i will make it right now . Link to comment
iPrestege Posted February 23, 2013 Share Posted February 23, 2013 Yeah Tha'ts Right He Should make an bind key or you know what i will make it right now . You're Script Also Have The Same Fu Ck Ing Problem ^^ Link to comment
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