SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 10/04/2017, 04:26 PM   #401
Oxygenated
Little Clucker
 
Oxygenated's Avatar
 
Join Date: Dec 2016
Posts: 21
Reputation: 2
Unhappy This is what i've done for now

Sir i really apologise that you are facing a little trouble while guiding me, indeed i am new to scripting all i just want to tell you that this is what i've done for now.
Code:
   
#include<a_samp>
#include<colandreas>

public OnFilterScriptInit()
{
	// Add any remove buildings (This only works once)
	CA_RemoveBuilding();
	
	// Initialize the collision world (This creates San Andreas, the entire map, excluding removed buildings)
	CA_Init();
	
	// Create objects
	CA_CreateDynamicObject_SC();

	return 1;
}
And again Sir a complete installation instructions will be highly appreciated. Once again i deeply regret for the problem that i am providing to you right now. Thanks!
__________________
Trying hard to get something new.

Last edited by Oxygenated; 10/04/2017 at 04:57 PM.
Oxygenated is offline   Reply With Quote
Old 22/04/2017, 10:03 PM   #402
CJ101
High-roller
 
CJ101's Avatar
 
Join Date: Jan 2008
Location: RevolutionX
Posts: 1,916
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;
}
__________________

Desert Storm SA-MP TDM
HTTP://DESERTSTORM-SAMP.COM

CJ101 is offline   Reply With Quote
Old 23/04/2017, 02:16 AM   #403
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,173
Reputation: 1126
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   #404
CJ101
High-roller
 
CJ101's Avatar
 
Join Date: Jan 2008
Location: RevolutionX
Posts: 1,916
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
__________________

Desert Storm SA-MP TDM
HTTP://DESERTSTORM-SAMP.COM


Last edited by CJ101; 23/04/2017 at 08:53 PM.
CJ101 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 0.3.7 RC Scripting 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 06:55 AM.


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