isElementOnScreen | Multi Theft Auto: Wiki Skip to content

isElementOnScreen

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


This function will check if an element is on the screen. Elements behind objects but still in the camera view count as being on screen.

Syntax

isElementOnScreen ( )

Code Examples

client

This function will check if you can see your killer when you die.

function player_Wasted ( killer, weapon, bodypart )
-- if there even was a killer and the killer isn't the killed player itself
if ( killer ) and ( killer ~= source ) then
-- there was a killer
if ( isElementOnScreen ( killer ) ) then
-- the killer was on screen
outputChatBox ( "You can still see your killer!", 255, 0, 0 )
else
-- the killer was not on screen
outputChatBox ( "You can not see your killer!", 255, 0, 0 )
end
end
end
-- call player_Wasted when only the local player dies
addEventHandler ( "onClientPlayerWasted", localPlayer, player_Wasted )

Issues

ID Description
2029 isElementOnScreen doesn't work for markers

See Also

Element Functions