Jump to content

onPlayerContact


#Paper

Recommended Posts

Posted

It doesn't show any error:

local chat = "   #ff00cc>#ffcc00> " 
local dd = false 
  
function handleMapInfo(mapInfo) 
    if string.find(name, "DD", 1, true) then  
    dd = true 
    else  
    dd = false 
    end 
end 
addEvent("onClientMapStarting",true) 
addEventHandler("onClientMapStarting",getRootElement(),handleMapInfo) 
  
function onContact(prev, current) 
if dd == true then 
    if getElementType(current) == "player" then 
        setElementData(getVehicleOccupant(source), "hitted", getPlayerName(source)) 
    end 
end 
end 
addEventHandler ("onPlayerContact", getRootElement(), onContact) 
  
function onWastedShowKilled () 
if dd == true then 
    if getElementData(source, "hitted") then 
        outputChatBox(chat.."#ffffff"..getPlayerName(source).." has been killed by "..getElementData(source, "hitted").."!", getRootElement(), 255, 255, 255, true) 
    end 
end 
end 
addEventHandler("onPlayerWasted", getRootElement(), onWastedShowKilled) 

Posted
onPlayerContact source is a player. why getVehicleOccupant(source)?

i think when a player crashes into the car then it is hitted...????

  • Moderators
Posted

No because the this is only for player ( that's why it's in the Player events category and it's name is onPlayerContact :| )

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