SA-MP Forums Archive
GetPlayerFightingStyle want words,not numbers - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetPlayerFightingStyle want words,not numbers (/showthread.php?tid=273004)



GetPlayerFightingStyle want words,not numbers - lvlaid - 30.07.2011



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);
}



Re: GetPlayerFightingStyle want words,not numbers - Sergei - 30.07.2011

Do it like this.

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



Re: GetPlayerFightingStyle want words,not numbers - iPLEOMAX - 30.07.2011

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);



Re: GetPlayerFightingStyle want words,not numbers - lvlaid - 31.07.2011

wow you guys are great! ty ty ty


Re: GetPlayerFightingStyle want words,not numbers - lvlaid - 31.07.2011




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..


Re: GetPlayerFightingStyle want words,not numbers - CmZxC - 31.07.2011

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


Re: GetPlayerFightingStyle want words,not numbers - lvlaid - 31.07.2011

omgggggg God bless you!!!!! ty!!!!!


Re: GetPlayerFightingStyle want words,not numbers - olaf137 - 31.07.2011

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)));



Re: GetPlayerFightingStyle want words,not numbers - lvlaid - 01.08.2011

ok mate ill remove it ty