Radio System Error
#1

Well I type the commands to play a station in game. And I cannot hear the music, I have the audio plugin and everything. But here is the script for it.

Код:
/*
			Sample Radio Script by Danny

		  /////,^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
		 o^ %xxxx333333oo33oo3o33333333333oo  /
		 u  M             iPod      |||||  M  /
		 u  M                              N  ,
		 u  M  Music                    >  H  ,
		 u^ M                              H  ,
		 u^ M  Extras                   >  H  ,
		 u^ M                              H  ,
		 u^ M  Settings                 >  H  ,
		 u^^M                              H  ,
		 u^^M  Shuffle Songs            >  H  ^
		 u^^M                              H  ^
		 X^^M  Backlight                >  H  ^
		 X^^Nyyyyyyyyyyyyyyyy88888888888888M  ^
		 X,,,^^^^^^^^^                        ^
		 X,,,,,^^^^^^^^                       ^
		 X,,,,,^^^^^^^^   ^^^^                ^
		 X,,,,,,^^^^^^,///,//////,            ^
		 X,,,,,,,^^,///(<<<<<<<<</(/^         ^
		 X,,,,,,,,/<<(<<<<<<<<<<<<(<</        ^
		 X,/,,,,,(&<<<<<&&////<&&<<<&&/       ^
		 X///,,,/&&&&%%&/      /&&<<&&&^      ^
		 X//////<(//%%%%        <%%%////      ^
		 X//////<%ooooo3^       %ooooo%/      ,
		 X///////o3333333<,^^^/o333oo33,      ,
		 8///////<33333333333333333333/^^     ,
		 8/////////%333xxxxxxxxxx333%/^^^^^   ,
		 8/<<(///////&3xxx%%o%xx3o&/,^^^^^^^  ,
		 y(<<<</////////(<&&&<<//,,,^^^^^^^^^ /
		 y<<<<<<//////////////,,,,,,,,^^^^^^^^/
		 8(<<<<<(//////////////,,,,,,,,^^^^^^^<
		  uu3o%%%&&<<<<<<(/////////////////CJ<^
		  ^,,////////////////////////////,,^^
*/

#include <a_samp>
#include <audio>

public OnFilterScriptInit()
{
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

main(){}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[128], id;
	cmd = strtok(cmdtext, id);

	if (strcmp(cmd, "/sterio", true) == 0)
	{
		if(IsPlayerInAnyVehicle(playerid) == 1 && GetPlayerVehicleSeat(playerid) == 0)
		{
			new tmp[128], vehid;
			tmp = strtok(cmdtext, id);
			if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFF330000, "USAGE: /sterio off, /sterio setstation");
			else if(strcmp(tmp, "off", true) == 0)
			{
				vehid = GetPlayerVehicleID(playerid);
				for(new i; i<MAX_PLAYERS; i++)
				{
					if(IsPlayerInVehicle(i, vehid))
					{
						StopAudioStreamForPlayer(i);
					}
				}
				return 1;
			}
			else if(strcmp(tmp, "setstation", true) == 0)
			{
				ShowPlayerDialog(playerid, 9998, DIALOG_STYLE_LIST, "Radio Stations", "Radio FG (House) \nUnderground FG (House)\nKiss 100(UK)", "Set", "Close");
				return 1;
			}
			SendClientMessage(playerid, 0xFF330000, "USAGE: /sterio off, /sterio setstation");
			return 1;
		}
		else
		{
			SendClientMessage(playerid, 0xFF330000, "SERVER: You need to be in the drivers seat of a vehicle to use this command!");
			return 1;
		}
	}
	return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
		case 9998:
		{
			if(!response) return SendClientMessage(playerid, 0xFF330000, "You did not select a station!");
			switch(listitem)
			{
				case 0:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://205.188.215.228:8002/listen.pls");
							SendClientMessage(i, 0xFF330000, "Now Playing: 181.FM The Hits");
						}
					}
					return 1;
				}
				case 1:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://www.radiofg.com/streams/fgu.pls");
							SendClientMessage(i, 0xFF330000, "Now Playing: Underground FG");
						}
					}
					return 1;
				}
				case 2:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://www.radiofeeds.co.uk/112s.png");
							SendClientMessage(i, 0xFF330000, "Now Playing: Kiss 100");
						}
					}
					return 1;
				}
			}
		}
	}
	return 1;
}

strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
Reply


Messages In This Thread
Radio System Error - by Johnny_Robins - 30.06.2012, 23:14
Re: Radio System Error - by Johnny_Robins - 01.07.2012, 04:56

Forum Jump:


Users browsing this thread: 1 Guest(s)