Cant find what went wrong.
#1

I have been working on SC-RP script. Added few items in /buy menu. Every time I /buy in any store, the server gets crashed. And when I re launch it and check my inventory I find the item which I bought is there and the commands associated with that item is working fine. I get these in the server log. I think there is something wrong with the BusinessBuy dialog, but dont know for sure. A little help here will be appreciated.

Server Log:
Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[18:14:45] filterscripts = ""  (string)
[18:14:45] 
[18:14:45] Server Plugins
[18:14:45] --------------
[18:14:45]  Loading plugin: crashdetect.dll
[18:14:45]   CrashDetect v4.12 is OK.
[18:14:45]   Loaded.
[18:14:45]  Loading plugin: sscanf.dll
[18:14:45] 

[18:14:45]  ===============================

[18:14:45]       sscanf plugin loaded.     

[18:14:45]          Version:  2.8.1        

[18:14:45]    © 2012 Alex "******" Cole  

[18:14:45]  ===============================

[18:14:45]   Loaded.
[18:14:45]  Loading plugin: streamer.dll
[18:14:45]   Loaded.
[18:14:45]  Loading plugin: Whirlpool.dll
[18:14:45]  
[18:14:45]  ==================
[18:14:45]  
[18:14:45]   Whirlpool loaded
[18:14:45]  
[18:14:45]  ==================
[18:14:45]  
[18:14:45]   Loaded.
[18:14:45]  Loading plugin: mysql.dll
[18:14:45]  >> plugin.mysql: R39-4 successfully loaded.
[18:14:45]   Loaded.
[18:14:45]  Loading plugin: nativechecker.dll
[18:14:45]   Loaded.
[18:14:45]  Loaded 6 plugins.

[18:14:45] 
[18:14:45] Filterscripts
[18:14:45] ---------------
[18:14:45]   Loaded 0 filterscripts.

[18:14:45]  
[18:14:45]  
[18:14:45]  
[18:14:45]  ======================================= 
[18:14:45]  |                                     | 
[18:14:45]  |        YSI version 3.09.0684        | 
[18:14:45]  |        By Alex "******" Cole        | 
[18:14:45]  |                                     | 
[18:14:45]  ======================================= 
[18:14:45]  
[18:14:45] [SQL] Connection to "localhost" passed!
[18:14:45] Test Script
[18:14:45] Number of vehicle models: 1
[18:14:45] New version of CrashDetect is available for download (4.13)
[18:15:05] [connection] 127.0.0.1:52501 requests connection cookie.
[18:15:06] [connection] incoming connection: 127.0.0.1:52501 id: 0
[18:15:06] [join] PlayerX has joined the server (0:127.0.0.1)
[18:15:42] [debug] Server crashed while executing roleplay.amx
[18:15:42] [debug] AMX backtrace:
[18:15:42] [debug] #0 native fwrite () [004056e0] from samp-server.exe
[18:15:42] [debug] #1 000d1e24 in ?? () from roleplay.amx
[18:15:42] [debug] #2 0003b640 in ?? (0x00000000) from roleplay.amx
[18:15:42] [debug] #3 0019728c in public dialog_BusinessBuy (0x00000000, 0x00000001, 0x00000001, 0x006dfb08) from roleplay.amx
[18:15:42] [debug] #4 native CallLocalFunction () [004743b0] from samp-server.exe
[18:15:42] [debug] #5 0000292c in public OnDialogResponse (0x00000000, 0x00007fbc, 0x00000001, 0x00000001, 0x006dfac8) from roleplay.amx
[18:15:42] [debug] Native backtrace:
[18:15:42] [debug] #0 77289f83 in ?? () from C:\Windows\SYSTEM32\ntdll.dll
[18:15:42] [debug] #1 00498bb8 in ?? () from C:\Users\Desktop\Script\samp-server.exe
[18:15:42] [debug] #2 0040531e in ?? () from C:\Users\Desktop\Script\samp-server.exe
Reply
#2

Show the dialog, and OnDialogResponse lines?
Reply
#3

Quote:
Originally Posted by Wolfe
Посмотреть сообщение
Show the dialog, and OnDialogResponse lines?
BusinessBuy is very long. I copied the the portion which I alerted.

1. Added Item "Rag"
http://pastebin.com/9kwm8yd6

2. Moved Item from another type of business to this business - "Repair Kit"
http://pastebin.com/VgsUjwmg
Reply
#4

https://sampwiki.blast.hk/wiki/Fwrite

Read the Warning box, that's the reason of the crash. You can compile with debug info, start the server and reproduce it to get a more detailed output (exact functions and lines).

Until then, I can only tell you that a function is called in BusinessBuy's code and that function calls fwrite. More likely would be Business_Save function.
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/Fwrite

Read the Warning box, that's the reason of the crash. You can compile with debug info, start the server and reproduce it to get a more detailed output (exact functions and lines).

Until then, I can only tell you that a function is called in BusinessBuy's code and that function calls fwrite. More likely would be Business_Save function.
I complied it with debug info and got this.

Код:
----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[12:45:27] filterscripts = ""  (string)
[12:45:27] 
[12:45:27] Server Plugins
[12:45:27] --------------
[12:45:27]  Loading plugin: crashdetect.dll
[12:45:27]   CrashDetect v4.12 is OK.
[12:45:27]   Loaded.
[12:45:27]  Loading plugin: sscanf.dll
[12:45:27] 

[12:45:27]  ===============================

[12:45:27]       sscanf plugin loaded.     

[12:45:27]          Version:  2.8.1        

[12:45:27]    © 2012 Alex "******" Cole  

[12:45:27]  ===============================

[12:45:27]   Loaded.
[12:45:27]  Loading plugin: streamer.dll
[12:45:27]   Loaded.
[12:45:27]  Loading plugin: Whirlpool.dll
[12:45:27]  
[12:45:27]  ==================
[12:45:27]  
[12:45:27]   Whirlpool loaded
[12:45:27]  
[12:45:27]  ==================
[12:45:27]  
[12:45:27]   Loaded.
[12:45:27]  Loading plugin: mysql.dll
[12:45:27]  >> plugin.mysql: R39-4 successfully loaded.
[12:45:27]   Loaded.
[12:45:27]  Loading plugin: nativechecker.dll
[12:45:27]   Loaded.
[12:45:27]  Loaded 6 plugins.

[12:45:27] 
[12:45:27] Filterscripts
[12:45:27] ---------------
[12:45:27]   Loaded 0 filterscripts.

[12:45:27]  
[12:45:27]  
[12:45:27]  
[12:45:27]  ======================================= 
[12:45:27]  |                                     | 
[12:45:27]  |        YSI version 3.09.0684        | 
[12:45:27]  |        By Alex "******" Cole        | 
[12:45:27]  |                                     | 
[12:45:27]  ======================================= 
[12:45:27]  
[12:45:27] [SQL] Connection to "localhost" passed!
[12:45:27] Test Server Roleplay
[12:45:27] Number of vehicle models: 1
[12:45:28] New version of CrashDetect is available for download (4.13)
[12:46:00] [connection] 127.0.0.1:55151 requests connection cookie.
[12:46:01] [connection] incoming connection: 127.0.0.1:55151 id: 0
[12:46:01] [join] PlayerX has joined the server (0:127.0.0.1)
[12:46:50] [debug] Server crashed while executing roleplay.amx
[12:46:50] [debug] AMX backtrace:
[12:46:50] [debug] #0 native fwrite () [004056e0] from samp-server.exe
[12:46:50] [debug] #1 001148b8 in Server_Save () at C:\Users\Desktop\Base Script\gamemodes\roleplay.pwn:19288
[12:46:50] [debug] #2 0004c18c in Tax_AddPercent (price=0) at C:\Users\Desktop\Base Script\gamemodes\roleplay.pwn:5129
[12:46:50] [debug] #3 0020f6dc in public dialog_BusinessBuy (playerid=0, response=1, listitem=1, inputtext[]=@0x006dfb08 "Repair Kit - $0") at C:\Users\Desktop\Base Script\gamemodes\roleplay.pwn:30340
[12:46:50] [debug] #4 native CallLocalFunction () [004743b0] from samp-server.exe
[12:46:50] [debug] #5 00003360 in public OnDialogResponse (playerid=0, dialogid=32700, response=1, listitem=1, inputtext[]=@0x006dfac8 "Repair Kit - $0") at C:\Users\ADHITH~1\Desktop\BASESC~1\pawno\include\easyDialog.inc:131
[12:46:50] [debug] Native backtrace:
[12:46:50] [debug] #0 77289f83 in ?? () from C:\Windows\SYSTEM32\ntdll.dll
[12:46:50] [debug] #1 00498bb8 in ?? () from C:\Users\Desktop\Base Script\samp-server.exe
[12:46:50] [debug] #2 0040531e in ?? () from C:\Users\Desktop\Base Script\samp-server.exe
Reply
#6

Yes, the mistake is in Server_Save function. You do not check if the file handle is valid (if file was opened successfully).

You can fix it by taking a look at the wiki examples I linked you. They provide the correct way of doing this right after the comment "Check, if file is open".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)