UP PROBLEM OnPlayerDeath

Započeo EmilHD, Decembar 24, 2017, 21:45:18 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: Underpoint
Detaljan opis problema: Kada igrac umre ili ga ubijem komandom izbaci neku gresku, a kada vise igraca umre kresa server.
Dio skriptehttps://pastebin.com/wzXkX9V3 https://pastebin.com/s5HcWmkW
Neke slike/video za lakse dobivanje pomoci(neobavezno)http://prntscr.com/hru9gs http://prntscr.com/hru9n5 http://prntscr.com/hru9r2

Potrebno je samo citati
[pawn]
[21:40:11] [debug] Run time error 4: "Array index out of bounds"
[21:40:11] [debug]  Attempted to read/write array element at index 65535 in array of size 1
[/pawn]
Zatim dobijas OnPlayerDeath za id 0 sto je INVALID_PLAYER_ID
[pawn]
[21:40:11] [debug] #0 001335ec in ?? (0, 65535, 255) from up-rp.amx
[21:40:11] [debug] #1 0000ad78 in public OnPlayerDeath (0, 65535, 255) from up-rp.amx
[/pawn]
Zato dobijas index 65535 ako je invalid player id. Isto ti je i sa vozilima. (ako probijes limit isti problem imas)

Resenje
[pawn]
if(playerid != INVALID_PLAYER_ID)
[/pawn]
na vrh funkcije OnPlayerDeath




A sta mislis oce sada?
[pawn]
public OnPlayerDeath(playerid, killerid, reason)
{
    if(playerid != INVALID_PLAYER_ID) {

    PlayerInfo[killerid][pUbistava]++; PlayerInfo[playerid][pSmrti]++;
    ResetPlayerWeapons(playerid); ResetujVar(playerid);
    ////////////////////////////////////////////////////////////
    if(IgracPolicajac(killerid))
    {
        PlayerInfo[killerid][pTrazeniLevel] = 0;
        SetPlayerWantedLevel(killerid,0);
    }
    ////////////////////////////////////////////////////////////
    if(!IgracPolicajac(killerid) && IsPlayerConnected(playerid))
    {
        PostaviWanted(killerid, "Ubistvo", "Nepoznat");
    }
    ////////////////////////////////////////////////////////////
    if(GetPlayerWantedLevel(killerid) > 6)
    {
        SetPlayerWantedLevel(killerid, 6);
        PlayerInfo[killerid][pTrazeniLevel] = 6;
    }
    ////////////////////////////////////////////////////////////
    if(GetPlayerWantedLevel(playerid) > 0)
    {
        new string[256];
        g_NovacMinus(playerid, GetPlayerWantedLevel(playerid)*400);
        SCMF(playerid, -1, ""ZUTA"[INFO] "CRVENA"Izgubili ste %d$ zbog umiranja sa wanted level-om "ZUTA"%d!", GetPlayerWantedLevel(playerid)*400, GetPlayerWantedLevel(playerid));
        SetPlayerWantedLevel(playerid, 0); PlayerInfo[playerid][pTrazeniLevel] = 0;
        format(string,sizeof(string),""CRVENA"[UP:RP] "SIVA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
        AdminGameMaster(-1,string);
    }
    ////////////////////////////////////////////////////////////
    if(IsPlayerConnected(killerid) && GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
    {
        new string[256];
        format(string,sizeof(string), ""CRVENA"[UP:RP Anti DB] "SIVA"Igrac %s (ID:%d) je uradio Drive By nad igracem %s (ID:%d)!", GetName(killerid), killerid, GetName(playerid), playerid);
        AdminGameMaster(-1, string);
    }
    ////////////////////////////////////////////////////////////
    if(IsPlayerConnected(killerid) && PlayerInfo[playerid][pLevel] >= 1)
    {
        new string[256];
        format(string,sizeof(string), ""CRVENA"[UP:RP AK] "SIVA"Igrac %s (ID:%d) je ubio igraca %s (ID:%d)", GetName(killerid), killerid, GetName(playerid), playerid);
        AdminGameMaster(-1, string);
    }
    ////////////////////////////////////////////////////////////
    if(gPlayerUsingLoopingAnim[playerid])
    {
        gPlayerUsingLoopingAnim[playerid] = 0;
    }
    }
    return 1;
}
[/pawn]

Ubacio sam buraz idalje isti problem lkn odo .

Citat: Tosic ãƒ,, poslato Decembar 24, 2017, 23:00:31 POSLE PODNE
A sta mislis oce sada?
[pawn]
public OnPlayerDeath(playerid, killerid, reason)
{
    if(playerid != INVALID_PLAYER_ID) {

    PlayerInfo[killerid][pUbistava]++; PlayerInfo[playerid][pSmrti]++;
    ResetPlayerWeapons(playerid); ResetujVar(playerid);
    ////////////////////////////////////////////////////////////
    if(IgracPolicajac(killerid))
    {
        PlayerInfo[killerid][pTrazeniLevel] = 0;
        SetPlayerWantedLevel(killerid,0);
    }
    ////////////////////////////////////////////////////////////
    if(!IgracPolicajac(killerid) && IsPlayerConnected(playerid))
    {
        PostaviWanted(killerid, "Ubistvo", "Nepoznat");
    }
    ////////////////////////////////////////////////////////////
    if(GetPlayerWantedLevel(killerid) > 6)
    {
        SetPlayerWantedLevel(killerid, 6);
        PlayerInfo[killerid][pTrazeniLevel] = 6;
    }
    ////////////////////////////////////////////////////////////
    if(GetPlayerWantedLevel(playerid) > 0)
    {
        new string[256];
        g_NovacMinus(playerid, GetPlayerWantedLevel(playerid)*400);
        SCMF(playerid, -1, ""ZUTA"[INFO] "CRVENA"Izgubili ste %d$ zbog umiranja sa wanted level-om "ZUTA"%d!", GetPlayerWantedLevel(playerid)*400, GetPlayerWantedLevel(playerid));
        SetPlayerWantedLevel(playerid, 0); PlayerInfo[playerid][pTrazeniLevel] = 0;
        format(string,sizeof(string),""CRVENA"[UP:RP] "SIVA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
        AdminGameMaster(-1,string);
    }
    ////////////////////////////////////////////////////////////
    if(IsPlayerConnected(killerid) && GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
    {
        new string[256];
        format(string,sizeof(string), ""CRVENA"[UP:RP Anti DB] "SIVA"Igrac %s (ID:%d) je uradio Drive By nad igracem %s (ID:%d)!", GetName(killerid), killerid, GetName(playerid), playerid);
        AdminGameMaster(-1, string);
    }
    ////////////////////////////////////////////////////////////
    if(IsPlayerConnected(killerid) && PlayerInfo[playerid][pLevel] >= 1)
    {
        new string[256];
        format(string,sizeof(string), ""CRVENA"[UP:RP AK] "SIVA"Igrac %s (ID:%d) je ubio igraca %s (ID:%d)", GetName(killerid), killerid, GetName(playerid), playerid);
        AdminGameMaster(-1, string);
    }
    ////////////////////////////////////////////////////////////
    if(gPlayerUsingLoopingAnim[playerid])
    {
        gPlayerUsingLoopingAnim[playerid] = 0;
    }
    }
    return 1;
}
[/pawn]
Msm da treba killerid al nisam siguran

Verovatno mu je u odredjenom delu prob al i treba mu svakako provera za IPI..

Tosicu tosicu, rijesio sam problem ovako je trebalo ali kasno sam shvatio hvala svima na pomoci :)

public OnPlayerDeath(playerid, killerid, reason)
{
       if(killerid != INVALID_PLAYER_ID)
       {
          PlayerInfo[killerid][pUbistava]++; PlayerInfo[playerid][pSmrti]++;
         ResetujVar(playerid); ResetPlayerWeapons(playerid);
         if(IgracPolicajac(killerid))
         {
             PlayerInfo[killerid][pTrazeniLevel] = 0;
            SetPlayerWantedLevel(killerid,0);
          }
       }

  //----------------------------------------------------------------------------------------//
       if(killerid != INVALID_PLAYER_ID)
       {
         if(!IgracPolicajac(killerid) && IsPlayerConnected(playerid))
         {
            if(PlayerInfo[killerid][pZatvor] == 0)
            {
               PostaviWanted(killerid, "Ubistvo", "Nepoznat");
            }
         }
      }
    ////////////////////////////////////////////////////////////
       if(GetPlayerWantedLevel(killerid) > 6)
       {
           SetPlayerWantedLevel(killerid, 6);
           PlayerInfo[killerid][pTrazeniLevel] = 6;
       }
    ////////////////////////////////////////////////////////////
       if(GetPlayerWantedLevel(playerid) > 0)
       {
           new string[256];
           g_NovacMinus(playerid, GetPlayerWantedLevel(playerid)*400);
           SCMF(playerid, -1, ""ZUTA"[INFO] "CRVENA"Izgubili ste %d$ zbog umiranja sa wanted level-om "ZUTA"%d!", GetPlayerWantedLevel(playerid)*400, GetPlayerWantedLevel(playerid));
           SetPlayerWantedLevel(playerid, 0); PlayerInfo[playerid][pTrazeniLevel] = 0;
           format(string,sizeof(string),""CRVENA"[UP:RP] "SIVA"Igrac %s je ubijen/se ubio sa wanted level-om!",GetName(playerid));
           AdminGameMaster(-1,string);
       }
       ////////////////////////////////////////////////////////////
       if(IsPlayerConnected(killerid) && GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
       {
           new string[256];
           format(string,sizeof(string), ""CRVENA"[UP:RP Anti DB] "SIVA"Igrac %s (ID:%d) je uradio Drive By nad igracem %s (ID:%d)!", GetName(killerid), killerid, GetName(playerid), playerid);
           AdminGameMaster(-1, string);
       }
       ////////////////////////////////////////////////////////////
       if(IsPlayerConnected(killerid) && PlayerInfo[playerid][pLevel] >= 1)
       {
           new string[256];
           format(string,sizeof(string), ""CRVENA"[UP:RP AK] "SIVA"Igrac %s (ID:%d) je ubio igraca %s (ID:%d)", GetName(killerid), killerid, GetName(playerid), playerid);
           AdminGameMaster(-1, string);
       }
       ////////////////////////////////////////////////////////////
       if(gPlayerUsingLoopingAnim[playerid])
       {
           gPlayerUsingLoopingAnim[playerid] = 0;
       }
       return 1;
}



RijeÅ¡enje je naÄ'eno.
heroin rap - Moskri u kuci, od sledece lajne glava ce mi puci