SA-MP Forums Archive
unknown command. - 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: unknown command. (/showthread.php?tid=361746)



unknown command. - The__ - 22.07.2012

pawn Код:
dcmd_boombox(playerid, params[])
{
    new string[128];
    if(PlayerInfo[playerid][pBoombox] == 1)
    {
        if(!Boombox[playerid])
        {
            if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /boombox [music url]");
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                        if(Boombox[i])
                        {
                            if(IsPlayerInRangeOfPoint(playerid, 30, bpos[i][0], bpos[i][1], bpos[i][2]))
                            {
                                SendClientMessage(playerid, COLOR_GREY, " There is another boombox nearby, place yours somewhere else.");
                                return 1;
                            }
                        }
                }
            }
            Boombox[playerid] = 1;
            format(string, sizeof(string), " You have placed your boombox at your location.");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            GetPlayerPos(playerid, bpos[playerid][0], bpos[playerid][1], bpos[playerid][2]); bpos[playerid][2] = bpos[playerid][2] - 1;
            GetPlayerFacingAngle(playerid, bpos[playerid][3]); bpos[playerid][3] = bpos[playerid][3] +180;
            BoomboxObject[playerid] = CreateDynamicObject(2103, bpos[playerid][0], bpos[playerid][1], bpos[playerid][2], 0, 0, bpos[playerid][3]);
            format(BoomboxURL[playerid], 256, "%s", params);
        }
        else
        {
            Boombox[playerid] = 0;
            format(string, sizeof(string), " You have removed your boombox.");
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            DestroyDynamicObject(BoomboxObject[playerid]);
            format(BoomboxURL[playerid], 256, "");
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    if(BoomboxPlayer[i] == playerid)
                    {
                        BoomboxStream[i] = 0;
                        BoomboxPlayer[i] = -1;
                        StopAudioStreamForPlayer(i);
                        SendClientMessage(i, COLOR_GREY, " The boombox creator has removed his boombox.");
                    }
                }
            }
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You don't have a boombox, buy one at the 24/7 for $125.");
        return 1;
    }
    return 1;
}
Says unknown command, what's the bug here ?


Re: unknown command. - Kindred - 22.07.2012

All looks fine, did you actually add this under OnPlayerCommandText?

pawn Код:
dcmd(boombox,7,cmdtext);



Re: unknown command. - The__ - 22.07.2012

Nvm, fixed .