/(w)hisper crashes the server lol wtf
#1

this command compiles perfectly...but when someone uses it ingame it crashes the server

pawn Код:
COMMAND:w(playerid, params[])
{
    return cmd_whisper(playerid, params);
}
COMMAND:whisper(playerid, params[])
{
    if (PlayerInfo[playerid][pSpawn] == 1){

        new COLOR = GetPlayerColor(playerid);

        new idx,string[512],length = strlen(params);
        while ((idx < length) && (params[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[512];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = params[idx];
            idx++;
        }
        result[idx - offset] = EOS;

        if (PlayerInfo[playerid][pMute] == 1)
        {
            SCM(playerid,COLOR_ERROR,"#Error: You Muted.");
            return 1;
        }

        if (!strlen(result))
        {
            SendClientMessage(playerid, COLOR_ERROR, "USAGE: /whisper (message).");
            return 1;
        }

        format(string, sizeof(string), "(WHISPER) %s (%d): %s",PlayerInfo[playerid][pName],playerid,result);
        SendClientMessage(playerid,COLOR, string);
        for (new i = 0; i < GetMaxPlayers(); i++)
        {

            i = GetClosestPlayer(playerid);
            if (IsPlayerConnected(i))
            {
                if (i != playerid)
                {
                    if (GetDistanceBetweenPlayers(playerid, i) < 10)
                    {
                        SendClientMessage(i,COLOR, string);
                    }
                }
            }
        }

    }else{
        SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead.");
    }

    return 1;
}
Reply


Messages In This Thread
/(w)hisper crashes the server lol wtf - by Ritzy2K - 24.03.2015, 09:52
Re: /(w)hisper crashes the server lol wtf - by ATGOggy - 24.03.2015, 10:16
Re: /(w)hisper crashes the server lol wtf - by KayJ - 24.03.2015, 10:37
Re: /(w)hisper crashes the server lol wtf - by Sew_Sumi - 24.03.2015, 11:29
Re: /(w)hisper crashes the server lol wtf - by BroZeus - 24.03.2015, 11:54
Re: /(w)hisper crashes the server lol wtf - by Sew_Sumi - 24.03.2015, 13:07
Re: /(w)hisper crashes the server lol wtf - by SickAttack - 24.03.2015, 13:12

Forum Jump:


Users browsing this thread: 1 Guest(s)