Jump to content
  • 0

Eroare warr/turf/ore buguite


SakaLuX

Question

Problema intalnita (descriere): Primesc erori de genul cand playerii se omoara intre ei si cred ca au legatura cu war-urile sau turfs
Ero(area / rile) / warning-(ul / urile):

Spoiler

[14:35:08] [debug] Run time error 4: "Array index out of bounds"
[14:35:08] [debug]  Accessing element at index 73 past array upper bound 72
[14:35:08] [debug] AMX backtrace:
[14:35:08] [debug] #0 0007b7c0 in public IsPlayerInTurf (playerid=1, turfid=73) at C:\Users\SakaLuX\Downloads\samp\pawno\WhiteCs.pwn:8574
[14:35:08] [debug] #1 000a1994 in public AB_OnPlayerDeath (playerid=1, killerid=65535, reason=255) at C:\Users\SakaLuX\Downloads\samp\pawno\WhiteCs.pwn:11653
[14:35:08] [debug] #2 00024de4 in public fk_OnPlayerDeath (playerid=1, killerid=65535, reason=255) at C:\Users\SakaLuX\Downloads\pawno\include\OPA.inc:71
[14:35:08] [debug] #3 0001d7e0 in public OnPlayerDeath (playerid=1, killerid=65535, reason=255) at C:\Users\SakaLuX\Downloads\samp\pawno\include\OnPlayerFakeKill.inc:47


Liniile de cod / sursa / script-ul(obligatoriu):

Asta e 8574         if(x >= TurfInfo[turfid][zMinX] && x < TurfInfo[turfid][zMaxX] && y >= TurfInfo[turfid][zMinY] && y < TurfInfo[turfid][zMaxY])

Spoiler

public IsPlayerInTurf(playerid, turfid)
{
    if(IsPlayerConnected(playerid))
    {
        if(turfid == -1)
        {
            return 0;
        }
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid,x,y,z);
        if(x >= TurfInfo[turfid][zMinX] && x < TurfInfo[turfid][zMaxX] && y >= TurfInfo[turfid][zMinY] && y < TurfInfo[turfid][zMaxY])
        {
             return 1;
        }
    }
    return 0;
}

11653         if(IsPlayerInTurf(playerid, i) == 1)

Spoiler

public OnPlayerDeath(playerid, killerid, reason)
{  
    Alive[playerid] = 0;
    CheckDelay[playerid] = 10;
    TextDrawHideForPlayer(playerid, Status[playerid]);
    new vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleVariables[vehicleid][vVehicleJob] == 7)
    {
        format(szMessage, sizeof(szMessage), "Job failed.");
        SCM(playerid, COLOR_NOB, szMessage);
        SetVehicleToRespawnEx(vehicleid);
        KillTimer(mowertimer[playerid]);
        MowerMoney[playerid] = 0;
        TextDrawHideForPlayer(playerid,Mower[playerid]);
        playerVariables[playerid][pFarmerMoney] = 0;

    }
    if(PlayerPaintballing[playerid] != 0)
    {
            foreach(Player, x)
            {
                if((PlayerPaintballing[playerid] != 0 && PlayerPaintballing[killerid] != 0) && PlayerPaintballing[x])
                {
                    SendDeathMessageToPlayer(x, killerid, playerid, reason);
                }
            }
            new string[500];

            
            new pinfo[128];
            KillP[killerid]++;
            DeathP[playerid]++;

            format(string, sizeof(string), "You have killed %s. You now have %d kills.",GetName(playerid), KillP[killerid]);
            SendClientMessage(killerid, COLOR_GENANNOUNCE, string);
            
            format(string, sizeof(string), "You have been killed by %s.",GetName(killerid));
            SendClientMessage(playerid, COLOR_GENANNOUNCE, string);

            PlayerPaintballScore[killerid] = KillP[killerid];
            if(PlayerPaintballScore[killerid] > PaintballWinnerScore)
            {
                PaintballWinner = killerid;
                PaintballWinnerScore = PlayerPaintballScore[killerid];
                foreach(Player,i)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(PlayerPaintballing != 0)
                        {
                            format(pinfo,sizeof(pinfo),"%s is now in lead with %d kills.",GetName(PaintballWinner),PaintballWinnerScore);
                            SCM(i, COLOR_YELLOW, pinfo);
                           }
                    }
                   }
            }
            return 1;
    }
    KillTimer(mowertimer[playerid]);
    if(playerVariables[playerid][pHeadValue] > 0)
    {
        if(IsPlayerConnected(killerid))
        {
            if(playerVariables[killerid][pGroup] == 12)
            {
                if(GoChase[killerid] == playerid)
                {
                    new string[256];
                    new killer[MAX_PLAYER_NAME];
                    new name[MAX_PLAYER_NAME];
                    GetPlayerName(killerid, killer, sizeof(killer));
                    GetPlayerName(playerid, name, sizeof(name));
                    playerVariables[killerid][pMoney] += playerVariables[playerid][pHeadValue];
                    format(string,128,"%s has succesfully completed the contract on %s for $%d, distance: %.0fm.",killer,name,playerVariables[playerid][pHeadValue], GetDistanceBetweenPlayers(killerid, playerid));
                    SendToGroup(12, COLOR_HIT, string);
                    playerVariables[playerid][pHeadValue] = -1;
                    GotHit[playerid] = 0;
                    GetChased[playerid] = 999;
                    GoChase[killerid] = 999;
                }
            }
        }
     }
    new turfkiller, turfplayerid;
    for(new i = 0; i <= sizeof(TurfInfo); i++)
    {
        if(IsPlayerInTurf(playerid, i) == 1)
        {
            turfplayerid = i;
            break;
        }
    }
    for(new i = 0; i <= sizeof(TurfInfo); i++)
    {
        if(IsPlayerInTurf(killerid, i) == 1)
        {
            turfkiller = i;
            break;
        }
    }
    new string[256];
    if(WarInfo[turfplayerid][wTime] > 0 && WarInfo[turfkiller][wTime] > 0)
        {
            if(turfplayerid == turfkiller)
            {
                if(playerVariables[playerid][pGroup] == WarInfo[turfplayerid][wAttacker] && playerVariables[killerid][pGroup] == WarInfo[turfplayerid][wFaction])
                {
                    playerVariables[playerid][pWarDeaths] += 1;
                    format(string, sizeof(string), "You have been killed by %s (%i)", playerVariables[killerid][pNormalName], killerid);
                    SCM(playerid, COLOR_GENANNOUNCE, string);

                    groupVariables[WarInfo[turfkiller][wFaction]][gScore] += 1;
                    playerVariables[killerid][pWarScore] += 1;
                    format(string, sizeof(string), "You have killed %s (%i).", playerVariables[playerid][pNormalName], playerid);
                    SCM(killerid, COLOR_GENANNOUNCE, string);

                    foreach(Player, x)
                    {
                        if(playerVariables[x][pGroup] == WarInfo[turfplayerid][wAttacker] || playerVariables[x][pGroup] == WarInfo[turfplayerid][wFaction])
                        {
                            SendDeathMessageToPlayer(x, killerid, playerid, reason);
                        }
                    }
                    SCM(playerid, COLOR_LIGHTBLUE, "You will be spawned in the HQ.");
                }
                else if(playerVariables[killerid][pGroup] == WarInfo[turfkiller][wAttacker] && playerVariables[playerid][pGroup] == WarInfo[turfkiller][wFaction])
                {
                    playerVariables[playerid][pWarDeaths] += 1;
                    format(string, sizeof(string), "You have been killed by %s (%i).", playerVariables[killerid][pNormalName], killerid);
                    SCM(playerid, COLOR_GENANNOUNCE, string);

                    groupVariables[WarInfo[turfplayerid][wAttacker]][gScore] += 1;
                    playerVariables[killerid][pWarScore] += 1;
                    format(string, sizeof(string), "You have killed %s (%i).", playerVariables[playerid][pNormalName], playerid);
                    SCM(killerid, COLOR_GENANNOUNCE, string);

                    foreach(Player, x)
                    {
                        if(playerVariables[x][pGroup] == WarInfo[turfplayerid][wAttacker] || playerVariables[x][pGroup] == WarInfo[turfplayerid][wFaction])
                        {
                            SendDeathMessageToPlayer(x, killerid, playerid, reason);
                        }
                    }
                    SCM(playerid, COLOR_LIGHTBLUE, "You will be spawned in group HQ.");
                }
            }
        }
     if((WarInfo[turfkiller][wTime] != 0 && (WarInfo[turfkiller][wAttacker] == playerVariables[playerid][pGroup] || WarInfo[turfkiller][wFaction] == playerVariables[playerid][pGroup]) && playerVariables[playerid][pGroup] != 0) || (playerVariables[killerid][pGroup] == 1 
     || playerVariables[killerid][pGroup] == 2 || playerVariables[killerid][pGroup] == 3 || playerVariables[killerid][pGroup] == 5) || (playerVariables[playerid][pGroup] == 1 || playerVariables[playerid][pGroup] == 2 || playerVariables[playerid][pGroup] == 3 || playerVariables[playerid][pGroup] == 5) || (playerVariables[playerid][pGroup] == playerVariables[killerid][pGroup]) || (PlayerPaintballing[killerid] >= 1))
    {
            
    }
    else
    {
        WantedID[playerid] = killerid;
        SCM(playerid, COLOR_GENANNOUNCE, "You have been attacked by another player. You have 60 seconds to call the police to report this crime. Use /call 112.");
        WantedIDTime[playerid] = 60;
    }
    //SetTimerEx("Spawn", 3999, 0, "d", playerid);
    SetPlayerHealth(playerid, 0);
    killerid = INVALID_PLAYER_ID;
    return 1;
}

71      return 1;

Spoiler

public OnPlayerDeath(playerid, killerid, reason)
{
    g_abLastTick[playerid] = gettime() + 3;

    #if defined AB_OnPlayerDeath
        AB_OnPlayerDeath(playerid, killerid, reason);
    #endif
    return 1;
}

47         return true;

Spoiler

public OnPlayerDeath(playerid, killerid, reason)
{
    if(!IsPlayerNPC(playerid))
    {
        if(gettime() - StartDeathTick[playerid] < 5) //5 seconds
        {
            CountDeaths[playerid] ++;
            if(CountDeaths[playerid] == 10) 
            {
                CallLocalFunction("OnPlayerFakeKill", "i", playerid);
                return CountDeaths[playerid] = 0;  
            }
        }
        else CountDeaths[playerid] = 1;
        StartDeathTick[playerid] = gettime();
    }
        #if defined fk_OnPlayerDeath
                fk_OnPlayerDeath(playerid, killerid, reason);
        #endif
        return true;
}

M-ai am un bug in care un player intra pe sv joaca 2 minute si in /stats ii apare +100 de ore....  /getmats nu functioneaza... si uneori si /stats nu merge... trebuie sa scrie /quitjob ca sa mearga dinou... Astea le vom rezolva dupa ce terminam cu cele date mai sus!


Imagini / Video (optional):
Ati incercat sa rezolvati singur?: Am incercat sa pun la eroarea 47 In loc de return true sa pun return 1 dar degeaba... si am mai facut schimbari dar tot nu am ajuns la rezolvare... ceea ce vedeti mai sus nu am schimbat nimic ca sa nu fie vreo problema

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Din pacate de el este vorba momentan am reusit sa refac multe buguri in el.... chiar imi place foarte mult acest gamemode dar nu stiu exact cum sa fixez variabilele si sa repar baza de date.... Daca esti amabil sa ma ajuti ar fi foarte frumos din partea ta! Daca nu o poti face macar da`mi 1 2 exemple si incerc singurel!

Link to comment
Share on other sites

  • 0
19 minutes ago, SakaLuX said:

Din pacate de el este vorba momentan am reusit sa refac multe buguri in el.... chiar imi place foarte mult acest gamemode dar nu stiu exact cum sa fixez variabilele si sa repar baza de date.... Daca esti amabil sa ma ajuti ar fi foarte frumos din partea ta! Daca nu o poti face macar da`mi 1 2 exemple si incerc singurel!

Din cate stiu eu la acel gm nu stiu daca a reusit 1 sa il repare in totalitae  problemele lui sunt ore skin joburi insurance job dealer de droguri da 1kkk chiar si mai mult daca scrii ex: /getdrugs 1000000000 iti va da 1kkk bani sau chiar mai mult  functioneaza doar cateva joburi bine are o comanda ascunsa din cate stiu case bizuri joburi au bani in ele 2kkk 1kkk etc nu merge /find nu merge uneori /stats nu merge /check la insurance tot la fel iti da bani daca bagi multe insurance 1kkk masinile de la factiuni unori se respawn/deaza aiurea pe mapa nu buguite comenzi freeze unfreeze range 

Ce trebuie sa faci este sa iei fiecare variabila in parte si sa creezi o noua baza de date si sa repari comenzile, cred ca mai are si alte buguri dar nu mai imi aduc eu aminte 

  • Upvote 1

text.gif

SKIPE : EDUARD.SENNOW

Link to comment
Share on other sites

  • 0

Am reparat mai tot  ce mi-a ramas: orele /stats si /check merg dupa ce scrii /quitjob dar acolo o sa ma mai chinui eu pana il rezolv.... getdrugs l-am rezolvat si asta care am postat`o acum... Care ma ajuta Multumesc anticipat!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.