Random Dialogs
#1

Hello everyone.

I made this Gamble system for my server.

Quote:

#define DIALOG_GAMBLE1 1
#define DIALOG_GAMBLE2 2
#define DIALOG_GAMBLE3 3

if (strcmp("/gamble", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, DIALOG_GAMBLE1, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries", "Pull", "");
return 1;

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_GAMBLE1)
{
if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
{
ShowPlayerDialog(playerid, DIALOG_GAMBLE2, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries {91FF00}Apples", "Pull", "");
}
else // Slot Machine (if they pressed ESC)
{
ShowPlayerDialog(playerid, DIALOG_GAMBLE2, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries {91FF00}Apples", "Pull", "");
}
return 1;
}
if(dialogid == DIALOG_GAMBLE2)
{
if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
{
ShowPlayerDialog(playerid, DIALOG_GAMBLE3, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries {91FF00}Apples {D0DB00}Bananas", "Exit", "");
}
else // Slot Machine (if they pressed ESC)
{
ShowPlayerDialog(playerid, DIALOG_GAMBLE3, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries {91FF00}Apples {D0DB00}Bananas", "Exit", "");
}
return 1;
}
if(dialogid == DIALOG_GAMBLE3)
{
if(response) // Slot Machine (if they clicked 'Pull', or pressed Enter)
{
if(Money[playerid] < 100) return SendClientMessage(playerid,0xFF0000FF,"You do not even have $100! You cheated in the Casino! You are now wanted by the Police.");

SendClientMessage(playerid,0xFF0000FF,"You have lost from the {0004FF}Fruit {FF00FF}Slot {91FF00}Machine! You lost $100. Good luck next time!");
GivePlayerMoney(playerid,-100);
}
else // Slot Machine (if they pressed ESC)
{
ShowPlayerDialog(playerid, DIALOG_GAMBLE3, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "~r~Berries ~g~Apples ~r~Strawberrys", "Exit", "");
}
return 1;
}
if(dialogid == DIALOG_MAKEADMIN)
{
if(response) // MakeMeAdmin (if they clicked 'Send', or pressed Enter)
{
SendClientMessage(playerid,0xFF0000FF,"[ADMIN]: Wrong Code!");
}
else // MakeMeAdmin (if they pressed ESC, or clicked 'Cancel')
{
SendClientMessage(playerid,0xFF0000FF,"[ADMIN]: You have canceled the MakeMeAdmin.");
}
return 1;
}

return 0;
}

(Im sorry if it's hard to see, because this forum doesn't count spaces).
Anyways, i want it so when you type /gamble, a RANDOM dialog shows up.
I probably need to make more defines for that, and i know that, but could
Someone please edit this with more dialogs, and when you type /gamble, you get a random dialog?
Because if you use this now the only thing you can do is lose ur money :P\

Greetings, CrazyManiac!
Reply
#2

I did this on a FS,with random dialogs,but sometimes is showing up same dialog 2-3 times,and i have 30 dialogs..check the HangMan from my signature.

You should do something like this
pawn Код:
if (strcmp("/gamble", cmdtext, true, 10) == 0)
{
new rand = 1 + random(3);
ShowPlayerDialog(playerid, rand, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries", "Pull", "");
return 1;
Reply
#3

You can use random function, like this:
pawn Код:
if( strcmp( "/gamble", cmdtext, true, 10 ) == 0 )
{
    switch( random( 3 ) )
    {
        case DIALOG_GAMBLE1: ShowPlayerDialog( playerid, DIALOG_GAMBLE1, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries", "Pull", "" );
        case DIALOG_GAMBLE2: ShowPlayerDialog( playerid, DIALOG_GAMBLE1, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries", "Pull", "" );
        case DIALOG_GAMBLE3: ShowPlayerDialog( playerid, DIALOG_GAMBLE1, DIALOG_STYLE_MSGBOX, "{0004FF}Fruit {FF00FF}Slot {91FF00}Machine", "{B34242}Berries", "Pull", "" );
    }
       
    return ( 1 );
}
You must edit it, you know!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)