SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 19/09/2017, 10:10 PM   #141
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,191
Reputation: 1241
Default Re: 3DTryg Functions

I would just like to mention I noticed something off.

Code:
	if(x == 0.0) x = EndX;
	if(y == 0.0) y = EndY;
	if(z == 0.0) z = EndZ;
When you use floats you should never use absolute precision since floats don't have absolute precision when making calculations.

You should always use less than/greater than operators when using floats never the equal to operator.

Code:
if(x > -0.0001 && x < 0.0001) x = EndX;
Pottus is offline   Reply With Quote
Old 20/09/2017, 02:41 AM   #142
Nero_3D
High-roller
 
Nero_3D's Avatar
 
Join Date: Jun 2007
Location: Germany
Posts: 3,745
Reputation: 646
Default Re: 3DTryg Functions

Quote:
Originally Posted by Pottus View Post
I would just like to mention I noticed something off.

Code:
	if(x == 0.0) x = EndX;
	if(y == 0.0) y = EndY;
	if(z == 0.0) z = EndZ;
When you use floats you should never use absolute precision since floats don't have absolute precision when making calculations.

You should always use less than/greater than operators when using floats never the equal to operator.

Code:
if(x > -0.0001 && x < 0.0001) x = EndX;
Well I think he wanted to check if CA_RayCastLine hit something so checking for 0.0 is fine because he set x, y, z to 0.0 beforehand, also 0.0 is a special value, so there won't be any rounding errors
Although the recommended way would be to use return value, wiki/ca_raycastline
Nero_3D is offline   Reply With Quote
Old 21/09/2017, 08:04 AM   #143
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,228
Reputation: 326
Default Re: 3DTryg Functions

Quote:
Originally Posted by Pottus View Post
I would just like to mention I noticed something off.

Code:
	if(x == 0.0) x = EndX;
	if(y == 0.0) y = EndY;
	if(z == 0.0) z = EndZ;
When you use floats you should never use absolute precision since floats don't have absolute precision when making calculations.

You should always use less than/greater than operators when using floats never the equal to operator.

Code:
if(x > -0.0001 && x < 0.0001) x = EndX;

PHP Code:
Tryg3D::Function:: MovePointCol(Float:StartX,Float:StartY,Float:StartZ,Float:EndX,Float:EndY,Float:EndZ,&Float:x,&Float:y,&Float:z){
    
0.0//reset vars for RayCastLine and ignore old values
    
ColAndreas::RayCastLine(StartX,StartY,StartZ,EndX,EndY,EndZ,x,y,z); //save collision if exist in x,y,z
    
if(== 0.0EndX//collision not exist set End value
    
if(== 0.0EndY;
    if(
== 0.0EndZ;

The same in all MovePointCol functions:
MovePointCol.inc
MovePointColCutLine.inc
MovePointColCutLineEx.inc
MovePointColWithVehicle.inc
AbyssMorgan is offline   Reply With Quote
Old 21/09/2017, 08:25 PM   #144
CoaPsyFactor
Gangsta
 
Join Date: Jul 2010
Location: Belgrade, Serbia
Posts: 904
Reputation: 52
Default Re: 3DTryg Functions

Quote:
Originally Posted by Pottus View Post
I would just like to mention I noticed something off.

Code:
	if(x == 0.0) x = EndX;
	if(y == 0.0) y = EndY;
	if(z == 0.0) z = EndZ;
When you use floats you should never use absolute precision since floats don't have absolute precision when making calculations.

You should always use less than/greater than operators when using floats never the equal to operator.

Code:
if(x > -0.0001 && x < 0.0001) x = EndX;
so "1.0 - 1.0" is not absolute 0.0?
__________________
Quote:
Originally Posted by ThaiLuan View Post
Code:
C:\Users\Administrator\Downloads\Viet-RP\gamemodes\3mien.pwn(112016) : fatal error 101: cannot write to file: "disk full"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Help me! How to fix error
CoaPsyFactor is offline   Reply With Quote
Old 28/09/2017, 09:29 AM   #145
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,228
Reputation: 326
Default Re: 3DTryg Functions

Update v4.5.2:

- Removed deprecated MapAndreas v1.1.0 support

- Update init system (more error detection, information)

- Minor code optimization

- Fix possibility double death in Tryg3D::GivePlayerDamage

- Removed Line3D Module

- Update ColAndreas / MapAndreas support

- Added ***** function (ColAndreas):
PHP Code:
*****::SetFloorPos(npcid); //fix z for current floor 
- Added Universal Functions (Streamer):
PHP Code:
IsElementInDynamicArea(TRYG3D_ELEMENT_TAG elementid,Item3D_Type:element_type,STREAMER_TAG_AREA areaid);
GetElementsInDynamicArea(STREAMER_TAG_AREA areaid,Item3D_Type:element_type,element_list[],max_element=sizeof(element_list)); 
- Removed deprecated functions:
PHP Code:
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); 
- Updated ***** function names (preserved old)
PHP Code:
IsNPCInRangeOfPoint     -> *****::InRangeOfPoint
GetNPCTargetAngle       
-> *****::GetTargetAngle
SetNPCTargetAngle       
-> *****::SetTargetAngle
GetNPCSpeed             
-> *****::GetSpeed
GetPointInFrontOfNPC    
-> *****::GetPointInFront
GetPointInFrontOfNPCCol 
-> *****::GetPointInFrontCol
SetNPCAbsolutePosition  
-> *****::SetAbsolutePosition 
- Renamed functions:
PHP Code:
IsMapAndreasInit        -> Tryg3D::IsMapAndreasInit
SafeMapAndreasInit      
-> Tryg3D::SafeMapAndreasInit

IsColAndreasInit        
-> Tryg3D::IsColAndreasInit
SafeColAndreasInit      
-> Tryg3D::SafeColAndreasInit 
Download:
3DTryg.inc

Bugs Report
AbyssMorgan is offline   Reply With Quote
Old 28/09/2017, 03:44 PM   #146
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Canada
Posts: 1,814
Reputation: 831
Default Re: 3DTryg Functions

Bud, its time you break your code into parts. So many functions in one file, where you could make classes. Like if i only needed area check functions so i would just need to download the area file say try3d_area.inc.
Gammix is offline   Reply With Quote
Old 28/09/2017, 03:51 PM   #147
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,228
Reputation: 326
Default Re: 3DTryg Functions

Quote:
Originally Posted by Gammix View Post
Bud, its time you break your code into parts. So many functions in one file, where you could make classes. Like if i only needed area check functions so i would just need to download the area file say try3d_area.inc.
Modular Version here:
https://github.com/AbyssMorgan/3DTryg-Source

edit core.lst and create your own version.

Default 3DTryg only support option for disable/enable plugn/internal modules.
AbyssMorgan is offline   Reply With Quote
Old 19/10/2017, 05:00 AM   #148
ToiletDuck
Huge Clucker
 
ToiletDuck's Avatar
 
Join Date: Apr 2012
Location: Philippines, Lucena City
Posts: 436
Reputation: 43
Default Re: 3DTryg Functions

IsPlayerOnPlayerScreen parameters? can't find it in the include.
__________________

ToiletDuck is offline   Reply With Quote
Old 19/10/2017, 06:50 AM   #149
AbyssMorgan
Banned
 
Join Date: Apr 2015
Location: Poland
Posts: 1,228
Reputation: 326
Default Re: 3DTryg Functions

Quote:
Originally Posted by ToiletDuck View Post
IsPlayerOnPlayerScreen parameters? can't find it in the include.
Deprecated, use:
PHP Code:
IsElementOnPlayerScreen(playerid,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:veh_col=false); 

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,bool:veh_col=false); 
AbyssMorgan is offline   Reply With Quote
Old 04/12/2017, 06:30 PM   #150
kennydalglish
Big Clucker
 
Join Date: Dec 2014
Posts: 152
Reputation: 8
Default Re: 3DTryg Functions

Hi. I'm trying to make sure that if a player walks out of the range, he drops it at a distance. With repeated use, the player can still exit the polygon. (tk tshshit not purely back, and still to the right). How can you solve this issue?

PHP Code:
new Floatx_pos,
    
Floaty_pos,
    
Floatz_pos,
    
Floatangle,
    
Floatnew_x_pos,
    
Floatnew_y_pos,
    
Floatnew_z_pos;

GetPlayerPos(playeridx_posy_posz_pos);
GetPointInFront3D(x_posy_posz_pos0.00.0, -7.5new_x_posnew_y_posnew_z_pos);  
SetPlayerPos(playeridnew_x_posnew_y_posnew_z_pos); 
kennydalglish 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 06:16 PM.


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