im having a problem that i cant understand how to fix it...
#1

i made stores and when i try to buy them there is a bug it shows the dialog and when i click at buy nothing wont happend ... can anyone knows how to fix this
check the photos to see the bug




pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
    for(new i = 0;i<MAX_BUSS;i++)
    {
        if(checkpointid == BusinessInfo[i][CP])
        {
            cpid[playerid] = i;
            format(file,sizeof(file),"Business/%i.ini",i);
            if(dini_Int(file, "HasOwner") == 0)
            {
                ShowPlayerDialog(playerid,219,DIALOG_STYLE_MSGBOX,"Buy Business","Do you want to buy this businesses?","Buy","Cancel");
            }
            else
            {
                SetPlayerPos(playerid, -25.132598,-139.066986,1003.546875);
                SetPlayerInterior(playerid, 16);
                SetPlayerVirtualWorld(playerid, i);
                SetPlayerFacingAngle(playerid, 359.9003);
            }
        }
    }
    if(checkpointid == BizExit)
    {
        format(file, sizeof(file), "Business/%i.ini", GetPlayerVirtualWorld(playerid));
        SetPlayerPos(playerid, dini_Float(file, "SpawnOutX"), dini_Float(file, "SpawnOutY"), dini_Float(file, "BusZ"));
        SetPlayerFacingAngle(playerid, dini_Float(file, "A"));
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerInterior(playerid, 0);
    }
    return 1;
}
Reply
#2

Make sure your OnDialogResponse callbacks in ALL filterscripts return 0 by default, (if no dialog was processed there).
Reply
#3

i've readed your problem , but i dont find where is the define of

ifplayerclicks BUY or cancel what is their call backs .. ?
Reply
#4

this their callback ...

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 219)
    {
        if(response == 1)
        {
            if(GetPlayerBusinessID(playerid) == 1)return 0;
            new busid;
            format(file,sizeof(file),"Business/%i.ini",cpid[playerid]);
            if(GetPlayerBusinessID(playerid) > -1)return SendClientMessage(playerid,Red,"You already own a business");
            if(dini_Int(file,"Cost") > GetPlayerMoney(playerid))return SendClientMessage(playerid,Red,"You do not have enough cash to buy this business.");
            GivePlayerMoney(playerid, -dini_Int(file,"Cost"));
            GetPlayerName(playerid,Name,sizeof(Name));
            dini_Set(file, "Name", Name);
            dini_Set(file, "Owner",Name);
            dini_IntSet(file, "OwnedBus",1);
            dini_IntSet(file, "HasOwner",1);
            format(Label, sizeof(Label), "{ccccff}%s's business\n\n{999999}%s\n{00BC00}Cost: {999999}$%i\n{00BC00}ID: {999999}%i",Name,dini_Get(file, "Owner"),dini_Int(file, "Cost"),busid);
            Update3DTextLabelText(BusinessInfo[cpid[playerid]][bLabel],White,Label);
            format(String,sizeof(String),"You have successfully purchased the %s.",dini_Get(file, "Name"));
            SendClientMessage(playerid,Green,String);
        }
        if(response == 0)
        {
            SendClientMessage(playerid,Yellow,"You chose not to buy this business");
        }
    }
    if(dialogid == 220)
    {
        if(response == 1)
        {
            GetPlayerName(playerid,Name,sizeof(Name));
            format(file,sizeof(file),"Business/%i.ini",GetPlayerBusinessID(playerid));
            format(Label, sizeof(Label), "{ccccff}For Sale\n\n{999999}No Owner\n{00BC00}Cost: {999999}$%i",dini_Get(file, "Name"),dini_Int(file, "Cost"));
            Update3DTextLabelText(BusinessInfo[cpid[playerid]][bLabel],White,Label);
            dini_Set(file, "Owner","No Owner");
            dini_IntSet(file, "Cost",dini_Int(file, "Cost"));
            dini_IntSet(file, "OwnedBus",0);
            dini_IntSet(file, "HasOwner",0);
            GivePlayerMoney(playerid,dini_Int(file, "Cost")/2);
            SendClientMessage(playerid,Green,"You have sold your business and recieved 50 percent of the price.");
        }
    }
    return 1;
}
Reply
#5

https://sampwiki.blast.hk/wiki/OnDialogResponse

Change the last "return 1;" to "return 0;" in ALL your filterscripts.
Reply
#6

everything is fixed thank you so much Respect <3
+1 reputation by me
thanks again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)