Home   Help Search Login Register  

Author Topic: removing a line  (Read 657 times)

0 Members and 1 Guest are viewing this topic.

Offline Killzone

  • Members
  • *
  • War is the true Enemy
removing a line
« on: 07 Jul 2005, 00:24:39 »
Hi all


I am trying to use a script so that I fire blanks for the 1st 12 seconds using:
________
Player addeventHandler ["fired",{deleteVehicle (nearestObject [_this select 0,_this select 4])}]

~12

________


My question is, what do I use to return the player back to normal? How do I cancel out this line?

Thanks as always  ;D
"Everyone dies so deal with it and move on"

                                                      ME

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:removing a line
« Reply #1 on: 07 Jul 2005, 00:28:46 »
Player addeventHandler ["fired",{deleteVehicle (nearestObject [_this select 0,_this select 4])}]

~12

player removealleventhandlers "fired"


Offline Killzone

  • Members
  • *
  • War is the true Enemy
Re:removing a line
« Reply #2 on: 07 Jul 2005, 00:34:45 »
Perfect!!!


Thank you Triggerhappy
"Everyone dies so deal with it and move on"

                                                      ME

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:removing a line
« Reply #3 on: 07 Jul 2005, 00:36:00 »
np, hit the little button in the corner that says "solved" so as to not arse other people in to answer a solved problem ;)

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:removing a line
« Reply #4 on: 07 Jul 2005, 04:42:02 »
Hang on a moment; depending on the situation where you do this, you might be removing a whole lot of eventhandlers that you shouldn't be removing. You want "removeEventHandler _id", which will remove a certain e-h but not all of them.

It's been a while since I last used e-h's, or user-added actions, but  there is a trick (check the comref) which makes it easier to track ids for actions; you could say
 _myAction = player addaction ["Hello","Hello.sqs"]
which would set the variable _myAction equal to the index of the new action. Then you could say
removeaction _myAction
to remove the correct action.

Presumably the same applies to eventhandlers, if so this is a much better way of managing them