SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 05/06/2016, 07:23 PM   #21
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,260
Reputation: 326
Default Re: Get Point In Front 2D 3D

Updated 3DTryg.inc to v2.5 now

Fixed GetVehicleRotation thanks for IllidanS4
PHP Code:
GetVehicleRotation(vehicleid,&Float:rx,&Float:ry,&Float:rz); 
Added new function:
PHP Code:
Float:GetPointInFrontOfVehicle2D(vehicleid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfVehicle3D(vehicleid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0);

Float:GetPointInFrontOfPlayer(playerid,&Float:tx,&Float:ty,Float:radius); //GetXYInFrontOfPlayer
 
Float:GetPointInFrontOfCamera2D(playerid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfCamera3D(playerid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0);

Float:GetPlayerTargetAngle(playerid,Float:x,Float:y,&Float:rz=0.0);
Float:SetPlayerTargetAngle(playerid,Float:x,Float:y,&Float:rz=0.0);

GetPlayerCameraRotation(playerid,&Float:rx,&Float:rz);
Float:GetPlayerCameraZAngle(playerid,&Float:rz=0.0);

GetPointInFrontOnGround(Float:x,Float:y,Float:z,Float:rx,Float:rz,&Float:tx,&Float:ty,&Float:tz,Float:max_distance);

bool:IsPointInCylinder(Float:px,Float:py,Float:pz,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:maxdist);

bool:IsProbable(chance); 
Completed functions:
PHP Code:
GetGroundRotation(Float:x,Float:y,Float:size,&Float:rx,&Float:ry); 
Optimized functions:
PHP Code:
NLTZ(value);
NMTZ(value);
Float:NLTZF(Float:value);
Float:NMTZF(Float:value);

Float:ShiftDegreeToRadian(Float:deg);
Float:ShiftDegreeToRadianEx(Float:deg);
Float:ShiftDegreeToGrades(Float:deg);
Float:ShiftRadianToDegree(Float:rad);
Float:ShiftRadianToDegreeEx(Float:rad);
Float:ShiftRadianToGrades(Float:rad);
Float:ShiftGradesToDegree(Float:grad);
Float:ShiftGradesToRadian(Float:grad);

ShiftRotationToVector(Float:rx,Float:rz,&Float:vx,&Float:vy,&Float:vz);

GetRotationFor2Point2D(Float:x,Float:y,Float:tx,Float:ty,&Float:rz);

Float:GetDistanceBetweenPoints1D(Float:x1,Float:x2);
Float:GetDistanceBetweenPoints2D(Float:x1,Float:y1,Float:x2,Float:y2);
Float:GetDistanceBetweenPoints3D(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2);

Float:sqrtN(Float:value,Float:exponent); 
All functions:
PHP Code:
Float:sqrtN(Float:value,Float:exponent);
abs(value);
power(value,Float:exponent);
Float:ctg(Float:value,anglemode:mode=radian);
Float:secans(Float:value,anglemode:mode=radian);
Float:cosecans(Float:value,anglemode:mode=radian);
single_clock(max,id);
even_clock(max,id);
uneven_clock(max,id);
IsEven(value);
GetRandomHit(Float:x,Float:y,Float:z,range,&Float:tx,&Float:ty,&Float:tz);
Float:GetDistanceBetweenPoints1D(Float:x1,Float:x2);
Float:GetDistanceBetweenPoints2D(Float:x1,Float:y1,Float:x2,Float:y2);
Float:GetDistanceBetweenPoints3D(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2);
NLTZ(value);
NMTZ(value);
Float:NLTZF(Float:value);
Float:NMTZF(Float:value);
CompRotation(rotation,&cr=0);
Float:CompRotationFloat(Float:rotation,&Float:cr=0.0);
GetPointInFront2D(Float:x,Float:y,Float:rz,Float:radius,&Float:tx,&Float:ty);
Float:GetPointInFrontOfPlayer(playerid,&Float:tx,&Float:ty,Float:radius);
Float:GetPointInFrontOfCamera2D(playerid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfCamera3D(playerid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0);
GetPointInFront3D(Float:x,Float:y,Float:z,Float:rx,Float:rz,Float:radius,&Float:tx,&Float:ty,&Float:tz);
GetRotationFor2Point2D(Float:x,Float:y,Float:tx,Float:ty,&Float:rz);
GetRotationFor2Point3D(Float:x,Float:y,Float:z,Float:tx,Float:ty,Float:tz,&Float:rx,&Float:rz);
GetRandomClockPos(Float:x,Float:y,Float:z,Float:radius,&Float:tx,&Float:ty,&Float:tz,&Float:trz,Float:rz = -1000.0);
GetRandomPointInCube(Float:minx,Float:miny,Float:minz,Float:maxx,Float:maxy,Float:maxz,&Float:x,&Float:y,&Float:z);
Float:ShiftDegreeToRadian(Float:deg);
Float:ShiftDegreeToRadianEx(Float:deg);
Float:ShiftDegreeToGrades(Float:deg);
Float:ShiftRadianToDegree(Float:rad);
Float:ShiftRadianToDegreeEx(Float:rad);
Float:ShiftRadianToGrades(Float:rad);
Float:ShiftGradesToDegree(Float:grad);
Float:ShiftGradesToRadian(Float:grad);
ConvertMTARaceRotation(Float:rotation1,Float:rotation2,Float:rotation3,&Float:rx,&Float:ry,&Float:rz);
ConvertToMTARaceRotation(Float:rx,Float:ry,Float:rz,&Float:rotation1,&Float:rotation2,&Float:rotation3);
GetMoveTime(Float:x,Float:y,Float:z,Float:tx,Float:ty,Float:tz,Float:speed,&rtime);
Float:GetSpeedForMoveTime(Float:x,Float:y,Float:z,Float:tx,Float:ty,Float:tz,&Float:speed,rtime);
GetVehicleRotation(vehicleid,&Float:rx,&Float:ry,&Float:rz);
Float:GetPointInFrontOfVehicle2D(vehicleid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfVehicle3D(vehicleid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0);
GetPlayerCameraRotation(playerid,&Float:rx,&Float:rz);
Float:GetPlayerCameraZAngle(playerid,&Float:rz=0.0);
GetPointFor2Point2D(Float:x1,Float:y1,Float:x2,Float:y2,Float:percent_size,&Float:tx,&Float:ty);
GetPointFor2Point3D(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2,Float:percent_size,&Float:tx,&Float:ty,&Float:tz);
ShiftVectorToRotation(Float:vx,Float:vy,Float:vz,&Float:rx,&Float:rz);
ShiftRotationToVector(Float:rx,Float:rz,&Float:vx,&Float:vy,&Float:vz);
bool:IsPointBetween2Points2D(Float:px,Float:py,Float:xA,Float:yA,Float:xB,Float:yB);
bool:IsPointBetween2Points3D(Float:px,Float:py,Float:pz,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB);
bool:IsPointNearly2Points2D(Float:px,Float:py,Float:xA,Float:yA,Float:xB,Float:yB,Float:maxdist);
bool:IsPointNearly2Points3D(Float:px,Float:py,Float:pz,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:maxdist);
bool:IsPointInCylinder(Float:px,Float:py,Float:pz,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:maxdist);
bool:IsProbable(chance);
GetGroundRotation(Float:x,Float:y,Float:size,&Float:rx,&Float:ry);
GetPointInFrontOnGround(Float:x,Float:y,Float:z,Float:rx,Float:rz,&Float:tx,&Float:ty,&Float:tz,Float:max_distance);
Float:GetPlayerTargetAngle(playerid,Float:x,Float:y,&Float:rz=0.0);
Float:SetPlayerTargetAngle(playerid,Float:x,Float:y,&Float:rz=0.0);

Deprecated Functions:
GetXYInFrontOfPlayer -> GetPointInFrontOfPlayer
GetPointInFront
-> GetPointInFront3D
GetPointInFrontOfCamera
-> GetPointInFrontOfCamera3D
GetDistanceBetweenPoints 
-> GetDistanceBetweenPoints3D

Old prototype
:
GetAngle -> GetPlayerTargetAngle SetPlayerTargetAngle GetRotationFor2Point2D 

Last edited by AbyssMorgan; 05/06/2016 at 07:54 PM. Reason: Update 2.5B
AbyssMorgan is offline   Reply With Quote
Old 05/06/2016, 07:44 PM   #22
Crayder
High-roller
 
Crayder's Avatar
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,865
Reputation: 588
Default Re: Get Point In Front 2D 3D

@AbyssMorgan: You really should be using "Float:0"... That compiles as "float(0)". It's best to just use "0.0", which compiles as "0.0".
__________________
Those who deserve reputation, do not need to beg for it.
Also, don't expect the help you need when offering reputation, you'll just be attracting Rep Hunters.
Join SA-MP Discord!
Crayder is offline   Reply With Quote
Old 05/06/2016, 07:52 PM   #23
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,260
Reputation: 326
Default Re: Get Point In Front 2D 3D

Quote:
Originally Posted by Crayder View Post
@AbyssMorgan: You really should be using "Float:0"... That compiles as "float(0)". It's best to just use "0.0", which compiles as "0.0".

okay, this will change
AbyssMorgan is offline   Reply With Quote
Old 05/07/2016, 07:16 AM   #24
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,260
Reputation: 326
Cool Re: Get Point In Front 2D 3D

Update v2.6 now:

- Fixed function:
PHP Code:
GetPointInFrontOfCamera2D(playerid,&Float:tx,&Float:ty,Float:radius); 
- Added ColAndreas Functions:
PHP Code:
MovePointCol(Float:StartX,Float:StartY,Float:StartZ,Float:EndX,Float:EndY,Float:EndZ,&Float:x,&Float:y,&Float:z);
GetPointInFront3DCol(Float:x,Float:y,Float:z,Float:rx,Float:rz,Float:radius,&Float:tx,&Float:ty,&Float:tz);
Float:GetPointInFrontOfPlayerCol(playerid,&Float:tx,&Float:ty,Float:radius);
Float:GetPointInFrontOfCamera2DCol(playerid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfCamera3DCol(playerid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0);
Float:GetPointInFrontOfVehicle2DCol(vehicleid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfVehicle3DCol(vehicleid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0); 
Notice: This function only working for ColAndreas Plugin. Include no requires ColAndreas plugin to use the other functions.
AbyssMorgan is offline   Reply With Quote
Old 06/07/2016, 12:25 AM   #25
Battlezone
Gangsta
 
Battlezone's Avatar
 
Join Date: Aug 2013
Location: Berlin
Posts: 855
Reputation: 143
Default Re: Get Point In Front 2D 3D

Very useful stuff .. and interesting debate guys
Edit: someone explain me this please CompRotationFloat?
__________________
Battlezone is offline   Reply With Quote
Old 06/07/2016, 03:56 AM   #26
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,260
Reputation: 326
Default Re: Get Point In Front 2D 3D

Comp - Compress, limits the range of values of rotation to <0.0:360.0). Frequently used internally.

Last edited by AbyssMorgan; 06/07/2016 at 07:44 AM.
AbyssMorgan is offline   Reply With Quote
Old 06/07/2016, 07:40 AM   #27
Battlezone
Gangsta
 
Battlezone's Avatar
 
Join Date: Aug 2013
Location: Berlin
Posts: 855
Reputation: 143
Default Re: Get Point In Front 2D 3D

Quote:
Originally Posted by AbyssMorgan View Post
Comp - Compress, limits the range of values of rotation to <0.0:360). Frequently used internally.
Ahh my bad, thanks!
__________________
Battlezone is offline   Reply With Quote
Old 06/07/2016, 10:34 AM   #28
Kaliber
Gangsta
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 914
Reputation: 120
Default Re: Get Point In Front 2D 3D

Quote:
Originally Posted by Crayder View Post
Your code is wrong, a single addition/subtraction will not work. For example, 730 in your code would return 370. My while loops will return 10.
Actually, why use loops.

You can easly use mod 360.

For example: 730%360 = 10.

And 250%360 = 250

It works perfectly without loops
__________________
Kaliber is offline   Reply With Quote
Old 06/07/2016, 10:46 AM   #29
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,260
Reputation: 326
Default Re: Get Point In Front 2D 3D

Modulo works only for integer values.
AbyssMorgan is offline   Reply With Quote
Old 06/07/2016, 10:49 AM   #30
GhostHacker
Banned
 
Join Date: Jan 2016
Location: Inside a dark cave Reputation: 3089
Posts: 161
Reputation: 28
Default Re: Get Point In Front 2D 3D

good good
GhostHacker is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] [INC] LSF - Lorenc's Simple Functions (w/ gang/clan functions) Lorenc_ Includes 14 21/04/2018 04:06 AM
What is the difference between public functions and stock functions? NeskWriter Scripting Help 1 16/10/2013 06:23 PM
File Functions + String Functions NoaM[W] Scripting Help 2 19/12/2012 08:13 PM
Pawno functions Doesn't Show on the functions Tab silvan Scripting Help 2 11/11/2012 09:42 AM
[Tool/Web/Other] Cross Functions V1.0 - Create Custom Call Backs / Functions by Just 1 Click CROSS_Hunter Tools and Files 7 05/11/2012 02:17 PM


All times are GMT. The time now is 01:30 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.