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(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pCop] == 1)
{
//CODE
}
}
else
{
SendClientMessage(playerid, COLOR_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(playerid, ERROR, "Ejected from police vehicle");
GameTextForPlayer(playerid,"~0x800080AA~Ejected: Only Police Officers can use this vehicle",5000,3);
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+ 1);
PlayCrimeReportForPlayer(playerid, 0,12);
SendClientMessageToAll(playerid, "Vehicle theft");
return 1;
}
else if(gTeam[playerid] == COP) SendClientMessage(playerid, WHITE, "This is a Police vehicle. You can use this one to work.");
else if(gTeam[playerid] == Medic)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, ERROR, "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