Player In Vehicle
#1

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
Reply
#2

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.
Reply
#3

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
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)