SetRadarAreaSize: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
[[Category:Incomplete]]
__NOTOC__  
__NOTOC__  
This fake function is for use with blah & blah and does blahblahblabhalbhl
Thie function changes the size of an existing radar area.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setRadarAreaSize ( element radararea, float x, float y )              
bool setRadarAreaSize ( radararea theRadararea, float x, float y )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''argumentName:''' description
*'''theRadararea:''' the radararea element whose size is to be changed.
 
*'''x:''' the x length of the radar area.
===Optional Arguments===
*'''y:''' the y length of the radar area.
{{OptionalArg}}
*'''argumentName2:''' descriptiona
*'''argumentName3:''' description


===Returns===
===Returns===
Returns ''true'' if blah, ''false'' otherwise.
Returns ''true'' if the size was set successfully, ''false'' if the specified radar area doesn't exist.


==Example==  
==Example==  
This example does...
This example decreases the size of a team's radar area whenever a player from that team dies:
<syntaxhighlight lang="lua">
-- 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
addEventHandler ( "onPlayerWasted", root, "playerWasted" )
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
</syntaxhighlight>
This (simpler) example creates a radar area and resets it's size right away:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
aRadarArea = createRadarArea ( 1024, 1024, 30, 140, 255, 255, 0, 85 )
blabhalbalhb --abababa
bool flag = setRadarAreaSize ( aRadarArea, 50, 90 )
--This line does this...
if ( flag ) then
mooo
  outputChatBox ( "Radar area size set successfully!" )
else
  outputChatBox ( "Failed to set radar area size." )
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{Radar area_functions}}

Revision as of 00:27, 11 September 2006

Thie function changes the size of an existing radar area.

Syntax

bool setRadarAreaSize ( radararea theRadararea, float x, float y )

Required Arguments

  • theRadararea: the radararea element whose size is to be changed.
  • x: the x length of the radar area.
  • y: the y length of the radar area.

Returns

Returns true if the size was set successfully, false if the specified radar area doesn't exist.

Example

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
addEventHandler ( "onPlayerWasted", root, "playerWasted" )
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

This (simpler) example creates a radar area and resets it's size right away:

aRadarArea = createRadarArea ( 1024, 1024, 30, 140, 255, 255, 0, 85 )
bool flag = setRadarAreaSize ( aRadarArea, 50, 90 )
if ( flag ) then
   outputChatBox ( "Radar area size set successfully!" )
else
   outputChatBox ( "Failed to set radar area size." )
end

See Also