Sande Posted March 12, 2013 Posted March 12, 2013 Hey, i downloaded smoke script in mta commity, i edited it little now i have one problem. When i type /smokeoff it doesnt destroy this sigarette. function sigarette ( thePlayer, commandName ) local x, y, z = getElementPosition ( thePlayer ) sig = createObject ( 1485, 0, 0, 0 ) exports [ "bone_attach" ]:attachElementToBone ( sig, thePlayer,1,-0.01,-0.01,-0.02,90,90,0) toggleControl ( thePlayer, "jump", false ) toggleControl ( thePlayer, "sprint", false ) toggleControl ( thePlayer, "crouch", false ) end addCommandHandler ( "smoke", sigarette ) function sigarette ( thePlayer, commandName ) toggleControl ( thePlayer, "jump", true ) toggleControl ( thePlayer, "sprint", true ) toggleControl ( thePlayer, "crouch", true ) destroyElement(sig) end addCommandHandler ( "smokeoff", sigarette )
iPrestege Posted March 12, 2013 Posted March 12, 2013 function sigarette ( thePlayer, commandName ) x, y, z = getElementPosition ( thePlayer ) exports [ "bone_attach" ]:attachElementToBone ( sig, thePlayer,1,-0.01,-0.01,-0.02,90,90,0) sig = createObject ( 1485,x,y,z) toggleControl ( thePlayer, "jump", false ) toggleControl ( thePlayer, "sprint", false ) toggleControl ( thePlayer, "crouch", false ) end addCommandHandler ( "smoke", sigarette ) function sigarette ( thePlayer, commandName ) destroyElement(sig) toggleControl ( thePlayer, "jump", true ) toggleControl ( thePlayer, "sprint", true ) toggleControl ( thePlayer, "crouch", true ) end addCommandHandler ( "smokeoff", sigarette )
Castillo Posted March 12, 2013 Posted March 12, 2013 Well, you should have stored the objects on a table, since if you use it, then another player does it too, it'll bug the script. local cigarettes = { } function cigarette ( thePlayer ) if ( not isElement ( cigarettes [ thePlayer ] ) ) then local x, y, z = getElementPosition ( thePlayer ) cigarettes [ thePlayer ] = createObject ( 1485, 0, 0, 0 ) exports [ "bone_attach" ]:attachElementToBone ( cigarettes [ thePlayer ], thePlayer, 1, -0.01, -0.01, -0.02, 90, 90, 0 ) toggleControl ( thePlayer, "jump", false ) toggleControl ( thePlayer, "sprint", false ) toggleControl ( thePlayer, "crouch", false ) else toggleControl ( thePlayer, "jump", true ) toggleControl ( thePlayer, "sprint", true ) toggleControl ( thePlayer, "crouch", true ) destroyElement ( cigarettes [ thePlayer ] ) end end addCommandHandler ( "smoke", cigarette ) Now you just need to use "/smoke". Edit: @Mr.Pres[T]ege: Your script has the same problem. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted March 12, 2013 Posted March 12, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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