12/10/2021 19:37
Alguém sabe me falar onde pode esse código esta gerando crash no pawn, e me explicar o porque disso?
Código:
timer MoveZombie[100](zombieid, newkeys)
{
new Float:xa, Float:ya, Float:za, Float:health;
if(FCNPC_IsDead(zombieid)) return 1;
foreach(new i : Player)
{
GetPlayerPos(i, xa, ya, za);
if(IsPlayerInRangeOfPoint(zombieid, 1, xa, ya, za))
{
HumanFound[zombieid] = 2;
FCNPC_MeleeAttack(zombieid,500);
GetPlayerHealth(i, health);
break;
}
else if(IsPlayerInRangeOfPoint(zombieid,ZOMBIE_RANGE / 4, xa, ya, za))
{
if(GetPlayerSpecialAction(zombieid) == SPECIAL_ACTION_DUCK)
{
if(HumanFound[zombieid] == 2)
{
FCNPC_StopAttack(zombieid);
}
HumanFound[zombieid] = 1;
FCNPC_GoTo(zombieid, xa, ya, za, FCNPC_MOVE_TYPE_RUN);
SetTimer("ResetDetectRange", 5000, false);
}
break;
}
else if(IsPlayerInRangeOfPoint(zombieid, ZOMBIE_RANGE / 2, xa, ya, za))
{
if(HumanFound[zombieid] == 2)
{
FCNPC_StopAttack(zombieid);
}
HumanFound[zombieid] = 1;
FCNPC_GoTo(zombieid, xa, ya, za, FCNPC_MOVE_TYPE_RUN);
SetTimer("ResetDetectRange", 5000, false);
break;
}
else if(IsPlayerInRangeOfPoint(zombieid, ZOMBIE_RANGE, xa, ya, za))
{
if(HumanFound[zombieid] == 2)
{
FCNPC_StopAttack(zombieid);
}
HumanFound[zombieid] = 1;
FCNPC_GoToPlayerEx(zombieid, i, 5, 5, FCNPC_MOVE_TYPE_RUN);
SetTimer("ResetDetectRange", 5000, false);
break;
}
else if(IsPlayerInRangeOfPoint(zombieid, ZOMBIE_RANGE * 2 , xa, ya, za))
{
if(newkeys & KEY_SPRINT)
{
GetPlayerPos(zombieid, xa, ya, za);
if(HumanFound[zombieid] == 2)
{
FCNPC_StopAttack(zombieid);
}
HumanFound[zombieid] = 1;
FCNPC_GoToPlayerEx(zombieid, i, 5, 5, FCNPC_MOVE_TYPE_RUN);
SetTimer("ResetDetectRange", 5000, false);
break;
}
}
else if(IsPlayerInRangeOfPoint(zombieid,ZOMBIE_RANGE * 5, xa, ya, za))
{
if(GetPlayerWeapon(i) == 22 && GetPlayerWeapon(i) >= 23 && GetPlayerWeapon(i) <= 38)
{
GetPlayerPos(zombieid, xa, ya, za);
if(HumanFound[zombieid] == 2)
{
FCNPC_StopAttack(zombieid);
}
HumanFound[zombieid] = 1;
FCNPC_GoToPlayerEx(zombieid, i, 5, 5, FCNPC_MOVE_TYPE_RUN);
SetTimer("ResetDetectRange", 5000, false);
break;
}
}
else
{
HumanFound[zombieid] = 0;
new Float:x, Float:y, Float:z;
GetPlayerPos(zombieid, x, y, z);
FCNPC_StopAttack(zombieid);
if(HumanFound[zombieid] == 0)
{
new pos = random(4);
if(pos == 0) { x = x + 100.0; }
else if(pos == 1) { x = x - 100.0; }
else if(pos == 2) { y = y + 100.0; }
else if(pos == 3) { y = y - 100.0; }
FCNPC_SetKeys(zombieid, 0, 0, 0);
FCNPC_GoTo(zombieid, x, y, z, FCNPC_MOVE_TYPE_WALK);
}
}
}
return 1;
}