getting bullet coordinates -
FFAKO - 03.01.2017
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;
}
Re: getting bullet coordinates -
iamjems - 03.01.2017
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(playerid, 19836, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
AttachPlayerObjectToPlayer(playerid, myobject[playerid], playerid, 1.5, 0.5, 0.0, 0.0, 1.5, 2);
return 1;
}
This is to store the bullet's X, Y and Z:
PHP код:
new Float:BulletCoordinates[3][MAX_PLAYERS];
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float: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.
Re: getting bullet coordinates -
FFAKO - 04.01.2017
thank you very much i was looking this for 2 weeks