Little strtok problem on /report command
#10

If the reason is blank then your code is wrong. Why would "Reason" not be a string?.
And why don't you use sscanf?

pawn Код:
dcmd_report(playerid, params[])
{
    new giveplayer, reason[24], string[64], player[MAX_PLAYER_NAME];;
    if (sscanf(params, "us", giveplayer, reason)) return SendClientMessage(playerid, COLOR_YELLOW, "[ERROR] Right Usage: /report [ID/Part of Name] [Reason]");
    else
    {
        GetPlayerName(playerid, player, sizeof(player));
        format(string, 128, "[REPORT] [%d]%s reported [%d]%s || reason: %s", playerid, player, giveplayer, giveplayer, reason);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(PInfo[i][Level] >= 1)
            {
                SendClientMessage(i, LIGHTBLUE, string);
            }
        }
        return 1;
    }
}
This makes alot more sense.
Reply


Messages In This Thread
Little strtok problem on /report command - by Mean - 06.01.2011, 15:13
Re: Little strtok problem on /report command - by Kyle - 06.01.2011, 15:24
Re: Little strtok problem on /report command - by Mean - 06.01.2011, 15:26
Re: Little strtok problem on /report command - by Kaylux - 06.01.2011, 15:32
Re: Little strtok problem on /report command - by Mean - 06.01.2011, 15:35
Re: Little strtok problem on /report command - by bartje01 - 06.01.2011, 15:38
Re: Little strtok problem on /report command - by Mean - 06.01.2011, 15:42
Re: Little strtok problem on /report command - by Ash. - 06.01.2011, 15:44
Re: Little strtok problem on /report command - by bartje01 - 06.01.2011, 15:57
Re: Little strtok problem on /report command - by Kaylux - 06.01.2011, 17:17

Forum Jump:


Users browsing this thread: 1 Guest(s)