Quick question about a command.
#8

Quote:
Originally Posted by sniperwars
Посмотреть сообщение
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."
Well mate as the users above said..

You can use new variable like:-

pawn Код:
new IsRadioOn[MAX_PLAYERS];
Now in the command or any place where YOU ARE PLAYING an AUDIO stream, put:

pawn Код:
IsRadioOn[playerid] = 1; // on music command maybe
And on the /radiooff command

pawn Код:
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;
}
This way you can detect if the radio is on.

Hope this helps

-FalconX
Reply


Messages In This Thread
Quick question about a command. - by sniperwars - 06.03.2012, 14:53
Re: Quick question about a command. - by GNGification - 06.03.2012, 15:19
Re: Quick question about a command. - by Campbell- - 06.03.2012, 16:27
Re: Quick question about a command. - by sniperwars - 06.03.2012, 16:35
Re: Quick question about a command. - by Campbell- - 06.03.2012, 16:49
Re: Quick question about a command. - by sniperwars - 06.03.2012, 17:15
Re: Quick question about a command. - by Campbell- - 06.03.2012, 17:22
Re: Quick question about a command. - by FalconX - 06.03.2012, 17:23
Re: Quick question about a command. - by sniperwars - 06.03.2012, 17:33
Re: Quick question about a command. - by FalconX - 06.03.2012, 17:34

Forum Jump:


Users browsing this thread: 2 Guest(s)