SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 22/04/2017, 10:03 PM   #401
CJ101
High-roller
 
CJ101's Avatar
 
Join Date: Jan 2008
Location: RevolutionX
Posts: 1,904
Reputation: 162
Default Re: ColAndreas - Collision Detection

For some reason the function CA_FindZ_For2DCoord(x,y,z); is not returning the ground Z level - its returning where the player IS.

Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_NO))
    {
        if(IsPlayerInAnyVehicle(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) != 520) return 1;
        if(Players[playerid][carpetwait] == true) return GameTextForPlayer(playerid,"~r~Reloading...",800,3);
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        CA_FindZ_For2DCoord(x,y,z);
        CreateExplosion(x,y,z,11,3);
        CreateExplosion(x+3,y,z,11,3);
        CreateExplosion(x+6,y,z,11,3);
        CreateExplosion(x+8,y,z,11,3);
        Players[playerid][carpetwait] = true;
        SetTimerEx("CarpetAgain",12000,0,"d",playerid);
       
        new kill;
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i) && IsPlayerInRangeOfPoint(i,3,x,y,z))
            {
                SetPlayerHealth(i,0);
                kill++;
            }
        }
        if(kill > 0)
        {
            format(xstring,sizeof xstring,"[*&*] Your airstike got you %d kills!",kill);
            SendClientMessage(playerid,COLOR_YELLOW,xstring);
            SetPlayerScore(playerid,Players[playerid][Kills] + kill);
            Players[playerid][Kills] += kill;
        }
    }
    return 1;
}
__________________
[/url]
CJ101 is offline   Reply With Quote
Old 23/04/2017, 02:16 AM   #402
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,416
Reputation: 1224
Default Re: ColAndreas - Collision Detection

You are not checking if any collision is found!

Code:
cell AMX_NATIVE_CALL ColAndreasNatives::CA_RayCastLine(AMX *amx, cell *params)
{
	cell* addr[3];

	// Adding a small value prevents a potential crash if all values are the same
	btVector3 Start = btVector3(btScalar(amx_ctof(params[1]) + 0.00001), btScalar(amx_ctof(params[2]) + 0.00001), btScalar(amx_ctof(params[3]) + 0.00001));
	btVector3 End = btVector3(btScalar(amx_ctof(params[4])), btScalar(amx_ctof(params[5])), btScalar(amx_ctof(params[6])));
	btVector3 Result;
	uint16_t Model = 0;

	if (collisionWorld->performRayTest(Start, End, Result, Model))
	{
		//Get our adderesses for the last 3
		amx_GetAddr(amx, params[7], &addr[0]);
		amx_GetAddr(amx, params[8], &addr[1]);
		amx_GetAddr(amx, params[9], &addr[2]);

		*addr[0] = amx_ftoc(Result.getX());
		*addr[1] = amx_ftoc(Result.getY());
		*addr[2] = amx_ftoc(Result.getZ());

		return Model;
	}
	return 0;
}
If the raytest fails then your input x, y, z values remain the same.
Pottus is offline   Reply With Quote
Old 23/04/2017, 04:51 AM   #403
CJ101
High-roller
 
CJ101's Avatar
 
Join Date: Jan 2008
Location: RevolutionX
Posts: 1,904
Reputation: 162
Default Re: ColAndreas - Collision Detection

@Pottus:

I'm getting some errors.

Code:
C:\Users\Justin\Documents\rxdm\gamemodes\war.pwn(2026) : error 010: invalid function or declaration
C:\Users\Justin\Documents\rxdm\gamemodes\war.pwn(2031) : error 010: invalid function or declaration
C:\Users\Justin\Documents\rxdm\gamemodes\war.pwn(2036) : error 010: invalid function or declaration
C:\Users\Justin\Documents\rxdm\gamemodes\war.pwn(2039) : error 067: variable cannot be both a reference and an array (variable "addr")
C:\Users\Justin\Documents\rxdm\gamemodes\war.pwn(2040) : error 025: function heading differs from prototype
C:\Users\Justin\Documents\rxdm\gamemodes\war.pwn(2041) : error 025: function heading differs from prototype
C:\Users\Justin\Documents\rxdm\gamemodes\war.pwn(2043) : error 010: invalid function or declaration
C:\Users\Justin\Documents\rxdm\gamemodes\war.pwn(2047) : error 010: invalid function or declaration
C:\Users\Justin\Documents\rxdm\gamemodes\war.pwn(2049) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase
__________________
[/url]

Last edited by CJ101; 23/04/2017 at 08:53 PM.
CJ101 is offline   Reply With Quote
Old 26/06/2017, 08:08 AM   #404
Matthew57
Banned
 
Join Date: May 2017
Posts: 58
Reputation: 7
Default Re: ColAndreas - Collision Detection

Hello, your Plugin isn't working it's giving me error Please help!
09:52:44] Loading plugin: ColAndreas.so
[09:52:44] Failed (libBulletDynamics.so.2.83: cannot open shared object file: No such file or directory)
Matthew57 is offline   Reply With Quote
Old 26/06/2017, 09:04 AM   #405
DRIFT_HUNTER
High-roller
 
Join Date: Oct 2009
Posts: 2,147
Reputation: 169
Default Re: ColAndreas - Collision Detection

Quote:
Originally Posted by Matthew57 View Post
Hello, your Plugin isn't working it's giving me error Please help!
09:52:44] Loading plugin: ColAndreas.so
[09:52:44] Failed (libBulletDynamics.so.2.83: cannot open shared object file: No such file or directory)
One more person that didnt even bothered reading first post...You see if you did read you would know what to do, and you would't have to wait for a reply.

Use these version
__________________
Путин here,
Путин there,
Путин просто everywhere.


Any PM's that include question about any kind of help will be ignored.
Use appropriate boards for that
DRIFT_HUNTER is offline   Reply With Quote
Old 02/07/2017, 03:19 PM   #406
ranme15
Big Clucker
 
ranme15's Avatar
 
Join Date: Aug 2010
Posts: 179
Reputation: 3
Default Re: ColAndreas - Collision Detection

Why am I getting "Pawno has stopped working.." whenever I try compiling with #include <colandreas>?
Those are my includes:
Code:
#include <a_samp>
#include <a_mysql>
#include <xml>
#include <streamer>
#include <colandreas>
#include <supporter>
#include <timerfix>
#include <sscanf2>
#include <Pawn.CMD>
#include <crashdetect>
#include <dialogs>
#include <log-plugin>
#include <YSF>
__________________
INACTIVE

Last edited by ranme15; 02/07/2017 at 04:14 PM.
ranme15 is offline   Reply With Quote
Old 23/07/2017, 02:54 PM   #407
Amads
Big Clucker
 
Amads's Avatar
 
Join Date: Feb 2012
Location: Poland
Posts: 197
Reputation: 40
Default Re: ColAndreas - Collision Detection

Allright, this is going to be weird.
Using colandreas_static.so CA_Init(); freezes my linux server. BUT it doesn't freeze if StrickenKid's MySQL plugin is loaded. I have no idea what's the connection between the two, but it's the only way to run ColAndreas for me.
http://forum.sa-mp.com/showpost.php?...8&postcount=10
Amads is offline   Reply With Quote
Old 23/07/2017, 10:56 PM   #408
Logic_
High-roller
 
Logic_'s Avatar
 
Join Date: Jun 2015
Location: NL-RP
Posts: 1,455
Reputation: 263
Default Re: ColAndreas - Collision Detection

Why are you using StrickenKid's MySQL plugin, I think it's outdated and not updated anymore.
__________________
RIP XXXTentacion [1998-2018]

My Releases: Click me!

Past experiences:
Ex- Developer of COD: Black Ops 3 [2017 - 2018], Palomino Creek RP [2018], NEG [2017], Zombieland [2015]
Logic_ is offline   Reply With Quote
Old 24/07/2017, 07:28 AM   #409
Amads
Big Clucker
 
Amads's Avatar
 
Join Date: Feb 2012
Location: Poland
Posts: 197
Reputation: 40
Default Re: ColAndreas - Collision Detection

I don't use it. Just without it loaded CA_Init(); freezes my server.
Amads is offline   Reply With Quote
Old 25/07/2017, 04:49 PM   #410
augustogdo
Little Clucker
 
augustogdo's Avatar
 
Join Date: Jan 2017
Posts: 28
Reputation: 0
Default Re: ColAndreas - Collision Detection

Great plugin, and it's better than MapAndreas
augustogdo 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
[Plugin] ColAndreas - (Released) Pottus Plugin Development 415 19/08/2015 12:31 AM
No veh collision vs vehicles with collision issue Kar Scripting Help 5 10/05/2015 11:08 PM
ColAndreas Pottus Screenshots and Videos 73 17/12/2014 08:32 PM
Collision Detection (Plugin) Deduction Scripting Help 0 27/12/2013 04:24 AM
Collision Detection? NumbSkull Scripting Help 4 13/11/2012 03:27 AM


All times are GMT. The time now is 05:09 AM.


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