Radio Script Need help
#1

oaky so this si my radio script, and the problem is that i want it so that you DONT NEED TO BE IN VEHICLE TO DO /RADIO CMD here is my filterscript
Код:
#include <a_samp>

public OnFilterScriptInit()
{
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

main(){}

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

	if (strcmp(cmd, "/Radio", 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: /radio off, /Radio 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, "setstation", "NRJ (Finland) \nDubStep\nElectro\nHipHop\nHouse\nJazz\nMetal\nPop\nR&B\nRock", "Set", "Close");
				return 1;
			}
			SendClientMessage(playerid, 0xFF330000, "USAGE: /Radio off, /Radio 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://149.5.240.22/WR-FI-finland");
							SendClientMessage(i, 0xFF330000, "Now Playing: NRJ (Finland)");
						}
					}
					return 1;
				}
				case 1:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://83.87.110.147/files/music/du_01.mp3");
							SendClientMessage(i, 0xFF330000, "Now Playing: DubStep");
						}
					}
					return 1;
				}
				case 2:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://83.87.110.147/files/music/el_01.mp3");
							SendClientMessage(i, 0xFF330000, "Now Playing: Electro");
						}
					}
					return 1;
				}
				case 3:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://83.87.110.147/files/music/hi_01.mp3");
							SendClientMessage(i, 0xFF330000, "Now Playing: HipHop");
						}
					}
					return 1;
				}
				case 4:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://83.87.110.147/files/music/ho_01.mp3");
							SendClientMessage(i, 0xFF330000, "Now Playing: House");
						}
					}
					return 1;
				}
				case 5:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://83.87.110.147/files/music/ja_01.mp3");
							SendClientMessage(i, 0xFF330000, "Now Playing: Jazz");
						}
					}
					return 1;
				}
				case 6:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://83.87.110.147/files/music/me_01.mp3");
							SendClientMessage(i, 0xFF330000, "Now Playing: Metal");
						}
					}
					return 1;
				}
				case 7:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://83.87.110.147/files/music/po_01.mp3");
							SendClientMessage(i, 0xFF330000, "Now Playing: Pop");
						}
					}
					return 1;
				}
				case 8:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377200");
							SendClientMessage(i, 0xFF330000, "Now Playing: Techno");
						}
					}
					return 1;
				}
				case 9:
				{
					new vehid = GetPlayerVehicleID(playerid);
					for(new i = 0; i<MAX_PLAYERS; i++)
					{
						if(IsPlayerInVehicle(i, vehid))
						{
							PlayAudioStreamForPlayer(i, "http://83.87.110.147/files/music/ro_01.mp3");
							SendClientMessage(i, 0xFF330000, "Now Playing: Rock");
						}
					}
					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
#2

any1?
Reply
#3

This is NOT your Filterscript, this has already been released.

EDIT: Use common sense "
Код:
if(IsPlayerInAnyVehicle(playerid
"
Reply
#4

and what do i edit in that?
Reply
#5

? what i edit ?
Reply
#6

Be Patient I am busy...
Remove stuff that looks like that (I.E PlayerInVehicle)
Reply
#7

Any1 help please
Reply
#8

Lol. Why did ya use my host (http://83.87.110.147/) in your script? You just copied those URL's from this script : https://sampforum.blast.hk/showthread.php?tid=306634

Just remove the car check:

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)