27.09.2018, 14:06
Your string size:
Your whole code size, including the braces and all: 4229
Calculating one of your dialogs content, it is 402, let's say 500, but not 19K!
Have a look at SA-MP's limits: https://sampwiki.blast.hk/wiki/Limits
You can't even have a dialog with more than 4K characters, which means, if a dialog will ever exceed that, you should use more than one dialog.
Furthermore, you're showing the dialog multiple times under different conditions, e.g.
It'll show a dialog under this condition:
And this:
And so on... till the last condition.
Further from that, indent your code, so not that:
But this:
Also you can simply do:
Instead of:
The same work it does.
This is how you can simply do it:
Better right? Use ternay operator instead of if condition if you want to sum everything up together.
Ternay Operator:
(a == b) ? Yes : No
a: is the variable you're checking it's value. e.g. userdata[playerid][settings]
b: is the value/number. Just like if (condition == 1) where 1 is the value.
Yes: if a equals b.
No: if a != b.
Next time use http://string-functions.com/length.aspx instead of 19K string size, haha.
Код:
new Achieve[19000];
Calculating one of your dialogs content, it is 402, let's say 500, but not 19K!
Have a look at SA-MP's limits: https://sampwiki.blast.hk/wiki/Limits
Код:
Info (Main text) 4096
Furthermore, you're showing the dialog multiple times under different conditions, e.g.
It'll show a dialog under this condition:
Код:
if(userdata[playerid][settings] == 1)
Код:
if(userdata[playerid][help] == 1)
Further from that, indent your code, so not that:
Код:
if(userdata[playerid][settings] == 1) { format(Achieve,sizeof(Achieve),"{FFFFFF} ---------------- {FFFF00}Easy Achievements: {FFFFFF}----------------\n{00FF00}1). AchieveDM - аъвш: дшщод мщшъ [Completed]\n{00FF00}2). Settings - аъвш: двгшеъ дощъощ [Completed]\n{FF0000}3). Help - аъвш: дфтмъ дфчегд мтжшд [Uncompleted]\n{FF0000}4). DoarIsrael - аъвш: щймен авшъ шйщйеп [Uncompleted]",Achieve); ShowPlayerDialog(playerid,7966,DIALOG_STYLE_LIST," AchieveDM - шщйоъ даъвшйн",Achieve,"бзш","бйием"); }
Код:
if(userdata[playerid][settings] == 1) { format(Achieve, sizeof(Achieve),"{FFFFFF} ---------------- {FFFF00}Easy Achievements: {FFFFFF}----------------\n\ {00FF00}1). AchieveDM - аъвш: дшщод мщшъ [Completed]\n\ {00FF00}2). Settings - аъвш: двгшеъ дощъощ [Completed]\n\ {FF0000}3). Help - аъвш: дфтмъ дфчегд мтжшд [Uncompleted]\n\ {FF0000}4). DoarIsrael - аъвш: щймен авшъ шйщйеп [Uncompleted]", Achieve); ShowPlayerDialog(playerid, 7966, DIALOG_STYLE_LIST, " AchieveDM - шщйоъ даъвшйн", Achieve, "бзш", "бйием"); }
Код:
if(userdata[playerid][settings])
Код:
if(userdata[playerid][settings] == 1)
This is how you can simply do it:
Код:
if(!strcmp(cmd, "/Achievements", true) || !strcmp(cmd, "/Achieve", true)) { new Achieve[500]; format(Achieve, sizeof(Achieve),"{FFFFFF} ---------------- {FFFF00}Easy Achievements: {FFFFFF}----------------\n\ {00FF00}1). AchieveDM - аъвш: дшщод мщшъ [Completed]\n\ {00FF00}2). Settings - аъвш: двгшеъ дощъощ [%s]\n\ {FF0000}3). Help - аъвш: дфтмъ дфчегд мтжшд [%s]\n\ {FF0000}4). DoarIsrael - аъвш: щймен авшъ шйщйеп [%s]", (userdata[playerid][settings] == 1) ? ("Completed") : ("Incomplete"), (userdata[playerid][help] == 1) ? ("Completed") : ("Incomplete"), (userdata[playerid][agra] == 1) ? ("Completed") : ("Incomplete")); ShowPlayerDialog(playerid, 7966, DIALOG_STYLE_LIST, " AchieveDM - шщйоъ даъвшйн", Achieve, "бзш", "бйием"); return 1; }
Ternay Operator:
(a == b) ? Yes : No
a: is the variable you're checking it's value. e.g. userdata[playerid][settings]
b: is the value/number. Just like if (condition == 1) where 1 is the value.
Yes: if a equals b.
No: if a != b.
Next time use http://string-functions.com/length.aspx instead of 19K string size, haha.