PLayershooting
#3

Hi !
you can do it using:
1. OnPlayerWeaponShot Callback ~~~~> https://sampwiki.blast.hk/wiki/OnPlayerWeaponShot
2. GetPlayerPos ~~~~> https://sampwiki.blast.hk/wiki/GetPlayerPos
3. IsPlayerInRangeOfPoint ~~~~> https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
4. GetPlayerWantedLevel ~~~~> https://sampwiki.blast.hk/wiki/GetPlayerWantedLevel
5. SetPlayerWantedLevel ~~~~> https://sampwiki.blast.hk/wiki/SetPlayerWantedLevel
6. a Loop

OnPlayerWeaponShot Callback call when a player fires a shot from a weapon...
so Get player position and make a loop through all players and check if someone close to player and if he/she is cop > give wantedlevel to him

here is a simple ex.


pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    new Float:pX, Float:pY, Float:pZ;
    GetPlayerPos(playerid, pX, pY, pZ);
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsCop(i))
        {
            if(IsPlayerInRangeOfPoint(i, /*Your Range*/, pX, pY, pZ))
            {
                SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 2);
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
PLayershooting - by STONEGOLD - 22.06.2015, 19:09
Re: PLayershooting - by rappy93 - 22.06.2015, 19:23
Re: PLayershooting - by M4D - 22.06.2015, 19:35

Forum Jump:


Users browsing this thread: 1 Guest(s)