Jump to content

help


MAB

Recommended Posts

the mta system can't know who is the player... all the function worked but the setElementData didn't so i added if thePlayer then .. now all the function isn't working

function resetjob (thePlayer) 
    if thePlayer then 
      setElementData ( thePlayer, "fisher", false ) 
      destroyElement ( boat ) 
      destroyElement ( blip ) 
      outputChatBox ( "It seems that your fishing boat exploded! Don't Worry you can start the job again!", hitElement, 255, 255, 0) 
      outputChatBox ( "If your boat was destroyed by other player then take a screen shot [F12] and tell a mod or use /report!", hitElement, 255, 255, 0) 
    end 
end      
addEventHandler ( "onVehicleExplode", boat, resetjob ) 

Link to comment

You need to use

getVehicleController() 
-- or  
getVehicleOccupant() 

Example

function resetjob () 
    local thePlayer = getVehicleController (source)  
        if ( thePlayer ) then 
        setElementData ( thePlayer, "fisher", false ) 
        destroyElement (source) 
        destroyElement ( blip ) 
        outputChatBox ( "It seems that your fishing boat exploded! Don't Worry you can start the job again!", thePlayer, 255, 255, 0) 
        outputChatBox ( "If your boat was destroyed by other player then take a screen shot [F12] and tell a mod or use /report!",thePlayer, 255, 255, 0) 
    end  
end     
addEventHandler ( "onVehicleExplode", boat, resetjob ) 

Link to comment
You need to use
getVehicleController() 
-- or  
getVehicleOccupant() 

Example

function resetjob () 
    local thePlayer = getVehicleController (source)  
        if ( thePlayer ) then 
        setElementData ( thePlayer, "fisher", false ) 
        destroyElement (source) 
        destroyElement ( blip ) 
        outputChatBox ( "It seems that your fishing boat exploded! Don't Worry you can start the job again!", thePlayer, 255, 255, 0) 
        outputChatBox ( "If your boat was destroyed by other player then take a screen shot [F12] and tell a mod or use /report!",thePlayer, 255, 255, 0) 
    end  
end     
addEventHandler ( "onVehicleExplode", boat, resetjob ) 

That is very nice but the problem is that thePlayer isn't in the boat....he left the boat then the boat was destroyed

Link to comment
When players enters a vehicle use setElementData(vehicle,"Player",playerElement or playerName)

Then when vehicle explodes... tell to the; player element or search a player from saved name.

i don't understand that...but it is ok now.. i am done with that function i used a commandHandler

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