02.06.2018, 19:43
From the data you have provided, I am guessing victimid is out of bounds, i.e, < 0 or > MAX_PLAYERS, assuming the User array is sized MAX_PLAYERS. Will have to see the GetClosestPlayer function to make sure that's the case.
On the assumption that that is the case, perhaps you should have some sort of a check on victimid before implementing the rest of the code. Something like:
Adding this to the after the new victimid = GetClosestPlayer(playerid,2.0) part of this code might help. I am also assuming this code is under OnPlayerKeyStateChange so playerid is not out of bound.
Making the final code look something like this:
On the assumption that that is the case, perhaps you should have some sort of a check on victimid before implementing the rest of the code. Something like:
pawn Код:
if(victimid >= sizeof(Users) || victimid < 0) return 1;
Making the final code look something like this:
pawn Код:
if(Team[playerid] == Zombies && User[playerid][USER_MINIJUE]==0 && User[playerid][USER_Evento] == 0 && User[playerid][USER_TipoD]==0 && newkeys & Morder)
{
if(GetPlayerWeapon(playerid) == 0)
{
new victimid = GetClosestPlayer(playerid,2.0);
if(victimid >= sizeof(Users) || victimid < 0) return 1; // can also replace sizeof(Users) with MAX_PLAYERS but you can only do this if your Users variable looks something like this Users[MAX_PLAYERS][someEnum]
if(Team[victimid] != Zombies )
{
if(IsPlayerPaused (victimid)) return GameTextForPlayer(playerid, "~G~El jugador se encuentra~N~ pausado", 6000, 4);
new Float: Health;
GetPlayerHealth(victimid, Health);
switch(User[playerid][USER_Mutacion]) {
case 0,2: {
if(Health <= 10 && User[victimid][USER_Muerto]== 0 )SendDeathMessage(playerid,victimid,WEAPON_DROWN),User[playerid][USER_KILLS]++,User[victimid][USER_Muerto]=1;
code.
.
.
. }
case 1: {
if(Health <= 20 && User[victimid][USER_Muerto]== 0 )SendDeathMessage(playerid,victimid,WEAPON_DROWN),User[playerid][USER_KILLS]++,User[victimid][USER_Muerto]=1;
code .
.
.
. }
}
SetPlayerScore(playerid,User[playerid][USER_SCORE]);
}
}
return 1;
}