Bulletproof shield.
#8

You actually can by using the provided X, Y, Z offsets and comparing them to the object.

Example:
pawn Код:
// in command...
ShieldObject[playerid] = CreateObject(18637, 0, 0, 0, 0, 0, 0);
AttachObjectToPlayer(objectid, .....
pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float: fX, Float: fY, Float: fZ)
{
     if(hittype == BULLET_HIT_TYPE_PLAYER && Shield[hitid] == true)
     {
          new Float: pos[4];
          GetObjectOffset(ShieldObject[playerid], playerid, EXTRA_TYPE_PLAYER, pos[0], pos[1], pos[2], pos[3]);
          if(GetDistance(x, y, z, pos[0], pos[1], pos[2], pos[3] < 5.0)
          {
               return 0;
          }
     }
     return 1;
}

stock GetDistance( Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2 )
{
    return floatround( floatsqroot( ( ( x1 - x2 ) * ( x1 - x2 ) ) + ( ( y1 - y2 ) * ( y1 - y2 ) ) + ( ( z1 - z2 ) * ( z1 - z2 ) ) ) ) );
}
However unless you hook(or use an extensive function) to store the object's offsets using Attached Player Objects you have to use global objects.
Reply


Messages In This Thread
Bulletproof shield. - by kepa333 - 15.03.2015, 20:57
Re: Bulletproof shield. - by Evocator - 15.03.2015, 21:11
Re: Bulletproof shield. - by kepa333 - 15.03.2015, 21:29
Re: Bulletproof shield. - by Smileys - 15.03.2015, 22:55
Re: Bulletproof shield. - by Sew_Sumi - 15.03.2015, 23:00
Re: Bulletproof shield. - by Crayder - 15.03.2015, 23:05
Re: Bulletproof shield. - by Smileys - 15.03.2015, 23:10
Re: Bulletproof shield. - by Abagail - 15.03.2015, 23:32
Re: Bulletproof shield. - by kepa333 - 16.03.2015, 15:59

Forum Jump:


Users browsing this thread: 1 Guest(s)