Wanted on Zone - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Wanted on Zone (
/showthread.php?tid=461718)
Wanted on Zone -
yancarlos4500 - 03.09.2013
How can i do that if a player attacks another player or shoots on the sky then it will give him 1 wanted level
Re : Wanted on Zone -
Matnix - 03.09.2013
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;
}
Re: Wanted on Zone -
yancarlos4500 - 03.09.2013
thanks didnt realize there was a public for that
Re: Wanted on Zone -
yancarlos4500 - 03.09.2013
but what about when a player shoots to the air
and doesn't hit a player
Re : Wanted on Zone -
Matnix - 03.09.2013
I don't understand? You want to set player wanted level when he shoots? (without hit a players)
Re: Wanted on Zone -
yancarlos4500 - 04.09.2013
Yes thas what I want
Re: Wanted on Zone -
Threshold - 04.09.2013
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.
Re: Wanted on Zone -
TonyII - 04.09.2013
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.
Re: Wanted on Zone -
Threshold - 04.09.2013
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.
Re: Wanted on Zone -
yancarlos4500 - 04.09.2013
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);