SA-MP Forums Archive
Need help - 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: Need help (/showthread.php?tid=551300)



Need help - Shazwan - 18.12.2014

Greetings, SA-MP members i really need your help kinda confusing using this both callbacks and sometimes its not working.

I want to script a sniper bullet that is countable bullet that can be finish and 1 shot 1 kill. each shot will -1 bullet

Код:
PlayerInfo[playerid][pBullet] -= 1;
this is the 2 example callbacks im using it but failed.

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
    {
        // One shot to the head to kill with sniper rifle
        SetPlayerHealth(playerid, 0.0);
        PlayerInfo[playerid][pBullet] -= 1;
    }
    return 1;
}
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    if(PlayerInfo[playerid][pBullet] >= 1)
    {
        new Float:HP;
        if(weaponid == 34)
        GetPlayerHealth(damagedid,HP);
        SetPlayerHealth(damagedid,HP-100);
        PlayerInfo[playerid][pBullet] -= 1;
    }
    return 1;
}
i really appreciate your help if can thanks. rep+


Re: Need help - Quickie - 18.12.2014

can u explain a bit further about that bullet thinggy so that we can help you


Re: Need help - Shazwan - 18.12.2014

This thing

Код:
PlayerInfo[playerid][pBullet]
if they buy the bullet from the store they will receive 5 bullet, each bullet they shoot a player it will set the HP of the player to 0.

And each shot they shoot will -1 bullet

Код:
PlayerInfo[playerid][pBullet] -= 1;