public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
foreach(new ii: Player)
if(GetPlayerTeam(ii) == team_hunter)
{
if(hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
{
foreach(new i:Player)
{
if(GetPlayerTeam(ii) != team_prop) continue;
if(hitid == Prop[i])
{
SetPlayerHealth(i, 0);
SendClientMessage(i, -1, "Test");
break;
}
}
}
}
return 1;
}
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
switch (hittype)
{
case BULLET_HIT_TYPE_PLAYER_OBJECT:
{
foreach(new i:Player)
foreach(new ii: Player)
{
if(GetPlayerTeam(i) == team_hunter) continue;
if(GetPlayerTeam(ii) == team_prop) continue;
if(hitid == Prop[ii])
{
SetPlayerHealth(ii, 0);
SendClientMessage(ii, -1, "You have been killed");
break;
}
}
}
}
return 1;
}
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(GetPlayerTeam(playerid) == team_hunter) // No need for a loop, as playerid is in OnPlayerWeaponShot
{
if(hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
{
foreach(new i : Player)
{
if(hitid == Prop[i]) // Are you sure Prop[MAX_PLAYERS] (Prop[i]) is assigned to an object?
{
SetPlayerHealth(i, 0);
SendClientMessage(i, -1, "Test");
break;
}
}
}
}
return 1;
}
DestroyObject(Prop[i]);
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
foreach(new ii: Player)
if(GetPlayerTeam(ii) == team_hunter)
{
if(hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
{
foreach(new i:Player)
{
if(GetPlayerTeam(ii) != team_prop) continue;
if(hitid == Prop[i])
{
for(new i2=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i2++)
{
if(IsPlayerAttachedObjectSlotUsed(playerid, i2)) RemovePlayerAttachedObject(playerid, i2);
}
SetPlayerHealth(i, 0);
SendClientMessage(i, -1, "Test");
break;
}
}
}
}
return 1;
}
Rudy_
Remember you are duplicating the object to allow it to be seen outside of the players normal VW? If your still using the method we discussed. This would mean however that you would need to detect damage to a duplicated object (normal object) on the enemies screen. |
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(GetPlayerTeam(playerid) == team_hunter) // No need for a loop, as playerid is in OnPlayerWeaponShot
{
if(hittype == BULLET_HIT_TYPE_PLAYER_OBJECT)
{
foreach(new i : Player)
{
if(hitid == Prop[i]) // Are you sure Prop[MAX_PLAYERS] (Prop[i]) is assigned to an object?
{
for(new i2=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i2++)
{
DestroyObject(Prop[i2]);
SetPlayerHealth(i, 0);
SendClientMessage(i, -1, "Test");
break;
}
}
}
}
}
return 1;
}
Try this.
(Also, are you sure Prop[playerid] is an object id?) pawn Код:
|
How didn't stinged code work? As it should kill the player as needed, but not destroy the object which is the only fault?
Does "Test" appear, or? Stinged's code is also more efficent, have you tried debugging Stinged's code or even yours? |
How didn't stinged code work? As it should kill the player as needed, but not destroy the object which is the only fault?
Does "Test" appear, or? Stinged's code is also more efficent, have you tried debugging Stinged's code or even yours? |