format(Msg, sizeof(Msg), ""COL_PINK"Kills: "COL_GREY"[%d]\n"COL_PINK""COL_PINK"Deaths: "COL_GREY"[%d] \n"COL_PINK""COL_PINK"Ratio: "COL_GREY"[%f] \n"COL_PINK""COL_PINK"Score: "COL_GREY"[%d]\n"COL_PINK"Money: "COL_GREY"[$ %d]\n"COL_PINK"Adminlevel: "COL_GREY"[%d]\n"COL_PINK"", pInfo[playerid][Kills], pInfo[playerid][Deaths], (Float:pInfo[playerid][Deaths] / pInfo[playerid][Kills]),GetPlayerScore(playerid),GetPlayerMoney(playerid), pInfo[playerid][Admin]);
new
Msg[ 5 ], Float:Ratio = pInfo[playerid][Kills]/FloatInfo[playerid][Deaths];
format( Msg, sizeof( Msg ), "Ratio: %f", Ratio );
if( strcmp( "/ratio", cmdtext, true, 6 ) == 0 ) {
new
Msg[ 200 ], Float:Ratio = pInfo[playerid][Kills]/pInfo[playerid][Deaths];
format( Msg, sizeof( Msg ), ""COL_PINK"Ratio: "COL_GREY"%f", Ratio );
ShowPlayerDialog(playerid, 555, DIALOG_STYLE_MSGBOX, ""COL_ORANGE"Ratio", Msg,"Ok","");
return 1;
}
%f
%.3f
new Float:ratio = (float(kills) / float(deaths));
Integer divided by integer will still give integer, it's simple as that. Try it like:
pawn Код:
|
if( strcmp( "/ratio", cmdtext, true, 6 ) == 0 ) {
new
Msg[ 200 ], Float:Ratio = (pInfo[playerid][Kills]/pInfo[playerid][Deaths]);
format( Msg, sizeof( Msg ), ""COL_PINK"Ratio: "COL_GREY"%.3f", Ratio );
ShowPlayerDialog(playerid, 555, DIALOG_STYLE_MSGBOX, ""COL_ORANGE"Ratio", Msg,"Ok","");
return 1;
}
new Float:Ratio = (float(pInfo[playerid][Kills])/float(pInfo[playerid][Deaths]));