public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(IsPlayerInRangeOfPoint(playerid, RANGE, X, Y, Z))
{
SetPlayerHealth(playerid, 0.0);
SendClientMessage(playerid, -1, "You got killed, because you shooted in a Spawn Point !");
}
return 1;
}
/*
Replace X, Y, Z with your position of Spawn Point.
Replace Range with your distance, when he cannot shoot.
*/
pawn Код:
|
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { if(hittype == BULLET_HIT_TYPE_NONE) { if(fX == spawnX && fY == spawnY && fZ == spawnZ) { SetPlayerHealth(playerid, 0.0); } } return 1; } //Replace spawnX, spawnY, spawnZ with your spawn positions.
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { if(hittype == BULLET_HIT_TYPE_NONE) { if(fX == spawnX && fY == spawnY && fZ == spawnZ) { SetPlayerHealth(playerid, 0.0); } } return 1; } //Replace spawnX, spawnY, spawnZ with your spawn positions. |
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { new Float:spawnX = CHANGE; new Float:spawnY = CHANGE; new Float:spawnZ = CHANGE; new Float:range = 5.0 // CHANGE IT if(IsPointInRangeOfPoint(fX, fY, fZ, spawnX, spawnY, spawnZ, range)) { SetPlayerHealth(playerid, 0.0); SendClientMessage(playerid, -1, "Don't spawnkill, you are dead."); } return 1; } stock IsPointInRangeOfPoint(Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2, Float:range) { x2 -= x; y2 -= y; z2 -= z; return ((x2 * x2) + (y2 * y2) + (z2 * z2)) < (range * range); }
EDIT: try this, change your spawn positions and range in CHANGE fields.
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ) { new Float:spawnX = CHANGE; new Float:spawnY = CHANGE; new Float:spawnZ = CHANGE; new Float:range = 5.0 // CHANGE IT if(IsPointInRangeOfPoint(fX, fY, fZ, spawnX, spawnY, spawnZ, range)) { SetPlayerHealth(playerid, 0.0); SendClientMessage(playerid, -1, "Don't spawnkill, you are dead."); } return 1; } stock IsPointInRangeOfPoint(Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2, Float:range) { x2 -= x; y2 -= y; z2 -= z; return ((x2 * x2) + (y2 * y2) + (z2 * z2)) < (range * range); } |