else { RemovePlayerFromVehicle(playerid); TogglePlayerControllable(playerid, 1);
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 4512 && response == 1) { if(IsPlayerConnected(playerid)) { for(new i = 0; i < sizeof(CarInfo); i++) { if(CarInfo[i][ownedvehicle] == GetPlayerVehicleID(playerid)) { if(PlayerInfo[playerid][pCarKey]!=0) { SendClientMessage(playerid, COLOR_GREY, "You already own a car, type /carsell if you want to buy this one!"); return 1; } if(CarInfo[i][cOwned]==1) { SendClientMessage(playerid, COLOR_GREY, "Someone already owns this car"); return 1; } if(GetPlayerMoney(playerid) >= CarInfo[i][cValue]) { PlayerInfo[playerid][pCarKey] = i; CarInfo[i][cOwned] = 1; CarOffered[playerid]=0; GetPlayerName(playerid, sendername2, sizeof(sendername2)); strmid(CarInfo[i][cOwner], sendername2, 0, strlen(sendername2), 999); GivePlayerMoney(playerid,-CarInfo[i][cValue]); GameTextForPlayer(playerid, "~w~Congratulations~n~This is your car until you sell it!", 5000, 3); SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!"); SendClientMessage(playerid, COLOR_GRAD2, "Type /carhelp for help"); TogglePlayerControllable(playerid, 1); SaveCars(); return 1; } else { RemovePlayerFromVehicle(playerid); TogglePlayerControllable(playerid, 1); return 1; }
if(!response)
To make second button work you should use:
pawn Код:
|
if(!response)
if(response == 0)
if(!strcmp("/hey", cmdtext, true)
if(strcmp("/hey", cmdtext, true) == 0)
Well
pawn Код:
pawn Код:
pawn Код:
pawn Код:
|
if(dialogid == 4512)
{
if(response == 1)
{
//Your code after the first if
} else
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
}
}
Yep, response is 1 if you click ok, and 0 if you click cancel
So do it like this: pawn Код:
![]() |
Yep, response is 1 if you click ok, and 0 if you click cancel
So do it like this: pawn Код:
![]() |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 4512) { if(response == 1) { for(new i = 0; i < sizeof(CarInfo); i++) { if(CarInfo[i][ownedvehicle] == GetPlayerVehicleID(playerid)) { if(PlayerInfo[playerid][pCarKey]!=0) { SendClientMessage(playerid, COLOR_GREY, "You already own a car, type /car sell if you want to buy this one!"); return 1; } if(CarInfo[i][cOwned]==1) { SendClientMessage(playerid, COLOR_GREY, "Someone already owns this car"); return 1; } if(GetPlayerMoney(playerid) >= CarInfo[i][cValue]) { PlayerInfo[playerid][pCarKey] = i; CarInfo[i][cOwned] = 1; CarOffered[playerid]=0; GetPlayerName(playerid, sendername2, sizeof(sendername2)); strmid(CarInfo[i][cOwner], sendername2, 0, strlen(sendername2), 999); GivePlayerMoney(playerid,-CarInfo[i][cValue]); GameTextForPlayer(playerid, "~w~Congratulations~n~This is your car until you sell it!", 5000, 3); SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!"); SendClientMessage(playerid, COLOR_GRAD2, "Type /car manual to view the car manual!"); TogglePlayerControllable(playerid, 1); SaveCars(); return 1; } else { RemovePlayerFromVehicle(playerid); TogglePlayerControllable(playerid, 1); return 1; } } } } return 1; } return 1; }
error 010: invalid function or declaration
error 010: invalid function or declaration |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 4512) { if(response == 1) { for(new i = 0; i < sizeof(CarInfo); i++) { if(CarInfo[i][ownedvehicle] == GetPlayerVehicleID(playerid)) { if(PlayerInfo[playerid][pCarKey]!=0) { SendClientMessage(playerid, COLOR_GREY, "You already own a car, type /car sell if you want to buy this one!"); return 1; } if(CarInfo[i][cOwned]==1) { SendClientMessage(playerid, COLOR_GREY, "Someone already owns this car"); return 1; } if(GetPlayerMoney(playerid) >= CarInfo[i][cValue]) { PlayerInfo[playerid][pCarKey] = i; CarInfo[i][cOwned] = 1; CarOffered[playerid]=0; GetPlayerName(playerid, sendername2, sizeof(sendername2)); strmid(CarInfo[i][cOwner], sendername2, 0, strlen(sendername2), 999); GivePlayerMoney(playerid,-CarInfo[i][cValue]); GameTextForPlayer(playerid, "~w~Congratulations~n~This is your car until you sell it!", 5000, 3); SendClientMessage(playerid, COLOR_GRAD2, "Congratulations on your new purchase!"); SendClientMessage(playerid, COLOR_GRAD2, "Type /car manual to view the car manual!"); TogglePlayerControllable(playerid, 1); SaveCars(); return 1; } else { RemovePlayerFromVehicle(playerid); TogglePlayerControllable(playerid, 1); } return 1; } } } } return 1; } return 1; }