SA-MP Forums Archive
Help with "PlayCrimeReportForPlayer"!! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with "PlayCrimeReportForPlayer"!! (/showthread.php?tid=258948)



Help with "PlayCrimeReportForPlayer"!! - XTM-Gaming - 02.06.2011

i recently found out about "PlayCrimeReportForPlayer" i tried it and i works fine....
But my only concern is, i only want it to play for cops - if you know what i mean
i only want to find out how to make it play for cops only!

Thank-you in advanced


Respuesta: Help with "PlayCrimeReportForPlayer"!! - usrb1n - 02.06.2011

If you have a GoodFather based GM (using pvars...)
pawn Код:
for(new i; i<MAX_PLAYERS; i++)
{
     if(IsPlayerConnected(i))
     {
         if(IsACop(i))
     {
               PlayCrimeReportForPlayer(i,0,3) // or whatever you want, just use "i" instead of playerid
               return 1;
          }
      }
}
I used isacop to make your life a little easier, so I will give you this too:

On the top of your script

pawn Код:
forward IsACop(playerid);

And the function....

pawn Код:
public IsACop(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        new leader = PlayerInfo[playerid][pLeader];
        new member = PlayerInfo[playerid][pMember];
        if(member==1 || member==2 || member==3)
        {
            return 1;
        }
        else if(leader==1 || leader==2 || leader==3)
        {
            return 1;
        }
    }
    return 0;
}
Note: This will play the sound for the 3 cops factions (1,2,3 - LSPD, FBI, SAST) you can changed this with your factions id.


Re: Help with "PlayCrimeReportForPlayer"!! - Haxarr - 02.06.2011

Okay. You need to create an enum or place something like this in the enum.

PHP код:
enum pInfo
{
       
pCop,
}
new 
PlayerInfo[MAX_PLAYERS][pInfo
Then place your command in an if statement, like so.

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/mycommand"cmdtexttrue10) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pCop] == 1)
            {
            
//CODE
            
}
        }
            else
            {
                
SendClientMessage(playeridCOLOR_GREY"   You are not a Cop / FBI / SAST /PG.");
            }
        return 
1;
    }
    return 
0;




Re: Help with "PlayCrimeReportForPlayer"!! - XTM-Gaming - 02.06.2011

this is what i want to edit....

PHP код:
f(newstate == PLAYER_STATE_DRIVER && GetVehicleModel(vehicleid) == 427 || GetVehicleModel(vehicleid) == 490 || GetVehicleModel(vehicleid) == 523 || GetVehicleModel(vehicleid) == 528 || GetVehicleModel(vehicleid) == 596 || GetVehicleModel(vehicleid) == 597 || GetVehicleModel(vehicleid) == 598 || GetVehicleModel(vehicleid) == 599 || GetVehicleModel(vehicleid) == 601)
    {
        if(
gTeam[playerid] != COP && gTeam[playerid] != Medic && gTeam[playerid] != ARMY && gTeam[playerid] != FBI && gTeam[playerid] != SWAT)
        {
            
RemovePlayerFromVehicle(playerid);
            
SendClientMessage(playeridERROR"Ejected from police vehicle");
            
GameTextForPlayer(playerid,"~0x800080AA~Ejected: Only Police Officers can use this vehicle",5000,3);
            
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+ 1);
            
PlayCrimeReportForPlayer(playerid0,12); 
            
SendClientMessageToAll(playerid"Vehicle theft");
            return 
1;
        }
        else if(
gTeam[playerid] == COPSendClientMessage(playeridWHITE"This is a Police vehicle. You can use this one to work.");
        else if(
gTeam[playerid] == Medic)
        {
            
RemovePlayerFromVehicle(playerid);
            
SendClientMessage(playeridERROR"Only Police Officers can use this vehicle.");
        }
    } 
look for "PlayCrimeReportForPlayer(playerid, 0,12); " its near the center - i only want that to play for cop

Sorry, am a newbie


Respuesta: Help with "PlayCrimeReportForPlayer"!! - usrb1n - 02.06.2011

What's the team name, faction name/id that you want the sound to be played for ?


Re: Help with "PlayCrimeReportForPlayer"!! - XTM-Gaming - 02.06.2011

"COPS" is the team name