Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Colshape polygon #424

Merged
merged 7 commits into from Jan 11, 2022
Merged

Conversation

McP4nth3r
Copy link
Contributor

No description provided.

@FabianTerhorst
Copy link
Owner

FabianTerhorst commented Jan 9, 2022

Please also convert the vector2_t[] to a std::vector<alt::Vector2f>.

@FabianTerhorst
Copy link
Owner

FabianTerhorst commented Jan 9, 2022

i mean in the cpp code. Not via params.

@McP4nth3r
Copy link
Contributor Author

i mean in the cpp code. Not via params.

you mean only in server.cpp and not in server.h?

@FabianTerhorst
Copy link
Owner

i mean in the cpp code. Not via params.

you mean only in server.cpp and not in server.h?

you need to create a std vector array from the c array for the altv api call. And you need to do that in the cpp code.

@@ -180,6 +181,19 @@ alt::IColShape* Server_CreateColShapeRectangle(alt::ICore* server, float x1, flo
return server->CreateColShapeRectangle(x1, y1, x2, y2, z).Get();
}

alt::IColShape* Server_CreateColShapePolygon(alt::ICore* server, float minZ, float maxZ, vector2_t points[]) {
std::vector<alt::Vector2f> convertedPoints(sizeof(points));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of sizeof i recommend also adding a parameter for pointsSize to make it more secure.

Copy link
Contributor Author

@McP4nth3r McP4nth3r Jan 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im completely new to cpp thanks for your tips :) i try to implement this with 878972f

@FabianTerhorst
Copy link
Owner

Ty

@FabianTerhorst FabianTerhorst merged commit f2a3b58 into FabianTerhorst:dev Jan 11, 2022
@McP4nth3r McP4nth3r deleted the colshapePolygon branch January 11, 2022 20:57
@Unnvaldr Unnvaldr removed their request for review January 21, 2022 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants