SA-MP Forums Archive
One bullet in weapon - 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: One bullet in weapon (/showthread.php?tid=379157)



One bullet in weapon - Smacky - 20.09.2012

Okay, I have a question. Can I do it like when player has left 1 bullet,he couldn't use it anymore,I mean it can't reach lower than 1 bullet.


Re: One bullet in weapon - Glint - 20.09.2012

You can use GetPlayerAmmo under OnPlayerUpdate.

Something like this maybe (not sure)
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(GetPlayerAmmo(playerid) == 1)
    {  
        /* What you want to do here */
    }
    return 1;
}



AW: One bullet in weapon - Forbidden - 20.09.2012

First you must declare GetPlayerAmmo as a word/or something else!
Example:
Quote:

new currentammo = GetPlayerAmmo( playerid );

Then I suggest you to make a timer instead of using OnPlayerUpdate, like this:
Quote:

SetTimer( "TestPlayerAmmo", 1500, true );

Then Create the Callback for TestPlayerAmmo:
Quote:

TestPlayerAmmo( playerid )
{
new currentammo = GetPlayerAmmo( playerid );
if( currentammo/GetPlayerAmmo( playerid ) < 1 )//as this is an example.
{
print( "Player One have only 1 Ammo left" );

}
}




Re: One bullet in weapon - YourLord - 20.09.2012

Forbidden have you tested this? you're dividing the ammo by itself.

pawn Код:
// basically you're doing that.
1/1 = 1
2/2 = 1
3/3 = 1
Your message inside will never be printed, And it should be settimerex.


Re: One bullet in weapon - RedFusion - 20.09.2012

Make sure to exclude the melee weapons


Re: One bullet in weapon - Smacky - 24.09.2012

Okay guys thanks for help I'll test it anyway thx.


Re: One bullet in weapon - vIBIENNYx - 24.09.2012

Little bit of a bump, but would this check per CLIP or ammo count?