28.06.2014, 03:51
Simples, substitua pela variбvel mp3player.
Se nгo tiver, crie uma
Logo sete-a no comando de comprar MP3 com o valor de true
Agora sу checar se a variбvel esta com o valor de true
Se nгo tiver, crie uma
pawn Код:
new bool:mp3player[MAX_PLAYERS];
pawn Код:
if(strcmp(cmd, "/mp3", true) == 0)
{
if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, -1, "Vocк nгo tem 100 reais para comprar!");
if(mp3player[playerid] == true) return SendClientMessage(playerid, "Vocк jб tem um MP3 Player!");
SendClientMessage(playerid, "Vocк adquiriu um MP3 Player!");
mp3player[playerid] = true;
}
pawn Код:
if(strcmp(cmd, "/music", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(mp3player[playerid] == true)//here
{
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, "Vocк nгo tem um MP3 Player!");
return 1;
}
}
return 1;
}