PDA

Просмотр полной версии : [Вопрос] Краш мода



Gressie
05.05.2014, 20:29
Крашит мод, MzCheck...CrashDetect выводит ошибки указывающие на:

for(new i =0;i<3;i++)
{
for(new z = 0;z<20;z++){OnmZONE[i][z] =0;}
}
В чём проблема?

L0ndl3m
05.05.2014, 20:34
for(new i = 0; i < sizeof(OnmZONE); i++)
{
for(new z = 0; z < sizeof(OnmZONE[]); z++)
OnmZONE[i][z] = 1;
}

DeimoS
05.05.2014, 20:35
Что именно crashdetect пишет? Да и не проще ли сделать так:

for(new z = 0;z<20;z++)
{
OnmZONE[0][z] =0;
OnmZONE[1][z] =0;
OnmZONE[2][z] =0;
}
?

Gressie
05.05.2014, 20:53
Не только на MzCheck но и SetPlayerUnjail вот сам лог:

[19:52:21] [debug] #0 00126aac in public SetPlayerUnjail () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:21257
[19:52:23] [debug] Run time error 4: "Array index out of bounds"
[19:52:23] [debug] Accessing element at index 1 past array upper bound 0
[19:52:23] [debug] AMX backtrace:
[19:52:23] [debug] #0 00126aac in public SetPlayerUnjail () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:21257
[19:52:24] [debug] Run time error 4: "Array index out of bounds"
[19:52:24] [debug] Accessing element at index 1 past array upper bound 0
[19:52:24] [debug] AMX backtrace:
[19:52:24] [debug] #0 00126aac in public SetPlayerUnjail () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:21257
[19:52:25] [debug] Run time error 4: "Array index out of bounds"
[19:52:25] [debug] Accessing element at index 1 past array upper bound 0
[19:52:25] [debug] AMX backtrace:
[19:52:25] [debug] #0 00126aac in public SetPlayerUnjail () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:21257
[19:52:26] [debug] Run time error 4: "Array index out of bounds"
[19:52:26] [debug] Accessing element at index 1 past array upper bound 0
[19:52:26] [debug] AMX backtrace:
[19:52:26] [debug] #0 00126aac in public SetPlayerUnjail () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:21257
[19:52:27] [debug] Run time error 4: "Array index out of bounds"
[19:52:27] [debug] Accessing element at index 1 past array upper bound 0
[19:52:27] [debug] AMX backtrace:
[19:52:27] [debug] #0 00126aac in public SetPlayerUnjail () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:21257
[19:52:28] [debug] Run time error 4: "Array index out of bounds"
[19:52:28] [debug] Accessing element at index 1 past array upper bound 0
[19:52:28] [debug] AMX backtrace:
[19:52:28] [debug] #0 00126aac in public SetPlayerUnjail () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:21257
[19:52:29] [debug] Run time error 4: "Array index out of bounds"
[19:52:29] [debug] Accessing element at index 1 past array upper bound 0
[19:52:29] [debug] AMX backtrace:
[19:52:29] [debug] #0 00126aac in public SetPlayerUnjail () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:21257

Строка:
if(MZSafeTime[f]>0)

L0ndl3m
05.05.2014, 20:58
Покажите инициализацию цикла.

Gressie
05.05.2014, 21:05
Покажите инициализацию цикла.

for(new f =0;f<3;f++)
{
if(MZSafeTime[f]>0)
{
MZSafeTime[f] --;
if(MZSafeTime[f] == 200 || MZSafeTime[f] == 450)
{
format(string,sizeof(string),"::: У вас осталось %d секунд. Место встречи: Заброшенный аэропорт:::",MZSafeTime[f]);
SendFamilyMessage(MZInfo[f][mNapad],COLOR_RED,string);
for(new h = 0; h < sizeof(BizzInfo); h++)
{
if(BizzInfo[h][bZahvat] == 1){SendFamilyMessage(BizzInfo[h][bMafia],COLOR_RED,string);}
}
}
}
}

DeimoS
05.05.2014, 21:06
for(new f =0;f<3;f++)
на

for(new f; f < sizeof(MZSafeTime); f++)
?

Gressie
05.05.2014, 21:13
for(new f =0;f<3;f++)
на

for(new f; f < sizeof(MZSafeTime); f++)
?

Спасибо, помогло.

Теперь:

[20:13:00] [debug] Run time error 4: "Array index out of bounds"
[20:13:00] [debug] Accessing element at index 1 past array upper bound 0
[20:13:00] [debug] AMX backtrace:
[20:13:00] [debug] #0 00039f68 in public MzCheck () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:2868
[20:13:11] [debug] Run time error 4: "Array index out of bounds"
[20:13:11] [debug] Accessing element at index 1 past array upper bound 0
[20:13:11] [debug] AMX backtrace:
[20:13:11] [debug] #0 00039f68 in public MzCheck () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:2868
[20:13:22] [debug] Run time error 4: "Array index out of bounds"
[20:13:22] [debug] Accessing element at index 1 past array upper bound 0
[20:13:22] [debug] AMX backtrace:
[20:13:22] [debug] #0 00039f68 in public MzCheck () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:2868
[20:13:33] [debug] Run time error 4: "Array index out of bounds"
[20:13:33] [debug] Accessing element at index 1 past array upper bound 0
[20:13:33] [debug] AMX backtrace:
[20:13:33] [debug] #0 00039f68 in public MzCheck () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:2868
[20:13:44] [debug] Run time error 4: "Array index out of bounds"
[20:13:44] [debug] Accessing element at index 1 past array upper bound 0
[20:13:44] [debug] AMX backtrace:
[20:13:44] [debug] #0 00039f68 in public MzCheck () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:2868
[20:13:55] [debug] Run time error 4: "Array index out of bounds"
[20:13:55] [debug] Accessing element at index 1 past array upper bound 0
[20:13:55] [debug] AMX backtrace:
[20:13:55] [debug] #0 00039f68 in public MzCheck () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:2868

Строка:

for(new z = 0;z<20;z++){OnmZONE[i][z] =0;}
Полный код:

for(new i =0;i<3;i++)
{
for(new z = 0;z<20;z++){OnmZONE[i][z] =0;}
}

DeimoS
05.05.2014, 21:16
Опять же, показывайте цикл

Gressie
05.05.2014, 21:16
Показал, обновил.

DeimoS
05.05.2014, 21:18
Спасибо, помогло.

Теперь:

[20:13:00] [debug] Run time error 4: "Array index out of bounds"
[20:13:00] [debug] Accessing element at index 1 past array upper bound 0
[20:13:00] [debug] AMX backtrace:
[20:13:00] [debug] #0 00039f68 in public MzCheck () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:2868
[20:13:11] [debug] Run time error 4: "Array index out of bounds"
[20:13:11] [debug] Accessing element at index 1 past array upper bound 0
[20:13:11] [debug] AMX backtrace:
[20:13:11] [debug] #0 00039f68 in public MzCheck () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:2868
[20:13:22] [debug] Run time error 4: "Array index out of bounds"
[20:13:22] [debug] Accessing element at index 1 past array upper bound 0
[20:13:22] [debug] AMX backtrace:
[20:13:22] [debug] #0 00039f68 in public MzCheck () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:2868
[20:13:33] [debug] Run time error 4: "Array index out of bounds"
[20:13:33] [debug] Accessing element at index 1 past array upper bound 0
[20:13:33] [debug] AMX backtrace:
[20:13:33] [debug] #0 00039f68 in public MzCheck () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:2868
[20:13:44] [debug] Run time error 4: "Array index out of bounds"
[20:13:44] [debug] Accessing element at index 1 past array upper bound 0
[20:13:44] [debug] AMX backtrace:
[20:13:44] [debug] #0 00039f68 in public MzCheck () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:2868
[20:13:55] [debug] Run time error 4: "Array index out of bounds"
[20:13:55] [debug] Accessing element at index 1 past array upper bound 0
[20:13:55] [debug] AMX backtrace:
[20:13:55] [debug] #0 00039f68 in public MzCheck () at C:\Users\Admin\Downloads\Sunshine Role Play(YourGame.su)\Sunshine Role Play(YourGame.su)\gamemodes\Sunshine(YourGame).pwn:2868

Строка:

for(new z = 0;z<20;z++){OnmZONE[i][z] =0;}
Полный код:

for(new i =0;i<3;i++)
{
for(new z = 0;z<20;z++){OnmZONE[i][z] =0;}
}

Вот же



for(new i = 0; i < sizeof(OnmZONE); i++)
{
for(new z = 0; z < sizeof(OnmZONE[]); z++)
OnmZONE[i][z] = 1;
}

Gressie
05.05.2014, 21:21
Вот же
Ещё вопрос, ты знаком с инклудом y_timers?

DeimoS
05.05.2014, 21:26
Ещё вопрос, ты знаком с инклудом y_timers?

Ну виделись пару раз. А что?

Gressie
05.05.2014, 21:45
Ну виделись пару раз. А что?
Как будет без y_timers это?

stop STimer[playerid];
stop SpecHATimer[playerid];
SpecHATimer[playerid] = repeat ReAdmin(playerid,params[0]);

DeimoS
06.05.2014, 06:00
http://forum.sa-mp.com/showthread.php?t=182948

KillTimer(STimer[playerid]);
KillTimer(SpecHATimer[playerid]);
Ну а repeat - что-то вроде зацикленного таймера. Только не сам таймер, а объявление о том, что его нужно вызывать постоянно. Само объявление будет выглядеть как-то так:

timer ReAdmin[/*Время вызова*/](playerid,blabla)
{
//Код, вызываемый таймером
}
То бишь, timer надо перевести в обычный forward + public, а уже таймер будет выглядеть так:

SpecHATimer[playerid] = SetTimerEx("ReAdmin", /*Время вызова*/, true, "ii", playerid, params[0]);//Только не уверен, что в params передаётся число, так что исправите, если что

Gressie
06.05.2014, 15:23
Спасибо, всем. :)