Jump to content

# Help createColRectangle

## Recommended Posts

Hello, how can I calculate the area's Height and width?

Edited by Guest
##### Link to comment

There's no need for a server side script.

```addEventHandler ( "onClientRender", getRootElement(),
function ( )
if guiGetVisible ( GUIEditor.label[9] ) then
local team = getPlayerTeam ( localPlayer )
local teamName = ( team and getTeamName ( team ) or "" )
guiSetText ( GUIEditor.label[9], "Team: " .. teamName )
end
end
)
```

##### Link to comment
There's no need for a server side script.
```addEventHandler ( "onClientRender", getRootElement(),
function ( )
if guiGetVisible ( GUIEditor.label[9] ) then
local team = getPlayerTeam ( localPlayer )
local teamName = ( team and getTeamName ( team ) or "" )
guiSetText ( GUIEditor.label[9], "Team: " .. teamName )
end
end
)
```

thanks it works good now! (:

You're welcome.

##### Link to comment

Hello, how can I calculate the area's Height and width?

##### Link to comment

You could try with this calculation:

```width, height = ( x2 - x1 ), ( y2 - y1 )
```

##### Link to comment
You could try with this calculation:
```width, height = ( x2 - x1 ), ( y2 - y1 )
```

What does this mean?Can you explain more? I did not understand what you mean?

##### Link to comment

Well, if you want to make a script which calculates the width and height from two pair of positions ( x and y ), you can try that math calculation.

##### Link to comment
Well, if you want to make a script which calculates the width and height from two pair of positions ( x and y ), you can try that math calculation.
```
width, height = ( x2 - x1 ), ( y2 - y1 )
ColShape = createColRectangle (-1947.08, -1796.138, width, height )

addEventHandler( "onClientColShapeHit", ColShape,
function ( thePlayer )
if ( thePlayer == localPlayer ) then
bindKey (  "F1", "down", open )

end
end
)

addEventHandler( "onClientColShapeLeave", ColShape,
function ( thePlayer )
if ( thePlayer == localPlayer ) then
unbindKey (  "F1", "down", open )
end
end
)
```

##### Link to comment

I guess you don't want to do what I said, so, you just set the height and width to what you want, until it fits what you need.

##### Link to comment

I do not understand that I wanted to do Can you put an example?

##### Link to comment
```ColShape = createColRectangle (-1947.08, -1796.138, 100, 100 )
```

##### Link to comment
```ColShape = createColRectangle (-1947.08, -1796.138, 100, 100 )
```

Thank you ,you did not understand what I mean!

##### Link to comment

Well, next time you should ask what is width and height, not how to calculate it.

##### Link to comment
Well, next time you should ask what is width and height, not how to calculate it.

I know height and width! But how do I calculate it?but thanks .

##### Link to comment
• MTA Team

What do you even want to calculate? There's nothing to calculate (unless you want the area, circuit or volume; which are taught in normal schools; simple put, Pythagorean theorem).

```createColRectangle(x, y, width, height)
```

##### Link to comment
What do you even want to calculate? There's nothing to calculate (unless you want the area, circuit or volume; which are taught in normal schools; simple put, Pythagorean theorem).
```createColRectangle(x, y, width, height)
```

Thanks!

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

• #### Social Media

×
• Create New...