S0rcerer Posted September 11, 2008 Share Posted September 11, 2008 In general GTA SA if you shot in the petrol tank , vehicle blows.How to create the script to do the same thing in the MTA? Link to comment
Gamesnert Posted September 11, 2008 Share Posted September 11, 2008 In general GTA SA if you shot in the petrol tank , vehicle blows.How to create the script to do the same thing in the MTA? http://development.mtasa.com/index.php? ... Explodable I'd advice to look around in the wiki more... =/ Link to comment
Scarface Posted September 11, 2008 Share Posted September 11, 2008 It is already in MTA Link to comment
XetaQuake Posted September 11, 2008 Share Posted September 11, 2008 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
Scarface Posted September 11, 2008 Share Posted September 11, 2008 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
Gamesnert Posted September 11, 2008 Share Posted September 11, 2008 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
XetaQuake Posted September 11, 2008 Share Posted September 11, 2008 Sexy command 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
Gamesnert Posted September 11, 2008 Share Posted September 11, 2008 Sexy command 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. But isn't there something like "onElementCreated" or something? Would be handy in such cases. (atleast, if onVehicleRespawn doesn't work ) Link to comment
XetaQuake Posted September 11, 2008 Share Posted September 11, 2008 Don´t works Your idea with onElementCreated are nice, i found a wiki topic about this idea: Requested Functions and EventsFrom 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
Ace_Gambit Posted September 11, 2008 Share Posted September 11, 2008 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
Michael_Sund Posted September 12, 2008 Share Posted September 12, 2008 U.N.T.E.S.T.E.D. but should work since I used a similar code. Was too lazy to search for it. =/ I lolled at this one, because you're too lazy to find a script instead you make a new haha LOLOLOL Link to comment
XetaQuake Posted September 12, 2008 Share Posted September 12, 2008 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
Gamesnert Posted September 12, 2008 Share Posted September 12, 2008 (edited) 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. Edited September 12, 2008 by Guest Link to comment
Fenix1042 Posted September 12, 2008 Share Posted September 12, 2008 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
Gamesnert Posted September 12, 2008 Share Posted September 12, 2008 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
Fenix1042 Posted September 12, 2008 Share Posted September 12, 2008 onVehicleEnter, onVehicleExit and onResourceStart (looping all vehicles) i guess. Link to comment
50p Posted September 12, 2008 Share Posted September 12, 2008 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
XetaQuake Posted September 12, 2008 Share Posted September 12, 2008 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 . Have anybody Ideas why, or other ideas to set the tank not explosible after the Car explodes? Link to comment
Gamesnert Posted September 12, 2008 Share Posted September 12, 2008 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 . 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
XetaQuake Posted September 12, 2008 Share Posted September 12, 2008 (edited) 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 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 September 12, 2008 by Guest Link to comment
Gamesnert Posted September 12, 2008 Share Posted September 12, 2008 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? BTW: Nice command name again And the idea with the Timer are nice too ^^ Thank you, I'm always as creative as possible with my commandnames. ^^ Link to comment
XetaQuake Posted September 12, 2008 Share Posted September 12, 2008 Ah to slow: i edited my last Post 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