[POMOC] OnPlayerUpdate 1 problem.

Započeo FarkiAs, Avgust 21, 2013, 21:58:48 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

FarkiAs

Skripta: moja od nule
Opis problema: ovo mi je crash detector izbacio u server.log-u [20:06:17] [debug] Run time error 4: "Array index out of bounds"
[20:06:17] [debug]  Accessing element at negative index -400
[20:06:17] [debug] AMX backtrace:
[20:06:17] [debug] #0 001b0cec in public FIXES_OnPlayerUpdate () from SSRP.amx
[20:06:17] [debug] #1 0001a89c in ?? () from SSRP.amx
[20:06:17] [debug] #2 00009b70 in public OnPlayerUpdate () from SSRP.amx

Dio skripte: evo vam onplayerupdate

///////////////////////////////////////////////////////////////////////////
public OnPlayerUpdate(playerid)
{
/////////////////////////////////////////////////////////////////////////////////////
if(GetSpeed(playerid) > 290)
{
if(!VoziloJeAvion(GetPlayerVehicleID(playerid)))
{
    new string[128];
    SCM(playerid,-1,"[AC] "CRVENA"Admini su obavesteni o koristenju speed hacka!"); TogglePlayerControllable(playerid, false);
format(string, sizeof(string), "[AC] "ZELENA"Igrac %s je moguce da koristi speed hack!",GetName(playerid));
AdminGameMaster(-1, string);
return 1;
}
}
////////////////////////////////////////////////////////////////////////////////////
new Float:Health; GetPlayerHealth(playerid, Health);
if(Health > HeltiIgraca[playerid])
{
SetPlayerHealth(playerid, HeltiIgraca[playerid]);
return 1;
}
////////////////////////////////////////////////////////////////////////////////////
new Float:Armour; GetPlayerArmour(playerid, Armour);
if(Armour > 99.0)
{
SCM(playerid,-1,"[AC] "CRVENA"Kikovani ste zbog armour hacka!");
Kick(playerid);
return 1;
}
////////////////////////////////////////////////////////////////////////////////////
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK && PlayerInfo[playerid][pAdmin] < 5)
{
SCM(playerid,-1,"[AC] "CRVENA"Kikovani ste zbog jetpack hacka!");
Kick(playerid);
return 1;
}
////////////////////////////////////////////////////////////////////////////////////
//CheckWeapons(playerid);
    ///////////////////////////////////////////////////////////////////////////////////
if(KupovinaAuta[playerid] == true)
{
new string[128];
    new Keys, ud, lr;
    GetPlayerKeys(playerid, Keys, ud, lr);
if(lr > 0)
{
AutoModel++;
if(AutoModel > PRODAJA_AUTA-1) { AutoModel = 0; }
DestroyVehicle(IzlozbenoAuto);
IzlozbenoAuto = CreateVehicle(AutoSalon[AutoModel][0], AIZLOZBENO_X,AIZLOZBENO_Y,AIZLOZBENO_Z,AIZLOZBENO_A, 1, 1, 30000);
format(string,sizeof(string),"%s",ImenaVozila[GetVehicleModel(IzlozbenoAuto) - 400]);
PlayerTextDrawSetString(playerid,TDProdajaVozila[2][playerid],string);
format(string,sizeof(string),"Cijena: ~g~%d$",AutoSalon[AutoModel][1]);
PlayerTextDrawSetString(playerid,TDProdajaVozila[3][playerid],string);
}
else if(lr < 0)
{
AutoModel--;
if(AutoModel < 0) { AutoModel = PRODAJA_AUTA-1; }
DestroyVehicle(IzlozbenoAuto);
IzlozbenoAuto = CreateVehicle(AutoSalon[AutoModel][0], AIZLOZBENO_X,AIZLOZBENO_Y,AIZLOZBENO_Z,AIZLOZBENO_A, 1, 1, 30000);
format(string,sizeof(string),"%s",ImenaVozila[GetVehicleModel(IzlozbenoAuto) - 400]);
PlayerTextDrawSetString(playerid,TDProdajaVozila[2][playerid],string);
format(string,sizeof(string),"Cijena: ~g~%d$",AutoSalon[AutoModel][1]);
PlayerTextDrawSetString(playerid,TDProdajaVozila[3][playerid],string);
}
else if(Keys & KEY_SECONDARY_ATTACK)
{
if(PlayerInfo[playerid][pPosedovanjeAuta] != -1) return SCM(playerid,-1,"[AC] "CRVENA"Vec posedujes auto!");
if(PlayerInfo[playerid][pNovacDzep] < AutoSalon[AutoModel][1]) return SCM(playerid,-1,"[AC] "CRVENA"Nemate dovoljno novca!");
for(new i = 0; i < sizeof(VoziloInfo); i++)
{
    new Fajl[64];
    format(Fajl, sizeof(Fajl), AUTO_FILE, i);
        if(!fexist(Fajl))
        {
    new poz = random(sizeof(RandomAutoSpawn));
    g_NovacMinus(playerid,AutoSalon[AutoModel][1]);
    PlayerInfo[playerid][pPosedovanjeAuta] = i;
VoziloInfo[i][vModel] = AutoSalon[AutoModel][0];
VoziloInfo[i][vPozX] = RandomAutoSpawn[poz][0];
VoziloInfo[i][vPozY] = RandomAutoSpawn[poz][1];
VoziloInfo[i][vPozZ] = RandomAutoSpawn[poz][2];
VoziloInfo[i][vPozA] = RandomAutoSpawn[poz][3];
VoziloInfo[i][vBoja1] = 0;
VoziloInfo[i][vBoja2] = 0;
VoziloInfo[i][vImaVlasnika] = 1;
VoziloInfo[i][vZakljucan] = 1;
VoziloInfo[i][vDroga] = 0;
VoziloInfo[i][vMats] = 0;
VoziloInfo[i][vOruzije] = -1;
VoziloInfo[i][vMunicija] = 0;
VoziloInfo[i][vRadio] = 0;
strmid(VoziloInfo[i][vVlasnik], GetName(playerid), 0, strlen(GetName(playerid)), 999);
TogglePlayerControllable(playerid, 1);
VoziloInfo[i][vID] = CreateVehicle(AutoSalon[AutoModel][0], VoziloInfo[i][vPozX],VoziloInfo[i][vPozY],VoziloInfo[i][vPozZ],VoziloInfo[i][vPozA], VoziloInfo[i][vBoja1], VoziloInfo[i][vBoja2], 30000);
          KupovinaAuta[playerid] = false; autokatalog = 0;
          UkloniVozilaTD(playerid); SetCameraBehindPlayer(playerid);
          SacuvajVozilo(i); SavePlayer(playerid); StatusMotora(playerid, 1);
          SetPlayerCheckpoint(playerid, VoziloInfo[i][vPozX],VoziloInfo[i][vPozY],VoziloInfo[i][vPozZ], 5.0);
          PosaoGPS[playerid] = 1; Fuel[GetPlayerVehicleID(playerid)] = 45;
          SCM(playerid,-1,"AC | "ZUTA"Uspjesno ste kupili auto!");
          SCM(playerid,-1,"AC | "ZUTA"Autom mozete upravljati komandom /v!");
          SCM(playerid,-1,"AC | "ZUTA"Lokacija vaseg auta je oznacena crveno na mapi!");
          SCM(playerid,-1,"AC | "ZUTA"Ako ne parkirate svoje vozilo negdje drugo, u roku 24h ce vam biti prodato!");
break;
}
}
}
    else if (Keys &  KEY_JUMP)
    {
    TogglePlayerControllable(playerid, 1);
    SCM(playerid, -1, "[AC] "CRVENA"Odustali ste od kupovine auta!");
    KupovinaAuta[playerid] = false; autokatalog = 0;
UkloniVozilaTD(playerid);
SetCameraBehindPlayer(playerid);
    }
}
///////////////////////////////////////////////////////////////////////////////////
if(RadioAktiviran[playerid] == 1 && !IsPlayerInAnyVehicle(playerid)) return RadioAktiviran[playerid] = 0, StopAudioStreamForPlayer(playerid);
///////////////////////////////////////////////////////////////////////////////////
if(UsaoAutoProdaja[playerid] != -1 && !IsPlayerInAnyVehicle(playerid)) return UsaoAutoProdaja[playerid] = -1;
    ///////////////////////////////////////////////////////////////////////////////////
if(UsaoMotorProdaja[playerid] != -1 && !IsPlayerInAnyVehicle(playerid)) return UsaoMotorProdaja[playerid] = -1;
////////////////////////////////////////////////////////////////////////////////////
if(UsaoAvionProdaja[playerid] != -1 && !IsPlayerInAnyVehicle(playerid)) return UsaoAvionProdaja[playerid] = -1;
////////////////////////////////////////////////////////////////////////////////////
if(UsaoPloviloProdaja[playerid] != -1 && !IsPlayerInAnyVehicle(playerid)) return UsaoPloviloProdaja[playerid] = -1;
///////////////////////////////////////////////////////////////////////////////////
if(Poligon[playerid] >= 1)
{
if(IsPlayerInAnyVehicle(playerid))
      {
          if(GetSpeed(playerid) > 100)
          {
              Poligon[playerid] = 0;
    DisablePlayerCheckpoint(playerid);
RemovePlayerFromVehicle(playerid);
SCM(playerid,-1, "[AS]: "CRVENA"Pali ste na vozackom ispitu jer ste prekoracili briznu od 100kmh na gradskoj voznji!");
    SetVehicleToRespawn(GetPlayerVehicleID(playerid));
}
}
}
///////////////////////////////////////////////////////////////////////////////////
if(IsPlayerInAnyVehicle(playerid))
    {
        if(!VoziloJeBicikla(GetVehicleModel(GetPlayerVehicleID(playerid))))
        {
    new sspeed[50];
new string[120];
new vozilo = GetPlayerVehicleID(playerid);
    format(sspeed, sizeof(sspeed), "%d", GetSpeed(playerid));
    PlayerTextDrawSetString(playerid, BRZINOMJER[2][playerid], sspeed);
    new Float: Pos[4];
    GetVehicleVelocity(GetPlayerVehicleID(playerid), Pos[0], Pos[1], Pos[2]);
    new keys, ud, lr;
    GetPlayerKeys(playerid, keys, ud, lr);
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
                format(string,sizeof(string),"%s", ImenaVozila[GetVehicleModel(vozilo)-400]);
                PlayerTextDrawSetString(playerid, BRZINOMJER[7][playerid], string);
    }
    }
    }
    ///////////////////////////////////////////////////////////////////////////////////
return 1;
}
Poslednja Izmena: Avgust 21, 2013, 21:59:03 POSLE PODNE od punisheR 7474

FarkiAs