28.06.2014, 03:28
Como posso adicionar nesse comando que ele nгo tem um mp3player?
Esse й pra qm tem PlayerInfo[playerid][pSom] = 1;
pawn Код:
if(strcmp(cmd, "/music", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pCrashed])
{
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr)) {
SendClientMessage(playerid, COLOR_WHITE, "|__________________ Music __________________|");
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /music [name]");
SendClientMessage(playerid, COLOR_GREY, "Available names: On, Off, Next");
SendClientMessage(playerid, COLOR_WHITE, "|___________________________________________|");
return 1;
}
if(strcmp(x_nr,"on",true) == 0)
{
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~g~CD Player On", 5000, 5);
new channel = Music[playerid];
PlayerPlaySound(playerid, Songs[channel][0], 0.0, 0.0, 0.0);
}
else if(strcmp(x_nr,"off",true) == 0)
{
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~r~CD Player Off", 5000, 5);
PlayerFixRadio(playerid);
}
else if(strcmp(x_nr,"next",true) == 0)
{
if(Music[playerid] == 0) { Music[playerid] = 1; }
else if(Music[playerid] == 1) { Music[playerid] = 2; }
else if(Music[playerid] == 2) { Music[playerid] = 3; }
else if(Music[playerid] == 3) { Music[playerid] = 4; }
else if(Music[playerid] == 4) { Music[playerid] = 5; }
else if(Music[playerid] == 5) { Music[playerid] = 6; }
else if(Music[playerid] == 6) { Music[playerid] = 0; }
new channel = Music[playerid];
PlayerPlaySound(playerid, Songs[channel][0], 0.0, 0.0, 0.0);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Unknown music command !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You don't have a CD-Player !");
return 1;
}
}
return 1;
}