Server crash on cmd
#1

When i try to set money to me /givemoney or /money ,server crash
i think problem is in SCMF because money cmd cause crash


There is sa codes:

Код:
if(strcmp(cmd, "/money", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_LIGHTRED, "Koriscenje: {FFFFFF}/money [ID Igraca/Deo Imena] [novac]");
		return 1;
		}
		new para1;
		new playa;
		new money;
		playa = ReturnUser(tmp);
		tmp = strtok(cmdtext, idx);
		money = strval(tmp);
		if (PlayerInfo[playerid][pAdmin] >= 9)
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					JBC_ResetPlayerMoney(playa);
					JBC_GivePlayerMoney(playa, money);
					GetPlayerName(playa, giveplayer, sizeof(giveplayer));
					GetPlayerName(playerid, sendername, sizeof(sendername));
					SCMF(para1,COLOR_LIGHTBLUE, "{FFFFFF}|{FF0000}A{FFFFFF}|{FF0000} Admin {FFFFFF}%s {FF0000}vam je podesio novac na {FFFFFF}$%d.", sendername,money);
					SCMF(playerid,COLOR_LIGHTBLUE, "{FF0000}Postavili ste {FFFFFF}$%d {FF0000}igracu {FFFFFF}%s.",money,giveplayer);
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_WHITE, "{FF0000}|VG| | {FFFFFF}Niste ovlasceni da koristite ovu komandu.");
		}
	}
return 1;
}
Код:
stock SCMF(playerid, color, fstring[], {Float, _}:...)
{
    #define BYTES_PER_CELL              4
    const STATIC_ARGS = 3;
    new n = (numargs() - STATIC_ARGS) * BYTES_PER_CELL;
    if(n)
    {
        new message[144],arg_start,arg_end;
        #emit CONST.alt        fstring
        #emit LCTRL          5
        #emit ADD
        #emit STOR.S.pri        arg_start

        #emit LOAD.S.alt        n
        #emit ADD
        #emit STOR.S.pri        arg_end
        do
        {
            #emit LOAD.I
            #emit PUSH.pri
            arg_end -= BYTES_PER_CELL;
            #emit LOAD.S.pri      arg_end
        }
        while(arg_end > arg_start);

        #emit PUSH.S          fstring
        #emit PUSH.C          144
        #emit PUSH.ADR         message

        n += BYTES_PER_CELL * 3;
        #emit PUSH.S          n
        #emit SYSREQ.C         format

        n += BYTES_PER_CELL;
        #emit LCTRL          4
        #emit LOAD.S.alt        n
        #emit ADD
        #emit SCTRL          4

        if(playerid == INVALID_PLAYER_ID)
        {
            #pragma unused playerid
            return SendClientMessageToAll(color, message);
        } else {
            return SendClientMessage(playerid, color, message);
        }
    } else {
        if(playerid == INVALID_PLAYER_ID)
        {
            #pragma unused playerid
            return SendClientMessageToAll(color, fstring);
        } else {
            return SendClientMessage(playerid, color, fstring);
        }
    }
}
Crashdetect log
Код:
[13:20:25] Number of vehicle models: 76
[13:20:43] [connection] 127.0.0.1:62193 requests connection cookie.
[13:20:44] [connection] incoming connection: 127.0.0.1:62193 id: 0
[13:20:44] [join] Wucha has joined the server (0:127.0.0.1)
[13:20:44] Ucitana server podesavanja.
[13:20:55] Wucha has logged in.
[13:21:06] [debug] Server crashed while executing VG.amx
[13:21:06] [debug] AMX backtrace:
[13:21:06] [debug] #0 native format () from samp-server.exe
[13:21:06] [debug] #1 0055f3bc in SCMF (playerid=0, color=869072810, fstring[]=@014f2d34 "{FFFFFF}|{FF0000}A{FFFFFF}|{FF0000} Admin {FFFFFF}%s {FF0000}vam je podesio nova...", ... <2 arguments>) at C:\Users\Nemanja\Desktop\Vertigo Gaming 2.0a\gamemodes\VG.pwn:73134
[13:21:06] [debug] #2 004b67dc in public OnPlayerCommandPerformed (playerid=0, cmdtext[]=@0154ce74 "/money 0", success=0) at C:\Users\Nemanja\Desktop\Vertigo Gaming 2.0a\gamemodes\VG.pwn:60283
[13:21:06] [debug] #3 native CallLocalFunction () from samp-server.exe
[13:21:06] [debug] #4 0001bc88 in ?? (... <2 arguments>) at C:\Users\Nemanja\Desktop\Vertigo Gaming 2.0a\pawno\include\zcmd.inc:108
[13:21:06] [debug] #5 000070f8 in public OnPlayerCommandText (playerid=0, cmdtext[]=@0154ce4c "/money 0") at C:\Users\Nemanja\Desktop\Vertigo Gaming 2.0a\pawno\include\YSI\y_hooks/impl.inc:929
[13:21:06] [debug] Native backtrace:
[13:21:06] [debug] #0 0046cff0 in ?? () from samp-server.exe
[13:21:06] [debug] #1 0046f992 in ?? () from samp-server.exe
[13:21:06] [debug] #2 7337d60a in ?? () from plugins\crashdetect.DLL
[13:21:06] [debug] #3 73384078 in ?? () from plugins\crashdetect.DLL
[13:21:06] [debug] #4 7337a767 in ?? () from plugins\crashdetect.DLL
[13:21:06] [debug] #5 7337d65a in ?? () from plugins\crashdetect.DLL
[13:21:06] [debug] #6 731c4b39 in ?? () from plugins\streamer.DLL
[13:21:06] [debug] #7 004746be in ?? () from samp-server.exe
[13:21:06] [debug] #8 004010b6 in ?? () from samp-server.exe
[13:21:06] [debug] #9 7337d60a in ?? () from plugins\crashdetect.DLL
[13:21:06] [debug] #10 73384078 in ?? () from plugins\crashdetect.DLL
[13:21:06] [debug] #11 7337a767 in ?? () from plugins\crashdetect.DLL
[13:21:06] [debug] #12 7337d65a in ?? () from plugins\crashdetect.DLL
[13:21:06] [debug] #13 731c4b39 in ?? () from plugins\streamer.DLL
[13:21:06] [debug] #14 0046dd10 in ?? () from samp-server.exe
[13:21:06] [debug] #15 00452270 in ?? () from samp-server.exe
[13:21:06] [debug] #16 77a19cc9 in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
[13:21:06] [debug] #17 0049eef9 in ?? () from samp-server.exe
[13:21:06] [debug] #18 0045ad2a in ?? () from samp-server.exe
[13:21:06] [debug] #19 77a74e1e in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
[13:21:06] [debug] #20 77a2e78c in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
[13:21:06] [debug] #21 773aebe9 in ?? () from C:\WINDOWS\System32\KERNELBASE.dll
[13:21:06] [debug] #22 77a453e2 in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
[13:21:06] [debug] #23 77a1be64 in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
[13:21:06] [debug] #24 0049104c in ?? () from samp-server.exe
[13:21:06] [debug] #25 0049125c in ?? () from samp-server.exe
[13:21:06] [debug] #26 0048d4db in ?? () from samp-server.exe
[13:21:06] [debug] #27 0049b4a1 in ?? () from samp-server.exe
[13:21:06] [debug] #28 0049b4b1 in ?? () from samp-server.exe
[13:21:06] [debug] Registers:
[13:21:06] [debug] EAX: 00000000 EBX: 0019ef94 ECX: 004f4fb2 EDX: ffffffff
[13:21:06] [debug] ESI: 09d0213c EDI: 00000004 EBP: 0049b4a1 ESP: 0019fe98
[13:21:06] [debug] EIP: 0049b4b1 EFLAGS: 00010286
[13:21:06] [debug] Stack:
[13:21:06] [debug] ESP+00000000: 004ab4a0 0019ff70 004ab0e1 ffffffff
[13:21:06] [debug] ESP+00000020: 00000094 00000006 00000002 000023f0
[13:21:06] [debug] ESP+00000040: 00000000 00000000 00000000 00000000
[13:21:06] [debug] ESP+00000060: 00000000 00000000 00000000 00000000
[13:21:06] [debug] ESP+00000080: 00000000 00000000 00000000 00000000
[13:21:06] [debug] ESP+000000a0: 00000000 00000000 00000000 00000000
[13:21:06] [debug] ESP+000000c0: 00000000 00000000 c0000005 00000000
[13:21:06] [debug] ESP+000000e0: 004ba530 00000000 0019ff94 76d68654
[13:21:06] [debug] ESP+00000100: 77a24a47 0020a000 2837a58f 00000000
[13:21:06] [debug] ESP+00000120: 00000000 00000000 2837a58f 0019ffa0
[13:21:06] [debug] ESP+00000140: 00000000 0019ffec 77a24a17 ffffffff
[13:21:06] [debug] ESP+00000160: 0020a000 00000000 78746341 00000020
[13:21:06] [debug] ESP+00000180: 00000020 00000000 00000014 00000001
[13:21:06] [debug] ESP+000001a0: 00000000 00000000 00000000 00000000
[13:21:06] [debug] ESP+000001c0: 00000044 000002e0 0000025c 00000000
[13:21:06] [debug] ESP+000001e0: 00000342 00000000 2d59495b 000008cc
[13:21:06] [debug] ESP+00000200: 32ceeacd 00000bfc 00000042 00000c40
[13:21:06] [debug] ESP+00000220: 0000005e 00000fd0 00000362 00000000
[13:21:06] [debug] ESP+00000240: 00000392 00000010 00000009 000000ec
[13:21:06] [debug] ESP+00000260: 00000001 00000002 00001758 000007a0
[13:21:06] [debug] ESP+00000280: 00000001 00000004 00002d84 00000314
[13:21:06] [debug] ESP+000002a0: 00000002 00000006 00003130 000000cc
[13:21:06] [debug] ESP+000002c0: 00000001 00000009 000032ec 00000028
[13:21:06] [debug] ESP+000002e0: 00000001 64487353 0000002c 00000001
[13:21:06] [debug] ESP+00000300: 00000001 000015a4 0000002c 0000005e
[13:21:06] [debug] ESP+00000320: 00000000 00000000 00000000 00000000
[13:21:06] [debug] ESP+00000340: 00000038 00000000 003a0043 0057005c
[13:21:06] [debug] ESP+00000360: 006e0069 00780053 005c0073 00000000
[13:21:06] [debug] ESP+00000380: 0000025c 00000001 f33271ba 000003c0
[13:21:06] [debug] ESP+000003a0: 2d59495b 00000750 00000032 00000784
[13:21:06] [debug] ESP+000003c0: 00000042 00000ac4 00000330 00000004
[13:21:06] [debug] ESP+000003e0: 00000362 00000005 b1280544 000011b8
[13:21:06] [debug] Loaded modules:
[13:21:06] [debug] 00400000 - 00519000 samp-server.exe
[13:21:06] [debug] 779c0000 - 77b4d000 ntdll.dll
[13:21:06] [debug] 76d50000 - 76e20000 KERNEL32.DLL
[13:21:06] [debug] 772c0000 - 77497000 KERNELBASE.dll
[13:21:06] [debug] 75890000 - 76bc3000 SHELL32.dll
[13:21:06] [debug] 76e60000 - 76f1d000 msvcrt.dll
[13:21:06] [debug] 76f70000 - 76fa8000 cfgmgr32.dll
[13:21:06] [debug] 76bd0000 - 76ce7000 ucrtbase.dll
[13:21:06] [debug] 77230000 - 772b8000 shcore.dll
[13:21:06] [debug] 74870000 - 7492e000 RPCRT4.dll
[13:21:06] [debug] 743e0000 - 74400000 SspiCli.dll
[13:21:06] [debug] 743d0000 - 743da000 CRYPTBASE.dll
[13:21:06] [debug] 74fa0000 - 74ff7000 bcryptPrimitives.dll
[13:21:06] [debug] 74500000 - 74543000 sechost.dll
[13:21:06] [debug] 774a0000 - 776e6000 combase.dll
[13:21:06] [debug] 75230000 - 757f6000 windows.storage.dll
[13:21:06] [debug] 77050000 - 770c8000 advapi32.dll
[13:21:06] [debug] 76f20000 - 76f65000 shlwapi.dll
[13:21:06] [debug] 77010000 - 77032000 GDI32.dll
[13:21:06] [debug] 74e40000 - 74f9e000 gdi32full.dll
[13:21:06] [debug] 778d0000 - 7794c000 msvcp_win.dll
[13:21:06] [debug] 746f0000 - 74865000 USER32.dll
[13:21:06] [debug] 76e40000 - 76e56000 win32u.dll
[13:21:07] [debug] 76e30000 - 76e3e000 kernel.appcore.dll
[13:21:07] [debug] 76d00000 - 76d45000 powrprof.dll
[13:21:07] [debug] 744e0000 - 744f4000 profapi.dll
[13:21:07] [debug] 70d80000 - 70da4000 WINMM.dll
[13:21:07] [debug] 70d50000 - 70d73000 winmmbase.dll
[13:21:07] [debug] 736b0000 - 736b8000 WSOCK32.dll
[13:21:07] [debug] 77950000 - 779b6000 WS2_32.dll
[13:21:07] [debug] 74550000 - 74575000 IMM32.DLL
[13:21:07] [debug] 73360000 - 733b0000 crashdetect.DLL
[13:21:07] [debug] 732f0000 - 73359000 MSVCP100.dll
[13:21:07] [debug] 73230000 - 732ef000 MSVCR100.dll
[13:21:07] [debug] 731c0000 - 73222000 streamer.DLL
[13:21:07] [debug] 73690000 - 736a5000 VCRUNTIME140.dll
[13:21:07] [debug] 73150000 - 731bd000 MSVCP140.dll
[13:21:07] [debug] 10000000 - 1000f000 sscanf.DLL
[13:21:07] [debug] 73ab0000 - 73b05000 mswsock.dll
[13:21:07] [debug] 72c40000 - 72c51000 napinsp.dll
[13:21:07] [debug] 72c20000 - 72c36000 pnrpnsp.dll
[13:21:07] [debug] 72bd0000 - 72be3000 NLAapi.dll
[13:21:07] [debug] 734a0000 - 73534000 DNSAPI.dll
[13:21:07] [debug] 770d0000 - 770d7000 NSI.dll
[13:21:07] [debug] 73df0000 - 73e20000 IPHLPAPI.DLL
[13:21:07] [debug] 73b40000 - 73b4c000 winrnr.dll
[13:21:07] [debug] 72ba0000 - 72bc1000 mdnsNSP.dll
[13:21:07] [debug] 73440000 - 7348e000 fwpuclnt.dll
[13:21:07] [debug] 73d10000 - 73d29000 bcrypt.dll
[13:21:07] [debug] 73490000 - 73498000 rasadhlp.dll
[13:21:07] [debug] 71600000 - 71679000 uxtheme.dll
[13:21:07] [debug] 77780000 - 77877000 ole32.dll
[13:21:07] [debug] 736f0000 - 7386a000 PROPSYS.dll
[13:21:07] [debug] 75000000 - 75093000 OLEAUT32.dll
[13:21:07] [debug] 75800000 - 75882000 clbcatq.dll
[13:21:07] [debug] 738c0000 - 738d6000 CLDAPI.dll
[13:21:07] [debug] 73870000 - 738ab000 AEPIC.dll
[13:21:07] [debug] 738b0000 - 738b8000 FLTLIB.DLL
[13:21:07] [debug] 73b10000 - 73b38000 ntmarta.dll
[13:21:07] [debug] 73a60000 - 73a73000 cryptsp.dll
[13:21:07] [debug] 73110000 - 7314d000 edputil.dll
[13:21:07] [debug] 72560000 - 726ec000 urlmon.dll
[13:21:07] [debug] 74400000 - 74419000 imagehlp.dll
[13:21:07] [debug] 72340000 - 72559000 iertutil.dll
[13:21:07] [debug] 73020000 - 7307e000 msiso.dll
Reply
#2

help
Reply
#3

i need help
Reply
#4

SCMF is crashing your server.
You can use va_SendClientMessage from y_va from YSI libraries.
Reply
#5

how to use that? can u edit the code?
Reply
#6

If you are already using YSI (say, y_ini or y_hooks), then certainly use y_va:
pawn Код:
#include <YSI\y_va>

#define SCMF va_SendClientMessage
If not, then there's no reason to have another dependency (gasp, I said YSI is not the only right way, what the world has come to!).

http://forum.sa-mp.com/showpost.php?...postcount=4529 - I got the SendClientMessageEx from here and modified it to be like your SCMF:
pawn Код:
stock SCMF(playerid, color, const text[], {Float, _}:...)
{
    static
        args,
        str[144];

    /*
     *  Custom function that uses #emit to format variables into a string.
     *  This code is very fragile; touching any code here will cause crashing!
    */

    if ((args = numargs()) == 3)
    {
        if(playerid == INVALID_PLAYER_ID) {
            #pragma unused playerid
            return SendClientMessageToAll(color, text);
        } else {
            return SendClientMessage(playerid, color, text);
        }
    }
    else
    {
        while (--args >= 3)
        {
            #emit LCTRL 5
            #emit LOAD.alt args
            #emit SHL.C.alt 2
            #emit ADD.C 12
            #emit ADD
            #emit LOAD.I
            #emit PUSH.pri
        }
        #emit PUSH.S text
        #emit PUSH.C 144
        #emit PUSH.C str
        #emit PUSH.S 8
        #emit SYSREQ.C format
        #emit LCTRL 5
        #emit SCTRL 4

        if(playerid == INVALID_PLAYER_ID) {
            #pragma unused playerid
            return SendClientMessageToAll(color, text);
        } else {
            return SendClientMessage(playerid, color, text);
        }

        #emit RETN
    }
}
Reply
#7

Код:
C:\Uwn(73103) : error 025: function heading differs from prototype
.pwn(73103) : error 025: function heading differs from prototype
.pwn(73104) : error 021: symbol already defined: "va_SendClientMessage"
stock SCMF(playerid, color, const text[], {Float, _}:...)
{
Reply
#8

still crashing and i cant #define SCMF va_SendClientMessage
Reply
#9

Reread my post. One or the other - not both at the same time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)