Pawno crashes - 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)
+--- Thread: Pawno crashes (
/showthread.php?tid=313875)
Pawno crashes -
geerdinho8 - 27.01.2012
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?
Re: Pawno crashes -
TheArcher - 27.01.2012
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.
Re: Pawno crashes -
geerdinho8 - 27.01.2012
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.
Re: Pawno crashes -
vassilis - 27.01.2012
you must use strcat for dialogs...
Re: Pawno crashes -
geerdinho8 - 27.01.2012
Quote:
Originally Posted by vassilis
you must use strcat for dialogs...
|
Can you give me an example of strcat?
Re: Pawno crashes -
FuTuяe - 27.01.2012
https://sampwiki.blast.hk/wiki/Strcat
Goodluck!
Re: Pawno crashes -
geerdinho8 - 27.01.2012
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.
Re: Pawno crashes -
MP2 - 27.01.2012
strcat isn't format. You need to use format() THEN strcat().
Re: Pawno crashes -
geerdinho8 - 27.01.2012
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?
Re: Pawno crashes -
Face9000 - 27.01.2012
A little tip,why you're using a string of 400 cells for that small dialog player stats?
256 is enough.