SA-MP Dialog - To much text? :P
#1

hello, I was working on a simple Rules Dialog..
Then i've got some errors.

Code:
: error 075: input line too long (after substitutions)
: error 037: invalid string (possibly non-terminated string)
: warning 215: expression has no effect
: error 001: expected token: ";", but found "."
: error 029: invalid expression, assumed zero
: fatal error 107: too many error messages on one line
This is the code.. it's a little bit to long :P

So i had to split it in 4 strings :S

pawn Code:
Removed due copycats
- Thanks Silverkiller for helping me.
+rep!
So ehh.. what's the problem here?
Reply
#2

Too much words in the format, make more lines..
Reply
#3

Use strcat.
Reply
#4

Fixed.. now i got this :S

Code:
: error 001: expected token: ",", but found "-identifier-"
: warning 215: expression has no effect
: error 001: expected token: ";", but found "-identifier-"
: warning 215: expression has no effect
: error 001: expected token: ";", but found "-identifier-"
: fatal error 107: too many error messages on one line
pawn Code:
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Server Rules Agreement (1/7)",string string2 string3 string4 string5 string6 string7, "I Agree", "I Disagree");
Reply
#5

I would recommend you to use one string only. You could do it like this
pawn Code:
case 5402:
{
    new
        String[100]; // Or whatever size you need
    strins(String, "Holy moly", 0, sizeof(String));
    strins(String, "\nYay", strlen(String), sizeof(String));
    // And so on
}
There's a few problems I can spot instantly with the code you provided.
First of all at least one of the formats are way too long.

Second,

pawn Code:
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Server Rules Agreement (1/7)",string string2 string3 string4, "I Agree", "I Disagree");
You would have to combine all your strings into 1 string.

pawn Code:
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Server Rules Agreement (1/7)",string, "I Agree", "I Disagree");
So if you use the method I provided above, you could store it all into 1 single string, without the need of using format over and over. You could also do it like this though,

pawn Code:
format(String, sizeof(String), "Holy Moly");
format(String, sizeof(String), "%s\nYay", String);
Another option would be to create the string with the rules beforehand. Then you could use it wherever you want in the script, having it ready to use whenever you need. This would also save up some memory or CPU, though this particular part wouldn't use too much anyway.

pawn Code:
new
    ServerRules[50 char] =
                                  !"Holy Moly    \
                                    Yay            \
                                    Test"
;
This is a packed string, which means it uses 1 byte per character instead of 4 bytes per character. This saves up a small chunk of memory. Considering that this string is going to be pretty big, a packed string will benefit you. If you do it like this, you can show the dialog like this at any time.

pawn Code:
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Server Rules Agreement (1/7)",ServerRules, "I Agree", "I Disagree");
You could also use a normal sting though.

Hope this helped.
Reply
#6

----
Reply
#7

pawn Code:
new ServerRules[char 1000] =
                        !"1. Do not use any cheats or hacks, exploits or third party modifications.\n                       \
                        2. Roleplay at all times unless an admin says not to.\n                                             \
                        3. Do not metagame.\n                                                                               \
                        4. Do not powergame.\n                                                                              \
                        5. Revenge killing is prohibited.\n                                                                 \
                        6. Do not steal (ninja-jack) occupied vehicles without any roleplay involved.\n                     \
                        7. Do not use abbrevations in character.\n8. Constantly jumping (bunny-hopping) is prohibited.\n    \  
                        9. Car-surfing is allowed only in pickup trucks (Up to 2 persons in the back)."
;
                        // And so on
Read my post above as well, might learn something, as it is better explained in that post.
Reply
#8

Thanks!
Reply
#9

Edit;

Dialog Wont pop up ingame. ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)