12.07.2013, 22:45
So, I'm working on a headshot system, but it keeps killing my teammates if you headshot them with any weapon.
Now what I want is, if you headshot someone with sniper only, also that if you're in Class Sniper and weapon 34, it will show on kill list:
Just the weapon and the playerid, without killerid.
My code:
Will rep+ the person that helps me solve this!
Now what I want is, if you headshot someone with sniper only, also that if you're in Class Sniper and weapon 34, it will show on kill list:
Just the weapon and the playerid, without killerid.
My code:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerConnected(killerid))
{
if(gPlayerClass[playerid] == SNIPER && gTeam[killerid] != gTeam[playerid])
{
if(GetPlayerWeapon(killerid) == 34)
{
if(GetPVarInt(playerid, "Headshotted") == 1)
{
SetPVarInt(playerid, "Headshotted", 0);
GameTextForPlayer(playerid, "~r~Headshotted", 3000, 3);
GameTextForPlayer(killerid, "~r~Headshot", 3000, 3);
SendDeathMessage(playerid,INVALID_PLAYER_ID,34);
return 1;
}
}
else
{
if(GetPlayerWeapon(killerid) == 34 && gTeam[killerid] != gTeam[playerid])
{
if(GetPVarInt(playerid, "Headshotted") == 1)
{
SetPVarInt(playerid, "Headshotted", 0);
GameTextForPlayer(playerid, "~r~Headshotted", 3000, 3);
GameTextForPlayer(killerid, "~r~Headshot", 3000, 3);
SendDeathMessage(playerid,killerid,reason);
return 1;
}
}
}
}
![Smiley](images/smilies/smile.png)