SA-MP Forums Archive
Server crash after using command. - 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: Server crash after using command. (/showthread.php?tid=614198)



Server crash after using command. - jimdo - 05.08.2016

My server were crashing and auto turned-off. I don't know what is the reason.
This is the command that I used.

pawn Код:
COMMAND:whupgrade(playerid)
{
    if(PlayerInfo[playerid][ranklvl] > 0) return SendClientError(playerid, CANT_USE_CMD);
    new wh = IsAtOwnWareHouse(playerid);
    WareHouseLoop(t)
    {
        if(IsPlayerInSphere(playerid, WareHouse[t][WareHouse_x], WareHouse[t][WareHouse_y], WareHouse[t][WareHouse_z], 5))
        {
            if(wh < 1) return SendClientError(playerid, "You are not outside your own faction warehouse");
            ShowPlayerDialog(playerid, 60, DIALOG_STYLE_LIST, ":: Faction Warehouse upgrade ::", "{ffffff}Level 1 ({ff0000}FREE{ffffff})\nLevel 2 ({ff0000}$1,000,000{ffffff})\nLevel 3 ({ff0000}$3,000,000{ffffff})\nLevel 4 ({ff0000}$10,000,000{ffffff})\nLevel 5 ({ff0000}$25,000,000{ffffff})\nLevel 6 ({ff0000}$40,000,000{ffffff})", "Select", "Exit");
        }
    }
    return 1;
}



Re: Server crash after using command. - JustMe.77 - 05.08.2016

Can you show us the content in your server_log.txt?
Also, use the crashdetect Plugin.


Re: Server crash after using command. - jimdo - 05.08.2016

here is the crashdetect

Код:
[01:14:06] *** IRC_OnConnect: Bot ID 3 connected!
[01:14:10] [debug] Server crashed while executing IM.amx
[01:14:10] [debug] AMX backtrace:
[01:14:10] [debug] #0 native fwrite () from samp-server.exe
[01:14:10] [debug] #1 00006418 in ?? (429640, 6501504, 7039460) from IM.amx
[01:14:10] [debug] #2 00006688 in ?? (429640, 6501504, 65799) from IM.amx
[01:14:10] [debug] #3 000a4214 in ?? (1) from IM.amx
[01:14:10] [debug] #4 000a97c8 in public AddToWareHouse (1) from IM.amx
[01:14:11] [debug] Native backtrace:
[01:14:11] [debug] #0 77659f83 in ?? () from C:\Windows\SYSTEM32\ntdll.dll
[01:14:11] [debug] #1 00498bb8 in ?? () from samp-server.exe
[01:14:11] [debug] #2 0040531e in ?? () from samp-server.exe
edit :

now i guess, its auto shut down don't know why.. even when i dont join the server, it's turned off automatically.


Re: Server crash after using command. - Shady - 05.08.2016

What is your command processor? ZCMD? If it is ZCMD, then change the first line to this one.

pawn Код:
COMMAND:whupgrade(playerid, params[])



Re: Server crash after using command. - AndySedeyn - 05.08.2016

Quote:
Originally Posted by ItzShady
Посмотреть сообщение
What is your command processor? ZCMD? If it is ZCMD, then change the first line to this one.

pawn Код:
COMMAND:whupgrade(playerid, params[])
Just using playerid works as well. That is, if you are sure that the command won't use any parameters.


Re: Server crash after using command. - Vince - 05.08.2016

It's pretty obvious isn't it?

Код:
native fwrite
Код:
in public AddToWareHouse
File functions crash the server if an invalid handle is used. One must ALWAYS check that a file can be opened (fopen()) in the desired mode (read or write) before doing any actual reading or writing.