MP3 Help
#3

First of all...
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mp3", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "MP3", "nRevenge - A Minecraft Parody of Usher's DJ got us fallin' love\nOppa Gangnam Style - PSY\nMine - Minecraft Parody of Fly (Nicki Minaj)\nWelcome to the jungle - GunN'Roses\nDiamond - Rihanna\nET - Katy Perry\nLeave out all the rest - Linkin Park\nIn The End - Linkin Park\nTNT - A Minecraft Parody of Cruz's Dynamite ", "Play", "Cancel");
        return 1;
    }
    return 1;
}
Basically, the '10' you've inserted into this line, means the LENGTH OF THE STRING, in this case /mp3 is not 10 cells long, it's 4... so really, you can just remove this, leaving you with:
pawn Код:
if(strcmp(cmdtext, "/mp3", true) == 0)
Secondly, your OnPlayerCommandText should return 0, not 1. If it returns 0, and the command does not exist, it will show this to the player: "SERVER: Unknown Command". However, if you return 1, it means the command exists.

So your finished code will be:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mp3", cmdtext, true) == 0)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "MP3", "nRevenge - A Minecraft Parody of Usher's DJ got us fallin' love\nOppa Gangnam Style - PSY\nMine - Minecraft Parody of Fly (Nicki Minaj)\nWelcome to the jungle - GunN'Roses\nDiamond - Rihanna\nET - Katy Perry\nLeave out all the rest - Linkin Park\nIn The End - Linkin Park\nTNT - A Minecraft Parody of Cruz's Dynamite ", "Play", "Cancel");
        return 1;
    }
    return 0;
}
However, I would also take ******' recommendation into account, as there are much more efficient command processors, like y_commands for example...
Reply


Messages In This Thread
MP3 Help - by YahyaBR - 04.03.2013, 11:24
Re: MP3 Help - by YahyaBR - 04.03.2013, 11:35
Re: MP3 Help - by Threshold - 04.03.2013, 11:56
Re: MP3 Help - by YahyaBR - 04.03.2013, 12:27
Re: MP3 Help - by YahyaBR - 04.03.2013, 13:31

Forum Jump:


Users browsing this thread: 2 Guest(s)