SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 02/05/2019, 01:59 PM   #1
ImNext
Big Clucker
 
ImNext's Avatar
 
Join Date: Jul 2018
Posts: 56
Reputation: 0
Default ColAndreas don't work

The title explains the topic, I am trying to check if there is an object of a coordinate up to the coordinate of the player, but does not work, ColAndreas always returns 0 even though there is an object between the player and the coordinate.

PHP Code:
GetPlayerPos(playeridP[0], P[1], P[2]);
obj CA_RayCastLine(_SentryData[_id][Sentry_X], _SentryData[_id][Sentry_Y], _SentryData[_id][Sentry_Z], P[0], P[1], P[2], P[3], P[4], P[5]);

format(strsizeof(str), "%f %f %f | %d"P[3], P[4], P[5], obj); //DEBUG ignore it
SendClientMessage(playerid, -1str); 
ImNext is offline   Reply With Quote
Old 02/05/2019, 02:27 PM   #2
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,741
Reputation: 585
Default Re: ColAndreas don't work

Did you call CA_Init() when the script loads?
Also, are you sure the coords are correct? You could create a label or object at both end points to see where they are exactly.
NaS is offline   Reply With Quote
Old 02/05/2019, 02:37 PM   #3
ImNext
Big Clucker
 
ImNext's Avatar
 
Join Date: Jul 2018
Posts: 56
Reputation: 0
Default Re: ColAndreas don't work

Quote:
Originally Posted by NaS View Post
Did you call CA_Init() when the script loads?
Also, are you sure the coords are correct? You could create a label or object at both end points to see where they are exactly.
Yeah, i made it.

PHP Code:
hook OnGameModeInit()
{
    
CA_Init();
    return 
Y_HOOKS_CONTINUE_RETURN_1;

I did a test here to find the coordinates, put a TextLabel and it appeared where it had to appear.
ImNext is offline   Reply With Quote
Old 02/05/2019, 02:44 PM   #4
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,741
Reputation: 585
Default Re: ColAndreas don't work

Does it load the data when the server starts, or is there something in the logs?
In case you test it with an object created by the server, make sure it is created in CA as well.
NaS is offline   Reply With Quote
Old 02/05/2019, 03:12 PM   #5
ImNext
Big Clucker
 
ImNext's Avatar
 
Join Date: Jul 2018
Posts: 56
Reputation: 0
Default Re: ColAndreas don't work

I am very dumb, I had forgotten to create the date of ColAndreas, now it works perfectly with NATIVE GTA CONSTRUCTIONS, but with those created by the streamer it does not detect ... How can I make it detect these constructions?
ImNext is offline   Reply With Quote
Old 02/05/2019, 03:19 PM   #6
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,741
Reputation: 585
Default Re: ColAndreas don't work

You can use CA_CreateDynamicObject_DC (instead of CreateDynamicObject) to create a pair of streamer and collision object or CA_CreateObject if you want to handle the collision objects yourself. If you use the first method you also need to use the CA function to destroy them.
NaS is offline   Reply With Quote
Old 02/05/2019, 03:26 PM   #7
ImNext
Big Clucker
 
ImNext's Avatar
 
Join Date: Jul 2018
Posts: 56
Reputation: 0
Default Re: ColAndreas don't work

Thanks bro.

REP+
ImNext 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
[Tutorial] ColAndreas Ph0eniX Tutorials 1 23/07/2018 12:32 AM
ColAndreas DTV Scripting Help 1 20/10/2016 11:22 PM
ColAndreas Max_Andolini Scripting Help 13 12/06/2016 09:14 AM
ColAndreas - What have you used it for? Pottus Everything and Nothing 21 29/03/2016 10:05 PM
Help ColAndreas Crystallize Scripting Help 7 02/03/2016 03:53 AM


All times are GMT. The time now is 06:44 AM.


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