Jumper_Mych Posted January 21, 2011 Share Posted January 21, 2011 Hi Vehicle Lock a Player bind key L is lock and unlock door vehicle but owner name can key unlock and lock door vehicle. example Jumper_Mych can press L (unlock and lock) because it is your own car. Obama Barack can't press L unlock and lock the vehicle because no owner vehicle. thanks for helping doesn't work vehicle = createVehicle ( 496, 2425, -55, 27, 0, 0, 0 ) setElementData(vehicle,"vehicle","car") setElementData(vehicle, "owner", "Jumper_Mych") function lockcar ( player ) if (getElementData(source, "vehicle" ) == "car") and ( getElementData(source, "owner" ) == getPlayerName(player) ) then if isVehicleLocked ( player ) then setVehicleLocked ( player, false ) else setVehicleLocked ( player, true ) cancelEvent() end end function bindLockOnSpawn ( theSpawnpoint ) bindKey ( source, "l", lockcar ) end addEventHandler ( "onPlayerSpawn", getRootElement(), bindLockOnSpawn ) If it works, delete my topic because your not allowed. Never hold my topic Link to comment
Castillo Posted January 21, 2011 Share Posted January 21, 2011 Your code has many errors, you got missing "end" and not needed stuff. try this code, vehicle = createVehicle ( 496, 2425, -55, 27, 0, 0, 0 ) setElementData(vehicle,"vehicle","car") setElementData(vehicle, "owner", "Jumper_Mych") function lockcar ( player ) if (getElementData(vehicle, "vehicle" ) == "car") and ( getElementData(vehicle, "owner" ) == getPlayerName(player) ) then if isVehicleLocked ( vehicle ) then setVehicleLocked ( vehicle, false ) outputChatBox("Vehicle unlocked!",player,0,255,0) else setVehicleLocked ( vehicle, true ) outputChatBox("Vehicle locked!",player,255,0,0) end end end function bindLockOnSpawn ( ) bindKey ( source, "l", "down", lockcar ) end addEventHandler( "onPlayerSpawn", getRootElement(), bindLockOnSpawn ) P.S: Stop saying "Don't copy my code" and so on because your codes always fails 1 Link to comment
Jumper_Mych Posted January 21, 2011 Author Share Posted January 21, 2011 Sit in vehicle can lock and unlock is work! but exit vehicle and go lock and unlock door vehicle doesn't work. I try sit in vehicle set lock and exit cant lock when error Link to comment
Castillo Posted January 21, 2011 Share Posted January 21, 2011 huh, i don't get you, i've tested it and has no problems. Link to comment
Jumper_Mych Posted January 21, 2011 Author Share Posted January 21, 2011 earlier my code is same doesn't work exit the lock and unlock and have problem Your code is doesn't work (alike me) Link to comment
Castillo Posted January 21, 2011 Share Posted January 21, 2011 When i press "L" it says Vehicle unlocked/locked, and the vehicle gets locked/unlocked. Link to comment
Jumper_Mych Posted January 21, 2011 Author Share Posted January 21, 2011 just send you youtube Link to comment
Castillo Posted January 21, 2011 Share Posted January 21, 2011 Did you copy my latest code? because i've changed it many times. Link to comment
Jumper_Mych Posted January 21, 2011 Author Share Posted January 21, 2011 your code doesn't work alike my youtube Link to comment
SDK Posted January 22, 2011 Share Posted January 22, 2011 Are you sure you copied it right? Because Solidsnake14's code has messages and I don't see any messages on your video .. Link to comment
Jumper_Mych Posted January 22, 2011 Author Share Posted January 22, 2011 Yes i copy code Solidsnake14 but is same my code alike youtube Solidsanke14 did you watching my youtube? Link to comment
Castillo Posted January 22, 2011 Share Posted January 22, 2011 Put the code EXACTLY like it is, leave the messages. Link to comment
Jumper_Mych Posted January 22, 2011 Author Share Posted January 22, 2011 Vehicle sit player can lock and unlock. Player is stay with backyard near vehicle can't unlock and lock. How that improvements to work? Link to comment
Castillo Posted January 22, 2011 Share Posted January 22, 2011 wow, a vehicle can sit on a player o_o? that's really strange, don't you think? Does it work? or not? Link to comment
Jumper_Mych Posted January 22, 2011 Author Share Posted January 22, 2011 wow, a vehicle can sit on a player o_o? that's really strange, don't you think? huh, Player is sit the vehicle can lock and unlock is work! but player is stay doesn't sit the vehicle doesn't work lock and unlock, do you know? Does it work? or not? Not yet finished. Link to comment
Castillo Posted January 22, 2011 Share Posted January 22, 2011 Look, i don't f** understand a word of what you say. Link to comment
Jumper_Mych Posted January 22, 2011 Author Share Posted January 22, 2011 to watch video youtube Solidsnake14 code: 1. Player in Vehicle can Lock and unlock - work 2. Player get out vehicle can lock and unlock - Doesn't work 3. Player in vehicle is lock can't get out vehicle - Doesn't work sure you understand it Link to comment
Castillo Posted January 22, 2011 Share Posted January 22, 2011 are you saying, when you enter the vehicle and vehicle is locked you can't unlock it anymore? Link to comment
Jumper_Mych Posted January 22, 2011 Author Share Posted January 22, 2011 Solidsnake14 code: 1. Player in Vehicle can Lock and unlock - work 2. Player get out vehicle can lock and unlock - Doesn't work 3. Player in vehicle is lock can't get out vehicle - Doesn't work do not you understand? I say Vehicle in ped work lock and unlock door Ped get out the vehicle next can't lock door vehicle and unlock Link to comment
Jumper_Mych Posted January 23, 2011 Author Share Posted January 23, 2011 you should at least try something first. Scripting moderator can help me? Link to comment
Castillo Posted January 23, 2011 Share Posted January 23, 2011 I should try something???? the code works with no errors at my private server, how that comes? P.S: You copied my word "You should at least try something first." Link to comment
Jumper_Mych Posted January 23, 2011 Author Share Posted January 23, 2011 you have rations but i want player owner vehicle and lock can't exit. unlock can get out vehicle owner. i want player far vehicle but can lock and unlock 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