getting bullet coordinates
#1

how to get x,y,z of a bullet that penetrated to shotted player and make it a variable like new = BulletCoordinates;
BulletCoordinates = x,y,z of penetrated bullet and also my code gives error why?
it says invalid declarition or function

new myobject;
myobject = CreateObject(19836, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{ AttachObjectToPlayer(myobject, playerid, 1.5, 0.5, 0.0, 0.0, 1.5, 2);
return 1;
}
Reply
#2

I suggest using player variables in order to control the objects and bullet information.
I also suggest using CreatePlayerObject and AttachPlayerObjectToPlayer.

You must create the object in another function or callback or whatever:

PHP код:
new myobject[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
myobject[playerid] = CreatePlayerObject(playerid198360.00.00.00.00.00.0);
    return 
1;
}
public 
OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart)
{
    
AttachPlayerObjectToPlayer(playeridmyobject[playerid], playerid1.50.50.00.01.52);
    return 
1;

This is to store the bullet's X, Y and Z:

PHP код:
new Float:BulletCoordinates[3][MAX_PLAYERS];
public 
OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if(
hittype == BULLET_HIT_TYPE_PLAYER)
    {
        
BulletCoordinates[0][playerid] = fX;
        
BulletCoordinates[1][playerid] = fY;
        
BulletCoordinates[2][playerid] = fZ;
        
BulletCoordinates[0][hitid] = fX;
        
BulletCoordinates[1][hitid] = fY;
        
BulletCoordinates[2][hitid] = fZ;
    }
    return 
1;

Be sure to create the new variables at the top of your script.
Reply
#3

thank you very much i was looking this for 2 weeks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)