Dialog problems -
FrankC - 05.10.2010
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"
Re: Dialog problems -
FrankC - 05.10.2010
Quote:
Originally Posted by Elder_of_Zion
Looks like you're missing the SA:MP 0.3 includes 
|
No im not
Re: Dialog problems -
Mauzen - 05.10.2010
Could also be a missing bracket ("}"), maybe in the function before this.
Re: Dialog problems -
Scenario - 05.10.2010
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;
}
Re: Dialog problems -
FrankC - 05.10.2010
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
Re: Dialog problems -
FrankC - 05.10.2010
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
Re: Dialog problems -
FrankC - 05.10.2010
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
Re: Dialog problems -
iFriSki - 05.10.2010
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;
}
}
Re: Dialog problems -
Scenario - 05.10.2010
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!
Re: Dialog problems -
FrankC - 05.10.2010
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