Clothes Shop Bug
#1

Hi,
mSelection menu doesn't appear.
What I must do?
CMD Code :
PHP код:
if(strcmp(cmd"/buy"true) == 0)
    {
        for(new 
0sizeof(BizInfo); i++)
        {
            if(
IsPlayerInRangeOfPoint(playerid,25.0,BizInfo[i][bInsideX],BizInfo[i][bInsideY],BizInfo[i][bInsideZ]))
            {
                if(
GetPlayerVirtualWorld(playerid) == i)
                   {
                    switch(
BizInfo[i][bType])
                    {
                        case 
1// Clothes Store
                        
{
                            if(
BizInfo[i][bProducts] <= 0)
                            {
                                
SendClientMessage(playeridCOLOR_GREY"   This business doesn't have any products left.");
                                return 
1;
                            }
                            
DisplayDialogForPlayer(playerid27);
                        }
                        default:
                        {
                            return 
SendClientMessage(playeridCOLOR_GREY"   You are not in a business that can sell products");
                        }
                    }
                }
            }
        }
        return 
1;
    } 
Dialog Codes : (List item 0) [DOESN'T WORK]
PHP код:
if(dialogid == 77//buy clothes
    
{
        if(
response)
        {
            if(!
IsAtClothShop(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not inside the Clothes shop");
            new 
biz GetPlayerVirtualWorld(playerid);
            if(!
IsNumeric(inputtext))
            {
                
SendClientMessage(playeridCOLOR_GREY"   You must enter a number for the skin ID.");
                return 
1;
            }
            if((
strval(inputtext) == 294 && PlayerInfo[playerid][pDonateRank] == 0) ||
                (
strval(inputtext) == 295 && PlayerInfo[playerid][pDonateRank] == 0) ||
                (
strval(inputtext) == 167) ||
                (
strval(inputtext) == 0) ||
                (
strval(inputtext) >= 265 && strval(inputtext) <= 267) ||
                (
strval(inputtext) == 165) ||
                (
strval(inputtext) == 166) ||
                (
strval(inputtext) >= 280 && strval(inputtext) <= 288) ||
                (
strval(inputtext) >= 274 && strval(inputtext) <= 279) ||
                (
strval(inputtext) >= 163 && strval(inputtext) <= 166) ||
                (
strval(inputtext) >= 268 && strval(inputtext) <= 271) ||
                (
strval(inputtext) == 296) ||
                (
strval(inputtext) == 71)) return SendClientMessage(playerid,COLOR_GREY,"   You are not allowed to use this skin.");
            new 
skin strval(inputtext);
            if(
skin || skin 299) return SendClientMessage(playeridCOLOR_GREY"   Skin can't be below 0 or above 299.");
            
PlayerTextDrawDestroy(playeridpModel_t[playerid]);
            
pModelState[playerid] = 999;
            
pModel_t[playerid] = CreatePlayerTextDraw(playerid220.0250.0"_");
            
PlayerTextDrawFont(playeridpModel_t[playerid], TEXT_DRAW_FONT_MODEL_PREVIEW);
            
PlayerTextDrawTextSize(playeridpModel_t[playerid], 200.0200.0);
            
PlayerTextDrawSetPreviewModel(playeridpModel_t[playerid], skin);
            
PlayerTextDrawUseBox(playeridpModel_t[playerid], 0);
            
PlayerTextDrawBackgroundColor(playeridpModel_t[playerid], 0x00000000);
            
PlayerTextDrawShow(playeridpModel_t[playerid]);
            
pModelState[playerid] = 2;
            
pModelRot[playerid][0] = 0;
            
pModelRot[playerid][1] = 0;
            
pModelRot[playerid][2] = 0;
            
pModelTimer[playerid] = SetTimerEx("UpdatePreviewModel"10001"i"playerid);
            
ShowPlayerDialog(playerid771DIALOG_STYLE_MSGBOX"Are you sure?""Are you sure you would like to by this skin for $500?\n\n{F5DA81}NOTE: Below is a preview of the skin.""Purchase""Cancel");
            
SetPVarInt(playerid"buyskinbincobiz"biz);
            
SetPVarInt(playerid"buyskinbinco"skin);
            return 
1;
        }
    }
    if(
dialogid == 771)
    {
        
PlayerTextDrawDestroy(playeridpModel_t[playerid]);
        
pModelState[playerid] = 999;
        if(!
response) { DeletePVar(playerid"buyskinbinco"); DeletePVar(playerid"buyskinbincobiz"); return 1; }
        else
        {
            
SendClientMessage(playerid,COLOR_LIGHTBLUE,"* You bought a new set of clothes for $500.");
            new 
skin GetPVarInt(playerid"buyskinbinco");
            new 
biz GetPVarInt(playerid"buyskinbincobiz");
            
GiveMoney(playerid, -500);
            
BizInfo[biz][bTill] += 500;
            
BizInfo[biz][bProducts] -= 1;
            
SetPlayerSkin(playerid,skin);
            
PlayerInfo[playerid][pModel] = skin;
            
DeletePVar(playerid"buyskinbinco");
            
DeletePVar(playerid"buyskinbincobiz");
        }
    } 
Accessory Code : [DOESN'T WORK]
PHP код:
if(dialogid == 24213// ID is Buying Accessories
    
{
        if(
response)
        {
            if(!
IsAtClothShop(playerid)) return SendClientMessage(playerid,COLOR_GREY,"   You are not at a clothes shop.");
            new 
biz GetPlayerVirtualWorld(playerid);
            if(
GetMoney(playerid) < AccessNames[listitem][modprice]) return SendClientMessage(playeridCOLOR_GRAD1"  You do not have enough money to pay for that!");
            new 
freeslot = -1;
            for(new 
07i++)
            {
                if(
Accessories[playerid][i] == 0)
                {
                    
freeslot i;
                    break;
                }
            }
            if(
freeslot == -1) return SendClientMessage(playeridCOLOR_GRAD1"  You do not have enough space in your inventory for that!");
            
PlayerTextDrawDestroy(playeridpModel_t[playerid]);
            
pModelState[playerid] = 999;
            
pModel_t[playerid] = CreatePlayerTextDraw(playerid220.0220.0"_");
            
PlayerTextDrawFont(playeridpModel_t[playerid], TEXT_DRAW_FONT_MODEL_PREVIEW);
            
PlayerTextDrawTextSize(playeridpModel_t[playerid], 200.0200.0);
            
PlayerTextDrawSetPreviewModel(playeridpModel_t[playerid], AccessNames[listitem][modid]);
            
PlayerTextDrawSetPreviewRot(playeridpModel_t[playerid], -15.00.00.0);
            
PlayerTextDrawUseBox(playeridpModel_t[playerid], 0);
            
PlayerTextDrawBackgroundColor(playeridpModel_t[playerid], 0x00000000);
            
PlayerTextDrawShow(playeridpModel_t[playerid]);
            
pModelState[playerid] = 1;
            
pModelRot[playerid][0] = 0;
            
pModelRot[playerid][1] = 0;
            
pModelRot[playerid][2] = 0;
            
pModelTimer[playerid] = SetTimerEx("UpdatePreviewModel"10001"i"playerid);
            
format(stringsizeof(string), "Are you sure you would like to by this accessory for $%d?\n\n{F5DA81}NOTE: Below is a preview of the accessory."AccessNames[listitem][modprice]);
            
ShowPlayerDialog(playerid772DIALOG_STYLE_MSGBOX"Are you sure?"string"Purchase""Cancel");
            
SetPVarInt(playerid"buyaccbincobiz"biz);
            
SetPVarInt(playerid"buyaccbinco"listitem);
        }
    }
    if(
dialogid == 772)
    {
        
PlayerTextDrawDestroy(playeridpModel_t[playerid]);
        
pModelState[playerid] = 999;
        if(!
response) { DeletePVar(playerid"buyaccbincobiz"); DeletePVar(playerid"buyaccbinco"); return 1; }
        else
        {
            new 
biz GetPVarInt(playerid"buyaccbincobiz");
            new 
accid GetPVarInt(playerid"buyaccbinco");
            new 
freeslot = -1;
            for(new 
07i++)
            {
                if(
Accessories[playerid][i] == 0)
                {
                    
freeslot i;
                    break;
                }
            }
            if(
freeslot == -1) return SendClientMessage(playeridCOLOR_GRAD1"  You do not have enough space in your inventory for that!");
            
Accessories[playerid][freeslot] = AccessNames[accid][modid];
            
AccessoriesB[playerid][freeslot] = 1;
            
AccessoriessX[playerid][freeslot] = 1;
            
AccessoriessY[playerid][freeslot] = 1;
            
AccessoriessZ[playerid][freeslot] = 1;
            
BizInfo[biz][bTill] += AccessNames[accid][modprice];
            
BizInfo[biz][bProducts] -= 1;
            
GiveMoney(playerid, -AccessNames[accid][modprice]);
            
SendClientMessage(playeridCOLOR_GRAD1"  Accessory bought! /inventory to use it!");
            
DeletePVar(playerid"buyaccbincobiz");
            
DeletePVar(playerid"buyaccbinco");
        }
    }
    if(
dialogid == 24214// ID is Inventory
    
{
        if(
response)
        {
            if(
listitem == 0)
            {
                
ShowAccessDialog(playerid0);
            }
        }
    }
    if(
dialogid == 24215// ID is Inventory Accessory List
    
{
        if(
response)
        {
            if(
Accessories[playerid][listitem] == 0)
            {
                
SendClientMessage(playeridCOLOR_GRAD1"That slot is empty! Choose another to edit...");
                
ShowAccessDialog(playerid0);
                return 
1;
            }
            else
            {
                new 
titlestring[128];
                
format(titlestringsizeof(titlestring), "Managing Accessory %d"listitem+1);
                
SetPVarInt(playerid"ManageAccessID"listitem);
                if(!
IsPlayerAttachedObjectSlotUsed(playeridlistitem))
                {
                    
ShowPlayerDialog(playerid24216DIALOG_STYLE_LISTtitlestring"Wear Accessory\nEdit Accessory\nChange Bone\nDelete Accessory""Select""Back");
                }
                else
                {
                    
ShowPlayerDialog(playerid24216DIALOG_STYLE_LISTtitlestring"Remove Accessory\nEdit Accessory\nChange Bone\nDelete Accessory""Select""Back");
                }
            }
        }
        else
        {
            
ShowPlayerDialog(playerid24214DIALOG_STYLE_LIST"Player Inventory""Accessories""Select""Cancel");
        }
    }
    if(
dialogid == 24216// ID is Inventory Manage Item
    
{
        if(
response)
        {
            new 
manageid GetPVarInt(playerid"ManageAccessID");
            if(
listitem == 0)
            {
                if(
GetPVarInt(playerid"ManageAccessID") < || GetPVarInt(playerid"ManageAccessID") > 6) return SendClientMessage(playeridCOLOR_RED"ACCESS DENIED: Hacking attempt!");
                if(
IsPlayerAttachedObjectSlotUsed(playeridmanageid))
                {
                    
RemovePlayerAttachedObject(playeridmanageid);
                    
SendClientMessage(playeridCOLOR_GRAD1"  Accessory removed from your person!");
                }
                else
                {
                    
SetPlayerAttachedObject(playerid,manageid,Accessories[playerid][manageid],AccessoriesB[playerid][manageid],AccessoriesX[playerid][manageid],AccessoriesY[playerid][manageid],AccessoriesZ[playerid][manageid],AccessoriesrX[playerid][manageid],AccessoriesrY[playerid][manageid],AccessoriesrZ[playerid][manageid],AccessoriessX[playerid][manageid],AccessoriessY[playerid][manageid],AccessoriessZ[playerid][manageid]);
                    
SendClientMessage(playeridCOLOR_GRAD1"  You are now wearing the accessory!");
                }
                
DeletePVar(playerid"ManageAccessID");
            }
            else if(
listitem == 1)
            {
                if(
GetPVarInt(playerid"ManageAccessID") < || GetPVarInt(playerid"ManageAccessID") > 6) return SendClientMessage(playeridCOLOR_RED"ACCESS DENIED: Hacking attempt!");
                if(
AccessoriesB[playerid][manageid] <= 0)
                {
                    
AccessoriesB[playerid][manageid] = 1;
                }
                if(
AccessoriessX[playerid][manageid] <= && AccessoriessY[playerid][manageid] <= && AccessoriessZ[playerid][manageid] <= 0)
                {
                    
AccessoriessX[playerid][manageid] = 1;
                    
AccessoriessY[playerid][manageid] = 1;
                    
AccessoriessZ[playerid][manageid] = 1;
                }
                
SetPlayerAttachedObject(playerid,manageid,Accessories[playerid][manageid],AccessoriesB[playerid][manageid],AccessoriesX[playerid][manageid],AccessoriesY[playerid][manageid],AccessoriesZ[playerid][manageid],AccessoriesrX[playerid][manageid],AccessoriesrY[playerid][manageid],AccessoriesrZ[playerid][manageid],AccessoriessX[playerid][manageid],AccessoriessY[playerid][manageid],AccessoriessZ[playerid][manageid]);
                
EditAttachedObject(playeridmanageid);
                
SendClientMessage(playeridCOLOR_GRAD1"Editing the accessory, for help on doing this use /editorhelp.");
            }
            else if(
listitem == 2)
            {
                if(
GetPVarInt(playerid"ManageAccessID") < || GetPVarInt(playerid"ManageAccessID") > 6) return SendClientMessage(playeridCOLOR_RED"ACCESS DENIED: Hacking attempt!");
                new 
bonestring[256+1];
                for(new 
isizeof(AttachmentBones); i++)
                {
                    
format(bonestringsizeof(bonestring), "%s\n%s"bonestringAttachmentBones[i]);
                }
                
ShowPlayerDialog(playerid24217DIALOG_STYLE_LIST"Change Bone"bonestring"Select""Back");
            }
            else if(
listitem == 3)
            {
                if(
GetPVarInt(playerid"ManageAccessID") < || GetPVarInt(playerid"ManageAccessID") > 6) return SendClientMessage(playeridCOLOR_RED"ACCESS DENIED: Hacking attempt!");
                
RemovePlayerAttachedObject(playeridmanageid);
                
Accessories[playerid][manageid] = 0;
                
AccessoriesB[playerid][manageid] = 0;
                
AccessoriesX[playerid][manageid] = 0;
                
AccessoriesY[playerid][manageid] = 0;
                
AccessoriesZ[playerid][manageid] = 0;
                
AccessoriesrX[playerid][manageid] = 0;
                
AccessoriesrY[playerid][manageid] = 0;
                
AccessoriesrZ[playerid][manageid] = 0;
                
AccessoriessX[playerid][manageid] = 0;
                
AccessoriessY[playerid][manageid] = 0;
                
AccessoriessZ[playerid][manageid] = 0;
                
SendClientMessage(playeridCOLOR_GRAD1"  Accessory removed from your inventory successfully!");
                
DeletePVar(playerid"ManageAccessID");
            }
        }
        else
        {
            
ShowAccessDialog(playerid0);
        }
    } 
Compiler works properly.
Reply
#2

Please help. it's about 2 days that Im waiting for a reply
Reply
#3

Hi,

First, I don't know your script but I don't understand why you use first 27 and then 77.

DisplayDialogForPlayer(playerid, 27);

if(dialogid == 77)

Are you sure the problem doesn't come from the IsPlayerInRangeOfPoint which doesn't detect the position ? Put a sendclientmessage to check this.

If it doesn't work, I will check the include mSelection to see if I haven't forgotten something.

Good luck
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)