When someone shoot - 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: When someone shoot (
/showthread.php?tid=486190)
When someone shoot -
iBots - 07.01.2014
How to detect like if someone shot,even if he didnt hit or shoot a player but if he used the gun to shoot
note:i dont have bullet system,i mean he always has 9999 bullets,so i cant detect it by the gun bullets..
Re: When someone shoot -
offon - 07.01.2014
You can use one of these:
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage
Re: When someone shoot - Emmet_ - 07.01.2014
Yeah you can, the ammo decrements even when it's infinite.
pawn Код:
new g_LastAmmo[MAX_PLAYERS];
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_FIRE && GetPlayerWeapon(playerid) >= 22)
{
if ((g_LastAmmo[playerid] - GetPlayerAmmo(playerid)) >= 1)
{
// Put your code here, k?
g_LastAmmo[playerid] = GetPlayerAmmo(playerid);
}
}
return 1;
}
Re: When someone shoot -
iBots - 07.01.2014
well i am trying to make like if he shoot with a gun,i can use yours emma.. and thanks for it but how to make it like:
lets says i detected that he shot,how to make like if he shot and he is detected he cant change to another weapon
i have made everything but i need to make it that he cant change weapons,i have set a timer and everything but how to let it like remove his weapons or toggles his ability to change weapon or give him his weapons back after the timer is over...
Respuesta: When someone shoot -
Swedky - 07.01.2014
I understood that you want that the player has always 'X' it arms and that could not change it.
pawn Код:
public OnPlayerUpdate(playerid)
{
if(GetPlayerWeapon(playerid) != WeaponID) //It checks if the player does not have this weapon.
{
SetPlayerArmedWeapon(playerid, WeaponID); //It gives him the weapon.
}
return 1;
}
It changes the 'weaponid' to the weapon that you wish not to change.
Im sorry if I was wrong on the doubt.
Re: When someone shoot -
iBots - 07.01.2014
but how to get the player's gun which he used... so i can use WeaponID for it?
Respuesta: Re: When someone shoot -
Swedky - 07.01.2014
Quote:
Originally Posted by iBots
but how to get the player's gun which he used... so i can use WeaponID for it?
|
To what do you refer? 'WeaponID' you must change it for her ID of the weapon that you wish to have all the time.
Re: When someone shoot -
iBots - 07.01.2014
Yea but i dont want to set the weapon i want it to be automatic like if i shot with shotgun i cant change from shotgun and same for all of the weapons