09.08.2015, 15:30
This seems nice, but I have a suggestion for you.
With this code, it will set all of the zombies' detect range higher when they are sprinting, no matter where they are on the map. You just adjust it to where it detects if they are in range of a zombie, and set that certain zombies detect range higher.
Because, say you are in Los Santos, and I am in San Fierro, and we are both near zombies, and you start sprinting, the zombies near me will also have higher detection ranges because you are sprinting.
pawn Code:
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;
}
Because, say you are in Los Santos, and I am in San Fierro, and we are both near zombies, and you start sprinting, the zombies near me will also have higher detection ranges because you are sprinting.