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



GetBoneName - Ari - 17.01.2014

pawn Код:
stock GetBoneName(bodypart)
{
    new BoneName[10];
    switch(bodypart) {
        case 3: format(BoneName, sizeof(BoneName), "Torso");
        case 4: format(BoneName, sizeof(BoneName), "Groin");
        case 5: format(BoneName, sizeof(BoneName), "Left Arm");
        case 6: format(BoneName, sizeof(BoneName), "Right Arm");
        case 7: format(BoneName, sizeof(BoneName), "Left Leg");
        case 8: format(BoneName, sizeof(BoneName), "Right Leg");
        case 9: format(BoneName, sizeof(BoneName), "Head");
    }
    return BoneName;
}
Here it is in an array if you want it (@hub)

pawn Код:
new BoneName[10][10] =
{
    "", "", "", "Torso", "Groin", "Left Arm", "Right Arm", "Left Leg", "Right Leg", "Head"
};
Example with Array:

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    new szString[128], GunName[32];
    GetWeaponName(weaponid, GunName, sizeof(GunName));
    format(szString, sizeof(szString), "* You shot %s in the %s with a %s, you dealt %.0f damage.", GetPlayerNameEx(playerid), BoneName[bodypart], GunName, amount);
    SendClientMessage(issuerid, COL_GREY, szString);
    return 1;
}
Example:

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
    new szString[128], GunName[32];
    GetWeaponName(weaponid, GunName, sizeof(GunName));
    format(szString, sizeof(szString), "* You shot %s in the %s with a %s, you dealt %.0f damage.", GetPlayerNameEx(playerid), GetBoneName(bodypart), GunName, amount);
    SendClientMessage(issuerid, COL_GREY, szString);
    return 1;
}



Re: GetBoneName - M3HR4N - 17.01.2014

nice one!
useful for tdm/dm gamemodes xD


Re: GetBoneName - Flake. - 17.01.2014

Very noice indeed


Re: GetBoneName - hub4 - 17.01.2014

using an array is more fast and convenient


Re: GetBoneName - Ari - 17.01.2014

Quote:
Originally Posted by hub4
Посмотреть сообщение
using an array is more fast and convenient
>more fast.

I know, I just put this together to debug with.


Re: GetBoneName - Plovix - 18.01.2014

Nice one,useful!


Re: GetBoneName - Basssiiie - 18.01.2014

You know you can just do this (for static strings)?

Код:
stock GetBoneName(bodypart)
{
    new BoneName[10];
    switch(bodypart) 
    {
        case 3: BoneName = "Torso";
        case 4: BoneName = "Groin";
        case 5: BoneName = "Left Arm";
        case 6: BoneName = "Right Arm";
        case 7: BoneName = "Left Leg";
        case 8: BoneName = "Right Leg";
        case 9: BoneName = "Head";
    }
    return BoneName;
}



Re: GetBoneName - Omar55555 - 18.01.2014

very nice good work.


Re: GetBoneName - Ari - 18.01.2014

Quote:
Originally Posted by Basssiiie
Посмотреть сообщение
You know you can just do this (for static strings)?

Код:
stock GetBoneName(bodypart)
{
    new BoneName[10];
    switch(bodypart) 
    {
        case 3: BoneName = "Torso";
        case 4: BoneName = "Groin";
        case 5: BoneName = "Left Arm";
        case 6: BoneName = "Right Arm";
        case 7: BoneName = "Left Leg";
        case 8: BoneName = "Right Leg";
        case 9: BoneName = "Head";
    }
    return BoneName;
}
http://forum.sa-mp.com/showpost.php?...92&postcount=5