Insert text per line
#1

Hello, I would like to put text on a line that will be randomly assigned. For example: new line = 5 .. and I should have done the lines, and only on line 5 give that text .. Do not understand, I know

Код:
new line[MAX_PLAYERS];

CMD:coin(playerid, params[])
{
  new sString[259];
  for(new i; i < MAX_LINES; i++) {

	   strins(sString, "%i)", i);
	}
  ShowPlayerDialog(playerid, 1562, DIALOG_STYLE_LIST, "Clicker - EvoLve.",  sString, "Select", "Close");
  return 1;
}
// This is generated dialog.. ye ? And put text 'Coins + 1' on random generated line..

line[playerid] = random(MAX_LINES); // Random generate line

//Set name of line.. And insert the text on the line that is specified in varriable line[playerid]..

stock ClickerGenerate(playerid)
{
  new generated[100];
  if(line[playerid] == 0) generated = "\n";
  else if(line[playerid] > 0) generated = "Coins + 1\n";
  return generated;
}
Or when I have bad code, please fix it to me .. I want it to give me a random number, and in the command / coins on that line will be 'Coins + 1' .. Thank you
Reply
#2

Код:
new line[MAX_PLAYERS];
CMD:coin(playerid, params[])
{
  static
    sString[64],
    str[128+1],
    bool:generated = false;
  ;
  line[playerid] = random(MAX_LINES);
  for(new i; i < MAX_LINES; i++)
  {
	   strins(sString, "%i)\n", i);
     if(line[playerid] == i && !generated) {
        strcat(str, "Coins + 1");
        generated = true;
     }
     strcat(str, sString);
	}
  ShowPlayerDialog(playerid, 1562, DIALOG_STYLE_LIST, "Clicker - EvoLve.",  str, "Select", "Close");
  return 1;
}
Try this
Reply
#3

oh, THX
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)