What is the problem?
#3

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:
pawn Код:
if(victimid >= sizeof(Users) || victimid < 0) return 1;
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:
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;
    }
Reply


Messages In This Thread
What is the problem? - by Daynox12 - 02.06.2018, 19:24
Re: What is the problem? - by HoNEYKISS - 02.06.2018, 19:31
Re: What is the problem? - by Cell_ - 02.06.2018, 19:43
Re: What is the problem? - by Daynox12 - 02.06.2018, 19:43
Re: What is the problem? - by Daynox12 - 02.06.2018, 19:59
Re: What is the problem? - by Cell_ - 02.06.2018, 20:10
Re: What is the problem? - by Daynox12 - 02.06.2018, 20:12
Re: What is the problem? - by Daynox12 - 02.06.2018, 21:37
Re: What is the problem? - by Cell_ - 02.06.2018, 22:03
Re: What is the problem? - by GTLS - 03.06.2018, 06:11

Forum Jump:


Users browsing this thread: 1 Guest(s)