bool:Tryg3D_IsPlayerSpawned(playerid);
TogglePlayerVisibleOnServer(playerid,bool:toggle); //Phantom Admin (Beta)
bool:IsPlayerVisibleOnServer(playerid);
UpdatePlayerOnServer(playerid); //Performed automatically
CheckPlayersOnServer(playerid); //Performed automatically
#define DISABLE_3D_TRYG_ATM //Use before 3DTryg.inc for disable ATM Module
#define ENABLE_3D_TRYG_ANIMS //Use before 3DTryg.inc for enable Anims Module
//by Crayder
Float:GetDistanceFromPointToLine(Float:px,Float:py,Float:pz,Float:sX,Float:sY,Float:sZ,Float:eX,Float:eY,Float:eZ,&Float:iX=0.0,&Float:iY=0.0,&Float:iZ=0.0);
bool:IsPointInCone3D(Float:px,Float:py,Float:pz,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:pointA_radius,Float:pointB_radius);
bool:IsPlayerInCone(playerid,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:pointA_radius,Float:pointB_radius);
Stream:StreamCone3D(Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:pointA_radius,Float:pointB_radius);
bool:GetRandomPointInStream(Stream:StreamData[Stream3D],&Float:x,&Float:y,&Float:z);
//New version by Crayder
bool:IsPointInCylinder3D(Float:px,Float:py,Float:pz,Float:xA,Float:yA,Float:zA,Float:xB,Float:yB,Float:zB,Float:radius);
IsPointInCylinder -> IsPointInCylinder3D
IsPointInCylinderEx -> IsPointInCylinder2D
IsPlayerInCylinder -> IsPlayerInCylinder3D
IsPlayerInCylinderEx -> IsPlayerInCylinder2D
StreamCylinderEx -> StreamCylinder2D
StreamCylinder -> StreamCylinder3D
IsNPCInCylinder -> IsNPCInCylinder3D
GetRandomPointInCylinder -> GetRandomPointInCylinder3D
GetRandomPointInCylinderEx -> GetRandomPointInCylinder2D
s_cylinder -> s_cylinder3d
s_cylinderex -> s_cylinder2d
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... Код:
IsPlayerOnPlayerScreen IsVehicleOnPlayerScreen IsObjectOnPlayerScreen IsActorOnPlayerScreen IsPlayerOnFakeScreen IsVehicleOnFakeScreen IsObjectOnFakeScreen IsActorOnFakeScreen IsDynamicObjectOnPlayerScreen IsDynamicObjectOnFakeScreen IsDynamicActorOnPlayerScreen IsDynamicActorOnFakeScreen Код:
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) |
bool:IsPointViewToPoint(
x, y, z, px, py, pz,
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);
Get3DTrygEfficiency -> Tryg3D_GetEfficiency
Get3DTrygModules -> Tryg3D_GetModules
Get3DTrygErrorCount -> Tryg3D_GetErrorCount
Reset3DTrygErrorCount -> Tryg3D_ResetErrorCount
GetTryg3DActiveCount -> Tryg3D_GetActiveCount
IsTryg3DModuleLoaded -> Tryg3D_IsModuleLoaded
Tryg3DMapAndreasFindZ -> Tryg3D_MapAndreasFindZ (preserved old)
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
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...
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
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
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...
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
//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]);
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
MovePointCol
MovePointColCutLine
MovePointColCutLineEx
GetQuatFromRot(Float:rx,Float:ry,Float:rz,&Float:qw,&Float:qx,&Float:qy,&Float:qz);
//New Version: Tryg3D_GetQuatFromEuler
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);
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);
//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));
//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);
bool:GetRandomPointOnStream(Stream:StreamData[Stream3D],&Float:x,&Float:y,&Float:z);
//support for Cone3D, Cylinder3D, SphericalSector
bool:GetRandomPointInStream(Stream:StreamData[Stream3D],&Float:x,&Float:y,&Float:z);
GetArcPointsFloor2D
GetArcPointsCellar2D
GetArcPointsLarboard2D
GetArcPointsStarboard2D
public OnFilterScriptInit(){
new cnt = 0, max_oper = 10000;
for(new i = 1; i <= max_oper; i++){
new Float:x,Float:y,Float:z;
GetRandomPointInCylinder3D(150.0,-90.0,180.0, 15.0,-58.0,50.0, 25.0, x,y,z);
if(IsPointInCylinder3D(x,y,z, 150.0,-90.0,180.0, 15.0,-58.0,50.0, 25.0)){
cnt++;
}
}
printf("%d / %d effectiveness %.2f %%",cnt,max_oper,(cnt*100.0/max_oper));
//9597 / 10000 effectiveness 95.97 %
return 1;
}
public OnFilterScriptInit(){
new cnt = 0, max_oper = 10000;
for(new i = 1; i <= max_oper; i++){
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;
}
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys){
if(Tryg3D_KeyPressed(KEY_YES)){
for(new i = 0; i < 50; i++){
new Float:x,Float:y,Float:z, Float:tx,Float:ty,Float:tz;
GetRandomPointOnSphericalSector(0.0,0.0,20.0, 0.0,90.0,500.0,VERTICAL_CAMERA_RADIUS,HORIZONTAL_CAMERA_RADIUS,tx,ty,tz);
MovePointCol(0.0,0.0,20.0, tx,ty,tz, x,y,z);
MissileLaunch(MISSILE_TYPE_EXPLODE_NORMAL,10.0,25.0,80.0, 0.0,0.0,20.0, 0,0,-1,350.0,MISSILE_OBJECT_HYDRA,x,y,z);
}
}
return 1;
}
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);
bool:IsPlayerInRangeOfElement(playerid,Float:range,Item3D_Type:target_type=item_player,bool:testLOS=true);
#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
Delete:
PHP код:
PHP код:
![]() 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 код:
|
#define ENABLE_3D_TRYG_ANIMS
#include <SAM/3DTryg>
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);
GetPlayerCollisionFlags(playerid);
GetVehicleCollisionFlags(vehicleid);
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);
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);
//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"
IsPointInWaterFrontOfNPC //Use IsPointInWaterOrientOfElement
GetRandomClockPos //Use GetRandomPointOnClock
{
GetDynamicActorOrientationPos
GetNPCOrientationPos
GetPlayerOrientationPos
GetVehicleOrientationPos
GetObjectOrientationPos
GetDynamicObjectOrientationPos
} -> GetElementOrientationPos
{
GetPlayerOrientationPosCol
GetVehicleOrientationPosCol
GetObjectOrientationPosCol
GetNPCOrientationPosCol
GetDynamicObjectOrientPosCol
GetDynamicActorOrientPosCol
} -> GetElementOrientationPosCol
USE_DEPRECATED_SCREEN_FUNCTION
GetPointInFront -> GetPointInFront3D
GetXYInFrontOfPlayer -> GetPointInFrontOfPlayer
GetXYInFrontOfPlayerCol -> GetPointInFrontOfPlayerCol
GetPointInFrontOfCamera -> GetPointInFrontOfCamera3D
GetXYZInFrontOfVehicle -> GetPointInFrontOfVehicle3D (Attention, different syntax)
GetVehicleAngle -> GetVehicleRotation
IsPointInCylinder -> IsPointInCylinder3D
IsPlayerInCylinder -> IsPlayerInCylinder3D
GetXYInFrontOfNPC -> GetPointInFrontOfNPC
GetXYInFrontOfNPCCol -> GetPointInFrontOfNPCCol
GetPointInFrontCol -> GetPointInFront3DCol
GetPointInFrontOfCameraCol -> GetPointInFrontOfCamera3DCol
bool:IsPointInWaterFrontOfPlayer(playerid,Float:radius);
TRYG3D_ELEMENT_TAG
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);
CountGangZone();
CountVisibleGangZone(playerid);
CountPlayerGangZone(playerid);
CountVisiblePlayerGangZone(playerid);
CountVisibleActors(playerid);
CountVisibleVehicles(playerid);
CountVisiblePlayers(playerid,bool:isplayer=true,bool:isnpc=true);
Tryg3D::EulerToQuat(Float:rx,Float:ry,Float:rz,&Float:qw,&Float:qx,&Float:qy,&Float:qz);
Tryg3D::QuatToEuler(&Float:rx,&Float:ry,&Float:rz,Float:qw,Float:qx,Float:qy,Float:qz);
ShiftVectorRotation(Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz,&Float:tx,&Float:ty,&Float:tz);
bool:IsVehicleFullyInDynamicArea(vehicleid,areaid);
bool:IsVehicleFullyInStream(vehicleid,Stream:StreamData[Stream3D]);
Update 4.1.1:
- Added Functions: PHP Code:
PHP Code:
PHP Code:
GitHub Abyss Morgan Website |
bool:IsVehicleInDynamicArea(vehicleid,areaid,&Float:percentage);
//x,y,z - cube center point, rx,ry,rz - cube rotations
GetRandomPointInCube3D(Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz,Float:size_x,Float:size_y,Float:size_z,&Float:tx,&Float:ty,&Float:tz);
GetRandomPointOnCube3D(Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz,Float:size_x,Float:size_y,Float:size_z,&Float:tx,&Float:ty,&Float:tz);
bool:IsPointInCube3D(Float:px,Float:py,Float:pz,Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz,Float:size_x,Float:size_y,Float:size_z);
bool:IsPlayerInCube3D(playerid,Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz,Float:size_x,Float:size_y,Float:size_z);
GetCube3DPoint(OrientationCube3D:orientation,Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz,Float:size_x,Float:size_y,Float:size_z,&Float:tx,&Float:ty,&Float:tz);
bool:IsElementInCube3D(elementid,Item3D_Type:element_type,Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz,Float:size_x,Float:size_y,Float:size_z);
Stream:StreamCube3D(Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz,Float:size_x,Float:size_y,Float:size_z);
bool:GetRandomPointInDynamicArea(STREAMER_TAG_AREA areaid,&Float:tx,&Float:ty,&Float:tz);
o_left_back_down
o_right_back_down
o_right_front_down
o_left_front_down
o_left_back_up
o_right_back_up
o_right_front_up
o_left_front_up
Float:GetEllipseRadius(Float:x,Float:y,Float:angle);
bool:GetArcPoints3D(Float:x,Float:y,Float:z,Float:tx,Float:ty,Float:tz,Float:ry,Float:height,Float:points[][],max_points = sizeof(points));
bool:IsPointInEllipse(Float:px,Float:py,Float:cx,Float:cy,Float:size_x,Float:size_y);
bool:IsPointInEllipticalCylinder2D(Float:px,Float:py,Float:pz,Float:cx,Float:cy,Float:minz,Float:maxz,Float:size_x,Float:size_y);
bool:IsPlayerInEllipse(playerid,Float:cx,Float:cy,Float:size_x,Float:size_y);
bool:IsPlayerInEllipticalCylinder2D(playerid,Float:cx,Float:cy,Float:minz,Float:maxz,Float:size_x,Float:size_y);
GetRandomPointInEllipse(Float:cx,Float:cy,Float:size_x,Float:size_y,&Float:tx,&Float:ty);
GetRandomPointInEllipticalCyl2D(Float:cx,Float:cy,Float:minz,Float:maxz,Float:size_x,Float:size_y,&Float:tx,&Float:ty,&Float:tz);
GetRandomPointOnEllipse(Float:cx,Float:cy,Float:size_x,Float:size_y,&Float:tx,&Float:ty);
GetRandomPointOnEllipticalCyl2D(Float:cx,Float:cy,Float:minz,Float:maxz,Float:size_x,Float:size_y,&Float:tx,&Float:ty,&Float:tz);
bool:IsElementInEllipse(elementid,Item3D_Type:element_type,Float:cx,Float:cy,Float:size_x,Float:size_y);
bool:IsElementInEllipticalCylinder2D(elementid,Item3D_Type:element_type,Float:cx,Float:cy,Float:minz,Float:maxz,Float:size_x,Float:size_y);
Stream:StreamEllipse(Float:cx,Float:cy,Float:size_x,Float:size_y);
Stream:StreamEllipticalCylinder2D(Float:cx,Float:cy,Float:minz,Float:maxz,Float:size_x,Float:size_y);
//Streamer:
FCNPC_RandomMoveInDynamicArea(npcid,STREAMER_TAG_AREA areaid,Float:climbing = 2.0,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,bool:UseMapAndreas = false,bool:setangle = true);
//Stream3D:
FCNPC_RandomMoveInStream(npcid,Stream:StreamData[Stream3D],Float:climbing = 2.0,type = MOVE_TYPE_AUTO,Float:speed = MOVE_SPEED_AUTO,bool:UseMapAndreas = false,bool:setangle = true);
s_ellipse
s_ellipticalcyl2d
#include <a_samp>
#include <ColAndreas>
#include <FCNPC>
#define ENABLE_3D_TRYG_STREAM3D
#include <SAM/3DTryg>
new NPC[6],
StreamCreate(NPCArea);
public OnFilterScriptInit(){
NPCArea = StreamCircle(2178.25,997.89,150.0);
/*
Also:
NPCArea = StreamRectangle(869.40,596.30,2997.00,2993.80); //Las Venturas
*/
NPC[0] = FCNPC_Create("Alusia");
FCNPC_Spawn(NPC[0],216,2178.25, 997.89, 10.82);
NPC[1] = FCNPC_Create("Luna");
FCNPC_Spawn(NPC[1],91,2100.56, 989.82, 10.82);
NPC[2] = FCNPC_Create("Skadi");
FCNPC_Spawn(NPC[2],11,2135.66, 1042.71, 10.81);
NPC[3] = FCNPC_Create("Lusia");
FCNPC_Spawn(NPC[3],13,2162.48, 1009.77, 10.52);
NPC[4] = FCNPC_Create("Nika");
FCNPC_Spawn(NPC[4],12,2141.83, 1009.89, 10.52);
NPC[5] = FCNPC_Create("Zero");
FCNPC_Spawn(NPC[5],294,2132.12, 1028.96, 10.52);
return 1;
}
public FCNPC_OnUpdate(npcid){
if(!FCNPC_IsMoving(npcid)){
FCNPC_RandomMoveInStream(npcid,NPCArea,_,MOVE_TYPE_WALK,MOVE_SPEED_AUTO,true,true);
}
return 1;
}
public OnFilterScriptExit(){
for(new i = 0; i <= 5; i++) FCNPC_Destroy(NPC[i]);
return 1;
}
DISABLE_3D_TRYG_VEHSTREAMER
item_dynamic_vehicle
Tryg3D::GetDynamicVehicleID(vehicleid);
GetDynamicVehicleFlags(vehicleid);
Float:GetDynamicVehicleSpeed(vehicleid);
GetDynamicVehiclePartPos(vehicleid,partid,&Float:tx,&Float:ty,&Float:tz,Float:offset_x=0.0,Float:offset_y=0.0,Float:offset_z=0.0);
Float:GetPointInFrontOfDynVeh2D(vehicleid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfDynVeh3D(vehicleid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0);
bool:IsDynVehInRangeOfPoint(vehicleid,Float:range,Float:x,Float:y,Float:z);
bool:IsDynVehFullyInDynamicArea(vehicleid,areaid);
Float:GetPointInFrontOfDynVeh2DCol(vehicleid,&Float:tx,&Float:ty,Float:radius);
GetPointInFrontOfDynVeh3DCol(vehicleid,&Float:tx,&Float:ty,&Float:tz,Float:radius,&Float:rx=0.0,&Float:rz=0.0);
bool:IsDynamicVehicleOnSpawn(vehicleid,Float:check_radius=1.0);
bool:IsDynamicVehicleFullyInStream(vehicleid,Stream:StreamData[Stream3D]);
GetDynamicVehicleRotation(vehicleid,&Float:rx,&Float:ry,&Float:rz);
bool:IsPlayerFakeSpectating(playerid,bool:force_disable=true);
It's possible detect if element is on fcnp vision? like you do with IsElementOnPlayerScreen
|
bool:IsElementOnFakeScreen(Float:x,Float:y,Float:z,targetid,Item3D_Type:target_type,Float:rx,Float:rz,Float:vrx=VERTICAL_CAMERA_RADIUS,Float:vrz=HORIZONTAL_CAMERA_RADIUS,bool:testLOS=true);
stock GetTarget(npcid){
new Float:x, Float:y, Float:z, Float:angle,
pool_players[MAX_PLAYERS], pool_upp = -1;
FCNPC_GetPosition(npcid,x,y,z);
angle = FCNPC_GetAngle(npcid);
foreach(new i: Player){
if(GetElementsDistance(i,item_player,npcid,item_npc) <= 300.0){
if(IsElementOnFakeScreen(x,y,z,i,item_player,0.0,angle) && GetPlayerState(i) != PLAYER_STATE_SPECTATING){
pool_upp++;
pool_players[pool_upp] = i;
}
}
}
if(pool_upp == -1) return INVALID_PLAYER_ID;
return pool_players[random(pool_upp+1)];
}