31.10.2016, 14:27
So, I had an idea where NPCs don't detect crouching players. I just don't know how to add it. Here's the only info from my server that I can give.
PHP код:
#define ZOMBIE_DETECT 15
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(!IsPlayerNPC(playerid))
{
if(newkeys & KEY_FIRE)
{
if(GetPlayerWeapon(playerid) >= 22 && GetPlayerWeapon(playerid) <= 38)
{
GetVictimDetectRange[playerid] = (ZOMBIE_DETECT * 4);
if(GetVictimTimerStatus[playerid] == 1) { KillTimer(GetVictimResetTimer[playerid]); }
GetVictimTimerStatus[playerid] = 1;
GetVictimResetTimer[playerid] = SetTimerEx("ResetDetectRange", 5000, false, "i", playerid);
}
}
else if(newkeys & KEY_SPRINT && GetVictimTimerStatus[playerid] == 0)
{
GetVictimDetectRange[playerid] = (ZOMBIE_DETECT * 2);
GetVictimTimerStatus[playerid] = 1;
GetVictimResetTimer[playerid] = SetTimerEx("ResetDetectRange", 5000, false, "i", playerid);
}
}
return 1;
}