Server Crash after Command
#1

Hey, My server crash after the Command /Newitem

Код HTML:
CMD:newitem(playerid, params[])
{
	if (!IsPlayerAdmin(playerid))
	{
	    return SendClientMessage(playerid, COLOR_TOMATO, "You must be RCON-Admin to use this command.");
	}

	new itemName[MAX_ITEM_NAME], itemModelid;
	if (sscanf(params, "is[64]", itemModelid, itemName))
	{
	    return SendClientMessage(playerid, COLOR_DEFAULT, "Usage: /newitem [modelid] [name]");
	}

	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	new Float:ang;
	GetPlayerFacingAngle(playerid, ang);
	x += (1.5 * floatsin(-ang, degrees));
	y += (1.5 * floatcos(-ang, degrees));
    new itemid = Inv_AddItem(itemModelid, itemName, x, y, z);
    if (itemid == -1)
    {
        return SendClientMessage(playerid, COLOR_TOMATO, "Cannot add anymore items, reached limit.");
    }
    
    Inv_EditItem(playerid, itemid);

    new string[128];
    format(string, sizeof string, "Item created: %s [itemid: %i | modelid: %i]", itemName, itemid, itemModelid);
    SendClientMessage(playerid, COLOR_GREEN, string);

	createdItems[createdItemsCount++] = itemid;
    SendClientMessage(playerid, COLOR_DEFAULT, "Item added to /items list, If you want to duplicate this item, type /additem.");
	return 1;
}
Reply
#2

It would be very hard to determine where is the bug, so you must try adding a format "debug" to send you messages in the server logs after every part in this command to know which part causes the error.
Reply
#3

use this debug codes, after that, please send a server_log.
PHP код:
CMD:newitem(playeridparams[])
{
    
printf("[debug] (newitem) - 1");
    if (!
IsPlayerAdmin(playerid))
    {
        return 
SendClientMessage(playeridCOLOR_TOMATO"You must be RCON-Admin to use this command."),printf("[debug] (newitem) - 1.2");
    }
    
printf("[debug] (newitem) - 2");
    new 
itemName[MAX_ITEM_NAME], itemModelid;
    if (
sscanf(params"is[64]"itemModeliditemName))
    {
        return 
SendClientMessage(playeridCOLOR_DEFAULT"Usage: /newitem [modelid] [name]"),printf("[debug] (newitem) - 2.2");
    }
    
printf("[debug] (newitem) - 3");
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    new 
Float:ang;
    
GetPlayerFacingAngle(playeridang);
    
+= (1.5 floatsin(-angdegrees));
    
+= (1.5 floatcos(-angdegrees));
    
printf("[debug] (newitem) - 4");
    new 
itemid Inv_AddItem(itemModeliditemNamexyz);
    
printf("[debug] (newitem) - 5");
    if (
itemid == -1)
    {
        return 
SendClientMessage(playeridCOLOR_TOMATO"Cannot add anymore items, reached limit."),printf("[debug] (newitem) - 5.2");
    }
    
printf("[debug] (newitem) - 6");
    
Inv_EditItem(playeriditemid);
    
printf("[debug] (newitem) - 7");
    new 
string[128];
    
format(stringsizeof string"Item created: %s [itemid: %i | modelid: %i]"itemNameitemiditemModelid);
    
SendClientMessage(playeridCOLOR_GREENstring);
    
printf("[debug] (newitem) - 8");
    
createdItems[createdItemsCount++] = itemid;
    
SendClientMessage(playeridCOLOR_DEFAULT"Item added to /items list, If you want to duplicate this item, type /additem.");
    
printf("[debug] (newitem) - 9");
    return 
1;

Reply
#4

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
use this debug codes, after that, please send a server_log.
All of your printf, need to be print...

printf is print with format. Print simply prints what you put in.

Код:
printf("%s connected", GetPlayerName(playerid));
Код:
print("Player connected");
Reply
#5

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
All of your printf, need to be print...
yeah I know but there's no point, I'm allways using prinft, even I dont need any formatting.
Reply
#6

Then use it properly...

If you're going to hand out examples, at least make them correct.
Reply
#7

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Then use it properly...

If you're going to hand out examples, at least make them correct.
it's correct, u can use formatting if u want, it depends on your decision.
Reply
#8

@Mugalito

Server Log:
PHP код:
Loaded log file"server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3.7-R2, (C)2005-2015 SA-MP Team
[21:49:53filterscripts ""  (string)
[
21:49:53
[
21:49:53Server Plugins
[21:49:53] --------------
[
21:49:53]  Loading plugincrashdetect.so
[21:49:53]   CrashDetect v4.18.1 is OK.
[
21:49:53]   Loaded.
[
21:49:53]  Loading pluginstreamer.so
[21:49:53
*** 
Streamer Plugin v2.9.2 by Incognito loaded ***
[
21:49:53]   Loaded.
[
21:49:53]  Loading pluginsscanf.so
[21:49:53
[
21:49:53]  ===============================
[
21:49:53]       sscanf plugin loaded.     
[
21:49:53]          Version:  2.8.2        
[21:49:53]    (c2012 Alex "******" Cole  
[21:49:53]  ===============================
[
21:49:53]   Loaded.
[
21:49:53]  Loading pluginColAndreas_static.so
[21:49:54] *********************
[
21:49:54] ** Created By:     **
[
21:49:54] ** [uL]Chris42O    **
[
21:49:54] ** [uL]Slice       **
[
21:49:54] ** [uL]Pottus      **
[
21:49:54] *********************
[
21:49:54No collision data found.
[
21:49:54] *********************
[
21:49:54]   ColAndreas Loaded
[21:49:54]    v1.4.0
[21:49:54] *********************
[
21:49:54]   Loaded.
[
21:49:54]  Loaded 4 plugins.
[
21:49:54
[
21:49:54Filterscripts
[21:49:54] ---------------
[
21:49:54]   Loaded 0 filterscripts.
[
21:49:54maxplayers 50  (intread-only)
[
21:49:54Number of vehicle models0
[21:50:45] [connection178.190.9.147:54768 requests connection cookie.
[
21:50:46] [connectionincoming connection178.190.9.147:54768 id0
[21:50:46] [joinlocalhost has joined the server (0:178.190.9.147)
[
21:51:16RCON (In-Game): Player #0 (localhost) has logged in.
[21:51:26] [debugServer crashed while executing main.amx
[21:51:26] [debugAMX backtrace:
[
21:51:26] [debug#0 native CA_GetModelBoundingSphere () from ColAndreas_static.so
[21:51:26] [debug#1 0001a3fc in ?? (2341, 1676916, 1124409106, -1029381855, 1068957696, 0, 0, 0, 0) from main.amx
[21:51:26] [debug#2 0002b8dc in public cmd_newitem (0, 1661060) from main.amx
[21:51:26] [debug#3 native CallLocalFunction () from samp03svr
[21:51:26] [debug#4 00012060 in public OnPlayerCommandText (0, 1660984) from main.amx
[21:51:26] [debugNative backtrace:
[
21:51:26] [debug#0 f73da180 in _Z13GetStackTraceRSt6vectorI10StackFrameSaIS0_EEPv () from plugins/crashdetect.so
[21:51:26] [debug#1 f73d2064 in _ZN11CrashDetect20PrintNativeBacktraceERSoRKN2os7ContextE () from plugins/crashdetect.so
[21:51:26] [debug#2 f73d2d64 in _ZN11CrashDetect20PrintNativeBacktraceERKN2os7ContextE () from plugins/crashdetect.so
[21:51:26] [debug#3 f73d4cdb in _ZN11CrashDetect7OnCrashERKN2os7ContextE () from plugins/crashdetect.so
[21:51:26] [debug#4 f73d94d5 in ?? () from plugins/crashdetect.so
[21:51:26] [debug#5 f7733d50 in __kernel_rt_sigreturn () from linux-gate.so.1
[21:51:26] [debug#6 f720142c in _ZN13ObjectManager17getBoundingSphereEtR9btVector3Rf () from plugins/ColAndreas_static.so
[21:51:26] [debug#7 f71fefea in _ZN17ColAndreasNatives25CA_GetModelBoundingSphereEP6tagAMXPi () from plugins/ColAndreas_static.so
[21:51:26] [debug#8 080950e4 in ?? () from ./samp03svr
[21:51:26] [debug#9 f73d3ad3 in _ZN11CrashDetect17HandleAMXCallbackEiPiS0_ () from plugins/crashdetect.so
[21:51:26] [debug#10 00000009 in ?? () from *·oчHµoчґ>Џ    ґ>Џ    µ@Џ    ґ>Џ    'BЏ    ґBЏ    Dpч
[21:51:26] [debugRegisters:
[
21:51:26] [debugEAX00000000 EBXf72cb000 ECXf72cb3a0 EDX00000000
[21:51:26] [debugESIf5c23b2c EDI00000000 EBPfff33dd8 ESPfff33d40
[21:51:26] [debugEIPf720142c EFLAGS00010213
[21:51:26] [debugStack:
[
21:51:26] [debugESP+00000000fff33dd8 f774ab70 00000925 f7201400
[21:51:26] [debugESP+00000020f6e35008 00000925 fff33d80 fff33d7c
[21:51:26] [debugESP+0000004000000000 00000001 098f2810 00000001
[21:51:26] [debugESP+00000060f5a4c008 000003a8 0989e438 080950e4
[21:51:26] [debugESP+00000080fff33ed0 00000000 f71fef90 f73feff4
[21:51:26] [debugESP+000000a00989e438 00000070 fff33fcc f5c23b2c
[21:51:26] [debugESP+000000c0f7756d20 09703699 fff33e98 f75249b8
[21:51:26] [debugESP+000000e000000000 00000000 00000000 00000002
[21:51:26] [debugESP+00000100f765e0f9 00000000 09702c60 f7756d20
[21:51:26] [debugESP+0000012000000000 00000000 00000000 00000000
[21:51:26] [debugESP+0000014000000000 00000001 f7524941 f7725000
[21:51:26] [debugESP+0000016000000000 00000002 fff33ec8 f7524e7a
[21:51:26] [debugESP+000001800989e438 f7757000 00000000 f73d35a4
[21:51:26] [debugESP+000001a000000070 0989e438 00000000 0019962c
[21:51:26] [debugESP+000001c0fff33ef0 f7757000 00000000 f7756d20
[21:51:26] [debugESP+000001e00989e438 098628b8 fff341fc f73d8560
[21:51:26] [debugESP+00000200098628b8 0000001b fff33fdc f5c23b68
[21:51:26] [debugESP+000002200989e438 f5a68200 f5a4de08 f73dc50f
[21:51:26] [debugESP+000002400989e438 00000059 0001a3fc f5a4c008
[21:51:26] [debugESP+000002600019962c 00199788 001958ac f5a4de08
[21:51:26] [debugESP+000002800003c71c 0989e438 f772230d 00000001
[21:51:26] [debugESP+000002a0098628b8 00000059 f73ff660 f73d5376
[21:51:26] [debugESP+000002c000012060 00000059 f7721e49 f73b97d4
[21:51:26] [debugESP+000002e009702c60 09703699 00000000 f73126f4
[21:51:26] [debugESP+0000030009702c60 09703699 0989e438 00000001
[21:51:26] [debugESP+00000320098f342c 09703498 00000001 f7475b1c
[21:51:26] [debugESP+0000034000000008 00000006 00000040 00000000
[21:51:26] [debugESP+0000036000011f4c f5a4c008 00000008 f73feff4
[21:51:26] [debugESP+00000380098628b8 fff341fc 00000059 f73b97d4
[21:51:26] [debugESP+000003a0fff340f4 7fffffff f73a4948 0989e438
[21:51:26] [debugESP+000003c000000059 0989e438 fff34148 f7320406
[21:51:26] [debugESP+000003e000000002 00199780 00000002 00000000
[21:51:26] [debugLoaded modules:
[
21:51:26] [debug00000000 00187dc3 samp03svr
[21:51:26] [debugf7733000 f7733e96 linux-gate.so.1
[21:51:26] [debugf7721000 f772381b /lib32/libdl.so.2
[21:51:26] [debugf7705000 f771fd2b /lib32/libpthread.so.0
[21:51:26] [debugf7613000 f770cce6 /usr/lib32/libstdc++.so.6
[21:51:26] [debugf75cd000 f7611b97 /lib32/libm.so.6
[21:51:26] [debugf75b0000 f75cc3c4 /usr/lib32/libgcc_s.so.1
[21:51:26] [debugf7402000 f75b7237 /lib32/libc.so.6
[21:51:26] [debugf7736000 f77574a0 /lib/ld-linux.so.2
[21:51:26] [debugf73bc000 f73feac4 plugins/crashdetect.so
[21:51:26] [debugf72e6000 f73bc7f0 plugins/streamer.so
[21:51:26] [debugf7728000 f772f09f /lib32/librt.so.1
[21:51:26] [debugf72d6000 f72e51d4 plugins/sscanf.so
[21:51:26] [debugf71c9000 f72d779b plugins/ColAndreas_static.so
[21:51:26] [debugf6df6000 f6e013ef /lib32/libnss_files.so.2 
Reply
#9

Did you have those lines added as Mugalito suggested?


Another one you may want to check is if the data is there for Col_Andreas. It should be in the ScriptFiles folder.

Код:
[21:49:54] No collision data found.
especially as you have
Код:
#0 native CA_GetModelBoundingSphere () from ColAndreas_static.so
Quote:
Originally Posted by Crayder
Посмотреть сообщение
Installation Instructions:
  1. Navigate to the github repository's release section (link above) and download the latest version.
  2. If you don't need the source just download the wizard, the plugin, and include.
  3. Run the binary builder application. This will generate a binary in which ColAndreas load data from.
  4. Create a folder in your scriptfiles called "colandreas" and place the binary file there.
  5. Add ColAndreas to your server.cfg.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)