One bullet in weapon
#1

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

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

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" );

}
}

Reply
#4

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

Make sure to exclude the melee weapons
Reply
#6

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)