micheal1230 Posted August 11, 2012 Share Posted August 11, 2012 title says error function seatbelton( player ) local check = getPedOccupiedVehicle ( player ) if ( check == true ) then setElementData( player, "seatbelt",true) exports.global:sendLocalMeAction(player, "puts their seatbelt on") else setElementData( player, "seatbelt",false) exports.global:sendLocalMeAction(player, "takes their seatbelt off") end elseif ( check == false ) then outputChatBox("You are not in a car!", player, 255,0,0 ) end addCommandHandler("seatbelt",seatbelton) Link to comment
laserlaser Posted August 11, 2012 Share Posted August 11, 2012 title says error function seatbelton( player ) local check = getPedOccupiedVehicle ( player ) if ( check == true ) then setElementData( player, "seatbelt",true) exports.global:sendLocalMeAction(player, "puts their seatbelt on") else setElementData( player, "seatbelt",false) exports.global:sendLocalMeAction(player, "takes their seatbelt off") end elseif ( check == false ) then outputChatBox("You are not in a car!", player, 255,0,0 ) end addCommandHandler("seatbelt",seatbelton) change with function seatbelton( player ) local check = getPedOccupiedVehicle ( player ) if ( check == true ) then setElementData( player, "seatbelt",true) exports.global:sendLocalMeAction(player, "puts their seatbelt on") elseif ( check == false ) then outputChatBox("You are not in a car!", player, 255,0,0 ) else setElementData( player, "seatbelt",false) exports.global:sendLocalMeAction(player, "takes their seatbelt off") end end addCommandHandler("seatbelt",seatbelton) Link to comment
Dev Posted August 12, 2012 Share Posted August 12, 2012 Sorry, your code is wrong too laserlaser. function seatBeltOn( player ) local check = getPedOccupiedVehicle ( player ) if ( check == true ) then local beltOn = getElementData( player, "seatbelt" ) if ( not beltOn ) then setElementData( player, "seatbelt", true) exports.global:sendLocalMeAction( player, "puts their seatbelt on.") else setElementData( player, "seatbelt", false) exports.global:sendLocalMeAction( player, "takes their seatbelt off.") end elseif ( check == false ) then outputChatBox("You are not in a car!", player, 255, 0, 0 ) end end addCommandHandler("seatbelt", seatBeltOn) Link to comment
Castillo Posted August 12, 2012 Share Posted August 12, 2012 This has been solved here already: viewtopic.php?f=91&t=46527 P.S: Your code is wrong as well Dev, read why on the topic I posted. Link to comment
laserlaser Posted August 12, 2012 Share Posted August 12, 2012 Sorry, your code is wrong too laserlaser. function seatBeltOn( player ) local check = getPedOccupiedVehicle ( player ) if ( check == true ) then local beltOn = getElementData( player, "seatbelt" ) if ( not beltOn ) then setElementData( player, "seatbelt", true) exports.global:sendLocalMeAction( player, "puts their seatbelt on.") else setElementData( player, "seatbelt", false) exports.global:sendLocalMeAction( player, "takes their seatbelt off.") end elseif ( check == false ) then outputChatBox("You are not in a car!", player, 255, 0, 0 ) end end addCommandHandler("seatbelt", seatBeltOn) Oh I looked a if block only, not element == true 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