[HELP] Pullover CMD + Voice Stream
#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


Messages In This Thread
[HELP] Pullover CMD + Voice Stream - by Uberanwar - 14.08.2013, 14:35
Re: [HELP] Pullover CMD + Voice Stream - by RedJohn - 14.08.2013, 14:49
Re: [HELP] Pullover CMD + Voice Stream - by Vanter - 14.08.2013, 14:56
Re: [HELP] Pullover CMD + Voice Stream - by RedJohn - 14.08.2013, 14:58
Re: [HELP] Pullover CMD + Voice Stream - by Vanter - 14.08.2013, 15:01
Re: [HELP] Pullover CMD + Voice Stream - by Uberanwar - 14.08.2013, 15:04
Re: [HELP] Pullover CMD + Voice Stream - by Vanter - 14.08.2013, 15:07
Re: [HELP] Pullover CMD + Voice Stream - by RedJohn - 14.08.2013, 15:12
Re: [HELP] Pullover CMD + Voice Stream - by Uberanwar - 14.08.2013, 15:12
Re: [HELP] Pullover CMD + Voice Stream - by Vanter - 14.08.2013, 15:18

Forum Jump:


Users browsing this thread: 1 Guest(s)