if(IsPlayerInRangeOfPoint(i, 0.5, x,y,z)) // HERE
{
if(IsPlayerAimingAtPlayer(i, npcid))
{
switch(weapon)
{
case 0,14: NPC_Chat[npcid][life] -= 7;
case 1: NPC_Chat[npcid][life] -= 8;
case 2,3,5,6,7,15: NPC_Chat[npcid][life] -= 10;
case 4,8: NPC_Chat[npcid][life] -= 14;
case 22,23,24,25,26,27,28,29,30,31,32,33: NPC_Chat[npcid][life] -= 2;
case 34: continue;
}
ApplyAnimation(npcid,"ped","HIT_front",4.1,0,0,0,0,0);
NPC_Chat[npcid][insultedby] = i; // You anger the bastard!!!
//SendClientMessage(i, COLOR_RED, "DAMAGE 1.0");
}
}
forward Check(npcid);
public Check(npcid)
{
new Float:x,Float:y,Float:z,name[30];
GetPlayerPos(npcid, x,y,z);
GetPlayerName(npcid, name, sizeof(name));
for(new i=0;i<MAX_PLAYERS;i++)
{
if(i != npcid && IsPlayerConnected(i) && ( !IsPlayerNPC(i) || (IsPlayerNPC(i) && IsPlayerInAnyVehicle(i))))
{
if(((HOLDING(KEY_HANDBRAKE) && (PRESSED(KEY_FIRE) || PRESSED(KEY_SECONDARY_ATTACK)) || PRESSED(KEY_FIRE))) && PlayerKeys[i][1] != 300 && !IsPlayerInAnyVehicle(i) && GetPlayerState(i) == 1)
{
if(IsPlayerInRangeOfPoint(i, 0.5, x,y,z)) // THIS IS THE PART
{
if(IsPlayerAimingAtPlayer(i, npcid))
{
switch(weapon)
{
case 0,14: NPC_Chat[npcid][life] -= 7;
case 1: NPC_Chat[npcid][life] -= 8;
case 2,3,5,6,7,15: NPC_Chat[npcid][life] -= 10;
case 4,8: NPC_Chat[npcid][life] -= 14;
case 22,23,24,25,26,27,28,29,30,31,32,33: NPC_Chat[npcid][life] -= 2;
case 34: continue;
}
ApplyAnimation(npcid,"ped","HIT_front",4.1,0,0,0,0,0);
NPC_Chat[npcid][insultedby] = i; // You anger the bastard!!!
//SendClientMessage(i, COLOR_RED, "DAMAGE 1.0");
}
}
}
}
}
|
Originally Posted by kingdutch
Isn't IsPlayerInRangeOfPoint a custom function?
|
|
Originally Posted by kingdutch
Isn't IsPlayerInRangeOfPoint a custom function?
If so, show us the code of your IPIROP func. The code you showed us is pretty useless since we also don't know where you get i from, and where you get x,y,z from. |
OnPlayerSpawn(playerid) { if (IsPlayerInRangeOfPoint(playerid, 1.0, /*some static x,y,z*/)) { print("True"); } else { print( "False" ); } }