/musiclist command.
#1

So, I've decided to make a listing command to list songs on my web server for players to /play.

However, here's the issue. I'm a little stuck on how i should define everything and all that.


Here's the non-working code i currently have.

pawn Код:
CMD:music(playerid, params[])
{
    if(sscanf(params,"s[250]",cmdstr)) return SendClientMessage(playerid, YELLOW, "USAGE: /music [House / Country / Rap / Other]");
    {
        case 1:
        {
            if(cmdstr == house)
            {
                return 1;
            }
        }
           
    }
    return 0;
}
What am I doing wrong? What would be a better way to approach this?

EDIT: notice i didn't place in the SendClientMessages and things yet.
Reply
#2

That's not how you use a switch/case, I recommend an enumerator for the music stations ( so you can case switch them, or just use strcmp.)
Reply
#3

I'm still new, and learning so i was wondering XD
Reply
#4

You could try this, i'm not sure if you want it like this but you can use dialogs too;

pawn Код:
CMD:music(playerid, params[])
    {
       new
       input[32];
       if(sscanf(params,"s[32]",input)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /music [House / Country / Rap / Other]");
       if(strcmp(input,"house",true) == 0)
    {
       SendClientMessage(playerid, COLOR_GREY, "You're now listening to house music.");
       return 1;
    }
       if(strcmp(input,"country",true) == 0)
    {
    SendClientMessage(playerid, COLOR_GREY, "You're now listening to country music.");
    }
       return 1;
    }
Reply
#5

Quote:
Originally Posted by Translator
Посмотреть сообщение
You could try this, i'm not sure if you want it like this but you can use dialogs too;

pawn Код:
CMD:music(playerid, params[])
    {
       new
       input[32];
       if(sscanf(params,"s[32]",input)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /music [House / Country / Rap / Other]");
       if(strcmp(input,"house",true) == 0)
    {
       SendClientMessage(playerid, COLOR_GREY, "You're now listening to house music.");
       return 1;
    }
       if(strcmp(input,"country",true) == 0)
    {
    SendClientMessage(playerid, COLOR_GREY, "You're now listening to country music.");
    }
       return 1;
    }
That's sort of how i wanted to do it, only i'm going to send a client message with a list of songs for them to /play.


I can edit this though and make it fit.


Thanks broski.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)