/musiclist 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: /musiclist command. (
/showthread.php?tid=439143)
/musiclist command. -
ESGaming - 24.05.2013
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.
Re: /musiclist command. -
Hoborific - 24.05.2013
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.)
Re: /musiclist command. -
ESGaming - 24.05.2013
I'm still new, and learning so i was wondering XD
Re: /musiclist command. -
Translator - 24.05.2013
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;
}
Re: /musiclist command. -
ESGaming - 24.05.2013
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.