#1

This is my Command ...

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/radio", true))
{
new string[3000];
strcat(string,"{FF0000}Stop Radio\n");
strcat(string,"{0000FF}181.FM - POWER 181\n");
strcat(string,"{006400}181.FM - Chilled\n");
strcat(string,"{FF8C00}181.FM - Party\n");
strcat(string,"{008000}181.FM - Highway 181\n");
strcat(string,"{4B00B0}181.FM - Kickin' Country\n");
strcat(string,"{00FF00}COUNTRY 108\n");
strcat(string,"{FFC0CB}DEFJAY.COM - 100% R&B\n");
strcat(string,"{A52A2A}Antena1 SP 94,7 FM\n");
strcat(string,"{808080}idobi Radio\n");
strcat(string,"{FF0000}America Country Radio\n");
strcat(string,"{0000FF}Absolutely Smooth Jazz - SKY.FM\n");
strcat(string,"{006400}SmoothJazz.com Global Radio\n");
strcat(string,"{FF8C00}CnR Radio\n");
strcat(string,"{008000}))) POLSKASTACJA .PL )))\n");
strcat(string,"{4B00B0}NOISEfm.pl - Niezalezne Radio Rock\n");
strcat(string,"{00FF00}RadioTeenTal Indian and Bollywood\n");
strcat(string,"{FFC0CB}DUBSTEP.FM\n");
strcat(string,"{A52A2A}PARTY VIBE RADIO\n");
strcat(string,"{808080}RADIO ORO MARBELLA EN DIRECTO\n");
strcat(string,"{FF0000}Radio Nueva Vida\n");
strcat(string,"{4B00B0}Radio538\n");
strcat(string,"{A52A2A}Back2Noize Hardstyle\n");
strcat(string,"{0000FF}Radio Hardstyle\n");
strcat(string,"{A52A2A}Studio Brussel\n");
strcat(string,"{FFC0CB}MNM Belgium\n");
ShowPlayerDialog(playerid, RADIO, DIALOG_STYLE_LIST,"{ADD8E6}mmtech {90EE90}Radio",string,"Select","Cancel");
return 1;
}

I want to add if Player is not in a Vehicle = You are not in a Vehicle
and If he get out of Car "StopRadio"
Reply
#2

Use Search sometimes
Reply
#3

Quote:
Originally Posted by Clad
Посмотреть сообщение
Not helpfull....
Reply
#4

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/radio", true))
	{
		if(!IsPlayerInVehicle(playerid)){
			SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle); return 1;
		}
		new string[3000];
		strcat(string,"{FF0000}Stop Radio\n");
		strcat(string,"{0000FF}181.FM - POWER 181\n");
		strcat(string,"{006400}181.FM - Chilled\n");
		strcat(string,"{FF8C00}181.FM - Party\n");
		strcat(string,"{008000}181.FM - Highway 181\n");
		strcat(string,"{4B00B0}181.FM - Kickin' Country\n");
		strcat(string,"{00FF00}COUNTRY 108\n");
		strcat(string,"{FFC0CB}DEFJAY.COM - 100% R&B\n");
		strcat(string,"{A52A2A}Antena1 SP 94,7 FM\n");
		strcat(string,"{808080}idobi Radio\n");
		strcat(string,"{FF0000}America Country Radio\n");
		strcat(string,"{0000FF}Absolutely Smooth Jazz - SKY.FM\n");
		strcat(string,"{006400}SmoothJazz.com Global Radio\n");
		strcat(string,"{FF8C00}CnR Radio\n");
		strcat(string,"{008000}))) POLSKASTACJA .PL )))\n");
		strcat(string,"{4B00B0}NOISEfm.pl - Niezalezne Radio Rock\n");
		strcat(string,"{00FF00}RadioTeenTal Indian and Bollywood\n");
		strcat(string,"{FFC0CB}DUBSTEP.FM\n");
		strcat(string,"{A52A2A}PARTY VIBE RADIO\n");
		strcat(string,"{808080}RADIO ORO MARBELLA EN DIRECTO\n");
		strcat(string,"{FF0000}Radio Nueva Vida\n");
		strcat(string,"{4B00B0}Radio538\n");
		strcat(string,"{A52A2A}Back2Noize Hardstyle\n");
		strcat(string,"{0000FF}Radio Hardstyle\n");
		strcat(string,"{A52A2A}Studio Brussel\n");
		strcat(string,"{FFC0CB}MNM Belgium\n");
		ShowPlayerDialog(playerid, RADIO, DIALOG_STYLE_LIST,"{ADD8E6}mmtech {90EE90}Radio",string,"Select","Cancel");
		return 1;
	}
To stop the music, you'd have to do it in "OnPlayerStateChange"
Reply
#5

well, as Clad said.
The wiki is a big database, you can find it all

anyways, im going to explain all the stuff you want now.

okey, so you want to set a condition saying if a player is in a vehicle, he's abel to use the command.
if not, he's not abel to use it.
There's a great function called IsPlayerInAnyvehicle(playerid) which returns true (or 1) when he is in any kind of vehicle and false (or 0) when he's not.
now, lets put these words in code:
pawn Код:
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,_SomeRedColor_,"You're not in a vehicle!");
(hint: we could also use GetPlayerState or GetPlayerVehicleID or GetPlayerVehicleSeat to check this)


Simple as that.
Now lets move on, you want the music to stop when the player is exiting a vehicle?
there's a callback called OnPlayerExitVehicle
it gets called every time someone is leaving a vehicle (yes even when you die in a vehicle it gets called)
so perfect for us!
Quote:
Originally Posted by BKarner
Посмотреть сообщение
To stop the music, you'd have to do it in "OnPlayerStateChange"
or OnPlayerStateChange like BKarner said

we just add
pawn Код:
StopAudioStreamForPlayer(playerid);
to it and we're good to go.
well, now music will stop everytime when the player exits a vehicle.
you might not really want that, idk.
You could add some boolead which is set to "true" when radio is on and "false" when off
and then use it here in that callback.


that's about it
don't mind my bad english
Reply
#6

Thank you last 2 Posts very helpfull (+rep)
Reply
#7

Edit: I know this guy. I'm currently helping him with this.

Update: I got the /radio command working using OCMD. We will further testing it tomorrow.
Players can use /radio also without car now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)