Insert text per line - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Insert text per line (
/showthread.php?tid=646554)
Insert text per line -
James585 - 18.12.2017
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
Re: Insert text per line -
0x88 - 19.12.2017
Код:
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
Re: Insert text per line -
James585 - 20.12.2017
oh, THX