if (strcmp("/stopradio", cmdtext, true, 10) == 0)
{
StopAudioStreamForPlayer(playerid);
SendClientMessage(playerid, COLOR_RED, "You have turned off the radio.");
return 1;
}
if (strcmp("/stopradio", cmdtext, true, 10) == 0) { if(Radio[playerid] = 1) { StopAudioStreamForPlayer(playerid) && SendClientMessage(playerid, COLOR_RED, "You have turned off the radio."); return 1; }
new bool:radio_on;
if (strcmp("/stopradio", cmdtext, true, 10) == 0)
{
if(radio_on == TRUE)
{
StopAudioStreamForPlayer(playerid);
SendClientMessage(playerid, COLOR_RED, "You have turned off the radio.");
radio_on = FALSE;
}
else
{
/* ... */
}
return 1;
}
I want the /stopradio command to detect if the radio is off.
If the radio is off, I want It to send a client message saying "The radio is already turned off." |
new bool:radio_on; /* You have to use this bool in an enum or anywhere else so you can also use it in /startradio. */
if (strcmp("/stopradio", cmdtext, true, 10) == 0)
{
if(radio_on == TRUE)
{
StopAudioStreamForPlayer(playerid);
SendClientMessage(playerid, COLOR_RED, "You have turned off the radio.");
radio_on = FALSE;
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "The radio is already turned off.");
}
I want the /stopradio command to detect if the radio is off.
If the radio is off, I want It to send a client message saying "The radio is already turned off." |
new IsRadioOn[MAX_PLAYERS];
IsRadioOn[playerid] = 1; // on music command maybe
if (strcmp("stopradio", cmdtext, true, 10) == 0)
{
if(IsRadioOn[playerid] == 1)
{
StopAudioStreamForPlayer(playerid);
SendClientMessage(playerid, COLOR_RED, "You have turned off the radio.");
IsRadioOn[playerid] = 0;
}
else
{
SendClientMessage(playerid, -1, "The radio is NOT on");
}
return 1;
}
if (strcmp("/stopradio", cmdtext, true, 10) == 0)
{
if(IsRadioOn[playerid] == 1)
{
StopAudioStreamForPlayer(playerid);
SendClientMessage(playerid, COLOR_RED, "You have turned off the radio.");
IsRadioOn[playerid] = 0;
}
else
{
SendClientMessage(playerid, -1, "The radio is NOT on");
}
return 1;
}