setRadarAreaSize | Multi Theft Auto: Wiki Skip to content

setRadarAreaSize

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 changes the size of an existing radar area.

Syntax

setRadarAreaSize ( )

Code Examples

server

Example 1:This example decreases the size of a team's radar area whenever a player from that team dies:

-- assume that team elements exist and that each player belongs to one of them
-- assume that radararea elements exist and that each is a child of one of the teams
function playerWasted ( killer, killerweapon, bodypart )
local victimteam = getPlayerTeam ( source ) -- get the team of the victim
local killerteam = getPlayerTeam ( killer ) -- get the team of the killer
if ( killer and killerteam ~= victimteam ) then -- if there is a killer and he is from an opposing team
local victimarea = getElementChild ( victimteam, 0 ) -- get the radararea belonging to the victim's team
local x, y = getRadarAreaSize ( victimarea ) -- get the size of the radar area
x = x - 5
y = y - 5
setRadarAreaSize ( victimarea, x, y ) -- set a new (smaller) size for the victim's radar area
end
end
addEventHandler ( "onPlayerWasted", root, playerWasted )

See Also