Displaying Exact Location In Dialog Problem!
#1

Topic says all.



I have a problem. I want it to display the position like..

X:123.1234 Y:123.1234 Z: 123.1234

But its displaying it like..

109842174982147 1239801487234 198734289734 -.-

Here is my code...

pawn Код:
format(string, sizeof(string), "\t%s's Stats\n\nKills: %d\nDeaths: %d\nRatio: %0.2f\nMoney: $%d\nScore: %d\nPosition: X:%.d Y:%.d Z:%.d\nTime Played: %d Hours %d Minutes %d Seconds",PlayerName2(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths],Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1),GetPlayerScore(player1),xpos, ypos, zpos, h, m, s);
        return ShowPlayerDialog(playerid, 20, DIALOG_STYLE_MSGBOX, "Player's Stats!", string, "Ok", "Exit");
What am i doing wrong?
Reply
#2

pawn Код:
format(string, sizeof(string), "\t%s's Stats\n\nKills: %d\nDeaths: %d\nRatio: %0.2f\nMoney: $%d\nScore: %d\nPosition: X:%.4f Y:%.4f Z:%.4f\nTime Played: %d Hours %d Minutes %d Seconds",PlayerName2(player1), PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths],Float:PlayerInfo[player1][Kills]/Float:pDeaths,GetPlayerMoney(player1),GetPlayerScore(player1),xpos, ypos, zpos, h, m, s);
        return ShowPlayerDialog(playerid, 20, DIALOG_STYLE_MSGBOX, "Player's Stats!", string, "Ok", "Exit");
Reply
#3

What you where doing wrong:

You used %d for a float, but %d is just a number without dots (.)
use %f instead, %04f it bether because otherwise your number behind the dot (.) will be like .31341456479194421488884173
Reply
#4

ahh.. Thank yew!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)