04.08.2014, 19:10
Use an array.
Example (obviously this might not work and isn't the most efficient example, but it should give you an idea on how to do it):
Don't expect fully working code neither, this is a sub section to ask help with scripting, not for people to make your scripts for you.
Example (obviously this might not work and isn't the most efficient example, but it should give you an idea on how to do it):
pawn Code:
#include <a_samp>
#define RAND_DIALOG0 0
#define RAND_DIALOG1 1
// etc
new bool: pDialogUsed[MAX_PLAYERS][5];
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/randomdialog", cmdtext, true, 10) == 0)
{
jump:
switch(random(5))
{
case 0:
{
if(pDialogUsed[playerid][0] == false)
{
ShowPlayerDialog(playerid, RAND_DIALOG0, DIALOG_STYLE_MSGBOX, "Insert Info Here", "Random Dialog 0", "Select", "Select");
}
else goto jump;
}
case 1:
{
// etc
}
}
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == RAND_DIALOG0)
{
if(response || !response)
{
pDialogUsed[playerid][0] = true;
// do some stuff
}
return 1;
}
return 0;
}