Car Radio Please Help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Car Radio Please Help (
/showthread.php?tid=304089)
Car Radio Please Help -
Compton - 16.12.2011
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;
}
Re: Car Radio Please Help -
Johnson_boy - 16.12.2011
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.
Re: Car Radio Please Help -
Compton - 16.12.2011
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