Dialog problems
#1

im trying to make a dialog but whats wrong with that responds?

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
        {
            if(dialogid == 4512 && response == 1)
            {
            if(IsBuyableCar[vehicleid])
            {
            if (strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid))) return SendClientMessage(playerid,COLOR_RED,"[ » ] You already own this vehicle !");
            if (strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],"Unbought"))
                {
                if(VehicleSystem[IsBuyableCar[vehicleid]][Price] > GetPlayerMoney(playerid)) return SendClientMessage(playerid,COLOR_RED,"[ » ] Not enought Dollars !");
                MaxVehicles[playerid]=0;
                for(new i=0;i<MAX_VEHICLES;i++)
                    {
                    if(strmatch(VehicleSystem[i][Owner],PlayerName(playerid)))
                        {
                        MaxVehicles[playerid]=MaxVehicles[playerid]+1;
                        }
                    }
                   
                if(MaxVehicles[playerid]>=MAX_VEHICLES_PER_PLAYER) return SendClientMessage(playerid,COLOR_RED,"[ » ] You already own the limit of vehicles !");

                strmid(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid),0,20,20);
                VehicleSystem[IsBuyableCar[vehicleid]][Locked]=0;
                GivePlayerMoney(playerid,-VehicleSystem[IsBuyableCar[vehicleid]][Price]);
                SendClientMessage(playerid,COLOR_GREEN,"[ » ] You have bought this vehicle !");
                format(string,sizeof(string), "[ » ] You lost %d $ !",VehicleSystem[IsBuyableCar[vehicleid]][Price]);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                SaveMYSQLCarID(vehicleid);
                }

            else
                {
                SendClientMessage(playerid,COLOR_RED,"[ » ] This vehicle is not for sale !");
                }
            }  
            }
                                        else
                                        {                  
                                        RemovePlayerFromVehicle(playerid);
                                        return 1;
                                        }

        return 1;
        }
Erros

pawn Код:
(396) : error 029: invalid expression, assumed zero
(396) : error 004: function "OnDialogResponse" is not implemented
(398) : error 017: undefined symbol "dialogid"
Reply
#2

Quote:
Originally Posted by Elder_of_Zion
Посмотреть сообщение
Looks like you're missing the SA:MP 0.3 includes
No im not
Reply
#3

Could also be a missing bracket ("}"), maybe in the function before this.
Reply
#4

You didn't have enough { and }'s, plus you have some in the wrong places.

EDIT: Sorry, I messed up one of the statements. Try now:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 4512 && response == 1)
    {
        if(IsBuyableCar[vehicleid])
        {
            if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid))) return SendClientMessage(playerid,COLOR_RED,"[ » ] You already own this vehicle !");
            if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],"Unbought"))
            {
                if(VehicleSystem[IsBuyableCar[vehicleid]][Price] > GetPlayerMoney(playerid)) return SendClientMessage(playerid,COLOR_RED,"[ » ] Not enought Dollars !");
                MaxVehicles[playerid]=0;
                for(new i=0;i<MAX_VEHICLES;i++)
                {
                    if(strmatch(VehicleSystem[i][Owner],PlayerName(playerid)))
                    {
                        MaxVehicles[playerid]=MaxVehicles[playerid]+1;
                    }
                }
                if(MaxVehicles[playerid]>=MAX_VEHICLES_PER_PLAYER) return SendClientMessage(playerid,COLOR_RED,"[ » ] You already own the limit of vehicles !");
                strmid(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid),0,20,20);
                VehicleSystem[IsBuyableCar[vehicleid]][Locked]=0;
                GivePlayerMoney(playerid,-VehicleSystem[IsBuyableCar[vehicleid]][Price]);
                SendClientMessage(playerid,COLOR_GREEN,"[ » ] You have bought this vehicle !");
                format(string,sizeof(string), "[ » ] You lost %d $ !",VehicleSystem[IsBuyableCar[vehicleid]][Price]);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                SaveMYSQLCarID(vehicleid);
            }
            else
            {
                SendClientMessage(playerid,COLOR_RED,"[ » ] This vehicle is not for sale !");
            }
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
Could also be a missing bracket ("}"), maybe in the function before this.
Thanks! that was it the response is inside "public OnPlayerCommandText"
that was the problem thanks
Reply
#6

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
You didn't have enough { and }'s, plus you have some in the wrong places.

EDIT: Sorry, I messed up one of the statements. Try now:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 4512 && response == 1)
    {
        if(IsBuyableCar[vehicleid])
        {
            if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid))) return SendClientMessage(playerid,COLOR_RED,"[ » ] You already own this vehicle !");
            if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],"Unbought"))
            {
                if(VehicleSystem[IsBuyableCar[vehicleid]][Price] > GetPlayerMoney(playerid)) return SendClientMessage(playerid,COLOR_RED,"[ » ] Not enought Dollars !");
                MaxVehicles[playerid]=0;
                for(new i=0;i<MAX_VEHICLES;i++)
                {
                    if(strmatch(VehicleSystem[i][Owner],PlayerName(playerid)))
                    {
                        MaxVehicles[playerid]=MaxVehicles[playerid]+1;
                    }
                }
                if(MaxVehicles[playerid]>=MAX_VEHICLES_PER_PLAYER) return SendClientMessage(playerid,COLOR_RED,"[ » ] You already own the limit of vehicles !");
                strmid(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid),0,20,20);
                VehicleSystem[IsBuyableCar[vehicleid]][Locked]=0;
                GivePlayerMoney(playerid,-VehicleSystem[IsBuyableCar[vehicleid]][Price]);
                SendClientMessage(playerid,COLOR_GREEN,"[ » ] You have bought this vehicle !");
                format(string,sizeof(string), "[ » ] You lost %d $ !",VehicleSystem[IsBuyableCar[vehicleid]][Price]);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                SaveMYSQLCarID(vehicleid);
            }
            else
            {
                SendClientMessage(playerid,COLOR_RED,"[ » ] This vehicle is not for sale !");
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
thanks
Reply
#7

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
You didn't have enough { and }'s, plus you have some in the wrong places.

EDIT: Sorry, I messed up one of the statements. Try now:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 4512 && response == 1)
    {
        if(IsBuyableCar[vehicleid])
        {
            if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid))) return SendClientMessage(playerid,COLOR_RED,"[ » ] You already own this vehicle !");
            if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],"Unbought"))
            {
                if(VehicleSystem[IsBuyableCar[vehicleid]][Price] > GetPlayerMoney(playerid)) return SendClientMessage(playerid,COLOR_RED,"[ » ] Not enought Dollars !");
                MaxVehicles[playerid]=0;
                for(new i=0;i<MAX_VEHICLES;i++)
                {
                    if(strmatch(VehicleSystem[i][Owner],PlayerName(playerid)))
                    {
                        MaxVehicles[playerid]=MaxVehicles[playerid]+1;
                    }
                }
                if(MaxVehicles[playerid]>=MAX_VEHICLES_PER_PLAYER) return SendClientMessage(playerid,COLOR_RED,"[ » ] You already own the limit of vehicles !");
                strmid(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid),0,20,20);
                VehicleSystem[IsBuyableCar[vehicleid]][Locked]=0;
                GivePlayerMoney(playerid,-VehicleSystem[IsBuyableCar[vehicleid]][Price]);
                SendClientMessage(playerid,COLOR_GREEN,"[ » ] You have bought this vehicle !");
                format(string,sizeof(string), "[ » ] You lost %d $ !",VehicleSystem[IsBuyableCar[vehicleid]][Price]);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                SaveMYSQLCarID(vehicleid);
            }
            else
            {
                SendClientMessage(playerid,COLOR_RED,"[ » ] This vehicle is not for sale !");
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Doesnt really work i get allot of errors this one { is not used?

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{ <<<--- this one
Reply
#8

When you're having issues with brackets, I suggest switching over to Notepad++. He was missing one bracket, and had some poor indentation which may have caused him to overlook it.



pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 4512 && response == 1)
    {
        if(IsBuyableCar[vehicleid])
        {
            if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid))) return SendClientMessage(playerid,COLOR_RED,"[ » ] You already own this vehicle !");
            if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],"Unbought"))
            {
                if(VehicleSystem[IsBuyableCar[vehicleid]][Price] > GetPlayerMoney(playerid)) return SendClientMessage(playerid,COLOR_RED,"[ » ] Not enought Dollars !");
                MaxVehicles[playerid]=0;
                for(new i=0;i<MAX_VEHICLES;i++)
                {
                    if(strmatch(VehicleSystem[i][Owner],PlayerName(playerid)))
                    {
                        MaxVehicles[playerid]=MaxVehicles[playerid]+1;
                    }
                }
                if(MaxVehicles[playerid]>=MAX_VEHICLES_PER_PLAYER) return SendClientMessage(playerid,COLOR_RED,"[ » ] You already own the limit of vehicles !");
                strmid(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid),0,20,20);
                VehicleSystem[IsBuyableCar[vehicleid]][Locked]=0;
                GivePlayerMoney(playerid,-VehicleSystem[IsBuyableCar[vehicleid]][Price]);
                SendClientMessage(playerid,COLOR_GREEN,"[ » ] You have bought this vehicle !");
                format(string,sizeof(string), "[ » ] You lost %d $ !",VehicleSystem[IsBuyableCar[vehicleid]][Price]);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                SaveMYSQLCarID(vehicleid);
            }
            else
            {
                SendClientMessage(playerid,COLOR_RED,"[ » ] This vehicle is not for sale !");
            }
            else
            {
                RemovePlayerFromVehicle(playerid);
            }
        }
        return 1;
    }
}
Reply
#9

I do see the missing bracket and I'll edit my original post when this one is done. As for the indentation, this forum screwed it up. Anyways, good luck!

- Thanks for the suggestion on Notepad++ I'm going to take a look!
Reply
#10

Quote:
Originally Posted by iFriSki
Посмотреть сообщение
When you're having issues with brackets, I suggest switching over to Notepad++. He was missing one bracket, and had some poor indentation which may have caused him to overlook it.



pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 4512 && response == 1)
    {
        if(IsBuyableCar[vehicleid])
        {
            if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid))) return SendClientMessage(playerid,COLOR_RED,"[ » ] You already own this vehicle !");
            if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],"Unbought"))
            {
                if(VehicleSystem[IsBuyableCar[vehicleid]][Price] > GetPlayerMoney(playerid)) return SendClientMessage(playerid,COLOR_RED,"[ » ] Not enought Dollars !");
                MaxVehicles[playerid]=0;
                for(new i=0;i<MAX_VEHICLES;i++)
                {
                    if(strmatch(VehicleSystem[i][Owner],PlayerName(playerid)))
                    {
                        MaxVehicles[playerid]=MaxVehicles[playerid]+1;
                    }
                }
                if(MaxVehicles[playerid]>=MAX_VEHICLES_PER_PLAYER) return SendClientMessage(playerid,COLOR_RED,"[ » ] You already own the limit of vehicles !");
                strmid(VehicleSystem[IsBuyableCar[vehicleid]][Owner],PlayerName(playerid),0,20,20);
                VehicleSystem[IsBuyableCar[vehicleid]][Locked]=0;
                GivePlayerMoney(playerid,-VehicleSystem[IsBuyableCar[vehicleid]][Price]);
                SendClientMessage(playerid,COLOR_GREEN,"[ » ] You have bought this vehicle !");
                format(string,sizeof(string), "[ » ] You lost %d $ !",VehicleSystem[IsBuyableCar[vehicleid]][Price]);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                SaveMYSQLCarID(vehicleid);
            }
            else
            {
                SendClientMessage(playerid,COLOR_RED,"[ » ] This vehicle is not for sale !");
            }
            else
            {
                RemovePlayerFromVehicle(playerid);
            }
        }
        return 1;
    }
}
Quote:
Originally Posted by RealCop228
Посмотреть сообщение
I do see the missing bracket and I'll edit my original post when this one is done. As for the indentation, this forum screwed it up. Anyways, good luck!

- Thanks for the suggestion on Notepad++ I'm going to take a look!
Thanks guys, its all working now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)