SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 22/03/2017, 08:06 PM   #31
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Ottawa, Canada
Posts: 1,682
Reputation: 662
Default Re: projectile.inc - PeppeAC's physics modified and simpler version

Quote:
Originally Posted by AndySedeyn View Post
Nice! Though, OnProjectileStop seems to be called prematurely. It's an annoyance when you create an object that is supposed to replace the projectile under OnProjectileStop (the replacement object would be in the air instead of on the ground).
Can you give me example projectile which causes this bug.
__________________
Gammix is offline   Reply With Quote
Old 22/03/2017, 08:12 PM   #32
AndySedeyn
High-roller
 
AndySedeyn's Avatar
 
Join Date: Feb 2014
Location: Belgium
Posts: 1,339
Reputation: 681
Default Re: projectile.inc - PeppeAC's physics modified and simpler version

Quote:
Originally Posted by Gammix View Post
Can you give me example projectile which causes this bug.
I took your example and just added the CreateObject line under OnProjectileStop because that's what roughly happens in my script:
PHP Code:
#include <a_samp>
#include <zcmd>
#include <projectile>

new iProjObject[MAX_PROJECTILES];

public 
OnFilterScriptInit()
{
    
CA_Init();
    return 
1;
}

CMD:test(playerid)
{
    new 
Float:xFloat:yFloat:zFloat:ang;
    
GetPlayerPos(playeridxyz);
    
GetPlayerFacingAngle(playeridang);

    new 
Projectile(x0.5 floatcos(-(ang 90.0), degrees), z2.0 floatsin(-angdegrees), 2.0 floatcos(-angdegrees), 4.0, .collision_friction 5.0, .sphere_radius 0.01, .gravity 13.0);
    if (
== -1)
        return 
0;
    
DestroyObject(iProjObject[i]);
    
iProjObject[i] = CreateObject(348x0.5 floatcos(-(ang 90.0), degrees), z93.7120.0ang 60.0);
    
    
ApplyAnimation(playerid,"GRENADE","WEAPON_throwu",3.0,0,0,0,0,0);
    return 
1;
}

public 
OnProjectileUpdate(projid)
{
    new 
Float:xFloat:yFloat:z;
    
GetProjectilePos(projidxyz);
    
SetObjectPos(iProjObject[projid], xyz);
    return 
1;
}

public 
OnProjectileStop(projid)
{
    new 
Float:xFloat:yFloat:z;
    
GetProjectilePos(projidxyz);
    
CreateObject(348xyz90.00.00.0);
    return 
1;

AndySedeyn is offline   Reply With Quote
Old 23/03/2017, 07:16 AM   #33
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Ottawa, Canada
Posts: 1,682
Reputation: 662
Default Re: projectile.inc - PeppeAC's physics modified and simpler version

Update v1.3.4:
- Fixed sphere hanging in space when colliding with a player.
- Fixed min and max height calculation.

@Andy: This version should get rid of all those issues you addressed before. Give it a try!
__________________
Gammix is offline   Reply With Quote
Old 23/03/2017, 01:17 PM   #34
AndySedeyn
High-roller
 
AndySedeyn's Avatar
 
Join Date: Feb 2014
Location: Belgium
Posts: 1,339
Reputation: 681
Default Re: projectile.inc - PeppeAC's physics modified and simpler version

Quote:
Originally Posted by Gammix View Post
@Andy: This version should get rid of all those issues you addressed before. Give it a try!
Yep, thank you
AndySedeyn is offline   Reply With Quote
Old 09/04/2017, 08:35 PM   #35
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Ottawa, Canada
Posts: 1,682
Reputation: 662
Default Re: projectile.inc - PeppeAC's physics modified and simpler version

Update v1.3.5:
- Fixed projectile index management, poolsize method used.
- New functions:
PHP Code:
IsValidProjectile(projid);
GetProjectilePoolSize(); 
- Callback "OnProjectileCollide" has a param change, the "modelid" now is "extraid". Read the main post for info. about it.
PHP Code:
OnProjectileCollide(projidtypeFloat:xFloat:yFloat:zextraid); 
- New example of "Grenade launcher" has been added.
__________________
Gammix is offline   Reply With Quote
Old 09/04/2017, 09:41 PM   #36
Jelly23
Guest
 
Posts: n/a
Default Re: projectile.inc - PeppeAC's physics modified and simpler version

Quote:
Originally Posted by Gammix View Post
Update v1.3.5:
- Fixed projectile index management, poolsize method used.
- New functions:
PHP Code:
IsValidProjectile(projid);
GetProjectilePoolSize(); 
- Callback "OnProjectileCollide" has a param change, the "modelid" now is "extraid". Read the main post for info. about it.
PHP Code:
OnProjectileCollide(projidtypeFloat:xFloat:yFloat:zextraid); 
- New example of "Grenade launcher" has been added.
Great! Have your rep.
  Reply With Quote
Old 11/04/2017, 03:20 PM   #37
Romz
Gangsta
 
Join Date: Jun 2013
Posts: 881
Reputation: 49
Default Re: projectile.inc - PeppeAC's physics modified and simpler version

Why does an object fall under the ground?

https://youtu.be/kuZfFby6OO0
Romz is offline   Reply With Quote
Old 11/04/2017, 05:22 PM   #38
Gammix
High-roller
 
Gammix's Avatar
 
Join Date: Jan 2015
Location: Ottawa, Canada
Posts: 1,682
Reputation: 662
Default Re: projectile.inc - PeppeAC's physics modified and simpler version

Quote:
Originally Posted by Kolstin View Post
Why does an object fall under the ground?

https://youtu.be/kuZfFby6OO0
Definitely this could be the reason:
Quote:
Originally Posted by Gammix View Post
Maybe you don't have cadb in scriptfiles? I know thats a stupid question but sometimes you might forgot to add it...
Cause that can be the only reason why collisions are not working, due to unsuccessful loading of collision data.
And be sure you initialize ColAndreas using "CA_Init();".
__________________
Gammix is offline   Reply With Quote
Old 18/05/2017, 02:09 PM   #39
PeppeAC
Big Clucker
 
Join Date: Jun 2013
Location: Trani, Italy
Posts: 104
Reputation: 190
Default Re: projectile.inc - PeppeAC's physics modified and simpler version

Nice work!
PeppeAC 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
Vehicle Projectile Detection Killa[DGZ] Scripting Help 7 04/10/2016 11:52 AM
[FilterScript] Soccer Mod PeppeAC -Small Edited by me. Ivander Filterscripts 6 29/09/2013 05:34 PM
Must be a simpler but efficient way to show textdraw countdowns for two players [REP++] Hoborific Scripting Help 0 06/02/2012 12:43 PM


All times are GMT. The time now is 05:37 PM.


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