Posts: 716
Threads: 92
Joined: May 2018
I made a stock to check if player is near a cop:
pawn Код:
stock IsPlayerNearALawEnforcement(playerid)
{
new team = GetPlayerTeam(playerid);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
foreach (new i : Player)
{
if (i != playerid)
{
if (team != gTeam(i) == TEAM_COP)
{
if (IsPlayerInRangeOfPoint(i, 20.0, x, y, z))
{
return true;
}
}
}
}
return false;
}
But i want to add radius to this stock, so i can use it like:
IsPlayerNearALawEnforcement(playerid, 20)
How?
Posts: 716
Threads: 92
Joined: May 2018
Thank you both. I'm trying Lokii's example and i get this errors:
Quote:
error 012: invalid function call, not a valid address
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
|
Referred to this line:
pawn Код:
if (team != gTeam(i) == TEAM_COP)
Posts: 716
Threads: 92
Joined: May 2018
Still getting that error.
Another question, i made a timer to reduce player's wanted level every 60 seconds if there isn't a cop in a range of 70 meters, so i did in this way:
pawn Код:
task WantedLevelReduce[60000]()
{
foreach (new i : Player)
{
if(gTeam[i] == TEAM_CIV)
{
if(GetPlayerWantedLevel(i) >= 1 && IsPlayerNearALawEnforcement(i, 70))
{
SetPlayerWantedLevelEx(i, GetPlayerWantedLevel(i)-1);
}
}
}
}
The IsPlayerNearLawEnforcement check is correct?
Basically: No cop in a range of 70 meters = reduce 1 wanted level.
Is it correct?
Posts: 716
Threads: 92
Joined: May 2018
Ok and what about your stock?
This errors:
Quote:
error 012: invalid function call, not a valid address
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
|
are gone if i remove the stock. So problem should be there...mh
Posts: 374
Threads: 13
Joined: Sep 2017
Reputation:
0
the stock works fine for me show me the lines where you use the function
Posts: 716
Threads: 92
Joined: May 2018