Jump to content

1.4 problem


Blinker.

Recommended Posts

Hello folks ,i was using a script to move a vehicle when a player dies in Destruction Derby gamemode to prevent car bugs.. so when a player Dies the car will be moved to another place but now in 1.4 version it's not working , i don't know why it's not working. in older versions it was working well i am using :

function moveVehicle ( vehicle ) 
    local x, y, z = getElementPosition ( vehicle ) 
    if ( vehicle ) then 
        setElementPosition ( vehicle, x, y, z - 100 )   
    end 
    end 
  
addEvent ( "onPlayerRaceWasted", true ) 
addEventHandler ( "onPlayerRaceWasted" , getRootElement(), moveVehicle ) 
  

i guess onPlayerRaceWasted is not working anymore in this new Race.

is there any alternative for onPlayerRaceWasted ?

Thanks in advance.

Link to comment

maybe this can help you

  
function notifyAboutExplosion() 
    -- source is the element that triggered the event and can be used in other events as well 
    outputChatBox(getVehicleName(source) .. " just blew up") 
end 
  
-- by using getRootElement() as root, it works for any vehicle 
addEventHandler("onVehicleExplode", getRootElement(), notifyAboutExplosion) 
  

source

https://wiki.multitheftauto.com/wiki/OnVehicleExplode

Link to comment
i guess the problem is setElementPosition , i've asked my friend he had a script to move the car after the player dies, he was using another event , but it doesn't work also in 1.4 , so the problem is setElementPosition

setElementPosition works pretty well, else looots of stuff everywhere would be failing.

Link to comment

Yes, I don't understand what happens here...

I think the problem's root is some script line somewhere inside the race resource.

Because it seems like if the car was warped after some time to the position where the player died and its visibility is set to false. It's very wierd.

Blinker, try using destroyElement instead of setElementPosition, I've not tried it because I believe it will cause troubles, just as when you destroy a vehicle using Admin Panel, the race resource messes up and gets restarted. However this can be solved by adding it to the Admin ACL.

Link to comment
Yes, I don't understand what happens here...

I think the problem's root is some script line somewhere inside the race resource.

Because it seems like if the car was warped after some time to the position where the player died and its visibility is set to false. It's very wierd.

Blinker, try using destroyElement instead of setElementPosition, I've not tried it because I believe it will cause troubles, just as when you destroy a vehicle using Admin Panel, the race resource messes up and gets restarted. However this can be solved by adding it to the Admin ACL.

The race resource gets messed up becouse destroying the car makes all the "cache" variables the race is using nil making it go totally wrong causing huge errors. In the end restarting is the only solution else than kicking the player.

Link to comment
Yes, I don't understand what happens here...

I think the problem's root is some script line somewhere inside the race resource.

Because it seems like if the car was warped after some time to the position where the player died and its visibility is set to false. It's very wierd.

Blinker, try using destroyElement instead of setElementPosition, I've not tried it because I believe it will cause troubles, just as when you destroy a vehicle using Admin Panel, the race resource messes up and gets restarted. However this can be solved by adding it to the Admin ACL.

The race resource gets messed up becouse destroying the car makes all the "cache" variables the race is using nil making it go totally wrong causing huge errors. In the end restarting is the only solution else than kicking the player.

Link to comment
  • 2 months later...

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...