Pawno crashes
#1

My pawno crashes with this lines:
pawn Код:
new Msg[500];
        new Float:Ratio = (float(pInfo[playerid][Kills])/float(pInfo[playerid][Deaths]));
        format(Msg, sizeof(Msg), ""COL_PINK"Kills: "COL_GREY"[%d]\n"COL_PINK""COL_PINK"Deaths: "COL_GREY"[%d] \n"COL_PINK"Score: "COL_GREY"[%d]\n"COL_PINK"Money: "COL_GREY"[$ %d]\n"COL_PINK"Adminlevel: "COL_GREY"[%d]\n"COL_PINK"Ratio: "COL_GREY"%.3f\n"COL_PINK"Warns: "COL_GREY"[%d]\n\n\n"COL_PINK"Total Online Time: "COL_GREY"[%d]", pInfo[playerid][Kills], pInfo[playerid][Deaths],GetPlayerScore(playerid),GetPlayerMoney(playerid), pInfo[playerid][Admin], Ratio, pInfo[playerid][Warns], pInfo[playerid][Online]);
        ShowPlayerDialog(playerid, 555, DIALOG_STYLE_MSGBOX, ""COL_ORANGE"Your Stats", Msg,"Ok","");
What did i do wrong?
Reply
#2

new Ratio = {pInfo[playerid][Kills]/pInfo[playerid][Deaths]};

Try like that. I didn't test it. Don't use float if the number is integer like Kills, Deaths, just tell me how can you kill 1 person and half XD.
Reply
#3

Nope, still crashing, i think there are too much characters in the Dialog, but i've seen servers with many more text inside a dialog.
Reply
#4

you must use strcat for dialogs...
Reply
#5

Quote:
Originally Posted by vassilis
Посмотреть сообщение
you must use strcat for dialogs...
Can you give me an example of strcat?
Reply
#6

https://sampwiki.blast.hk/wiki/Strcat

Goodluck!
Reply
#7

Thanks,

i now have it like this
pawn Код:
new string[400];
        new Float:Ratio = (float(pInfo[playerid][Kills])/float(pInfo[playerid][Deaths]));
        strcat(string, ""COL_PINK"Kills: "COL_GREY"[%d]\n"COL_PINK""COL_PINK"Deaths: "COL_GREY"[%d] \n"COL_PINK"Score: "COL_GREY"[%d]\n"COL_PINK"Money: "COL_GREY"[$ %d]", pInfo[playerid][Kills], pInfo[playerid][Deaths],GetPlayerScore(playerid),GetPlayerMoney(playerid));
        strcat(string, "\n"COL_PINK"Adminlevel: "COL_GREY"[%d]\n"COL_PINK"Ratio: "COL_GREY"%.3f\n"COL_PINK"Warns: "COL_GREY"[%d]\n\n\n"COL_PINK"Total Online Time: "COL_GREY"[%d]", pInfo[playerid][Admin], Ratio, pInfo[playerid][Warns], pInfo[playerid][Online]);
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Stats", string, "Close", "");

But it only shows [%d], it has to be the ammount of warns for example.
Also it only shows the first strcat line.

Help please.
Reply
#8

strcat isn't format. You need to use format() THEN strcat().
Reply
#9

Quote:
Originally Posted by MP2
Посмотреть сообщение
strcat isn't format. You need to use format() THEN strcat().
I understand that, but i dont know how to do that, can you give me an example?
Reply
#10

A little tip,why you're using a string of 400 cells for that small dialog player stats?

256 is enough.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)