SA-MP Forums Archive
Player In Vehicle - 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: Player In Vehicle (/showthread.php?tid=436892)



Player In Vehicle - CurlyPwn - 13.05.2013

Quote:

if (strcmp("/radio", cmdtext, true, 10) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, "Notice", "You must be in a vehicle.", "Close", "");

ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "Radio", "Pulse87 NY \n", "Play", "Close");
return 1;
}

i want only the driver can use /radio and when u exit the vehicle the radio stops nd when u re enter the vehicle radio starts again also i want the other players in the vehicle to hear the radio but if they are not the driver and they write /radio it will say u must be the driver to use this command


Re: Player In Vehicle - RajatPawar - 13.05.2013

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_ONFOOT && oldstate == PLAYER_DRIVER)
            // Stop the radio
   else if(newstate == PLAYER_DRIVER && oldstate == PLAYER_ONFOOT)
          // Start it
   return 1;
}
I didn't remember the states, so check them on the wiki again.


Re: Player In Vehicle - CNRLIFE - 13.05.2013

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_ONFOOT && oldstate == PLAYER_DRIVER)
            // Stop the radio
   else if(newstate == PLAYER_DRIVER && oldstate == PLAYER_ONFOOT)
          // Start it
   return 1;
}
I didn't remember the states, so check them on the wiki again.
PLAYER_STATE_ONFOOT and PLAYER_STATE_DRIVER


Re: Player In Vehicle - CurlyPwn - 13.05.2013

i did the stop now how do i make the command know what radio station the user was on?