When someone shoot
#1

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..
Reply
#2

You can use one of these:
https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage
https://sampwiki.blast.hk/wiki/OnPlayerGiveDamage
Reply
#3

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;
}
Reply
#4

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...
Reply
#5

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.
Reply
#6

but how to get the player's gun which he used... so i can use WeaponID for it?
Reply
#7

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.
Reply
#8

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)