di3g0 Posted October 2, 2021 Share Posted October 2, 2021 Hola bros aca tratando de cambiarle los stat al cj cuando se come una hamburguesa xd come una y cambia de 0 a 300 ,despues compro otra ,se la come y ahi ya no cambia de 300 a 400... y ahi me trabé intenté con else , elseif... ya se que debe de ser una cosa muy facil pero... XD if burgereat == 2 then if setPedStat( thePlayer , 21 , 0 ) then setPedStat( thePlayer , 21 , 300 ) executeCommandHandler ( "stopeatburgerB", thePlayer ) burgereat = 0 elseif burgereat == 2 then if setPedStat( thePlayer , 21 , 300 ) then setPedStat( thePlayer , 21 , 400 ) executeCommandHandler ( "stopeatburgerB", thePlayer ) burgereat = 0 end end end addCommandHandler( "eatburger_dragB", eatBurgerDragB ) Link to comment
_SAXI_ Posted October 2, 2021 Share Posted October 2, 2021 Hola, eso sucede porque estás haciendo mal la condicional; estás usando setPedStat -- devuelve true solo si se pudo establecer el valor. En caso de que el ped o jugador ya tengan el stat establecido, devolverá false Cuando deberías usar getPedStat Aquí la corrección: if burgereat == 2 then if getPedStat( thePlayer , 21 ) == 0 then setPedStat( thePlayer , 21 , 300 ) executeCommandHandler ( "stopeatburgerB", thePlayer ) burgereat = 0 elseif getPedStat( thePlayer , 21) == 300 then setPedStat( thePlayer , 21 , 400 ) executeCommandHandler ( "stopeatburgerB", thePlayer ) burgereat = 0 end end 1 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