I get error when i type command /report - 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: I get error when i type command /report (
/showthread.php?tid=388639)
I get error when i type command /report -
cecko1235 - 29.10.2012
When i use command /report or /akill my server shut down.Here is the error message
Код:
--------------------------
SA-MP Server: 0.3e-R2
Exception At Address: 0x0040531E Module: (samp-server.exe)
Registers:
EAX: 0x00000020 EBX: 0x00000052 ECX: 0x00000024 EDX: 0x7F62F000
ESI: 0x00000000 EDI: 0x0278A648 EBP: 0x00000000 ESP: 0x0013F558
EFLAGS: 0x00010202
Stack:
+0000: 0x00000052 0x00000000 0x0278A638 0x0013F580
+0010: 0x0000000E 0x0040575F 0x00000001 0x01B79290
+0020: 0x01CDBEF0 0x0000003F 0x0013F5E0 0x004010B6
+0030: 0x01CDBEF0 0x0278A648 0x00000001 0x66B5BF13
+0040: 0x01CDBEF0 0x0000000E 0x0013F654 0x0278A638
+0050: 0x66B74588 0x01B75B20 0x0013F5C0 0x025F6D44
+0060: 0x01CDBEF0 0x00000000 0x00000000 0x01CDBEF0
+0070: 0x00193BB8 0x0006C8F8 0x0000000E 0x66B6AE4B
+0080: 0xFFFFFFFF 0x0013F5F4 0x0013F5F4 0x66B63C32
+0090: 0x0000000E 0x0013F654 0x0278A638 0x0013F64C
+00A0: 0x66B66076 0x01CDBEF0 0x0000000E 0x0013F654
+00B0: 0x0278A638 0x0000001B 0x01B79290 0x00000000
+00C0: 0x0006CA44 0x02589020 0x00597030 0x00000000
+00D0: 0x00000000 0x0258A44C 0x00190DF8 0x00194DB8
+00E0: 0x025F6E90 0x00190DF8 0x00193BB8 0x001937A8
+00F0: 0x001937A8 0x0013F698 0x66B5C05A 0x00000000
+0100: 0x0013F6E4 0x0000001B 0x66B74588 0x01B75AC0
+0110: 0x0013F678 0x00000000 0x01CDBEF0 0x0AA1CB01
+0120: 0x00000001 0x01CDBEF0 0x00000000 0x00000008
+0130: 0x0000001B 0x66B6AE4B 0xFFFFFFFF 0x0013F6A8
--------------------------
Loaded Modules:
samp-server.exe A: 0x00400000 - 0x004F5000 (C:\Users\...\Downloads\samp03e_svr_R2_win32\samp-server.exe)
ntdll.dll A: 0x77950000 - 0x77AB9000 (C:\Windows\SYSTEM32\ntdll.dll)
KERNEL32.DLL A: 0x75A00000 - 0x75AF3000 (C:\Windows\system32\KERNEL32.DLL)
KERNELBASE.dll A: 0x75140000 - 0x751F9000 (C:\Windows\system32\KERNELBASE.dll)
apphelp.dll A: 0x74360000 - 0x74402000 (C:\Windows\system32\apphelp.dll)
SHELL32.dll A: 0x761A0000 - 0x7727A000 (C:\Windows\system32\SHELL32.dll)
USER32.dll A: 0x77460000 - 0x7757F000 (C:\Windows\system32\USER32.dll)
WSOCK32.dll A: 0x72E50000 - 0x72E57000 (C:\Windows\SYSTEM32\WSOCK32.dll)
WINMM.dll A: 0x70CF0000 - 0x70D11000 (C:\Windows\SYSTEM32\WINMM.dll)
msvcrt.dll A: 0x75B90000 - 0x75C41000 (C:\Windows\system32\msvcrt.dll)
combase.dll A: 0x75C50000 - 0x75D6E000 (C:\Windows\SYSTEM32\combase.dll)
SHLWAPI.dll A: 0x759C0000 - 0x75A00000 (C:\Windows\system32\SHLWAPI.dll)
GDI32.dll A: 0x775E0000 - 0x776E3000 (C:\Windows\system32\GDI32.dll)
WS2_32.dll A: 0x77310000 - 0x7735D000 (C:\Windows\system32\WS2_32.dll)
WINMMBASE.dll A: 0x70CB0000 - 0x70CD9000 (C:\Windows\SYSTEM32\WINMMBASE.dll)
RPCRT4.dll A: 0x77870000 - 0x7793C000 (C:\Windows\system32\RPCRT4.dll)
NSI.dll A: 0x759B0000 - 0x759B7000 (C:\Windows\system32\NSI.dll)
IMM32.DLL A: 0x75760000 - 0x7578A000 (C:\Windows\system32\IMM32.DLL)
MSCTF.dll A: 0x77360000 - 0x77439000 (C:\Windows\system32\MSCTF.dll)
nvStInit.dll A: 0x74F90000 - 0x74F97000 (C:\PROGRA~1\NVIDIA~1\3DVISI~1\nvStInit.dll)
PSAPI.DLL A: 0x77940000 - 0x77945000 (C:\Windows\system32\PSAPI.DLL)
ADVAPI32.dll A: 0x75DB0000 - 0x75E5B000 (C:\Windows\system32\ADVAPI32.dll)
MSVCR90.dll A: 0x74E40000 - 0x74EE3000 (C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6595_none_5095f45cbcb59f24\MSVCR90.dll)
sechost.dll A: 0x75D70000 - 0x75DA3000 (C:\Windows\SYSTEM32\sechost.dll)
streamer.dll A: 0x6A870000 - 0x6A8AF000 (C:\Users\...\Downloads\samp03e_svr_R2_win32\plugins\streamer.dll)
MSVCP100.dll A: 0x63330000 - 0x63399000 (C:\Windows\SYSTEM32\MSVCP100.dll)
MSVCR100.dll A: 0x63270000 - 0x6332E000 (C:\Windows\SYSTEM32\MSVCR100.dll)
mswsock.dll A: 0x74840000 - 0x7488A000 (C:\Windows\system32\mswsock.dll)
napinsp.dll A: 0x6E0F0000 - 0x6E100000 (C:\Windows\system32\napinsp.dll)
pnrpnsp.dll A: 0x6DC90000 - 0x6DCA4000 (C:\Windows\system32\pnrpnsp.dll)
NLAapi.dll A: 0x721B0000 - 0x721C0000 (C:\Windows\system32\NLAapi.dll)
DNSAPI.dll A: 0x746A0000 - 0x74714000 (C:\Windows\SYSTEM32\DNSAPI.dll)
winrnr.dll A: 0x6E100000 - 0x6E108000 (C:\Windows\System32\winrnr.dll)
IPHLPAPI.DLL A: 0x71250000 - 0x71272000 (C:\Windows\SYSTEM32\IPHLPAPI.DLL)
WINNSI.DLL A: 0x71230000 - 0x71237000 (C:\Windows\SYSTEM32\WINNSI.DLL)
rasadhlp.dll A: 0x6F2D0000 - 0x6F2D6000 (C:\Windows\System32\rasadhlp.dll)
and here is the report command:
Код:
if(strcmp(cmd, "/report", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new sendername[MAX_PLAYER_NAME], str50[256];
GetPlayerName(playerid, sendername, sizeof(sendername));
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /report [playerid/PartOfName] [text]");
return 1;
}
giveplayerid = strval(tmp);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /report [playerid/PartOfName] [text]");
return 1;
}
format(str50, sizeof(str50), "Report from %s(ID:%d) FOR %s(ID:%d): %s", sendername, playerid, PlayerName(giveplayerid), giveplayerid, (result));
ABroadCast(COLOR_RED,str50,1);
ReportLog(str50);
GameTextForPlayer(playerid,"~r~Your report has been sent to the admins",3000,4);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (PlayerInfo[i][pAdmin] >= 1)
{
if (PlayerInfo[i][aDuty] == 0)
{
format(string, sizeof(string), "%s(ID:%d) has sent report!PM to him if no one is On Duty.", sendername, playerid);
SendClientMessage(i, COLOR_RED, string);
}
}
}
}
}
return 1;
}
Re: I get error when i type command /report -
maramizo - 29.10.2012
I'd suggest you start using ZCMD and SSCANF.
pawn Код:
CMD:report(playerid, params[])
{
new giveplayerid, str[128];
if(sscanf(params,"us[128]", giveplayerid, str)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [PlayerID] [Reason].");
format(str, 128, "Report from %s(ID:%d) FOR %s(ID:%d): %s", PlayerName(playerid), playerid, PlayerName(giveplayerid), str);
ABroadCast(COLOR_RED,str,1);
ReportLog(str);
GameTextForPlayer(playerid,"~r~Your report has been sent to the admins",3000,4);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (PlayerInfo[i][pAdmin] >= 1)
{
if (PlayerInfo[i][aDuty] == 0)
{
format(string, sizeof(string), "%s(ID:%d) has sent report!PM to him if no one is On Duty.", sendername, playerid);
SendClientMessage(i, COLOR_RED, string);
}
}
}
}
return 1;
}
You can see 52 lines are now 24 lines.