Vehicle Projectile Detection
#1

Hey guys,

How would one detect a projectile fired from a rhino that then hits a custom(CreateDynamicObject) object.

Is it possible?, how would one go about it?


In the past I've done it with camera vectors, inrange detection and keystate(key fire).. but it's not consistent enough for me, I need something else!


Any help is greatly appreciated.
Reply
#2

Just tried the object function that comes with 'EnablePlayerCameraTarget' and it works great, but you need to be really close for it to work.. which sux because you take damage too.

Spose thats how it is?
Reply
#3

What do you want to do?
Reply
#4

I want to script detection for the shooting of dynamic objects with a rhino..
Reply
#5

Yeah, yeah... But what do you want to achieve with that?
Reply
#6

Well.. I have a gamemode that I've been developing for quite a few years now, it's a space based war combat server and as it currently stands players can do just about everything, except destroy another users base with just their rhino, the only vehicle available..

So this is all that is needed to finish it off.


EDIT: If you've ever played War Commander, thats the general direction I'm heading, except 3d ofc
Reply
#7

I think this is the only way:

https://sampwiki.blast.hk/wiki/GetPlayerCameraFrontVector

Maybe something like that:

Quote:

stock PlayerFaces(playerid, Float, Float:y, Float:z, Float:radius)
{
new Float:cx,Float:cy,Float:cz,Float:fx,Float:fy,Float :fz;
GetPlayerCameraPos(playerid, cx, cy, cz);
GetPlayerCameraFrontVector(playerid, fx, fy, fz);
return (radius >= DistanceCameraTargetToLocation(cx, cy, cz, x, y, z, fx, fy, fz));
}
+

Quote:

if(PlayerFaces(playerid, dynamicObjectPos[0], dynamicObjectPos[1], dynamicObjectPos[2], range) + PRESSING KEY CODE)
{
//Code

Reply
#8

Yeah, thats basically the method I was using to start with.. but thanks anyway Rdx, much appreciated!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)