DakiLLa Posted August 25, 2008 Share Posted August 25, 2008 Guys, need help. I want to make an arrest scene. There is some script but it's not work. Can you help ? function Arrest ( attacker, weapon, bodypart ) if isElement(attacker) and getElementType(attacker) == "player" then if ( weapon == 3 and getPlayerSkin ( attacker ) >= 280 ) then if ( getPlayerWantedLevel ( source ) > 0 ) then setPlayerWantedLevel ( source, 0 ) setElementPosition ( source, -1982.1209, 130.7857, 27.6875 ) outputChatBox ( "You have been arrested.", source, 255, 0, 0 ) toggleAllControls ( source, true ) end end end setTimer ( DisableControls, 30000, 1 ) end addEventHandler ( "onPlayerDamage", getRootElement (), Arrest ) function DisableControls () toggleAllControls ( source, false ) outputChatBox ("You are free now. Please, dont become a criminal in next time.", source, 0, 255, 0 ) end Link to comment
Gamesnert Posted August 25, 2008 Share Posted August 25, 2008 Ehm... What exactly is wrong? If you don't know, place outputChatBox("1"), "2", etc. in the if blocks. So for example: function Arrest ( attacker, weapon, bodypart ) if isElement(attacker) and getElementType(attacker) == "player" then outputChatBox("1") if ( weapon == 3 and getPlayerSkin ( attacker ) >= 280 ) then outputChatBox("2") if ( getPlayerWantedLevel ( source ) > 0 ) then outputChatBox("3") setPlayerWantedLevel ( source, 0 ) setElementPosition ( source, -1982.1209, 130.7857, 27.6875 ) outputChatBox ( "You have been arrested.", source, 255, 0, 0 ) toggleAllControls ( source, true ) end end end setTimer ( DisableControls, 30000, 1 ) end addEventHandler ( "onPlayerDamage", getRootElement (), Arrest ) function DisableControls () outputChatBox("4") toggleAllControls ( source, false ) outputChatBox ("You are free now. Please, dont become a criminal in next time.", source, 0, 255, 0 ) end And if you see... 1 2 3 4 (this one after a while) ... then it should work, right? Otherwise, tell us from where it's going wrong. Link to comment
DakiLLa Posted August 25, 2008 Author Share Posted August 25, 2008 uh, i dont remember to put some stars for a player before strike of nightstik but toggleAllControls shows Warning bad Argument in this line. and message "You are free..." shows for ALL people, not for criminal person. Link to comment
Ace_Gambit Posted August 25, 2008 Share Posted August 25, 2008 The variable source is not passed to DisableControls by default. You will have to pass it as an argument in your setTimer call. setTimer ( DisableControls, 30000, 1, source ) function DisableControls (thePlayer) toggleAllControls ( thePlayer, false ) outputChatBox ("You are free now. Please, dont become a criminal in next time.", thePlayer, 0, 255, 0 ) end 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