GetBoneName
#1

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

nice one!
useful for tdm/dm gamemodes xD
Reply
#3

Very noice indeed
Reply
#4

using an array is more fast and convenient
Reply
#5

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

Nice one,useful!
Reply
#7

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

very nice good work.
Reply
#9

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)