SA-MP Forums Archive
Why this crashes server? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why this crashes server? (/showthread.php?tid=528027)



Why this crashes server? - alanhutch - 25.07.2014

HI!

This buying-car system crashes the server... How I can resolve this?

pawn Код:
if(dialogid == 9001)
    {
        new i = TempCarID[playerid];
        new string[256];
        if(response)
        {
            if(PlayerInfo[playerid][pCash] >= CarInfo[i][CarPrice]) // 400k
            {
                if(PlayerInfo[playerid][pCarKey1] == 0)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "Congratulazioni! Hai appena acquistato una {00C3FF}%s!{FFFFFF} Scegli i nuovi colori con le freccine!", vehName[PlayerInfo[playerid][PlayerVehicleModel2]-400]);
                    autopersonale[playerid] = AddStaticVehicleEx(CarInfo[i][CarModel], -1226.6300,-163.1487,15.3326,0,0,0,-1);
                    PutPlayerInVehicle(playerid, autopersonale[playerid], 0);
                    PlayerInfo[playerid][pCarKey1] = GetPlayerVehicleID(playerid);
                    AutoPerInfo[GetPlayerVehicleID(playerid)][apModello] = CarInfo[i][CarModel];
                    AutoPerInfo[GetPlayerVehicleID(playerid)][apSpawnX] = -1226.6300;
                    AutoPerInfo[GetPlayerVehicleID(playerid)][apSpawnY] = -163.1487;
                    AutoPerInfo[GetPlayerVehicleID(playerid)][apSpawnZ] = 15.3326;
                    AutoPerInfo[GetPlayerVehicleID(playerid)][apSpawnRZ] = 0;
                    AutoPerInfo[GetPlayerVehicleID(playerid)][apColore1] = 0;
                    AutoPerInfo[GetPlayerVehicleID(playerid)][apColore2] = 0;
                    AutoPerInfo[GetPlayerVehicleID(playerid)][apChiusa] = 0;
                    PutPlayerInVehicle(playerid, PlayerInfo[playerid][pCarKey1], 0);
                    SelectTextDraw(playerid, 0xC8C8C8C8);
                    TextDrawShowForPlayer(playerid, Coloriauto0);
                    TextDrawShowForPlayer(playerid, Coloriauto1);
                    TextDrawShowForPlayer(playerid, Coloriauto2);
                    TextDrawShowForPlayer(playerid, Coloriauto3);
                    TextDrawShowForPlayer(playerid, Coloriauto4);
                    TextDrawShowForPlayer(playerid, Coloriauto5);
                    TextDrawShowForPlayer(playerid, Coloriauto6);
                    TextDrawShowForPlayer(playerid, Coloriauto7);
     Colore1Scelto[playerid] = 0;
     auto1[playerid] = 1;

                    if(!Aereo(PlayerVehicleID1[playerid]))
                    {
                    SetPlayerPos(playerid,-1936.1733,272.5863,40.7512);
                    SetVehiclePos(GetPlayerVehicleID(playerid),-1936.1733,272.5863,40.7512);
                    PutPlayerInVehicle(playerid,GetPlayerVehicleID(playerid),0);
                    SetVehicleZAngle(GetPlayerVehicleID(playerid), 0);
                    SetPlayerCameraPos(playerid, -1928.8693,264.8525,47.5356);
                    SetPlayerCameraLookAt(playerid, -1935.8932,272.9854,41.0469);
                    }
                    else
                    {
                    SetPlayerPos(playerid, -1226.6300,-163.1487,15.3326);
                    SetVehiclePos(GetPlayerVehicleID(playerid), -1226.6300,-163.1487,15.3326);
                    PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid),0);
                    }
                    return 1;
                }//other things...
Thanks!


Re: Why this crashes server? - Blast3r - 25.07.2014

Get the crashdetector plugin to see which line causes the crash and reply with it here.


Re: Why this crashes server? - alanhutch - 25.07.2014

Ok, one minute...


Re: Why this crashes server? - alanhutch - 25.07.2014

Here's the crashdetect.
Код:
[25/07/2014 23:10:45] [debug] Run time error 4: "Array index out of bounds"
[25/07/2014 23:10:45] [debug]  Accessing element at negative index -1
[25/07/2014 23:10:45] [debug] AMX backtrace:
[25/07/2014 23:10:45] [debug] #0 0051d44c in public OnPlayerCommandText (0x00000002, 0x0111ab2c) from PLRPbene.amx
[25/07/2014 23:10:45] [debug] #1 000e7138 in public cuff_OnPlayerKeyStateChange (0x00000002, 0x00000010, 0x00000000) from PLRPbene.amx
[25/07/2014 23:10:45] [debug] #2 native CallLocalFunction () [00472ad0] from samp-server.exe
[25/07/2014 23:10:45] [debug] #3 00002dac in public OnPlayerKeyStateChange (0x00000002, 0x00000010, 0x00000000) from PLRPbene.amx
[25/07/2014 23:10:50] [debug] Server crashed while executing PLRPbene.amx
[25/07/2014 23:10:50] [debug] AMX backtrace:
[25/07/2014 23:10:50] [debug] #0 native SendClientMessage () [004703a0] from samp-server.exe
[25/07/2014 23:10:50] [debug] #1 00068c64 in public OnDialogResponse (0x00000002, 0x00002329, 0x00000001, 0xffffffff, 0x0125ed98) from PLRPbene.amx
[25/07/2014 23:10:50] [debug] Native backtrace:
[25/07/2014 23:10:50] [debug] #0 004989ec in ?? () from samp-server.exe
[25/07/2014 23:10:50] [debug] #1 0941f1ac in ?? ()
[25/07/2014 23:10:50] [debug] #2 77e6b2ba in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
[25/07/2014 23:10:50] [debug] #3 77e69a46 in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
[25/07/2014 23:10:50] [debug] #4 6f36474e in ?? () from C:\WINDOWS\SYSTEM32\MSVCP100.dll
[25/07/2014 23:10:50] [debug] #5 6f365168 in ?? () from C:\WINDOWS\SYSTEM32\MSVCP100.dll
[25/07/2014 23:10:50] [debug] #6 6f3665d6 in ?? () from C:\WINDOWS\SYSTEM32\MSVCP100.dll
[25/07/2014 23:10:50] [debug] #7 0049787a in ?? () from samp-server.exe
[25/07/2014 23:10:50] [debug] #8 0048a598 in ?? () from samp-server.exe
[25/07/2014 23:10:50] [debug] #9 00470445 in ?? () from samp-server.exe
[25/07/2014 23:10:50] [debug] #10 004010b6 in ?? () from samp-server.exe
[25/07/2014 23:10:50] [debug] #11 72eb49ca in ?? () from plugins\crashdetect.DLL
[25/07/2014 23:10:50] [debug] #12 72eb681f in ?? () from plugins\crashdetect.DLL
[25/07/2014 23:10:50] [debug] #13 72ea9b84 in ?? () from plugins\crashdetect.DLL
[25/07/2014 23:10:50] [debug] #14 72eb4a1a in ?? () from plugins\crashdetect.DLL
[25/07/2014 23:10:50] [debug] #15 0046de11 in ?? () from samp-server.exe
[25/07/2014 23:10:50] [debug] #16 00452970 in ?? () from samp-server.exe
[25/07/2014 23:10:50] [debug] #17 72eb4a1a in ?? () from plugins\crashdetect.DLL
[25/07/2014 23:10:50] [debug] #18 0046db90 in ?? () from samp-server.exe
[25/07/2014 23:10:50] [debug] #19 00499cd9 in ?? () from samp-server.exe
[25/07/2014 23:10:50] [debug] #20 0045b39a in ?? () from samp-server.exe
[25/07/2014 23:10:50] [debug] #21 77ead12e in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll



Re: Why this crashes server? - alanhutch - 25.07.2014

Help, this is very urgent


Respuesta: Why this crashes server? - angelxeneize - 25.07.2014

try change AddStaticVehicleEx for CreateVehicle


Re: Why this crashes server? - alanhutch - 25.07.2014

Crashes anyway


Re: Why this crashes server? - Virtual1ty - 25.07.2014

Obviously "i" variable has gotten a negative index of "-1", that's what the crashdetect tells ya, and thats why the server crashes.
If that's not the var in question that one surely is!


Re: Why this crashes server? - alanhutch - 26.07.2014

Quote:
Originally Posted by Virtual1ty
Посмотреть сообщение
Obviously "i" variable has gotten a negative index of "-1", that's what the crashdetect tells ya, and thats why the server crashes.
If that's not the var in question that one surely is!
At the respawn delay??


Re: Why this crashes server? - alanhutch - 26.07.2014

Can you post the correct code please? (I'm italian, I'm not so good in english xD)