Wanted on Zone
#1

How can i do that if a player attacks another player or shoots on the sky then it will give him 1 wanted level
Reply
#2

Somethings like that also - visit this wiki sa-mp page to find more informations about this callback.

pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
    return 1;
}
Reply
#3

thanks didnt realize there was a public for that
Reply
#4

but what about when a player shoots to the air
and doesn't hit a player
Reply
#5

I don't understand? You want to set player wanted level when he shoots? (without hit a players)
Reply
#6

Yes thas what I want
Reply
#7

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
        {
            if(GetPlayerWantedLevel(playerid) < 1)
            {
                SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
            }
        }
    }
    return 1;
}
I have added the if(GetPlayerWantedLevel, because you don't want the player to continuously get an added wanted level. You can edit this code however you want, this is just an example of what is required.
Reply
#8

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_FIRE)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
        {
            if(GetPlayerWantedLevel(playerid) < 1)
            {
                SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
            }
        }
    }
    return 1;
}
I have added the if(GetPlayerWantedLevel, because you don't want the player to continuously get an added wanted level. You can edit this code however you want, this is just an example of what is required.
I think it woul be better like KEY_FIRE & KEY_AIM, because you can't shoot without aiming on samp and if someone would just throw a random punch they'd get a wanted level.
Reply
#9

You are correct, however players do not need to aim to fire a weapon. Although it would be useful to add a GetPlayerWeapon line in the code to make sure a player is indeed holding a weapon. Thank you for clearing that for me TonyII.
Reply
#10

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
You are correct, however players do not need to aim to fire a weapon. Although it would be useful to add a GetPlayerWeapon line in the code to make sure a player is indeed holding a weapon. Thank you for clearing that for me TonyII.
I dont understand about GetPlayerWeapon, how can i check if player have any weapons that requireds bullets

do i have to make a function.


Plus something else

can i do this in a timer

SetTimerEx("timerchargef", 2000*litro, false, "u", playerid);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)