[HELP] Pullover CMD + Voice Stream
#1

Hi guys, I have a pullover command for Law Enforcement.

Quote:
Код:
dcmd_pullover(playerid, params[])
{
	new string[128];
	new ID;
	new playername[MAX_PLAYER_NAME];
	new tname[MAX_PLAYER_NAME];
	if(gTeam[playerid] == CIVILIAN) // To check if  player is NOT Law Enforcement
	{
	    SendClientMessage(playerid,COLOR_RED,"[ERROR] Only Law Enforcement Officers can use this command.");
	    return 1;
	}
	if(sscanf(params, "u", ID))
	{
		SendClientMessage(playerid,COLOR_RED,"[USAGE]: /pullover (PlayerName/PlayerID)");
		return 1;
	}
	if(!IsPlayerConnected(ID)) // If entered wrong ID, it will send a message that u entered a wrong id.
	{
		format(string,sizeof(string),"[ERROR] The ID you entered is not connected to the server.");
		SendClientMessage(playerid,COLOR_RED,string);
		return 1;
	}
	if(playerid == ID) // if you're asking yourself to pullover
	{
	    SendClientMessage(playerid,COLOR_RED,"[ERROR] You cannot ask yourself to pullover!");
	    return 1;
	}
	// Removed IsSpawned
	GetPlayerName(playerid,playername,sizeof(playername));
	GetPlayerName(ID,tname,sizeof(tname));
	if(GetDistanceBetweenPlayers(playerid,ID) > 30)
	{
		format(string,sizeof(string),"[ERROR] %s(%d) is too far away to ask them to pullover.",tname,ID);
		SendClientMessage(playerid,COLOR_RED,string);
		return  1;
	}
	if(IsPlayerInAnyVehicle(ID) == 0) // Doesnt need defining, checking if ID is not in a vehicle
	{
	    format(string,sizeof(string),"[ERROR] %s(%d) must be in a vehicle in order to ask them to pullover.",tname,ID);
	    SendClientMessage(playerid,COLOR_RED,string);
	    return 1;
	}
	// The stage to pullover the suspect
	format(string,sizeof(string),"[POLICE] Law Enforcement Officer %s(%d) asked you to pullover.",playername,playerid);
	SendClientMessage(ID,COLOR_LIGHTBLUE,string);
	format(string, sizeof(string), "~b~This is SAPD, pull over your vehicle now!");
	GameTextForPlayer(ID, string, 2000, 5);
	
	format(string,sizeof(string), "[POLICE] You have asked %s(%d) to pull over.",tname,ID);
	SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
	return 1;
}
So I wanna stream (LOCALLY not globally) a megaphone voice FOR the suspect, how do I do it?
megaphone voice pullover link: http://mfi.re/listen/l9xh508wgr0v991/Pull_Over2.mp3

Other questions: Medic can use the pullover command. I wanna make it Law Enforcement (Cops) only. How to fix this?

Your help will be very appreciated. Thanks
Reply
#2

PlayAudioStreamForPlayer

Stream source: pullover.mp3
Reply
#3

okay that's my script I posted,
see
pawn Код:
if(gTeam[playerid] == TEAM_CIVIL) //make it
if(gTeam[playerid] != TEAM_COPS)
Reply
#4

Quote:
Originally Posted by Vanter
Посмотреть сообщение
okay that's my script I posted,
see
pawn Код:
if(gTeam[playerid] == TEAM_CIVIL) //make it
if(gTeam[playerid] != TEAM_COPS)
Do you know what this guy wants?
Reply
#5

Код:
Medic can use the pullover command. I wanna make it Law Enforcement (Cops) only. How to fix this?
Oh no I don't.
Reply
#6

Quote:
Originally Posted by RedJohn
Посмотреть сообщение
Where do I exactly put the PlayAudioStreamForPlayer and the link? Under/Above where?
Reply
#7

With the pull over client messages.
down at the bottom of the command
Reply
#8

pawn Код:
dcmd_pullover(playerid, params[])
{
    new string[128], ID, playername[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME], Float:Position[6], Float:Distance = 5.0;
    if(gTeam[playerid] == CIVILIAN) // To check if  player is NOT Law Enforcement
    {
        SendClientMessage(playerid,COLOR_RED,"[ERROR] Only Law Enforcement Officers can use this command.");
        return 1;
    }
    if(sscanf(params, "u", ID))
    {
        SendClientMessage(playerid,COLOR_RED,"[USAGE]: /pullover (PlayerName/PlayerID)");
        return 1;
    }
    if(!IsPlayerConnected(ID)) // If entered wrong ID, it will send a message that u entered a wrong id.
    {
        format(string,sizeof(string),"[ERROR] The ID you entered is not connected to the server.");
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    if(playerid == ID) // if you're asking yourself to pullover
    {
        SendClientMessage(playerid,COLOR_RED,"[ERROR] You cannot ask yourself to pullover!");
        return 1;
    }
    // Removed IsSpawned
    GetPlayerName(playerid,playername,sizeof(playername));
    GetPlayerName(ID,tname,sizeof(tname));
    if(GetDistanceBetweenPlayers(playerid,ID) > 30)
    {
        format(string,sizeof(string),"[ERROR] %s(%d) is too far away to ask them to pullover.",tname,ID);
        SendClientMessage(playerid,COLOR_RED,string);
        return  1;
    }
    if(IsPlayerInAnyVehicle(ID) == 0) // Doesnt need defining, checking if ID is not in a vehicle
    {
        format(string,sizeof(string),"[ERROR] %s(%d) must be in a vehicle in order to ask them to pullover.",tname,ID);
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    // The stage to pullover the suspect
    GetPlayerPos(ID, Position[0], Position[1], Position[2]);
    GetPlayerPos(playerid, Position[3], Position[4], Position[5]);
    format(string,sizeof(string),"[POLICE] Law Enforcement Officer %s(%d) asked you to pullover.",playername,playerid);
    SendClientMessage(ID,COLOR_LIGHTBLUE,string);
    format(string, sizeof(string), "~b~This is SAPD, pull over your vehicle now!");
    GameTextForPlayer(ID, string, 2000, 5);
    PlayAudioStreamForPlayer(playerid, "http://k002.kiwi6.com/hotlink/p1lw6z3qjk/pull_over2.mp3", Position[3], Position[4], Position[5], Distance, 1);
    PlayAudioStreamForPlayer(ID, "http://k002.kiwi6.com/hotlink/p1lw6z3qjk/pull_over2.mp3", Position[0], Position[1], Position[2], Distance, 1);
    format(string,sizeof(string), "[POLICE] You have asked %s(%d) to pull over.",tname,ID);
    SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
    return 1;
}
Reply
#9

Quote:
Originally Posted by Vanter
Посмотреть сообщение
With the pull over client messages.
down at the bottom of the command
wait are u talking about the voice stream one?
Reply
#10

Quote:
Originally Posted by RedJohn
Посмотреть сообщение
pawn Код:
dcmd_pullover(playerid, params[])
{
    new string[128], ID, playername[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME], Float:Position[6], Float:Distance = 5.0;
    if(gTeam[playerid] != COP) // To check if  player is NOT Law Enforcement
//sorry RedJohn I edited this line ^
    {
        SendClientMessage(playerid,COLOR_RED,"[ERROR] Only Law Enforcement Officers can use this command.");
        return 1;
    }
    if(sscanf(params, "u", ID))
    {
        SendClientMessage(playerid,COLOR_RED,"[USAGE]: /pullover (PlayerName/PlayerID)");
        return 1;
    }
    if(!IsPlayerConnected(ID)) // If entered wrong ID, it will send a message that u entered a wrong id.
    {
        format(string,sizeof(string),"[ERROR] The ID you entered is not connected to the server.");
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    if(playerid == ID) // if you're asking yourself to pullover
    {
        SendClientMessage(playerid,COLOR_RED,"[ERROR] You cannot ask yourself to pullover!");
        return 1;
    }
    // Removed IsSpawned
    GetPlayerName(playerid,playername,sizeof(playername));
    GetPlayerName(ID,tname,sizeof(tname));
    if(GetDistanceBetweenPlayers(playerid,ID) > 30)
    {
        format(string,sizeof(string),"[ERROR] %s(%d) is too far away to ask them to pullover.",tname,ID);
        SendClientMessage(playerid,COLOR_RED,string);
        return  1;
    }
    if(IsPlayerInAnyVehicle(ID) == 0) // Doesnt need defining, checking if ID is not in a vehicle
    {
        format(string,sizeof(string),"[ERROR] %s(%d) must be in a vehicle in order to ask them to pullover.",tname,ID);
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    // The stage to pullover the suspect
    GetPlayerPos(ID, Position[0], Position[1], Position[2]);
    GetPlayerPos(playerid, Position[3], Position[4], Position[5]);
    format(string,sizeof(string),"[POLICE] Law Enforcement Officer %s(%d) asked you to pullover.",playername,playerid);
    SendClientMessage(ID,COLOR_LIGHTBLUE,string);
    format(string, sizeof(string), "~b~This is SAPD, pull over your vehicle now!");
    GameTextForPlayer(ID, string, 2000, 5);
    PlayAudioStreamForPlayer(playerid, "http://k002.kiwi6.com/hotlink/p1lw6z3qjk/pull_over2.mp3", Position[3], Position[4], Position[5], Distance, 1);
    PlayAudioStreamForPlayer(ID, "http://k002.kiwi6.com/hotlink/p1lw6z3qjk/pull_over2.mp3", Position[0], Position[1], Position[2], Distance, 1);
    format(string,sizeof(string), "[POLICE] You have asked %s(%d) to pull over.",tname,ID);
    SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
    return 1;
}
use this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)