DIALOG_STYLE_LIST help..
#1

Hello guys, am kinda new to scripting and I might need a help creating a /shop cmd with DIALOG_STYLE_LIST,
I mean that the /shop cmd will look kinda like this;

"You've entered the shop, please purchase the weapon of your choise"

AK-47 2500$
M4A1 2500$
Combat-Shotgun 4000$

And etc...

Another problem I've is displaying a text on the bottom corner while in-game, I've this scripted.

pawn Код:
new Text:HZGaming; // At the top of the script.
And on public OnGameModeInit() I've this;

pawn Код:
HZGaming = TextDrawCreate(1.5 ,459 , "Welcome to Hazard-Gaming, visit hz-gaming.com");
    TextDrawFont(HZGaming , 3);
    TextDrawLetterSize(HZGaming , 0.4, 2.8000000000000003);
    TextDrawColor(HZGaming , 0xffbf00FF);
    TextDrawSetOutline(HZGaming , false);
    TextDrawSetProportional(HZGaming , true);
    TextDrawSetShadow(HZGaming , 1);
Now I don't have this text displayed at the bottom corner of my screen, and I'd like to know how to fix this problem.

If you've any usefull tutorials for begginer scripter which might ACTUALLY help I'd love a link to them.

Thanks ahead, all the best.
Reply
#2

Add to onplayerspawn or onplayerconnect

pawn Код:
TextDrawShowForPlayer(playerid,HZGaming);
As for the shop:
pawn Код:
ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_LIST,"Title","Contents\nContents\nContents","ok","Close");
There's a few shop FS's around if you want to take a look at them however
Reply
#3

pawn Код:
#define DIALOG_SHOP 1

CMD_shop(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "SHOP", "AK-47\nM4A1\nCombat Shotgun", "Choose", "Quit"); //In the command
   return 1;
}

//AK is Case 0
//M4 is Case 1
//Combat Shotgun is case 2

//On Dialog Response
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_SHOP:
        {
            if (!response)
            {
               return 1;
            }
            if (response)
            {
                switch(listitem)
                {
                  case 0://AK
                 {
                    if(GetPlayerMoney(playerid) < 2500)
                    {
                       SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this weapon");
                       return 1;
                   }
                    SendClientMessage(playerid, COLOR_GREEN, "You have bought an AK for 2500$.");
                    GivePlayerWeapon(playerid, 30, 300);
                 }
                 case 1://M4
                 {
                    if(GetPlayerMoney(playerid) < 2500)
                    {
                       SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this weapon");
                       return 1;
                   }
                    SendClientMessage(playerid, COLOR_GREEN, "You have bought an M4 for 2500$.");
                    GivePlayerWeapon(playerid, 31, 300);
                 }
                case 2://Combat Shotgun
                 {
                    if(GetPlayerMoney(playerid) < 2500)
                    {
                       SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this weapon");
                       return 1;
                    }
                    SendClientMessage(playerid, COLOR_GREEN, "You have bought an AK for 2500$.");
                    GivePlayerWeapon(playerid, 27, 300);
                 }
               }
           }
       }
    }
    return 1;
}
I hope I helped
Reply
#4

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
Add to onplayerspawn or onplayerconnect

pawn Код:
TextDrawShowForPlayer(playerid,HZGaming);
As for the shop:
pawn Код:
ShowPlayerDialog(playerid,dialogid,DIALOG_STYLE_LIST,"Title","Contents\nContents\nContents","ok","Close");
There's a few shop FS's around if you want to take a look at them however
Thanks for your help, but I'd like a link if ya could

P.S. - I've added the line you said, but still no result. Any other problem you notice? :O
I want the text to be displayed at the bottom left corner of the screen, and I created it here;
http://bsndesign.webs.com/tde.htm

Quote:
Originally Posted by _Khaled_
Посмотреть сообщение
pawn Код:
#define DIALOG_SHOP 1

CMD_shop(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "SHOP", "AK-47\nM4A1\nCombat Shotgun", "Choose", "Quit"); //In the command
   return 1;
}

//AK is Case 0
//M4 is Case 1
//Combat Shotgun is case 2

//On Dialog Response
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_SHOP:
        {
            if (!response)
            {
               return 1;
            }
            if (response)
            {
                switch(listitem)
                {
                  case 0://AK
                 {
                    if(GetPlayerMoney(playerid) < 2500)
                    {
                       SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this weapon");
                       return 1;
                   }
                    SendClientMessage(playerid, COLOR_GREEN, "You have bought an AK for 2500$.");
                    GivePlayerWeapon(playerid, 30, 300);
                 }
                 case 1://M4
                 {
                    if(GetPlayerMoney(playerid) < 2500)
                    {
                       SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this weapon");
                       return 1;
                   }
                    SendClientMessage(playerid, COLOR_GREEN, "You have bought an M4 for 2500$.");
                    GivePlayerWeapon(playerid, 31, 300);
                 }
                case 2://Combat Shotgun
                 {
                    if(GetPlayerMoney(playerid) < 2500)
                    {
                       SendClientMessage(playerid, COLOR_RED, "You don't have enough money to buy this weapon");
                       return 1;
                    }
                    SendClientMessage(playerid, COLOR_GREEN, "You have bought an AK for 2500$.");
                    GivePlayerWeapon(playerid, 27, 300);
                 }
               }
           }
       }
    }
    return 1;
}
I hope I helped
You've really helped, but I'd like to know HOW to code it, if ya have any tut. link I'd be greatfull!
Reply
#5

Heres a simple shop I created

https://sampforum.blast.hk/showthread.php?tid=446109
Reply
#6

Quote:
Originally Posted by Josh_Main
Посмотреть сообщение
Thanks, was very helpfull!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)