micheal1230 Posted August 11, 2012 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)
laserlaser Posted August 11, 2012 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)
Dev Posted August 12, 2012 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) "First they ignore you, then they laugh at you, then they fight you, then you win." - Mahatma Gandhi (1869-1948)
Castillo Posted August 12, 2012 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. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
laserlaser Posted August 12, 2012 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
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