weird string problem
#1

Hi!
I made a simple voting system that allows to input question and answers (up to 4, 2 are optinal).
The problem is that the last string comes up wrong in a dialog, I have no idea why!
Little more specific, I'm able to input 4 answers only if the answer lenght isn't longer then 4(maybe 3).
What comes out is simply messed up, but there seem to be some logic in there like... for script to avoid reaching the string size limit it copies the answers and puts them together.
It looks like this: ansansanswer1, ansanswer2, answer3, (empty) or something like that.
here is some parts of the code
Global:
Код:
new VoteQ[MAX_STRING];
new VoteAnswers[32][4];
new VoteStage;
Dialog:
Код:
	if(dialogid == 23) {
	if(response) {
	if(VoteOn == false) {
	if(VoteStage < 4) {
	if(VoteStage == 0) {
	format(VoteQ, MAX_STRING, "%s", inputtext);
	} else {
	format(VoteAnswers[VoteStage-1], 32, "%s", inputtext);
	}
	if(VoteStage == 2) {
	ShowPlayerDialog(playerid, 23, DIALOG_STYLE_INPUT, "Vote:", "Input answer", "Next", "Start");
	} else if(VoteStage == 3) {
	ShowPlayerDialog(playerid, 23, DIALOG_STYLE_INPUT, "Vote:", "Input answer", "Start", "Cancel");
	} else {
	ShowPlayerDialog(playerid, 23, DIALOG_STYLE_INPUT, "Vote:", "Input answer", "Next", "Cancel");
	}
	VoteStage++;
	} else {
	format(VoteAnswers[VoteStage-1], 32, "%s", inputtext);
	foreach(Player, i) {
	SendMess(i, COLOR_RED, VoteQ, VoteQ);
	Voted[i] = false;
	}
	SetTimer("VoteEnd", 60000, false);
	VoteOn = true;
	}	} else {
	//active vote
	}
	} else {
	if(VoteStage > 1 && VoteStage < 4) {
	foreach(Player, i) {
	SendMess(i, COLOR_RED, VoteQ, VoteQ);
	Voted[i] = false;
	}
	SetTimer("VoteEnd", 60000, false);
	VoteOn = true;
	}
	}
	return true;
	}
Voting command:
Код:
format(string, MAX_STRING, "%s\n%s", VoteAnswers[0], VoteAnswers[1]);
if(!isnull(VoteAnswers[2])) {
format(string, MAX_STRING, "%s\n%s", string, VoteAnswers[2]);
}
if(!isnull(VoteAnswers[3])) {
format(string, MAX_STRING, "%s\n%s", string, VoteAnswers[3]);
}
ShowPlayerDialog(playerid, 22, DIALOG_STYLE_LIST, VoteQ, string, "Vote", "Cancel");
Code could seem really messed up, but it simply puts inputtext into VoteAnswers.
I have tried to change the string limits, but no luck.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)