SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 09/02/2017, 08:57 PM   #101
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: 3DTryg Functions

Quote:
Originally Posted by Fynn. View Post
This function is long, but I think it would replace the heap of functions with respect to vision. (Players, actors, cars, npc's ...)

Erase this...

Code:
IsPlayerOnPlayerScreen
IsVehicleOnPlayerScreen
IsObjectOnPlayerScreen
IsActorOnPlayerScreen
IsPlayerOnFakeScreen
IsVehicleOnFakeScreen
IsObjectOnFakeScreen
IsActorOnFakeScreen
IsDynamicObjectOnPlayerScreen
IsDynamicObjectOnFakeScreen
IsDynamicActorOnPlayerScreen
IsDynamicActorOnFakeScreen
And alone add this:

Code:
bool:IsPointViewToPoint(x, y, z, px, py, pz, Float:range, element_orientation:orientation, Float:rx=INVALID_ROTATION, Float:rz=INVALID_ROTATION, Float:vrx=VERTICAL_CAMERA_RADIUS, Float:vrz=HORIZONTAL_CAMERA_RADIUS, bool:testLOS=true, bool:testVW=true)
Goob job.
Why you using element_orientation:orientation in screen test.

I think you mean:
PHP Code:
bool:IsPointViewToPoint(
xyzpxpypz,
Float:range,
items:item_type//player, actor, npc etc.
Float:rx=INVALID_ROTATION,Float:rz=INVALID_ROTATION,
Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true,bool:testVW=true); 
One function for all element types :D
I think add one/two universal function, and convert old functions to macro definitions. The same method as Stream3D Module.
AbyssMorgan is offline   Reply With Quote
Old 09/02/2017, 11:45 PM   #102
Unrea1
Gangsta
 
Unrea1's Avatar
 
Join Date: Oct 2013
Location: Venezuela
Posts: 792
Reputation: 126
Default Re: 3DTryg Functions

Exactly, instead of having many functions that after all is for the same, it is better to create a function that serves everything.

I used "element_orientation: orientation" in case the script wants to change the camera angle, by default it would be something like "element_orientation = default", I hope to understand what I'm trying to explain with this parameter. It did not occur to me "items: item_type" which by the way, it falls excellent to the function. regards
__________________
Unrea1 is offline   Reply With Quote
Old 10/02/2017, 07:41 PM   #103
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: 3DTryg Functions

Update v3.3.0:

- Fixed warring variable 'v3DTryg3DStreamerExam'

- Renamed Functions:
PHP Code:
Get3DTrygEfficiency -> Tryg3D_GetEfficiency
Get3DTrygModules 
-> Tryg3D_GetModules
Get3DTrygErrorCount 
-> Tryg3D_GetErrorCount
Reset3DTrygErrorCount 
-> Tryg3D_ResetErrorCount
GetTryg3DActiveCount 
-> Tryg3D_GetActiveCount
IsTryg3DModuleLoaded 
-> Tryg3D_IsModuleLoaded

Tryg3DMapAndreasFindZ 
-> Tryg3D_MapAndreasFindZ (preserved old
- Marked as deprecated:
PHP Code:
Float:GetActorDistanceFromPoint(actorid,Float:x,Float:y,Float:z);
Float:GetObjectDistanceFromPoint(objectid,Float:x,Float:y,Float:z);
Float:GetDistanceBetweenPlayers(playerid_a,playerid_b);
Float:GetDistanceBetweenVehicles(vehicleid_a,vehicleid_b);
Float:GetDistanceBetweenObjects(objectid_a,objectid_b);
Float:GetPlayerActorDistance(playerid,actorid);
Float:GetPlayerVehicleDistance(playerid,vehicleid);
Float:GetPlayerObjectDistance(playerid,objectid);

//New Version:
GetElementsDistance
GetElementDistanceFromPoint 
- Marked as deprecated:
PHP Code:
bool:IsPlayerInCircle(playerid,Float:x,Float:y,Float:radius);
bool:IsPlayerInCylinder3D(playerid,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:radius);
bool:IsPlayerInCylinder2D(playerid,Float:x,Float:y,Float:minz,Float:maxz,Float:radius);
bool:IsPlayerInSphere(playerid,Float:x,Float:y,Float:z,Float:radius);
bool:IsPlayerInRectangle(playerid,Float:minx,Float:miny,Float:maxx,Float:maxy);
bool:IsPlayerInCube(playerid,Float:minx,Float:miny,Float:minz,Float:maxx,Float:maxy,Float:maxz);
bool:IsPlayerInPolygon(playerid,Float:points[],maxpoints=sizeof(points));
bool:IsPlayerInCircularSector(playerid,Float:x,Float:y,Float:rz,Float:radius,Float:view_angle);
bool:IsPlayerInSphericalSector(playerid,Float:x,Float:y,Float:z,Float:rx,Float:rz,Float:radius,Float:vrx,Float:vrz);
bool:IsPlayerInCone(playerid,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:pointA_radius,Float:pointB_radius);

//New Version:
IsElementIn... 


- Removed Functions:
PHP Code:
Float:GetDistanceBetweenDynamicObject(objectid_a,objectid_b);
Float:GetPlayerDynamicObjectDistance(playerid,objectid);
Float:GetDynamicObjectDistFromPoint(objectid,Float:x,Float:y,Float:z);

Float:GetDynamicActorDistFromPoint(actorid,Float:x,Float:y,Float:z);
Float:GetPlayerDynamicActorDistance(playerid,actorid);

Float:GetNPCDynamicActorDistance(npcid,actorid);
Float:GetNPCDistanceFromPoint(npcid,Float:x,Float:y,Float:z);
Float:GetDistanceBetweenNPCs(npcid_a,npcid_b);
Float:GetNPCActorDistance(npcid,actorid);
Float:GetNPCVehicleDistance(npcid,vehicleid);
Float:GetNPCObjectDistance(npcid,objectid);
Float:GetNPCDynamicObjectDistance(npcid,objectid);

//New Version:
GetElementsDistance
GetElementDistanceFromPoint 
- Removed Functions:
PHP Code:
bool:IsPlayerOnPlayerScreen(playerid,targetid,Float:rx=INVALID_ROTATION,Float:rz=INVALID_ROTATION,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true,bool:testVW=true);
bool:IsVehicleOnPlayerScreen(playerid,vehicleid,Float:rx=INVALID_ROTATION,Float:rz=INVALID_ROTATION,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true,bool:testVW=true);
bool:IsObjectOnPlayerScreen(playerid,objectid,Float:rx=INVALID_ROTATION,Float:rz=INVALID_ROTATION,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true);
bool:IsActorOnPlayerScreen(playerid,actorid,Float:rx=INVALID_ROTATION,Float:rz=INVALID_ROTATION,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true,bool:testVW=true);
bool:IsPlayerOnFakeScreen(Float:x,Float:y,Float:z,targetid,Float:rx,Float:rz,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true);
bool:IsVehicleOnFakeScreen(Float:x,Float:y,Float:z,vehicleid,Float:rx,Float:rz,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true);
bool:IsObjectOnFakeScreen(Float:x,Float:y,Float:z,objectid,Float:rx,Float:rz,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true);
bool:IsActorOnFakeScreen(Float:x,Float:y,Float:z,actorid,Float:rx,Float:rz,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true);

bool:IsDynamicObjectOnPlayerScreen(playerid,objectid,Float:rx=INVALID_ROTATION,Float:rz=INVALID_ROTATION,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true,bool:testVW=true);
bool:IsDynamicObjectOnFakeScreen(Float:x,Float:y,Float:z,objectid,Float:rx,Float:rz,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true);

bool:IsDynamicActorOnPlayerScreen(playerid,actorid,Float:rx=INVALID_ROTATION,Float:rz=INVALID_ROTATION,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true,bool:testVW=true);
bool:IsDynamicActorOnFakeScreen(Float:x,Float:y,Float:z,actorid,Float:rx,Float:rz,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true);

//New Version:
IsElementOnPlayerScreen
IsElementOnFakeScreen

//If you need use old syntax add this before 3DTryg.inc:
#define USE_DEPRECATED_SCREEN_FUNCTION 
- Removed functions:
PHP Code:
bool:IsNPCInCircle(npcid,Float:x,Float:y,Float:radius);
bool:IsNPCInCylinder3D(npcid,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:radius);
bool:IsNPCInCylinder2D(npcid,Float:x,Float:y,Float:minz,Float:maxz,Float:radius);
bool:IsNPCInSphere(npcid,Float:x,Float:y,Float:z,Float:radius);
bool:IsNPCInRectangle(npcid,Float:minx,Float:miny,Float:maxx,Float:maxy);
bool:IsNPCInCube(npcid,Float:minx,Float:miny,Float:minz,Float:maxx,Float:maxy,Float:maxz);
bool:IsNPCInPolygon(npcid,Float:points[],maxpoints=sizeof(points));
bool:IsNPCInCircularSector(npcid,Float:x,Float:y,Float:rz,Float:radius,Float:view_angle);
bool:IsNPCInSphericalSector(npcid,Float:x,Float:y,Float:z,Float:rx,Float:rz,Float:radius,Float:vrx,Float:vrz);
bool:IsNPCInCone3D(npcid,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:pointA_radius,Float:pointB_radius);

//New Version:
IsElementIn... 
- Removed functions:
PHP Code:
bool:IsPlayerInStream(playerid,Stream:StreamData[Stream3D]);
bool:IsObjectInStream(objectid,Stream:StreamData[Stream3D]);
bool:IsActorInStream(actorid,Stream:StreamData[Stream3D]);
bool:IsNPCInStream(npcid,Stream:StreamData[Stream3D]);
bool:IsDynamicObjectInStream(objectid,Stream:StreamData[Stream3D]);
bool:IsDynamicActorInStream(actorid,Stream:StreamData[Stream3D]);

//New Version:
IsElementInStream 
- Added universal functions:
PHP Code:
//General
bool:GetElementPos({Text3D,_}:elementid,Item3D_Type:element_type,&Float:x,&Float:y,&Float:z);
Float:GetElementsDistance({Text3D,_}:elementid,Item3D_Type:element_type,{Text3D,_}:targetid,Item3D_Type:target_type);
Float:GetElementDistanceFromPoint({Text3D,_}:elementid,Item3D_Type:element_type,Float:x,Float:y,Float:z);

//Screen Test
bool:IsElementOnPlayerScreen(playerid,{Text3D,_}:targetid,Item3D_Type:target_type=item_player,element_orientation:orientation=o_front,
Float:rx=INVALID_ROTATION,Float:rz=INVALID_ROTATION,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,
bool:testLOS=true,bool:testVW=true);

bool:IsElementOnFakeScreen(Float:x,Float:y,Float:z,{Text3D,_}:targetid,Item3D_Type:target_type,Float:rx,Float:rz,
Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true);

//Area Test
bool:IsElementInCircle({Text3D,_}:elementid,Item3D_Type:element_type,Float:x,Float:y,Float:radius);
bool:IsElementInCylinder3D({Text3D,_}:elementid,Item3D_Type:element_type,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:radius);
bool:IsElementInCylinder2D({Text3D,_}:elementid,Item3D_Type:element_type,Float:x,Float:y,Float:minz,Float:maxz,Float:radius);
bool:IsElementInSphere({Text3D,_}:elementid,Item3D_Type:element_type,Float:x,Float:y,Float:z,Float:radius);
bool:IsElementInRectangle({Text3D,_}:elementid,Item3D_Type:element_type,Float:minx,Float:miny,Float:maxx,Float:maxy);
bool:IsElementInCube({Text3D,_}:elementid,Item3D_Type:element_type,Float:minx,Float:miny,Float:minz,Float:maxx,Float:maxy,Float:maxz);
bool:IsElementInPolygon({Text3D,_}:elementid,Item3D_Type:element_type,Float:points[],maxpoints sizeof(points));
bool:IsElementInCircularSector({Text3D,_}:elementid,Item3D_Type:element_type,Float:x,Float:y,Float:rz,Float:radius,Float:view_angle);
bool:IsElementInSphericalSector({Text3D,_}:elementid,Item3D_Type:element_type,Float:x,Float:y,Float:z,Float:rx,Float:rz,Float:radius,Float:vrx,Float:vrz);
bool:IsElementInCone({Text3D,_}:elementid,Item3D_Type:element_type,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:pointA_radius,Float:pointB_radius);

//Stream Test
bool:IsElementInStream({Text3D,_}:elementid,Item3D_Type:element_type,Stream:StreamData[Stream3D]); 
- Added Item3D_Type's:
PHP Code:
item_player
item_npc
item_actor
item_object
item_vehicle
item_dynamic_object
item_dynamic_pickup
item_dynamic_cp
item_dynamic_racecp
item_dynamic_mapicon
item_dynamic_3dtext
item_dynamic_actor 
Current supported elements:
a) Character Elements:
- Player's
- NPC's
- Actor's

b) Static Elements:
- Object's
- Vehicle's
- GangZone's

c) Dynamic Elements:
- DynamicObject's
- DynamicPickup's
- DynamicCP's
- DynamicRaceCP's
- DynamicMapIcon's
- Dynamic3DText's
- DynamicActor's

Download:
3DTryg.inc

Stock amount: 295 -> 253


Last edited by AbyssMorgan; 16/09/2017 at 09:51 AM.
AbyssMorgan is offline   Reply With Quote
Old 12/02/2017, 03:30 PM   #104
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: 3DTryg Functions

Update v4.0.0:

- Fixed minor bugs in:
PHP Code:
MovePointCol
MovePointColCutLine
MovePointColCutLineEx 
- Removed function:
PHP Code:
GetQuatFromRot(Float:rx,Float:ry,Float:rz,&Float:qw,&Float:qx,&Float:qy,&Float:qz);
//New Version: Tryg3D_GetQuatFromEuler 
- Added functions (prototype):
PHP Code:
GetRandomPointInSphericalSector(Float:x,Float:y,Float:z,Float:rx,Float:rz,Float:radius,Float:vrx,Float:vrz,&Float:tx,&Float:ty,&Float:tz);
GetRandomPointOnSphericalSector(Float:x,Float:y,Float:z,Float:rx,Float:rz,Float:radius,Float:vrx,Float:vrz,&Float:tx,&Float:ty,&Float:tz); 
- Imported functions by Nero_3D from rotation.inc (Code anti colision: YES):
PHP Code:
Tryg3D_QuatRotate(Float:qw,Float:qx,Float:qy,Float:qz,Float:oX,Float:oY,Float:oZ,&Float:tx,&Float:ty,&Float:tz);
Tryg3D_GetQuatFromEuler(Float:rx,Float:ry,Float:rz,&Float:qw,&Float:qx,&Float:qy,&Float:qz,T3D:eulermode:mode=T3D:euler_default);
Tryg3D_EulerRotate(Float:rx,Float:ry,Float:rz,Float:oX,Float:oY,Float:oZ,&Float:tx,&Float:ty,&Float:tz,T3D:eulermode:mode=T3D:euler_default); 
- Added functions:
PHP Code:
//Extended version for GetPointInFront3D (Special thanks for Nero_3D rotation.inc)
GetPointInFront3DEx(Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz,Float:radius,&Float:tx,&Float:ty,&Float:tz);

GetRandomPointOnCylinder2D(Float:x,Float:y,Float:minz,Float:maxz,Float:radius,&Float:tx,&Float:ty,&Float:tz);

GetRandomPointInCylinder3D(Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:radius,&Float:tx,&Float:ty,&Float:tz);
GetRandomPointOnCylinder3D(Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:radius,&Float:tx,&Float:ty,&Float:tz);

GetRandomPointInCone3D(Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:pointA_radius,Float:pointB_radius,&Float:tx,&Float:ty,&Float:tz);
GetRandomPointOnCone3D(Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:pointA_radius,Float:pointB_radius,&Float:tx,&Float:ty,&Float:tz);

bool:GetArcPointsFloor3D(Float:x,Float:y,Float:z,Float:tx,Float:ty,Float:tz,Float:spread,Float:points[][],max_points sizeof(points));
bool:GetArcPointsCellar3D(Float:x,Float:y,Float:z,Float:tx,Float:ty,Float:tz,Float:spread,Float:points[][],max_points sizeof(points));
bool:GetArcPointsLarboard3D(Float:x,Float:y,Float:z,Float:tx,Float:ty,Float:tz,Float:spread,Float:points[][],max_points sizeof(points));
bool:GetArcPointsStarboard3D(Float:x,Float:y,Float:z,Float:tx,Float:ty,Float:tz,Float:spread,Float:points[][],max_points sizeof(points)); 
- Added ColAndreas function:
PHP Code:
//Extended version for GetPointInFront3DCol
GetPointInFront3DColEx(Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz,Float:radius,&Float:tx,&Float:ty,&Float:tz); 
- Added Stream3D function:
PHP Code:
bool:GetRandomPointOnStream(Stream:StreamData[Stream3D],&Float:x,&Float:y,&Float:z); 
- Updated functions:
PHP Code:
//support for Cone3D, Cylinder3D, SphericalSector
bool:GetRandomPointInStream(Stream:StreamData[Stream3D],&Float:x,&Float:y,&Float:z); 
- Functions marked as deprecated:
PHP Code:
GetArcPointsFloor2D
GetArcPointsCellar2D
GetArcPointsLarboard2D
GetArcPointsStarboard2D 

- Test for GetRandomPointInCylinder3D:
PHP Code:
public OnFilterScriptInit(){

    new 
cnt 0max_oper 10000;
    for(new 
1<= max_operi++){
        new 
Float:x,Float:y,Float:z;
        
GetRandomPointInCylinder3D(150.0,-90.0,180.015.0,-58.0,50.025.0x,y,z);
        if(
IsPointInCylinder3D(x,y,z150.0,-90.0,180.015.0,-58.0,50.025.0)){
            
cnt++;
        }
    }
    
printf("%d / %d effectiveness %.2f %%",cnt,max_oper,(cnt*100.0/max_oper));
    
    
//9597 / 10000 effectiveness 95.97 %
    
    
return 1;

- Test for
PHP Code:
public OnFilterScriptInit(){

    new 
cnt 0max_oper 10000;
    for(new 
1<= max_operi++){
        new 
Float:x,Float:y,Float:z;
        
GetRandomPointInCone3D(150.0,-69.0,15.0,-60.0,-50.0,150.0,15.0,90.0,x,y,z);
        if(
IsPointInCone3D(x,y,z,150.0,-69.0,15.0,-60.0,-50.0,150.0,15.0,90.0)){
            
cnt++;
        }
    }
    
printf("%d / %d effectiveness %.2f %%",cnt,max_oper,(cnt*100.0/max_oper));
    
    
//9433 / 10000 effectiveness 94.33 %
    
return 1;

- Test for GetRandomPointOnSphericalSector:
PHP Code:
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys){
    if(
Tryg3D_KeyPressed(KEY_YES)){
        for(new 
050i++){
            new 
Float:x,Float:y,Float:zFloat:tx,Float:ty,Float:tz;
            
GetRandomPointOnSphericalSector(0.0,0.0,20.00.0,90.0,500.0,VERTICAL_CAMERA_RADIUS,HORIZONTAL_CAMERA_RADIUS,tx,ty,tz);
            
MovePointCol(0.0,0.0,20.0tx,ty,tzx,y,z);
            
MissileLaunch(MISSILE_TYPE_EXPLODE_NORMAL,10.0,25.0,80.00.0,0.0,20.00,0,-1,350.0,MISSILE_OBJECT_HYDRA,x,y,z);
        }
    }
    return 
1;


Video for GetRandomPointOnSphericalSector:
https://www.youtube.com/watch?v=hQLvmf0duAM

Screen for Arc3D:
http://i.imgur.com/qDzxLL4.png

Download:
3DTryg.inc

Last edited by AbyssMorgan; 16/09/2017 at 08:36 AM.
AbyssMorgan is offline   Reply With Quote
Old 12/02/2017, 06:57 PM   #105
Roozevelt
Gangsta
 
Roozevelt's Avatar
 
Join Date: Jan 2016
Location: Tunsia
Posts: 526
Reputation: 154
Default Re: 3DTryg Functions

Great
__________________
Left SA-MP.
Roosevelt's stunt map pack : Click here
SEF community
Join now

Support my music : https://www.youtube.com/watch?v=1ats...&start_radio=1
Roozevelt is offline   Reply With Quote
Old 13/02/2017, 07:30 PM   #106
Unrea1
Gangsta
 
Unrea1's Avatar
 
Join Date: Oct 2013
Location: Venezuela
Posts: 792
Reputation: 126
Default Re: 3DTryg Functions

Delete:

PHP Code:
bool:IsPlayerInRangeOfVehicle(playerid,Float:range,vehicleid,bool:testLOS=true); 
bool:IsPlayerInRangeOfPlayer(playerid,Float:range,targetid,bool:testLOS=true); 
bool:IsPlayerInRangeOfObject(playerid,Float:range,objectid,bool:testLOS=true); 
bool:IsPlayerInRangeOfPointCol(playerid,Float:range,Float:x,Float:y,Float:z,bool:testLOS=true);  
bool:IsPlayerInRangeOfDynamicObject(playerid,Float:range,objectid,bool:testLOS=true); 
bool:IsPlayerInRangeOfDynamicActor(playerid,Float:range,actorid,bool:testLOS=true);  
bool:IsPlayerInRangeOfNPC(playerid,Float:range,npcid,bool:testLOS=true);  
bool:IsPlayerInRangeOfActor(playerid,Float:range,actorid,bool:testLOS=true); 
Add:

PHP Code:
bool:IsPlayerInRangeOfElement(playerid,Float:range,Item3D_Type:target_type=item_player,bool:testLOS=true); 
Greetings

Edit:

Add modules of FCNPC (FCNPC_GetPosition, etc) in the new functions (example, item_npc use GetPlayerPos, add other item as item_fcnpc...)

When using the following functions, mark "undefined symbol" ...

PHP Code:
#if defined Tryg3D_Anims
    
Tryg3D_Function:: bool:IsPlayerSkydiving(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index >= 958 && T3D:index <= 962);
    }

    
Tryg3D_Function:: bool:IsPlayerUsingParachute(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index >= 963 && T3D:index <= 979);
    }

    
Tryg3D_Function:: bool:IsPlayerAiming(playerid){
        switch(
GetPlayerAnimationIndex(playerid)){
            case 
1160..1163,1167,1365,1643,1453,220: return true;
        }
        return 
false;
    }

    
Tryg3D_Function:: bool:IsPlayerStay(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index == 1189 || T3D:index == 1133);
    }

    
Tryg3D_Function:: bool:IsPlayerRunning_(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index == 1231 || T3D:index == 1266 || T3D:index == 1196);
    }

    
Tryg3D_Function:: bool:IsPlayerSwim(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index == 1538 || T3D:index == 1539 || T3D:index == 1541 || T3D:index == 1544);
    }

    
Tryg3D_Function:: bool:IsPlayerJump_(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index == 1195 || T3D:index == 1198);
    }

    
Tryg3D_Function:: bool:IsPlayerParaFall(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index == 958 || T3D:index == 959 || T3D:index == 961 || T3D:index == 962 || T3D:index == 1134);
    }

    
Tryg3D_Function:: bool:IsPlayerParaGlide(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index == 963 || T3D:index == 965 || T3D:index == 971 || T3D:index == 976 || T3D:index == 978);
    }

    
Tryg3D_Function:: bool:IsPlayerFall(playerid){
        return (
GetPlayerAnimationIndex(playerid) == 1130);
    }
#endif 
__________________

Last edited by Unrea1; 14/02/2017 at 04:42 AM.
Unrea1 is offline   Reply With Quote
Old 14/02/2017, 07:56 AM   #107
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: 3DTryg Functions

Quote:
Originally Posted by Fynn. View Post
Delete:

PHP Code:
bool:IsPlayerInRangeOfVehicle(playerid,Float:range,vehicleid,bool:testLOS=true); 
bool:IsPlayerInRangeOfPlayer(playerid,Float:range,targetid,bool:testLOS=true); 
bool:IsPlayerInRangeOfObject(playerid,Float:range,objectid,bool:testLOS=true); 
bool:IsPlayerInRangeOfPointCol(playerid,Float:range,Float:x,Float:y,Float:z,bool:testLOS=true);  
bool:IsPlayerInRangeOfDynamicObject(playerid,Float:range,objectid,bool:testLOS=true); 
bool:IsPlayerInRangeOfDynamicActor(playerid,Float:range,actorid,bool:testLOS=true);  
bool:IsPlayerInRangeOfNPC(playerid,Float:range,npcid,bool:testLOS=true);  
bool:IsPlayerInRangeOfActor(playerid,Float:range,actorid,bool:testLOS=true); 
Add:

PHP Code:
bool:IsPlayerInRangeOfElement(playerid,Float:range,Item3D_Type:target_type=item_player,bool:testLOS=true); 
Greetings

Edit:

Add modules of FCNPC (FCNPC_GetPosition, etc) in the new functions (example, item_npc use GetPlayerPos, add other item as item_fcnpc...)

When using the following functions, mark "undefined symbol" ...

PHP Code:
#if defined Tryg3D_Anims
    
Tryg3D_Function:: bool:IsPlayerSkydiving(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index >= 958 && T3D:index <= 962);
    }

    
Tryg3D_Function:: bool:IsPlayerUsingParachute(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index >= 963 && T3D:index <= 979);
    }

    
Tryg3D_Function:: bool:IsPlayerAiming(playerid){
        switch(
GetPlayerAnimationIndex(playerid)){
            case 
1160..1163,1167,1365,1643,1453,220: return true;
        }
        return 
false;
    }

    
Tryg3D_Function:: bool:IsPlayerStay(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index == 1189 || T3D:index == 1133);
    }

    
Tryg3D_Function:: bool:IsPlayerRunning_(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index == 1231 || T3D:index == 1266 || T3D:index == 1196);
    }

    
Tryg3D_Function:: bool:IsPlayerSwim(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index == 1538 || T3D:index == 1539 || T3D:index == 1541 || T3D:index == 1544);
    }

    
Tryg3D_Function:: bool:IsPlayerJump_(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index == 1195 || T3D:index == 1198);
    }

    
Tryg3D_Function:: bool:IsPlayerParaFall(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index == 958 || T3D:index == 959 || T3D:index == 961 || T3D:index == 962 || T3D:index == 1134);
    }

    
Tryg3D_Function:: bool:IsPlayerParaGlide(playerid){
        new 
T3D:index GetPlayerAnimationIndex(playerid);
        return (
T3D:index == 963 || T3D:index == 965 || T3D:index == 971 || T3D:index == 976 || T3D:index == 978);
    }

    
Tryg3D_Function:: bool:IsPlayerFall(playerid){
        return (
GetPlayerAnimationIndex(playerid) == 1130);
    }
#endif 
I already adding support for FCNPC position in v4.0.1

PHP Code:
#define ENABLE_3D_TRYG_ANIMS
#include <SAM/3DTryg> 

Last edited by AbyssMorgan; 16/09/2017 at 08:35 AM.
AbyssMorgan is offline   Reply With Quote
Old 14/02/2017, 07:59 AM   #108
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: 3DTryg Functions

Update v4.0.1:

- Removed functions (Use universal functions):
PHP Code:
bool:IsPlayerInRangeOfVehicle(playerid,Float:range,vehicleid,bool:testLOS=true);
bool:IsPlayerInRangeOfPlayer(playerid,Float:range,targetid,bool:testLOS=true);
bool:IsPlayerInRangeOfObject(playerid,Float:range,objectid,bool:testLOS=true);
bool:IsPlayerInRangeOfPointCol(playerid,Float:range,Float:x,Float:y,Float:z,bool:testLOS=true);
bool:IsPlayerInRangeOfActor(playerid,Float:range,actorid,bool:testLOS=true);
bool:IsPlayerInRangeOfDynamicObject(playerid,Float:range,objectid,bool:testLOS=true);
bool:IsPlayerInRangeOfDynamicActor(playerid,Float:range,actorid,bool:testLOS=true);
bool:IsPlayerInRangeOfNPC(playerid,Float:range,npcid,bool:testLOS=true);

bool:GetPlayerToPointVector(playerid,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz);
bool:GetObjectToPointVector(objectid,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz);
bool:GetVehicleToPointVector(vehicleid,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz);
bool:GetDynamicObjectToPointVector(objectid,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz);
bool:GetNPCToPointVector(npcid,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz);
GetDynamicObjectCollisionFlags(objectid);
GetObjectCollisionFlags(objectid);
GetNPCCollisionFlags(npcid);

bool:IsBetweenNPCsIsWall(npcid,targetid);
bool:IsBetweenNPCToPointIsWall(npcid,Float:x,Float:y,Float:z);

GetPlayerRotatedVector(playerid,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz,bool:return_vector=true,Float:rx=0.0,Float:ry=0.0,Float:rz=0.0);
GetObjectRotatedVector(objectid,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz,bool:return_vector=true,Float:rx=0.0,Float:ry=0.0,Float:rz=0.0);
GetVehicleRotatedVector(vehicleid,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz,bool:return_vector=true,Float:rx=0.0,Float:ry=0.0,Float:rz=0.0);
GetDynamicObjectRotatedVector(objectid,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz,bool:return_vector=true,Float:rx=0.0,Float:ry=0.0,Float:rz=0.0);
GetNPCRotatedVector(npcid,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz,bool:return_vector=true,Float:rx=0.0,Float:ry=0.0,Float:rz=0.0);

GetObjectRotationQuat(objectid,&Float:qw,&Float:qx,&Float:qy,&Float:qz);
GetDynamicObjectRotationQuat(objectid,&Float:qw,&Float:qx,&Float:qy,&Float:qz);

GetVehicleUpVector(vehicleid,&Float:vx,&Float:vy,&Float:vz);
GetVehicleUpPos(vehicleid,Float:radius,&Float:x,&Float:y,&Float:z);
GetVehicleDownPos(vehicleid,Float:radius,&Float:x,&Float:y,&Float:z);
GetObjectUpVector(objectid,&Float:vx,&Float:vy,&Float:vz);
GetObjectUpPos(objectid,Float:radius,&Float:x,&Float:y,&Float:z);
GetObjectDownPos(objectid,Float:radius,&Float:x,&Float:y,&Float:z);

GetDynamicObjectUpVector(objectid,&Float:vx,&Float:vy,&Float:vz);
GetDynamicObjectUpPos(objectid,Float:radius,&Float:x,&Float:y,&Float:z);
GetDynamicObjectDownPos(objectid,Float:radius,&Float:x,&Float:y,&Float:z); 


- Marked as deprecated:
PHP Code:
GetPlayerCollisionFlags(playerid);
GetVehicleCollisionFlags(vehicleid); 
- Added Universal Functions:
PHP Code:
bool:GetElementToPointVector({Text3D,_}:elementid,Item3D_Type:element_type,Float:radius,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz);
bool:GetElementRotatedVector({Text3D,_}:elementid,Item3D_Type:element_type,Float:tx,Float:ty,Float:tz,&Float:vx,&Float:vy,&Float:vz,bool:return_vector=true,Float:rx=0.0,Float:ry=0.0,Float:rz=0.0);
bool:GetElementRotationQuat({Text3D,_}:elementid,Item3D_Type:element_type,&Float:qw,&Float:qx,&Float:qy,&Float:qz);
bool:GetElementUpVector({Text3D,_}:elementid,Item3D_Type:element_type,&Float:vx,&Float:vy,&Float:vz);
bool:GetElementUpPos({Text3D,_}:elementid,Item3D_Type:element_type,,&Float:x,&Float:y,&Float:z,bool:reverse=false); 
- Added Universal Functions (ColAndreas):
PHP Code:
bool:IsBetweenElementsIsWall({Text3D,_}:elementid,Item3D_Type:element_type,{Text3D,_}:targetid,Item3D_Type:target_type);
bool:IsBetweenElementToPointIsWall(Float:x,Float:y,Float:z,{Text3D,_}:targetid,Item3D_Type:target_type);

GetElementCollisionFlags({Text3D,_}:elementid,Item3D_Type:element_type);

bool:IsPlayerInRangeOfElement(playerid,Float:range,{Text3D,_}:targetid,Item3D_Type:target_type=item_player,bool:testLOS=true);
bool:IsElementInRangeOfPoint(Float:x,Float:y,Float:z,Float:range,{Text3D,_}:targetid,Item3D_Type:target_type=item_player,bool:testLOS=true);
bool:IsElementInRangeOfElement({Text3D,_}:elementid,Item3D_Type:element_type,Float:range,{Text3D,_}:targetid,Item3D_Type:target_type=item_player,bool:testLOS=true); 
Download:
3DTryg.inc

Stock ammount: 239


Last edited by AbyssMorgan; 16/09/2017 at 08:35 AM.
AbyssMorgan is offline   Reply With Quote
Old 19/02/2017, 01:39 PM   #109
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: 3DTryg Functions

Update v4.0.2:

- Added support for STREAMER_ENABLE_TAGS

- Updated functions:
PHP Code:
//Old Syntax:
Tryg3D_GivePlayerDamage(targetid,Float:damage,playerid,weaponid,bool:force_spawn=true,bool:death_msg=true,bool:death_call=true);

//New Syntax:
Tryg3D_GivePlayerDamage(targetid,Float:amount,playerid,weaponid,bodypart)

//Auto call
OnPlayerGiveDamage
OnPlayerTakeDamage

OnPlayerDeath 
before player "fake death"
SpawnPlayer after player "fake death" 
- Removed functions:
PHP Code:
IsPointInWaterFrontOfNPC //Use IsPointInWaterOrientOfElement

GetRandomClockPos //Use GetRandomPointOnClock

{
    
GetDynamicActorOrientationPos
    GetNPCOrientationPos
    GetPlayerOrientationPos
    GetVehicleOrientationPos
    GetObjectOrientationPos
    GetDynamicObjectOrientationPos
} -> GetElementOrientationPos

{
    
GetPlayerOrientationPosCol
    GetVehicleOrientationPosCol
    GetObjectOrientationPosCol
    GetNPCOrientationPosCol
    GetDynamicObjectOrientPosCol
    GetDynamicActorOrientPosCol
} -> GetElementOrientationPosCol 
- Removed option:
PHP Code:
USE_DEPRECATED_SCREEN_FUNCTION 
- Removed extra names:
PHP Code:
GetPointInFront            -> GetPointInFront3D
GetXYInFrontOfPlayer       
-> GetPointInFrontOfPlayer
GetXYInFrontOfPlayerCol    
-> GetPointInFrontOfPlayerCol
GetPointInFrontOfCamera    
-> GetPointInFrontOfCamera3D
GetXYZInFrontOfVehicle     
-> GetPointInFrontOfVehicle3D (Attentiondifferent syntax)
GetVehicleAngle            -> GetVehicleRotation 
IsPointInCylinder          
-> IsPointInCylinder3D
IsPlayerInCylinder         
-> IsPlayerInCylinder3D
GetXYInFrontOfNPC          
-> GetPointInFrontOfNPC
GetXYInFrontOfNPCCol       
-> GetPointInFrontOfNPCCol
GetPointInFrontCol         
-> GetPointInFront3DCol
GetPointInFrontOfCameraCol 
-> GetPointInFrontOfCamera3DCol 
- Marked as deprecated:
PHP Code:
bool:IsPointInWaterFrontOfPlayer(playerid,Float:radius); 
- Added element tag definition:
PHP Code:
TRYG3D_ELEMENT_TAG 
- Added universal functions:
PHP Code:

bool
:GetElementOrientationPos(TRYG3D_ELEMENT_TAG elementid,Item3D_Type:element_type,element_orientation:orientation,Float:distance,&Float:tx,&Float:ty,&Float:tz);
bool:GetElementOrientationPosCol(TRYG3D_ELEMENT_TAG elementid,Item3D_Type:element_type,element_orientation:orientation,Float:distance,&Float:tx,&Float:ty,&Float:tz);
bool:IsPointInWaterOrientOfElement(TRYG3D_ELEMENT_TAG elementid,Item3D_Type:element_type,Float:radius,element_orientation:orientation=o_front); 
Download:
3DTryg.inc

Stock ammount: 229


Last edited by AbyssMorgan; 16/09/2017 at 08:35 AM.
AbyssMorgan is offline   Reply With Quote
Old 04/03/2017, 04:53 PM   #110
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,213
Reputation: 352
Default Re: 3DTryg Functions

Update v4.0.3:

- Update Version Checker (Now always working).

- Added YSF functions:
PHP Code:
CountGangZone();
CountVisibleGangZone(playerid);
CountPlayerGangZone(playerid);
CountVisiblePlayerGangZone(playerid); 
- Added functions:
PHP Code:
CountVisibleActors(playerid);
CountVisibleVehicles(playerid);
CountVisiblePlayers(playerid,bool:isplayer=true,bool:isnpc=true); 
Download:
3DTryg.inc

Last edited by AbyssMorgan; 16/09/2017 at 08:33 AM.
AbyssMorgan 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 05:06 AM
What is the difference between public functions and stock functions? NeskWriter Scripting Help 1 16/10/2013 07:23 PM
File Functions + String Functions NoaM[W] Scripting Help 2 19/12/2012 09:13 PM
Pawno functions Doesn't Show on the functions Tab silvan Scripting Help 2 11/11/2012 10: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 03:17 PM


All times are GMT. The time now is 04:24 PM.


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