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; }
CMD:newitem(playerid, params[])
{
printf("[debug] (newitem) - 1");
if (!IsPlayerAdmin(playerid))
{
return SendClientMessage(playerid, COLOR_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]", itemModelid, itemName))
{
return SendClientMessage(playerid, COLOR_DEFAULT, "Usage: /newitem [modelid] [name]"),printf("[debug] (newitem) - 2.2");
}
printf("[debug] (newitem) - 3");
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));
printf("[debug] (newitem) - 4");
new itemid = Inv_AddItem(itemModelid, itemName, x, y, z);
printf("[debug] (newitem) - 5");
if (itemid == -1)
{
return SendClientMessage(playerid, COLOR_TOMATO, "Cannot add anymore items, reached limit."),printf("[debug] (newitem) - 5.2");
}
printf("[debug] (newitem) - 6");
Inv_EditItem(playerid, itemid);
printf("[debug] (newitem) - 7");
new string[128];
format(string, sizeof string, "Item created: %s [itemid: %i | modelid: %i]", itemName, itemid, itemModelid);
SendClientMessage(playerid, COLOR_GREEN, string);
printf("[debug] (newitem) - 8");
createdItems[createdItemsCount++] = itemid;
SendClientMessage(playerid, COLOR_DEFAULT, "Item added to /items list, If you want to duplicate this item, type /additem.");
printf("[debug] (newitem) - 9");
return 1;
}
printf("%s connected", GetPlayerName(playerid));
print("Player connected");
Then use it properly...
If you're going to hand out examples, at least make them correct. |
Loaded log file: "server_log.txt".
----------
SA-MP Dedicated Server
----------------------
v0.3.7-R2, (C)2005-2015 SA-MP Team
[21:49:53] filterscripts = "" (string)
[21:49:53]
[21:49:53] Server Plugins
[21:49:53] --------------
[21:49:53] Loading plugin: crashdetect.so
[21:49:53] CrashDetect v4.18.1 is OK.
[21:49:53] Loaded.
[21:49:53] Loading plugin: streamer.so
[21:49:53]
*** Streamer Plugin v2.9.2 by Incognito loaded ***
[21:49:53] Loaded.
[21:49:53] Loading plugin: sscanf.so
[21:49:53]
[21:49:53] ===============================
[21:49:53] sscanf plugin loaded.
[21:49:53] Version: 2.8.2
[21:49:53] (c) 2012 Alex "******" Cole
[21:49:53] ===============================
[21:49:53] Loaded.
[21:49:53] Loading plugin: ColAndreas_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:54] No 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:54] Filterscripts
[21:49:54] ---------------
[21:49:54] Loaded 0 filterscripts.
[21:49:54] maxplayers = 50 (int, read-only)
[21:49:54] Number of vehicle models: 0
[21:50:45] [connection] 178.190.9.147:54768 requests connection cookie.
[21:50:46] [connection] incoming connection: 178.190.9.147:54768 id: 0
[21:50:46] [join] localhost has joined the server (0:178.190.9.147)
[21:51:16] RCON (In-Game): Player #0 (localhost) has logged in.
[21:51:26] [debug] Server crashed while executing main.amx
[21:51:26] [debug] AMX 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] [debug] Native 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] [debug] Registers:
[21:51:26] [debug] EAX: 00000000 EBX: f72cb000 ECX: f72cb3a0 EDX: 00000000
[21:51:26] [debug] ESI: f5c23b2c EDI: 00000000 EBP: fff33dd8 ESP: fff33d40
[21:51:26] [debug] EIP: f720142c EFLAGS: 00010213
[21:51:26] [debug] Stack:
[21:51:26] [debug] ESP+00000000: fff33dd8 f774ab70 00000925 f7201400
[21:51:26] [debug] ESP+00000020: f6e35008 00000925 fff33d80 fff33d7c
[21:51:26] [debug] ESP+00000040: 00000000 00000001 098f2810 00000001
[21:51:26] [debug] ESP+00000060: f5a4c008 000003a8 0989e438 080950e4
[21:51:26] [debug] ESP+00000080: fff33ed0 00000000 f71fef90 f73feff4
[21:51:26] [debug] ESP+000000a0: 0989e438 00000070 fff33fcc f5c23b2c
[21:51:26] [debug] ESP+000000c0: f7756d20 09703699 fff33e98 f75249b8
[21:51:26] [debug] ESP+000000e0: 00000000 00000000 00000000 00000002
[21:51:26] [debug] ESP+00000100: f765e0f9 00000000 09702c60 f7756d20
[21:51:26] [debug] ESP+00000120: 00000000 00000000 00000000 00000000
[21:51:26] [debug] ESP+00000140: 00000000 00000001 f7524941 f7725000
[21:51:26] [debug] ESP+00000160: 00000000 00000002 fff33ec8 f7524e7a
[21:51:26] [debug] ESP+00000180: 0989e438 f7757000 00000000 f73d35a4
[21:51:26] [debug] ESP+000001a0: 00000070 0989e438 00000000 0019962c
[21:51:26] [debug] ESP+000001c0: fff33ef0 f7757000 00000000 f7756d20
[21:51:26] [debug] ESP+000001e0: 0989e438 098628b8 fff341fc f73d8560
[21:51:26] [debug] ESP+00000200: 098628b8 0000001b fff33fdc f5c23b68
[21:51:26] [debug] ESP+00000220: 0989e438 f5a68200 f5a4de08 f73dc50f
[21:51:26] [debug] ESP+00000240: 0989e438 00000059 0001a3fc f5a4c008
[21:51:26] [debug] ESP+00000260: 0019962c 00199788 001958ac f5a4de08
[21:51:26] [debug] ESP+00000280: 0003c71c 0989e438 f772230d 00000001
[21:51:26] [debug] ESP+000002a0: 098628b8 00000059 f73ff660 f73d5376
[21:51:26] [debug] ESP+000002c0: 00012060 00000059 f7721e49 f73b97d4
[21:51:26] [debug] ESP+000002e0: 09702c60 09703699 00000000 f73126f4
[21:51:26] [debug] ESP+00000300: 09702c60 09703699 0989e438 00000001
[21:51:26] [debug] ESP+00000320: 098f342c 09703498 00000001 f7475b1c
[21:51:26] [debug] ESP+00000340: 00000008 00000006 00000040 00000000
[21:51:26] [debug] ESP+00000360: 00011f4c f5a4c008 00000008 f73feff4
[21:51:26] [debug] ESP+00000380: 098628b8 fff341fc 00000059 f73b97d4
[21:51:26] [debug] ESP+000003a0: fff340f4 7fffffff f73a4948 0989e438
[21:51:26] [debug] ESP+000003c0: 00000059 0989e438 fff34148 f7320406
[21:51:26] [debug] ESP+000003e0: 00000002 00199780 00000002 00000000
[21:51:26] [debug] Loaded modules:
[21:51:26] [debug] 00000000 - 00187dc3 samp03svr
[21:51:26] [debug] f7733000 - f7733e96 linux-gate.so.1
[21:51:26] [debug] f7721000 - f772381b /lib32/libdl.so.2
[21:51:26] [debug] f7705000 - f771fd2b /lib32/libpthread.so.0
[21:51:26] [debug] f7613000 - f770cce6 /usr/lib32/libstdc++.so.6
[21:51:26] [debug] f75cd000 - f7611b97 /lib32/libm.so.6
[21:51:26] [debug] f75b0000 - f75cc3c4 /usr/lib32/libgcc_s.so.1
[21:51:26] [debug] f7402000 - f75b7237 /lib32/libc.so.6
[21:51:26] [debug] f7736000 - f77574a0 /lib/ld-linux.so.2
[21:51:26] [debug] f73bc000 - f73feac4 plugins/crashdetect.so
[21:51:26] [debug] f72e6000 - f73bc7f0 plugins/streamer.so
[21:51:26] [debug] f7728000 - f772f09f /lib32/librt.so.1
[21:51:26] [debug] f72d6000 - f72e51d4 plugins/sscanf.so
[21:51:26] [debug] f71c9000 - f72d779b plugins/ColAndreas_static.so
[21:51:26] [debug] f6df6000 - f6e013ef /lib32/libnss_files.so.2
[21:49:54] No collision data found.
#0 native CA_GetModelBoundingSphere () from ColAndreas_static.so
Installation Instructions:
|