'strcat' and it's use with list type of dialog.
#1

Just another Query with 'strcat' am i able to use it for a list type Dialog?

Example:(6 Extra Lines of Code in my GM )
pawn Code:
strcat(dialog,"{000000}||||||\r\n{FFFFFF}||||||\r\n{2A77A1}||||||\r\n{840510}||||||\r\n{253739}||||||\r\n{87446f}||||||\r\n{d68f11}||||||","Continue","Back");
Or would i be able to do it
Example:(126 Extra Lines of Code in my GM -.-)
pawn Code:
strcat(dialog,"{000000}||||||\r\n");
strcat(dialog,"{FFFFFF}||||||\r\n");
strcat(dialog,"{2A77A1}||||||\r\n");
strcat(dialog,"{840510}||||||\r\n");
strcat(dialog,"{253739}||||||\r\n");
....
Would both work?

Sorry for being a slack ass and not testing it, i just have a lot to get through and am kinda in a rush, Yes i understand others might be the same way but just thought someone might have known off by heart, so sorry for asking prior to testing...
Reply
#2

strcat adds to the end of a string, so:

pawn Code:
new string[32] = "Hello";
strcat(string, " this is");
strcat(string, " a string.");
result:

"Hello this is a string."
Reply
#3

@MP2: Re-read his post.

@Deal-or-die: Unless the line isn't too long, you should be fine.
Reply
#4

Quote:
Originally Posted by MP2
View Post
strcat adds to the end of a string, so:

pawn Code:
new string[32] = "Hello";
strcat(string, " this is");
strcat(string, " a string.");
result:

"Hello this is a string."
https://sampforum.blast.hk/showthread.php?tid=338181

So... are you saying that it wouldn't work? for what i need?

Is there anything that i could do here other than make another dialog with a 'next' button as the only error i am getting is
Code:
'error 075: input line too long (after substitutions)'
Reply
#5

Quote:
Originally Posted by Disturn
View Post
@MP2: Re-read his post.

@Deal-or-die: Unless the line isn't too long, you should be fine.
Yea that what i thought... Haha, Cheers mate.
Reply
#6

Quote:
Originally Posted by Disturn
View Post
@MP2: Re-read his post.
I did. I didn't just post random code did I?

Your original code was

pawn Code:
ShowPlayerDialog(playerid, 125, DIALOG_STYLE_MSGBOX, "Purchase Confirmation", "By Signing this contract you are agreeing to purchasing this vehicle you you will be charged accordingly,\n If you decline this purchase you will not be charged and the vehicle will remain at the dealership for another buyer.\n\n\n{FF0000} After vehicle purchase, the vehicle is then under your care and is not covered by any dealership insurance policies.\n\n We offer every vehicle sold a temporary license plate that is only valid for one day((One payday)).", "Sign", "Decline");
Just split it up (you'll have to guess how short to make them):

pawn Code:
new szDialog[464] = "By Signing this contract you are agreeing to purchasing this vehicle you you will be charged accordingly,");
strcat(szDialog, "\n If you decline this purchase you will not be charged and the vehicle will remain at the dealership for another buyer.");
strcat(szDialog, "\n\n\n{FF0000} After vehicle purchase, the vehicle is then under your care and is not covered by any dealership insurance policies.");
strcat(szDialog, "\n\n We offer every vehicle sold a temporary license plate that is only valid for one day((One payday)).");

ShowPlayerDialog(playerid, 125, DIALOG_STYLE_MSGBOX, "Purchase Confirmation", szDialog, "Sign", "Decline");
Useful site: http://www.javascriptkit.com/script/...harcount.shtml

NOTE: Not tested, it's a lot of text to work with so something may be out of place. Let me know.

P.S.:

ShowPlayerDialog(playerid, 125, DIALOG_STYLE_MSGBOX

You should use defines, as you're going to end up with hundreds of dialog IDs and not knowing which is which.

pawn Code:
#define DIALOG_DEALERSHIP_CONTRACT 125
Reply
#7

Quote:
Originally Posted by MP2
View Post
I did. I didn't just post random code did I?

Your original code was

pawn Code:
ShowPlayerDialog(playerid, 125, DIALOG_STYLE_MSGBOX, "Purchase Confirmation", "By Signing this contract you are agreeing to purchasing this vehicle you you will be charged accordingly,\n If you decline this purchase you will not be charged and the vehicle will remain at the dealership for another buyer.\n\n\n{FF0000} After vehicle purchase, the vehicle is then under your care and is not covered by any dealership insurance policies.\n\n We offer every vehicle sold a temporary license plate that is only valid for one day((One payday)).", "Sign", "Decline");
Just split it up (you'll have to guess how short to make them):

pawn Code:
new szDialog[464] = "By Signing this contract you are agreeing to purchasing this vehicle you you will be charged accordingly,");
strcat(szDialog, "\n If you decline this purchase you will not be charged and the vehicle will remain at the dealership for another buyer.");
strcat(szDialog, "\n\n\n{FF0000} After vehicle purchase, the vehicle is then under your care and is not covered by any dealership insurance policies.");
strcat(szDialog, "\n\n We offer every vehicle sold a temporary license plate that is only valid for one day((One payday)).");

ShowPlayerDialog(playerid, 125, DIALOG_STYLE_MSGBOX, "Purchase Confirmation", szDialog, "Sign", "Decline");
Useful site: http://www.javascriptkit.com/script/...harcount.shtml

NOTE: Not tested, it's a lot of text to work with so something may be out of place. Let me know.
Yea no worries mate, cheers for the feed back and MP2 wasn't having a go at you nor was he saying you didn't read it, he was just saying re-read it as you had something wrong.

Cheers too both of yas. will let you know how it went i have a fair bit to do before i can test it yet :P got about 4 different systems i am working on :P.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)