How to make a business?
#1

I've done the commands to make the business for a store.. How do I now add the commands > /buy (Comes up with a list)
Reply
#2

What kind of things do you want to put on /buy? Do you want them to save afterwards?

EDIT: I've made this, try it.

PHP код:
#define BUY 1001
CMD:buy(playerid,params[])
{
    if(
GetPlayerInterior(playerid) != ID)) return SendClientMessage(playerid,COLOR_RED,"You're not in the store."); // Checks if the player is in the store. [Change the "ID" to the interiors ID where the store is.
    
ShowPlayerDialog(playerid,BUY,DIALOG_STYLE_LIST,"Products",
    
"Product\tAmount\tPrice\n\
    Beer\t1.5l\t500\n\
    Water\t1.0l\t250\n\
    Phone\t1\t1500"
,
    
"Select","Close");
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid==BUY)
    {
        if(
response)
        {
            switch(
listitem)
            {
                case 
0:
                {
                    if(
GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid,COLOR_RED,"You don't have enough money.");
                    
/// Your saving variable here [ex]: PlayerInfo[playerid][pPhone]
                    
GivePlayerMoney(playerid,-500);
                    
SendClientMessage(playerid,COLOR_ORANGE,"You've bought a can of beer.");
                }
                case 
1:
                {
                    if(
GetPlayerMoney(playerid) < 250) return SendClientMessage(playerid,COLOR_RED,"You don't have enough money.");
                    
GivePlayerMoney(playerid,-250);
                    
/// Your saving variable here [ex]; PlayerInfo[playerid][pPhone]
                    
SendClientMessage(playerid,COLOR_ORANGE,"You've bought a bottle of water.");
                }
                case 
2:
                {
                    if(
GetPlayerMoney(playerid) <1500) return SendClientMessage(playerid,COLOR_RED,"You don't have enough money.");
                    
GivePlayerMoney(playerid,-1500);
                    
/// Your saving variable here [ex]; PlayerInfo[playerid][pPhone]
                    
SendClientMessage(playerid,COLOR_ORANGE,"You've bought a phone.");
                }
            }
        }
        return 
1;
    }
    return 
0;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)