Author Topic: ExtinguishFire function  (Read 1977 times)

Theremin

  • Full Member
  • ***
  • Posts: 154
  • Karma: +48/-18
  • Worst Server Owner
    • View Profile
    • Visit my YouTube channel
ExtinguishFire function
« on: December 22, 2014, 04:45:24 pm »
I have some problems with ExtinguishFire function,
Quote
"I've tried everything, and I just couldn't keep those extra two-hundred errors off! It started to affect my script."
anyway i can't get this snippet to work and console returns no error
Code: [Select]
function onPlayerKeyStateChange( player, key, down )
{
if ( ( player.Vehicle ) && ( key == KEY_INCAR_FIRE ) )
{
local pos = player.Vehicle.Pos;
ExtinguishFire( pos, 50.0 );
}
return;
}
i'm almost sure the error must be in retrieving the pos by ExtinguishFire function, as when i tried using CreateFire instead it worked as a charm (and CreateFire has the same arguments). Or even using another function works perfectly, therefore i have no clue what i'm doing wrong.
Quote
"give me some advice! I mean, come on, I got real problems!"
:D

Theremin

  • Full Member
  • ***
  • Posts: 154
  • Karma: +48/-18
  • Worst Server Owner
    • View Profile
    • Visit my YouTube channel
Re: ExtinguishFire function
« Reply #1 on: December 23, 2014, 02:47:13 am »
Did you read "This will extinguish all fires within a 5.0 radius from the player when they type '/extinguish2'." ?

This is written in the example in LU wiki, within a 5.0 radius because the example does use five meters radius. Mine uses 50 meters radius as you may have noticed, anyway i tested it with 5.0 meters instead of 50.0 and it's still not working.

Theremin

  • Full Member
  • ***
  • Posts: 154
  • Karma: +48/-18
  • Worst Server Owner
    • View Profile
    • Visit my YouTube channel
Re: ExtinguishFire function
« Reply #2 on: December 23, 2014, 02:44:52 pm »
tested and not works.

That's what i said. Not even the wiki example works.

Theremin

  • Full Member
  • ***
  • Posts: 154
  • Karma: +48/-18
  • Worst Server Owner
    • View Profile
    • Visit my YouTube channel
Re: ExtinguishFire function
« Reply #3 on: February 26, 2015, 09:43:20 pm »
I'm upping this topic as I still haven't solved it.

Vortrex

  • Full Member
  • ***
  • Posts: 267
  • Karma: +54/-73
    • View Profile
Re: ExtinguishFire function
« Reply #4 on: February 27, 2015, 02:32:37 pm »
I may have a solution for this, but it's only a concept as I haven't tried it yet. It's probably not the solution you were looking for, but its a workaround that has the same effect.

Create an array to store the necessary information for current fires.
When you create a fire, push it onto the array. You should probably need only the position and radius.

If you want to destroy a fire, remove the slot of the fire in the array. Then, use the
ExtinguishAllFires() function. You can then re-create all the remaining fires based on what's left in the array.

Theremin

  • Full Member
  • ***
  • Posts: 154
  • Karma: +48/-18
  • Worst Server Owner
    • View Profile
    • Visit my YouTube channel
Re: ExtinguishFire function
« Reply #5 on: March 26, 2015, 02:16:08 am »
I understood 100% of what you wrote in your last post and I also acknowledge that I have no idea how to do that, I haven't yet mastered the use of arrays even though i'm starting to understand something about them. That said I've given up on this script idea for now, but I'll prefer not to have this topic locked in case someone else has something to write about this topic. Beside from a solution, which has now been given by Vortrex, my question remains: Is the ExtinguishFire function broken or am I doing some mistakes in using it?
P.s: Thanks Vortrex for your idea. :)

EDIT: Whoops! I wasn't aware locking the topic was also up to the OP, just noticed it, so nevermind I'll just leave it open. ;D
« Last Edit: March 26, 2015, 02:41:46 am by Theremin »

 

© Liberty Unleashed Team.