Exception At Address: 0x004A75C8
#1

Ok anyone have any idea why this is happening?

Whats happening is whenever i use the number '0' as a param for my heal command my server closes (works fine with other numbers). Nothing happens in server.log but it gets logged in crashinfo.txt.

heres the command (note iv stripped it down alot to try and find whats wrong).
pawn Код:
YCMD:heal(playerid, params[], help)
{
    if(help)
    {
    }
    else
    {
        if(ij_PlayerData[playerid][ingang] == MEDIC_GROUP)
        {
            new
                id;
            if(sscanf(params, "i", id))return SendClientMessage(playerid, ERROR_RED, "ERROR: Usage /heal [id/name]");//changed the specifier from 'u' to 'i' no luck
            SendClientMessageToAll(CYAN, "EXECUTED");//this is where the server closes note: it doesn't get executed.
            SetPVarInt(id, "healerid", playerid);
            SendClientMessage(id, CYAN, "|MEDIC MESSAGE|: %s is attempting to heal you please use /healaccept to bring up a medic menu.");
            return 1;
        }
        else SendClientMessage(playerid, ERROR_RED, "ERROR: You are not a medic");
    }
    return 1;
}
And here is the crashinfo log.
Код:
--------------------------

SA-MP Server: 0.3c



Exception At Address: 0x004A75C8



Registers:

EAX: 0x44454D7C	EBX: 0x02393E73	ECX: 0x7FFFFFFE	EDX: 0x0012ED40

ESI: 0x0012E998	EDI: 0x0012F16F	EBP: 0x0012E9E4	ESP: 0x0012E958

EFLAGS: 0x00010202



Stack:

+0000: 0x0012F130   0x0012ED30   0x02393EE4   0x009B6B10

+0010: 0x7C9101DB   0x0012E95C   0x004A6BC4   0x00000007

+0020: 0x00000000   0x004C1198   0x00000000   0x00000000

+0030: 0x00000000   0x00000000   0x00000000   0x00000007

+0040: 0x00000011   0x00000000   0x44454D7C   0xFFFFFFFF

+0050: 0x00000000   0x0012F2F8   0x00000000   0x004A72F7

+0060: 0x0012F190   0x0012ED90   0x004A7870   0x00000003

+0070: 0x00000008   0x00000000   0x001207C0   0x00000000

+0080: 0x00000000   0x00000000   0x009B6B10   0x00000000

+0090: 0x00000000   0x0012F204   0x00000001   0x00000003

+00A0: 0x00000008   0x00000000   0x000007C0   0x00000000

+00B0: 0x0046CC1C   0x0012F204   0x00000001   0x0046CA83

+00C0: 0x00000001   0x004BD5B8   0xFFFFFFFF   0x0000009C

+00D0: 0x00000800   0x00000000   0x0012EA35   0xD0611701

+00E0: 0xE0FFAF0A   0x00008000   0x54845504   0x0046CA83

+00F0: 0x00000001   0x004BD5B8   0xFFFFFFFF   0x0000009C

+0100: 0x00000800   0x00000000   0x0012EA65   0xD0611701

+0110: 0xE0FFAF0A   0x00008000   0x54845504   0x54445535

+0120: 0x009B0140   0x023574A4   0x01E97D80   0x00000012

+0130: 0x00000004   0x00000000   0x01EF5A10   0x00401096
Any help is very VERY much appreciated i've never had a problem like this before. If you need anymore info please ask and ill answer asap.

EDIT: Just to make it more clear, if i do "/heal 1" its fine, works well. But if do "/heal 0" the server closes and gives me this exeption.
All my other commands work ok using "0" as a parameter.

EDIT 2: I think it might have had something to do with sscanf. I re-wrote the command w/o sscanf and it works. More code but at least it works.

pawn Код:
YCMD:heal(playerid, params[], help)
{
    if(help)
    {
    }
    else
    {
        if(ij_PlayerData[playerid][ingang] == MEDIC_GROUP)
        {
            new
                id;
            if(isnumeric(params))
            {
                id = strval(params);
                if(IsPlayerConnected(id))
                {
                    new
                        str[128];
                    format(str, sizeof(str), "|MEDIC MESSAGE|: %s is attempting to heal you please use /healaccept to bring up a medic menu.", playername(playerid));
                    SetPVarInt(id, "healerid", playerid);
                    SendClientMessage(id, CYAN, str);
                    return 1;
                }
                else SendClientMessage(playerid, ERROR_RED, "Player Not Found");
            }
            else
            {
                id = INVALID_PLAYER_ID;
                foreach(Player, i)
                {
                    if(!strcmp(params, playername(i)))
                    {
                        id = i;
                        break;
                    }
                }
                if(id != INVALID_PLAYER_ID)
                {
                    new
                        str[128];
                    format(str, sizeof(str), "|MEDIC MESSAGE|: %s is attempting to heal you please use /healaccept to bring up a medic menu.", playername(playerid));
                    SetPVarInt(id, "healerid", playerid);
                    SendClientMessage(id, CYAN, str);
                    return 1;
                }
                else SendClientMessage(playerid, ERROR_RED, "Player Not Found");
            }
        }
        else SendClientMessage(playerid, ERROR_RED, "ERROR: You are not a medic");
    }
    return 1;
}
Reply
#2

Quote:

if(sscanf(params, "i", id))

to
Quote:

if(sscanf(params, "u", id))

4char
Reply
#3

If you read the comment you will see that i did use 'u' and then with 'i' both should work. Its just one can take a string (which wasn't my problem).

I ended up using different code that did work anyway.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)