Two questions..
#1

[b]Is it possible to detect with what weapons is player shot?
If yes, how?

WeA
Reply
#2

Shot? No. Killed? Yes.

pawn Код:
OnPlayerDeath(playerid,killerid,reason)
{
  if(reason == 31) // M4
    return 31;

  return 1;
}
https://sampwiki.blast.hk/wiki/Weapons
Reply
#3

You can't detect when a player gets shot, (well not easily or accurately) there are some functions out there.


You can make a system to detect when a player fires a weapon(again not accurately);
The problem is people can tap their fire button, not actually firing any bullets.

pawn Код:
public OnPlayerUpdate(playerid)
{
  new keys, ud, lr, wpnid = GetPlayerWeapon(playerid);
  GetPlayerKeys(playerid, keys, ud, lr);
  //player on foot, pressing fire, holding a "firing" weapon
  if( GetPlayerState == PLAYER_STATE_ONFOOT && keys & KEY_FIRE && wpnid > 22 && wpnid < 38)
  {
     //player has fired weapon or is about to
  }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)