Car Radio Please Help
#1

Hello, Well I decided to make a script for car radios, so players will be able to hear the streamed music if they are inside of a car. I made a dialog and added stations, but one more thing I want todo is to make it so that only a driver will be able to use/see the dialog and the passengers will be able only to hear the station that the driver had chosen. I know I need to create a viriable somehow, But I never did that before, so I have no idea how, can someone help me with it?

Here is the code that maybe needed

Код:
if(GetPlayerState(playerid)== PLAYER_STATE_DRIVER)
	{
    if(strcmp(cmdtext, "/tests", true) == 0)
    {
	ShowPlayerDialog(playerid,33,DIALOG_STYLE_LIST,"Music:","\n1.Radio 1\n2.Radio 2\n3.Radio 3\n4.Radio 4","Buy","Cancel");
	}
	}
	else
	{
	if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
	{
	SendClientMessage(playerid,YELLOW,"You are not in a car");
	}
	return 1;
	}
Reply
#2

Check if the state is PLAYER_STATE_DRIVER when command is used,
on command run a loop (foreach) and play it to everyone in the same vehicle as driver.
Reply
#3

Could you explain a lil bit more please? Im really having problems with understand this xD

Maybe a little example, I tried to read about Loops but it didnt help me much
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)