Near Cops
#1

PHP Code:
if(IsPlayerNearLawEnforcement(playerid) && GetPlayerWantedLevel(playerid) < 6)
    {
         
shotsfired[playerid] ++;
         if(
shotsfired[playerid] >= 2)
         {
            new 
string[256], copmsg[256], ID;
            
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid) + 1);
            
format(stringsizeof(string), "Comitted A Crime: Shooting in public - Wanted Level %d"GetPlayerWantedLevel(playerid));
            
SendClientMessage(playeridCOLOR_WANTEDstring);
            
pInfo[playerid][pCrimes] ++;
            
pInfo[playerid][pWantedLevel] = pInfo[playerid][pWantedLevel] + 1;
            
format(copmsgsizeof(copmsg), "Suspect %s (%d) has shooting in public near %s"GetName(playerid), playeridReturnPlayerZone(ID));
            
SendRadioMessageToCops(copmsg);
            
shotsfired[playerid] = 0;
         }
    } 
PHP Code:
stock IsPlayerNearLawEnforcement(playerid)
{
    new 
Float:cPos[3], Float:range 100.0;
    foreach(
Playeri)
    {
        if(
GetTeam{i} == CLASS_CIV || GetTeam{i} == CLASS_MEDIC) continue;
        
GetPlayerPos(icPos[0], cPos[1], cPos[2]);
        if(
IsPlayerInRangeOfPoint(playeridrangecPos[0], cPos[1], cPos[2]))
        {
            return 
1;
        }
    }
    return 
0;

Problem: I am trying to do if a player shoots in public like if there's a cop in range then player should gain a wanted level

but i dont know why its not working there are 2 problems

1- If a cop shoots cop gets wanted level too
2- if a civlian shoots he gets wanted level too even if there's no cop
Reply


Messages In This Thread
Near Cops - by STONEGOLD - 17.02.2017, 18:25
Re: Near Cops - by BiosMarcel - 17.02.2017, 19:36
Re: Near Cops - by STONEGOLD - 17.02.2017, 20:51

Forum Jump:


Users browsing this thread: 1 Guest(s)