Jump to content

petrol tank


S0rcerer

Recommended Posts

Hello :) (BTW: Bäm, i am back :) we was moving house)

For a week, i already tried this too with the test-script from the wiki, but it don´t works and i get warnings (don´t know there anymore, i already delete the little script)

I am interesting in this script too, could somebody help us?

PS: Are signatures deactivate?!

have a good day,

XetaQuake =)

Link to comment
Hello :) (BTW: Bäm, i am back :) we was moving house)

For a week, i already tried this too with the test-script from the wiki, but it don´t works and i get warnings (don´t know there anymore, i already delete the little script)

I am interesting in this script too, could somebody help us?

PS: Are signatures deactivate?!

have a good day,

XetaQuake =)

I never found the wiki with useful examples to make things work, about the script, ill try one my self

Link to comment
function ohnozTheGasTanksWillBeVulnerable(theActivator) 
    local vehicles=getElementsByType("vehicle") 
    for k,v in ipairs(vehicles) do 
        setVehicleFuelTankExplodable(v,true) 
    end 
    outputChatBox("Warning! " .. getClientName(theActivator) .. " made all gastanks vulnerable! You'll all be pwned!",getRootElement(),255,0,0) 
end 
addCommandHandler("loliwanttopwnbymakinggastanksexplodable",ohnozTheGasTanksWillBeVulnerable) 

U.N.T.E.S.T.E.D. but should work since I used a similar code. Was too lazy to search for it. =/

Link to comment

Sexy command :P

Works good, thanks Gamesnert.

But there a problem: when do you create vehicles online (example: Freeroam GUI) there don´t explodes by shooting in the tank.

I thinks its because of

local vehicles=getElementsByType("vehicle") 

, there find just all vehicles from the map. How to fix this?

XetaQuake

Link to comment
Sexy command :P

Works good, thanks Gamesnert.

But there a problem: when do you create vehicles online (example: Freeroam GUI) there don´t explodes by shooting in the tank.

I thinks its because of

local vehicles=getElementsByType("vehicle") 

, there find just all vehicles from the map. How to fix this?

XetaQuake

I don't know for sure, but I guess...

onVehicleRespawn

Or a timer that loops, but I don't recommend that... =/

And well it's nothing. It's a basic for loop with the command. :P

But isn't there something like "onElementCreated" or something? Would be handy in such cases. (atleast, if onVehicleRespawn doesn't work :P)

Link to comment

Don´t works :/

Your idea with onElementCreated are nice, i found a wiki topic about this idea:

Requested Functions and Events

From MTA Development wiki

Server-side

- onVehicleCreated or an equivalent... shouldn't be too hard? -Robhol (14:15 Jul 6, 08)

- If we did it, it'd be onElementCreated - what do you want this for? eAi 08:58, 7 July 2008 (CDT)

- onElementCreated is a good idea - it could be used for lots of things. Also, how about onVehicleDrown or whatever? that is, when a vehicle hits deep water. Checking for collisions and stuff is very awkward, and client-side only, and has to be checked constantly.. -Robhol (17:31 Jul 9 08)

from: http://development.mtasa.com/index.php? ... and_Events

Hmm, any other ideas?

//EDIT:

I getting it working! with onVehicleStartEnter, but there a one thing thats are not so nice, now i need your help:

When i spawning a Car, it don´t works - okay, thats no surprise, its because of onVehicleStartEnter - so i need to go in the car first.

Now i have a funny and logical idea: explosible tanks only works when the engine are running. onVehicleStartEnter are near the same, but when i go in a car and triggering onVehicleStartEnter, all cars are explosible - the cars there a not running too. Have anybody a idea to realise my "engine idea"?

Link to comment

Well, that shouldn't be too hard to figure out because the engine starts running when a player takes place in the driver seat. All you have to do is check if there's someone in the driver seat. There's also a function getVehicleEngineState which is probably a better alternative.

But my question is, why isn't onVehicleRespawn working?

Link to comment

Hi, i don´t getting it working.

my problem is, that i don´t know how i can get the vehicle the sourceplayer is in. Its needed because the argument from setVehicleFuelTankExplodable needs a vehicle name - because i don´t want that ANY cars gets explosible tanks, only the cars there a players in

Any tipps pleas :)

Link to comment
But my question is, why isn't onVehicleRespawn working?

Haven't tried it, but I don't think it works. Because it's essentially onVehicleRespawn... So I'd guess it doesn't work. =/

Hi, i don´t getting it working.

my problem is, that i don´t know how i can get the vehicle the sourceplayer is in. Its needed because the argument from setVehicleFuelTankExplodable needs a vehicle name - because i don´t want that ANY cars gets explosible tanks, only the cars there a players in

Any tipps pleas :)

If I understand this, this is the answer to Ace's question? Great... All that typing before this quote for nothing... =/

Might this help? (only a small piece of code to retrieve the driver in a vehicle)

local driver=getVehicleOccupant(source,0) or false --False in case there is an error, so it won't show it.  
if driver then 
        outputChatBox("The driver, " .. getClientName(driver) .. ", is a fool. He'll probably park his car against a tree... =/",getRootElement()) 
end 

And with onPlayerVehicleEnter and onPlayerVehicleExit as well as onVehicleEnter and onVehicleExit there are arguments to get the vehicle & player. ;)

And for vehicles you have source, ofcourse. xD

Edited by Guest
Link to comment

Well, you could do the following (All of them):

1. Explodable tanks sets to true on resource start, looping through all vehicles

2. Explodable tanks sets to true on vehicle spawn command (if you have an admin vehicle spawn command)

3. Explodable tanks sets to true onVehicleRespawn event.

This would cover all bases.

- Fenix

Link to comment
Well, you could do the following (All of them):

1. Explodable tanks sets to true on resource start, looping through all vehicles

2. Explodable tanks sets to true on vehicle spawn command (if you have an admin vehicle spawn command)

3. Explodable tanks sets to true onVehicleRespawn event.

This would cover all bases.

- Fenix

It should, but just to remind you... ;)

my problem is, that i don´t know how i can get the vehicle the sourceplayer is in. Its needed because the argument from setVehicleFuelTankExplodable needs a vehicle name - because i don´t want that ANY cars gets explosible tanks, only the cars there a players in
Link to comment

It should, but just to remind you... ;)

my problem is, that i don´t know how i can get the vehicle the sourceplayer is in. Its needed because the argument from setVehicleFuelTankExplodable needs a vehicle name - because i don´t want that ANY cars gets explosible tanks, only the cars there a players in

Or if you know the player element, you can use getPlayerOccupiedVehicle and getPlayerOccupiedVehicleSeat (to see if he's driver).

Link to comment

Hey all, thanks for help - it works a lot better now, here is my script:

function GasTanksExplosible(source) 
    local theVehicle = getPlayerOccupiedVehicle(source) 
    local theSeat = getPlayerOccupiedVehicleSeat(source) 
    if theSeat == 0 then 
     setVehicleFuelTankExplodable(theVehicle, true) 
    end 
end 
function GasTanksNotExplosible(source) 
    local theVehicle = getPlayerOccupiedVehicle(source) 
    local theSeat = getPlayerOccupiedVehicleSeat(source) 
    if theSeat == 0 then 
     setVehicleFuelTankExplodable(theVehicle, false) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), GasTanksExplosible ) 
addEventHandler ( "onVehicleStartExit", getRootElement(), GasTanksNotExplosible ) 

But there is only one last Problem: When a car explodes and respawned, the tank is still explosible. I tried to fix this with many ways, like the event onVehicleRespawns or onVehicleExplode. But with the last two events the car don´t respawn anymore :shock:.

Have anybody Ideas why, or other ideas to set the tank not explosible after the Car explodes?

Link to comment
Hey all, thanks for help - it works a lot better now, here is my script:

function GasTanksExplosible(source) 
    local theVehicle = getPlayerOccupiedVehicle(source) 
    local theSeat = getPlayerOccupiedVehicleSeat(source) 
    if theSeat == 0 then 
     setVehicleFuelTankExplodable(theVehicle, true) 
    end 
end 
function GasTanksNotExplosible(source) 
    local theVehicle = getPlayerOccupiedVehicle(source) 
    local theSeat = getPlayerOccupiedVehicleSeat(source) 
    if theSeat == 0 then 
     setVehicleFuelTankExplodable(theVehicle, false) 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), GasTanksExplosible ) 
addEventHandler ( "onVehicleStartExit", getRootElement(), GasTanksNotExplosible ) 

But there is only one last Problem: When a car explodes and respawned, the tank is still explosible. I tried to fix this with many ways, like the event onVehicleRespawns or onVehicleExplode. But with the last two events the car don´t respawn anymore :shock:.

Have anybody Ideas why, or other ideas to set the tank not explosible after the Car explodes?

... Do not let the car respawn...

Not even...

function lolDunnoWhatToPutHereSoLetsKeepItPointlessXD() 
    setVehicleFuelTankExplodable(source, false) 
end 
addEventHandler("onVehicleRespawn",getRootElement(),lolDunnoWhatToPutHereSoLetsKeepItPointlessXD) 

And otherwise...

function lolDunnoWhatToPutHereSoLetsKeepItPointlessXD() 
    setTimer(setVehicleFuelTankExplodable,50,1,source, false) 
end 
addEventHandler("onVehicleRespawn",getRootElement(),lolDunnoWhatToPutHereSoLetsKeepItPointlessXD) 

..?

Link to comment

Hi, Gamesnert :)

... Do not let the car respawn...

I let cars spawn with a other script, after there explodes

Not even...

function lolDunnoWhatToPutHereSoLetsKeepItPointlessXD() 
    setVehicleFuelTankExplodable(source, false) 
end 
addEventHandler("onVehicleRespawn",getRootElement(),lolDunnoWhatToPutHereSoLetsKeepItPointlessXD) 

And otherwise...

function lolDunnoWhatToPutHereSoLetsKeepItPointlessXD() 
    setTimer(setVehicleFuelTankExplodable,50,1,source, false) 
end 
addEventHandler("onVehicleRespawn",getRootElement(),lolDunnoWhatToPutHereSoLetsKeepItPointlessXD) 

I have tried it: Its the same - the car dont respawns, but without my tank script, it works.

BTW: Nice command name again :P And the idea with the Timer are nice too ^^

STOP! (Edit:)

Sorry, it was my fault. the car only don´t respawnes when the driver died WITH the car, but thats normal on my respawn script. When i crash the car and go out, the car explodes - and yes: The tank is not explosible =)

Thread Finish! - THANKS ALL

Edited by Guest
Link to comment
I have tried it: Its the same - the car dont respawns, but without my tank script, it works.

... That is just weird... =/

I let cars spawn with a other script, after there explodes

Ehm... Try putting it there? :P

BTW: Nice command name again :P And the idea with the Timer are nice too ^^

Thank you, I'm always as creative as possible with my commandnames. ^^

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...