GetPlayerFightingStyle want words,not numbers
#1



so,i get this number of fightingstyle with this:



pawn Код:
Para = GetPlayerFightingStyle(i);
new hrk[265];
format(hrk,sizeof(hrk),"~p~Gorivo: ~w~%d%%~n~~g~~h~Energija: ~w~%d~n~~b~~h~Brzina: ~w~%d km/h~n~~r~~h~Ubistva: ~w~%d~n~~y~Smrti: ~w~%d~n~~p~~h~Banka: ~w~USKORO!~n~~b~~h~Stil: ~w~%d",VGas[VehID], floatround(hp), Speed, PlayerData[i][Kills], PlayerData[i][Deaths], Para);

and I've been wondering, how could I change this number 4 to FIGHT_STYLE_NORMAL or even name like,dunno,JUDO?


I'm trying something like:


pawn Код:
if(GetPlayerFightingStyle(playerid) == FIGHT_STYLE_NORMAL)
{
ormat(hrk,sizeof(hrk),"~p~Stil: ~w~%d -FIGHT_STYLE_NORMAL (JUDO) , Para);
}
Reply
#2

Do it like this.

pawn Код:
stock GetPlayerFightingStyleEx(playerid)
{
   new stylename[12];
   switch(GetPlayerFightingStyle(playerid))
   {
      case FIGHT_STYLE_NORMAL: stylename = "JUDO";
   }
   return stylename;
}
Reply
#3

pawn Код:
stock GetFightStyleName(styleid)
{
    new sname[12];
    sname = "Unknown";
    switch(styleid)
    {
        case 4: sname = "Normal";
        case 5: sname = "Boxing";
        case 6: sname = "Kung Fu";
        case 7: sname = "Knee Head";
        case 15: sname = "Grabkick";
        case 26: sname = "Elbow";
    }
    return sname;
}
pawn Код:
new string[64];
format( string, sizeof(string), "Your fighting style: %s", GetFightStyleName( GetPlayerFightingStyle(playerid) ) );
SendClientMessage(playerid, -1, string);
Reply
#4

wow you guys are great! ty ty ty
Reply
#5




funny thing, now I get different number only I tried both codes you guys provided,here's the code:

pawn Код:
new Para[265];
Para = GetFightStyleName( GetPlayerFightingStyle(i));
new hrk[265];
format(hrk,sizeof(hrk),"Stil: ~w~%d", Para);
pawn Код:
stock GetFightStyleName(styleid)
{
    new sname[12];
    sname = "Unknown";
    switch(styleid)
    {
        case 4: sname = "Normal";
        case 5: sname = "Boxing";
        case 6: sname = "Kung Fu";
        case 7: sname = "Knee Head";
        case 15: sname = "Grabkick";
        case 26: sname = "Elbow";
    }
    return sname;
}

I tried with the same code u guys gave it to me,also without this "new para" but stil,all I get is those numbers.
Number for normal style is allways 78,for boxing style 66 and so on,so on..
Reply
#6

format(hrk,sizeof(hrk),"Stil: ~w~%d", Para);
Shouldn't it be
format(hrk,sizeof(hrk),"Stil: ~w~%s", Para);
Reply
#7

omgggggg God bless you!!!!! ty!!!!!
Reply
#8

BTW: You don't need the string Para. You can simply do this:

Код:
new hrk[265];
format(hrk,sizeof(hrk),"Stil: ~w~%s", GetFightStyleName(GetPlayerFightingStyle(i)));
Reply
#9

ok mate ill remove it ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)