Can this be done better?
#1

Aight so I wanted to give cop a sight, so if someone does a crime inside the sight, their wanted level will increment.
I did it likes this, but I don't think this is very efficient since I can't really make different kinds of areas.
Using Incognito's streamer btw.
pawn Код:
new Copsight[MAX_PLAYERS];

public OnPlayerDisconnect(playerid, reason)
{
    DestroyDynamicArea(Copsight[playerid]);
    return 1;
}
public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid,0);
    TogglePlayerClock(playerid,1);
    if(playerTeam[playerid] == TEAM_POLICE)
    {
        SetPlayerTeam(playerid,0);
        SetPlayerColor(playerid,COLOR_BLUE);
        Copsight[playerid] = CreateDynamicCircle(2495.5669, -1687.1925, 40,-1, -1, -1);
        AttachDynamicAreaToPlayer(Copsight[playerid], playerid);
    }
    if(playerTeam[playerid] == TEAM_CIVILIAN)
    {
        SetPlayerTeam(playerid,1);
        SetPlayerColor(playerid,COLOR_WHITE);
    }
}

and the increase
if(IsPlayerInAnyDynamicArea(playerid) == 1){SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);}
Reply
#2

You needn't create a dynamic area (although very good thinking), that's a bit overcomplicating.

What you could do when someone commits a crime is loop through all policemen and use IsPlayerInRangeOfPoint.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)