Dialog Help?
#1

Can someone change this to a dialog, when you type /buy in a business it opens the menu,
PHP код:
CMD:prices(playeridparams[])
{
    new 
idx GetPlayerVirtualWorld(playerid)-100string[128];
    if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_DARKRED"You need to login first before using any command.");
    if(
idx && idx MAX_BIZ && BizInfo[idx][bType] != && BizInfo[idx][bType] != && BizInfo[idx][bType] != && BizInfo[idx][bType] != && BizInfo[idx][bType] != || idx || idx MAX_BIZ) return SendClientMessage(playeridCOLOR_DARKRED"You are not inside a business.");
    if(
BizInfo[idx][bType] == 1)
    {
        
format(stringsizeof(string), "** %s's 24/7 Market menu list **"BizInfo[idx][bOwner]);
        
SendClientMessage(playeridCOLOR_ORANGEstring);
        
SendClientMessage(playeridCOLOR_WHITE" Cellphone ($100) | Phonebook ($50) | Dice ($20) | Cigar ($100)");
        
SendClientMessage(playeridCOLOR_WHITE" Speedometer ($200) | Sprunk ($30) | Spraycan ($100) | Rope ($60)");
        
SendClientMessage(playeridCOLOR_WHITE" Blindfold ($60) | WalkieTalkie ($200) | Smartphone($500)");
        
SendClientMessage(playeridCOLOR_WHITE" Camera ($300) | GasCan ($100)");
        
//if(BizInfo[idx][bLevel] >= 5) SendClientMessage(playerid, COLOR_WHITE, " Radio ($300)");
    
}
    else if(
BizInfo[idx][bType] == 3)
    {
        
format(stringsizeof(string), "** %s's Ammunation menu list **"BizInfo[idx][bOwner]);
        
SendClientMessage(playeridCOLOR_ORANGEstring);
        
SendClientMessage(playeridCOLOR_WHITE" 1) Shotgun Ammo ($400) | 2) Rifle Ammo ($2000)");
        
SendClientMessage(playeridCOLOR_WHITE" 3) Gun Ammo ($800)");
        
SendClientMessage(playeridCOLOR_WHITE" 4) Light-Machinegun Ammo ($1200)");
        
SendClientMessage(playeridCOLOR_WHITE" 5) Heavy-Machinegun Ammo ($2200)");
        
SendClientMessage(playeridCOLOR_WHITE" 6) Vest ($1000)");
    }
    else if(
BizInfo[idx][bType] == 4)
    {
        
format(stringsizeof(string), "** %s's Club menu list **"BizInfo[idx][bOwner]);
        
SendClientMessage(playeridCOLOR_ORANGEstring);
        
SendClientMessage(playeridCOLOR_WHITE"1) Sprunk ($50) | 2) Beer ($100) | 3) Vodka ($200)");
    }
    else if(
BizInfo[idx][bType] == 6)
    {
        
format(stringsizeof(string), "** %s's Fast Food menu list **"BizInfo[idx][bOwner]);
        
SendClientMessage(playeridCOLOR_ORANGEstring);
        
SendClientMessage(playeridCOLOR_WHITE"1) Small Meal ($10) | 2) Medium Meal ($30) | 3) Big Meal ($50)");
    }
    return 
1;

PHP код:
CMD:buy(playeridparams[])
{
    new 
idx GetPlayerVirtualWorld(playerid)-100string[128], typeprice;
    if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_DARKRED"You need to login first before using any command.");
    if(
idx && idx MAX_BIZ && BizInfo[idx][bType] != && BizInfo[idx][bType] != && BizInfo[idx][bType] != && BizInfo[idx][bType] != && BizInfo[idx][bType] != || idx || idx MAX_BIZ) return SendClientMessage(playeridCOLOR_DARKRED"You are not inside a business.");
    if(
BizInfo[idx][bType] == 1)
    {
        if(
sscanf(params"s[32]"params)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /buy [item]");
        if(
BizInfo[idx][bProducts] < 1) return SendClientMessage(playeridCOLOR_DARKRED"This business is currently out of products.");
        if(!
strcmp(params"cellphone"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 100) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            new 
randphone random(100) + random(8999);//minimum 100  max 9999
            
PlayerInfo[playerid][pNumber] = randphone;
            
PlayerInfo[playerid][pHasCellphone] = 1;
            
BizInfo[idx][bMoney] += 100;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -100);
            
format(stringsizeof(string), "* %s has bought a cellphone for $100."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" (( Check /stats to check your new Phone Number ))");
        }
        if(!
strcmp(params"phonebook"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 50) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            
PlayerInfo[playerid][pPhonebook] = 1;
            
BizInfo[idx][bMoney] += 50;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -50);
            
format(stringsizeof(string), "* %s has bought an electronic phonebook for $50."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" You can use /phonebook to find someone's number.");
        }
        if(!
strcmp(params"dice"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 20) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            
PlayerInfo[playerid][pDice] = 1;
            
BizInfo[idx][bMoney] += 20;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -20);
            
format(stringsizeof(string), "* %s has bought a pair of special dice for $20."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" You can use /rolldice to roll a dice.");
        }
        if(!
strcmp(params"cigar"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 100) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            
PlayerInfo[playerid][pCigar] = 5;
            
BizInfo[idx][bMoney] += 100;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -100);
            
format(stringsizeof(string), "* %s has bought 5 cuban cigars for $100."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" You can use /use to smoke a cigar.");
        }
        
// Level 2: Speedometer | Sprunk | Spraycan | Rope
        
if(!strcmp(params"speedometer"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 200) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            
PlayerInfo[playerid][pSpeedo] = 1;
            
BizInfo[idx][bMoney] += 200;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -200);
            
format(stringsizeof(string), "* %s has bought a speedometer for $200."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" You can use /tog to toggle speedometer on/off.");
        }
        if(!
strcmp(params"sprunk"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 30) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            
PlayerInfo[playerid][pSprunk] = 5;
            
BizInfo[idx][bMoney] += 30;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -30);
            
format(stringsizeof(string), "* %s has bought 5 redbull cans for $30."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" You can use /sprunk to drink a sprunk can.");
        }
        if(!
strcmp(params"spraycan"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 100) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            
PlayerInfo[playerid][pSpray] = 10;
            
BizInfo[idx][bMoney] += 100;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -100);
            
format(stringsizeof(string), "* %s has bought a duko spraycan $100."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" You can use /colorcar & /paintcar to color/paint a car.");
        }
        if(!
strcmp(params"rope"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 60) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            
PlayerInfo[playerid][pRope] = 5;
            
BizInfo[idx][bMoney] += 60;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -60);
            
format(stringsizeof(string), "* %s has bought 5 strong ropes for $60."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" You can use /tie to tie someone.");
        }
        
// Level 3: Blindfold | WalkieTalkie
        
if(!strcmp(params"blindfold"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 60) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            
PlayerInfo[playerid][pBlindfold] = 5;
            
BizInfo[idx][bMoney] += 60;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -60);
            
format(stringsizeof(string), "* %s has bought 5 blindfolds for $600."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" You can use /blindfold to blindfold someone.");
        }
        if(!
strcmp(params"walkietalkie"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 200) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            
PlayerInfo[playerid][pWT] = 1;
            
BizInfo[idx][bMoney] += 200;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -200);
            
format(stringsizeof(string), "* %s has bought a WalkieTalkie for $200."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" You can use /wtc to adjust the WalkieTalkie's channel, /wt to talk on it.");
        }
        if(!
strcmp(params"smartphone"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 500) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            
PlayerInfo[playerid][pHasCellphone] = 2;
            
BizInfo[idx][bMoney] += 500;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -500);
            
format(stringsizeof(string), "* %s has bought a smartphone for $500."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" You can use /smartphone to view your new cellphone commands.");
        }
        
// Level 4: Camera | Gas
        
if(!strcmp(params"camera"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 300) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            
GiveDodWeapon(playerid43999999);
            
BizInfo[idx][bMoney] += 300;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -300);
            
format(stringsizeof(string), "* %s has bought a professional camera for $300."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" You can start taking photos using your camera.");
        }
        if(!
strcmp(params"gascan"true))
        {
            if(
PlayerInfo[playerid][pMoney] < 100) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
            
PlayerInfo[playerid][pGas] = 1;
            
BizInfo[idx][bMoney] += 100;
            
BizInfo[idx][bProducts] --;
            
BizInfo[idx][bSold] ++;
            
GiveDodMoney(playerid, -100);
            
format(stringsizeof(string), "* %s has bought a gas can for $100."RPN(playerid));
            
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
SendClientMessage(playeridCOLOR_WHITE" You can use /gascan inside a vehicle anywhere now.");
        }
        
// Level 5: Radio
        /*if(!strcmp(params, "radio", true))
        {
            if(BizInfo[idx][bLevel] < 2) return SendClientMessage(playerid, COLOR_DARKRED, "This 24/7 Market doesn't have this product yet.");
            if(PlayerInfo[playerid][pMoney] < 600) return SendClientMessage(playerid, COLOR_DARKRED, "You don't have enough money to do this.");
            PlayerInfo[playerid][pRadio] = 1;
            BizInfo[idx][bMoney] += 600;
            BizInfo[idx][bProducts] --;
            BizInfo[idx][bSold] ++;
            GiveDodMoney(playerid, -600);
            format(string, sizeof(string), "* %s has bought a radio for $600.", RPN(playerid));
            SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            SendClientMessage(playerid, COLOR_WHITE, " You can use /music to play music using your radio.");
        }*/
    
}
    else if(
BizInfo[idx][bType] == 3)
    {
        if(
sscanf(params"i"type)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /buy [type]");
        if(
BizInfo[idx][bProducts] < 1) return SendClientMessage(playeridCOLOR_DARKRED"This business is currently out of products.");
        if(
type == 1price 400;
        else if(
type == 2price 2000;
        else if(
type == 3price 800;
        else if(
type == 4price 1200;
        else if(
type == 5price 2200;
        else if(
type == 6price 1000;
        else if(
type == 7price 5000;
        if(
type || type 7) return SendClientMessage(playeridCOLOR_DARKRED"Products are between 1 and 7");
        if(
PlayerInfo[playerid][pMoney] < price) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
        switch(
type)
        {
            case 
1:
            {
                if(
GetPlayerWeapon(playerid) != 25 && GetPlayerWeapon(playerid) != 26 && GetPlayerWeapon(playerid) != 27) return SendClientMessage(playeridCOLOR_DARKRED"You are not holding the right weapon for this type of ammo.");
                if(
GetPlayerWeapon(playerid) == 25GiveDodWeapon(playerid25120);
                if(
GetPlayerWeapon(playerid) == 26GiveDodWeapon(playerid26120);
                if(
GetPlayerWeapon(playerid) == 27GiveDodWeapon(playerid27120);
                
format(stringsizeof(string), "* %s has bought 120 shotgun bullets for $%d."RPN(playerid), price);
            }
            case 
2:
            {
                if(
GetPlayerWeapon(playerid) != 33 && GetPlayerWeapon(playerid) != 34) return SendClientMessage(playeridCOLOR_DARKRED"You are not holding the right weapon for this type of ammo.");
                if(
GetPlayerWeapon(playerid) == 33GiveDodWeapon(playerid33200);
                if(
GetPlayerWeapon(playerid) == 34GiveDodWeapon(playerid34200);
                
format(stringsizeof(string), "* %s has bought 100 rifle bullets for $%d."RPN(playerid), price);
            }
            case 
3:
            {
                if(
GetPlayerWeapon(playerid) != 22 && GetPlayerWeapon(playerid) != 23 && GetPlayerWeapon(playerid) != 24) return SendClientMessage(playeridCOLOR_DARKRED"You are not holding the right weapon for this type of ammo.");
                if(
GetPlayerWeapon(playerid) == 22GiveDodWeapon(playerid22120);
                if(
GetPlayerWeapon(playerid) == 23GiveDodWeapon(playerid23120);
                if(
GetPlayerWeapon(playerid) == 24GiveDodWeapon(playerid24120);
                
format(stringsizeof(string), "* %s has bought 120 gun bullets for $%d."RPN(playerid), price);
            }
            case 
4:
            {
                if(
GetPlayerWeapon(playerid) != 28 && GetPlayerWeapon(playerid) != 29 && GetPlayerWeapon(playerid) != 32) return SendClientMessage(playeridCOLOR_DARKRED"You are not holding the right weapon for this type of ammo.");
                if(
GetPlayerWeapon(playerid) == 28GiveDodWeapon(playerid28200);
                if(
GetPlayerWeapon(playerid) == 29GiveDodWeapon(playerid29200);
                if(
GetPlayerWeapon(playerid) == 32GiveDodWeapon(playerid32200);
                
format(stringsizeof(string), "* %s has bought 200 light-machinegun bullets for $%d."RPN(playerid), price);
            }
            case 
5:
            {
                if(
GetPlayerWeapon(playerid) != 30 && GetPlayerWeapon(playerid) != 31) return SendClientMessage(playeridCOLOR_DARKRED"You are not holding the right weapon for this type of ammo.");
                if(
GetPlayerWeapon(playerid) == 30GiveDodWeapon(playerid30200);
                if(
GetPlayerWeapon(playerid) == 31GiveDodWeapon(playerid31200);
                
format(stringsizeof(string), "* %s has bought 200 heavy-machinegun bullets for $%d."RPN(playerid), price);
            }
            case 
6:
            {
                new 
Float:ArmourGetPlayerArmour(playeridArmour);
                if(
Armour >= 80) return SendClientMessage(playeridCOLOR_DARKRED"You don't need a vest.");
                
SetPlayerArmour(playerid80);
                
format(stringsizeof(string), "* %s has bought a vest for $%d."RPN(playerid), price);
            }
        }
        
GiveDodMoney(playerid, -price);
        
BizInfo[idx][bMoney] += price;
        
BizInfo[idx][bProducts] --;
        
BizInfo[idx][bSold] ++;
        
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
        return 
1;
    }
    else if(
BizInfo[idx][bType] == 4)
    {
        if(
sscanf(params"i"type)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /buy [type]");
        if(
BizInfo[idx][bProducts] < 1) return SendClientMessage(playeridCOLOR_DARKRED"This business is currently out of products.");
        if(
type == 1price 50;
        else if(
type == 2price 100;
        else if(
type == 3price 200;
        if(
PlayerInfo[playerid][pMoney] < price) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
        switch(
type)
        {
            case 
1:
            {
                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_SPRUNK);
                
format(stringsizeof(string), "* %s has bought a sprunk can $%d."RPN(playerid), price);
            }
            case 
2:
            {
                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_BEER);
                
format(stringsizeof(string), "* %s has bought a bottle of beer for $%d."RPN(playerid), price);
            }
            case 
3:
            {
                
SetPlayerSpecialAction(playeridSPECIAL_ACTION_DRINK_WINE);
                
format(stringsizeof(string), "* %s has bought a bottle of vodka for $%d."RPN(playerid), price);
            }
        }
        
GiveDodMoney(playerid, -price);
        
BizInfo[idx][bMoney] += price;
        
BizInfo[idx][bProducts] --;
        
BizInfo[idx][bSold] ++;
        
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
    }
    else if(
BizInfo[idx][bType] == 6)
    {
        if(
sscanf(params"i"type)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /buy [type]");
        if(
BizInfo[idx][bProducts] < 1) return SendClientMessage(playeridCOLOR_DARKRED"This business is currently out of products.");
        if(
type == 1price 10;
        else if(
type == 2price 30;
        else if(
type == 3price 50;
        if(
PlayerInfo[playerid][pMoney] < price) return SendClientMessage(playeridCOLOR_DARKRED"You don't have enough money to do this.");
        new 
Float:pH;
        switch(
type)
        {
            case 
1:
            {
                
GetPlayerHealth(playeridpH);
                
SetPlayerHealth(playeridpH+20);
                
GetPlayerHealth(playeridpH);
                if(
pH 100SetPlayerHealth(playerid100);
                
format(stringsizeof(string), "* %s has bought a small meal for $%d."RPN(playerid), price);
            }
            case 
2:
            {
                
GetPlayerHealth(playeridpH);
                
SetPlayerHealth(playeridpH+40);
                
GetPlayerHealth(playeridpH);
                if(
pH 100SetPlayerHealth(playerid100);
                
format(stringsizeof(string), "* %s has bought a medium meal for $%d."RPN(playerid), price);
            }
            case 
3:
            {
                
SetPlayerHealth(playerid100);
                
format(stringsizeof(string), "* %s has bought a large meal for $%d."RPN(playerid), price);
            }
        }
        
GiveDodMoney(playerid, -price);
        
BizInfo[idx][bMoney] += price;
        
BizInfo[idx][bProducts] --;
        
BizInfo[idx][bSold] ++;
        
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)