Not play music if the player is in car
#1

Sorry for my bad english, i have made boombox system but i have one problem, when te player drive the car and listen music in the car, stream from boombox on the street appears in hes car, and that makes the problem.
Can you guys help me to solve that problem, in this checks make if player is in car to not play music for him?

Код:
public OnPlayerEnterDynamicArea(playerid, areaid)
{
	foreach(new i : Player)
	{
	    if(GetPVarType(i, "BBArea"))
	    {
	        if(areaid == GetPVarInt(i, "BBArea"))
	        {
	            new station[256];
	            GetPVarString(i, "BBStation", station, sizeof(station));
	            if(!isnull(station))
				{
					PlayStream(playerid, station, GetPVarFloat(i, "BBX"), GetPVarFloat(i, "BBY"), GetPVarFloat(i, "BBZ"), 30.0, 1);
	            }
				return 1;
	        }
	    }
	}
	return 1;
}
And this if you want:
Код:
stock PlayStream(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
{
	if(GetPVarType(playerid, "pAudioStream")) StopAudioStreamForPlayer(playerid);
	else SetPVarInt(playerid, "pAudioStream", 1);
    PlayAudioStreamForPlayer(playerid, url, posX, posY, posZ, distance, usepos);
}
Reply
#2

https://sampwiki.blast.hk/wiki/GetPlayerState

PHP код:
new tempstate GetPlayerState(i);
if(
tempstate==PLAYER_STATE_DRIVER||tempstate==PLAYER_STATE_PASSENGER
This will make for a check that you would deny the stream based on them being in a car.

PHP код:
if(tempstate==PLAYER_STATE_DRIVER||tempstate==PLAYER_STATE_PASSENGER
This will make a check to confirm that they are not in a car, and able to be ready to hear the stream.

PHP код:
if(tempstate==PLAYER_STATE_DRIVER&&tempstate==PLAYER_STATE_PASSENGER
Notice the OR (||) versus the AND (&&) in each of them. (Don't use both, it's highly likely the simplest usage of it would be the && check in your application).
Reply
#3

Doesn't work, can you please help me with importing that in my code? Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)