SA-MP Forums Archive
[FilterScript] Armour Update - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Armour Update (/showthread.php?tid=209333)



Armour Update - Nexotronix - 10.01.2011

What this script do:

[ame]http://www.youtube.com/watch?v=H41c86Max0Q[/ame]

Okay! let's do this =) :

In the top of your code paste this:

pawn Код:
#define ARMOUR_INDEX 4 // this is the index of armour

next step: we pasting code to on playerupdate:

pawn Код:
public OnPlayerUpdate(playerid)
{
    new Float:armour[MAX_PLAYERS];
    GetPlayerArmour(playerid, armour[playerid]);
    if( armour[playerid] > 0.0 )
    {
        SetPlayerAttachedObject( playerid, ARMOUR_INDEX, 1242, 1, 0.019999, 0.039999, 0.000000, 2.459999, 89.699989, -3.100000, 1.710000, 2.119999, 1.719999);//áðîíÿ
    }
    else if( armour[playerid] == 0.0 && IsPlayerAttachedObjectSlotUsed(i, ARMOUR_INDEX))
    {
        RemovePlayerAttachedObject(playerid, ARMOUR_INDEX); // armour
    }
    return 1;
}
So this is it, thanks for watching, reading, and using!
and sorry for my bad english!


Re: Armour Update - Mr.Stranger - 10.01.2011

great good job


Re: Armour Update - Biesmen - 10.01.2011

Very nice, good job.


Re: Armour Update - Mr.Stranger - 10.01.2011

well here is the fix code


pawn Код:
public ArmourUpdate()
{
    new Float:armour;//this is our armour value
    for(new i=0; i<=GetMaxPlayers(); i++)//i'm put this code, cause i had bug before, when armour can have only player with id 0!
    {
        GetPlayerArmour(i, armour);//checking hommuch armour player has...
        if( armour > 0.0 )//...if player has more then 0.0 of armour...
        {
            SetPlayerAttachedObject( i, ARMOUR_INDEX, 373, 1, 0.286006, -0.038657, -0.158132, 67.128456, 21.916156, 33.972290, 1.000000, 1.000000, 1.000000 ); // ...armour getting on the players body...
        }
        else if( armour == 0.0 )//...if player do not have armour...
        {
            RemovePlayerAttachedObject(i, ARMOUR_INDEX); // ...armour getting off the players body...
        }
        return 1;//the value what function returning
    }
    return 0;
}



Re: Armour Update - Red_Devils - 10.01.2011

great job!!!!!fuck, this great!!!!!!!!!!!!!!!!!!!good job!


Re: Armour Update - Nexotronix - 10.01.2011

Quote:

great job!!!!!fuck, this great!!!!!!!!!!!!!!!!!!!good job!

thanks

Quote:

well here is the fix code

okay, thanks, i see my mistake


Re: Armour Update - schillow - 10.01.2011

oh that's nice
GJ


Re: Armour Update - Hash [NL-RP] - 10.01.2011

You forgot to forward it, newbies will get confused,
Код:
 forward ArmourUpdate();



Re: Armour Update - Kwarde - 10.01.2011

NICE!
I found an armour object, but it was too small :S (the size of the pickup).
Is this an custom object, or an object that was already there and I never found?


Re: Armour Update - Hash [NL-RP] - 10.01.2011

Tested it, Only ID 0 gets the armour.

Edit:
Use this works with whole server.
Код:
forward ArmourUpdate();
public ArmourUpdate()
{
    new Float:armour;//this is our armour value
    for(new i=i;i<MAX_PLAYERS;i++)//
    {
        GetPlayerArmour(i, armour);//checking hommuch armour player has...
        if( armour > 0.0 )//...if player has more then 0.0 of armour...
        {
            SetPlayerAttachedObject( i, ARMOUR_INDEX, 373, 1, 0.286006, -0.034657, -0.158132, 67.128456, 21.916156, 33.972290, 1.000000, 1.000000, 1.000000 ); // ...armour getting on the players body...
        }
        else if( armour == 0.0 )//...if player do not have armour...
        {
            RemovePlayerAttachedObject(i, ARMOUR_INDEX); // ...armour getting off the players body...
        }
        return 1;//the value what function returning
    }
    return 0;
}
Bit slow to load up, but its reliable.