Removeplayerfromvehicle -
TheDiscussionCafe - 01.06.2012
i have this vehicle script:
pawn Код:
case DIALOG_VEHICLE_BUY:
{
new vehicleid = GetPVarInt(playerid, "DialogValue1");
new caption[32], info[256];
format(caption, sizeof(caption), "Vehicle ID %d", vehicleid);
format(info, sizeof(info), "This vehicle is for sale ($%d)\nWould you like to buy it?", VehicleValue[vehicleid]);
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_MSGBOX, caption, info, "Yes", "No");
}
how i make so
if player select no, removeplayerfromvehicle?
Re: Removeplayerfromvehicle -
Scott - 01.06.2012
The response variable for
OnDialogResponse will be equal to 0 if they select the second button.
Re: Removeplayerfromvehicle -
thefatshizms - 01.06.2012
pawn Код:
if(!response) return RemovePlayerFromVehicle(vehid)
something like that

i think
Re: Removeplayerfromvehicle -
thefatshizms - 02.06.2012
i would of thought it would be like this :
pawn Код:
if(dialogid == DIALOG_VEHICLE_BUY);
{
if(!response) return RemovePlayerFromVehicle(vehid)
{
case 1:
{
//code
lol think im wrong :/
Re: Removeplayerfromvehicle -
TheDiscussionCafe - 02.06.2012
oh man im very confused. pls help?
Re: Removeplayerfromvehicle -
TheDiscussionCafe - 02.06.2012
okay here is my buy vehicle dialog.
pawn Код:
if(dialogid == DIALOG_VEHICLE_BUY)
{
if(response)
{
if(GetPlayerVehicles(playerid) >= MAX_PLAYER_VEHICLES)
{
ShowErrorDialog(playerid, "You can't buy any more vehicles! Max: " #MAX_PLAYER_VEHICLES );
return 1;
}
new id = GetPVarInt(playerid, "DialogValue1");
if(GetPlayerMoney(playerid) < VehicleValue[id])
{
ShowErrorDialog(playerid, "You don't have enough money to buy this vehicle!");
return 1;
}
new freeid = GetFreeVehicleID();
if(!freeid)
{
ShowErrorDialog(playerid, "Vehicle dealership is out of stock!");
return 1;
}
GivePlayerMoney(playerid, -VehicleValue[id]);
new dealerid = strval(VehicleOwner[id]);
VehicleCreated[freeid] = VEHICLE_PLAYER;
VehicleModel[freeid] = VehicleModel[id];
VehiclePos[freeid] = DealershipPos[dealerid];
VehicleColor[freeid] = VehicleColor[id];
VehicleInterior[freeid] = VehicleInterior[id];
VehicleWorld[freeid] = VehicleWorld[id];
VehicleValue[freeid] = VehicleValue[id];
GetPlayerName(playerid, VehicleOwner[freeid], sizeof(VehicleOwner[]));
VehicleNumberPlate[freeid] = DEFAULT_NUMBER_PLATE;
for(new d=0; d < sizeof(VehicleTrunk[]); d++)
{
VehicleTrunk[freeid][d][0] = 0;
VehicleTrunk[freeid][d][1] = 0;
}
for(new d=0; d < sizeof(VehicleMods[]); d++)
{
VehicleMods[freeid][d] = 0;
}
VehiclePaintjob[freeid] = 255;
VehicleLock[freeid] = 0;
VehicleAlarm[freeid] = 0;
UpdateVehicle(freeid, 0);
SaveVehicle(freeid);
new msg[128];
format(msg, sizeof(msg), "You have bought this vehicle for $%d", VehicleValue[id]);
SendClientMessage(playerid, COLOR_WHITE, msg);
RemovePlayerFromVehicle(playerid);
}
else
{
RemovePlayerFromVehicle(playerid);
}
return 1;
}
i added removeplayerfromvehicle so when player press "yes", it will remove player from vehicle. that works. but when i press "no" (i added it after "else"), it doesnt work. pls help?
Re: Removeplayerfromvehicle -
Scott - 02.06.2012
Please post the full code of your OnDialogResponse, it doesn't make sense that you have a switch() and an if statement both with the same dialog id.
Re: Removeplayerfromvehicle -
TheDiscussionCafe - 02.06.2012
Quote:
Originally Posted by h02
Please post the full code of your OnDialogResponse, it doesn't make sense that you have a switch() and an if statement both with the same dialog id.
|
okay this is just from avs vehicle system as i am using it.
http://pastebin.com/bF9Fjikr
Re: Removeplayerfromvehicle -
Sandiel - 02.06.2012
Quote:
Originally Posted by TheDiscussionCafe
okay here is my buy vehicle dialog.
pawn Код:
if(dialogid == DIALOG_VEHICLE_BUY) { if(response) { if(GetPlayerVehicles(playerid) >= MAX_PLAYER_VEHICLES) { ShowErrorDialog(playerid, "You can't buy any more vehicles! Max: " #MAX_PLAYER_VEHICLES ); return 1; } new id = GetPVarInt(playerid, "DialogValue1"); if(GetPlayerMoney(playerid) < VehicleValue[id]) { ShowErrorDialog(playerid, "You don't have enough money to buy this vehicle!"); return 1; } new freeid = GetFreeVehicleID(); if(!freeid) { ShowErrorDialog(playerid, "Vehicle dealership is out of stock!"); return 1; } GivePlayerMoney(playerid, -VehicleValue[id]); new dealerid = strval(VehicleOwner[id]); VehicleCreated[freeid] = VEHICLE_PLAYER; VehicleModel[freeid] = VehicleModel[id]; VehiclePos[freeid] = DealershipPos[dealerid]; VehicleColor[freeid] = VehicleColor[id]; VehicleInterior[freeid] = VehicleInterior[id]; VehicleWorld[freeid] = VehicleWorld[id]; VehicleValue[freeid] = VehicleValue[id]; GetPlayerName(playerid, VehicleOwner[freeid], sizeof(VehicleOwner[])); VehicleNumberPlate[freeid] = DEFAULT_NUMBER_PLATE; for(new d=0; d < sizeof(VehicleTrunk[]); d++) { VehicleTrunk[freeid][d][0] = 0; VehicleTrunk[freeid][d][1] = 0; } for(new d=0; d < sizeof(VehicleMods[]); d++) { VehicleMods[freeid][d] = 0; } VehiclePaintjob[freeid] = 255; VehicleLock[freeid] = 0; VehicleAlarm[freeid] = 0; UpdateVehicle(freeid, 0); SaveVehicle(freeid); new msg[128]; format(msg, sizeof(msg), "You have bought this vehicle for $%d", VehicleValue[id]); SendClientMessage(playerid, COLOR_WHITE, msg); RemovePlayerFromVehicle(playerid); } else { RemovePlayerFromVehicle(playerid); } return 1; }
i added removeplayerfromvehicle so when player press "yes", it will remove player from vehicle. that works. but when i press "no" (i added it after "else"), it doesnt work. pls help?
|
Change that to this:
pawn Код:
if(dialogid == DIALOG_VEHICLE_BUY)
{
if(response)
{
if(GetPlayerVehicles(playerid) >= MAX_PLAYER_VEHICLES)
{
ShowErrorDialog(playerid, "You can't buy any more vehicles! Max: " #MAX_PLAYER_VEHICLES );
return 1;
}
new id = GetPVarInt(playerid, "DialogValue1");
if(GetPlayerMoney(playerid) < VehicleValue[id])
{
ShowErrorDialog(playerid, "You don't have enough money to buy this vehicle!");
return 1;
}
new freeid = GetFreeVehicleID();
if(!freeid)
{
ShowErrorDialog(playerid, "Vehicle dealership is out of stock!");
return 1;
}
GivePlayerMoney(playerid, -VehicleValue[id]);
new dealerid = strval(VehicleOwner[id]);
VehicleCreated[freeid] = VEHICLE_PLAYER;
VehicleModel[freeid] = VehicleModel[id];
VehiclePos[freeid] = DealershipPos[dealerid];
VehicleColor[freeid] = VehicleColor[id];
VehicleInterior[freeid] = VehicleInterior[id];
VehicleWorld[freeid] = VehicleWorld[id];
VehicleValue[freeid] = VehicleValue[id];
GetPlayerName(playerid, VehicleOwner[freeid], sizeof(VehicleOwner[]));
VehicleNumberPlate[freeid] = DEFAULT_NUMBER_PLATE;
for(new d=0; d < sizeof(VehicleTrunk[]); d++)
{
VehicleTrunk[freeid][d][0] = 0;
VehicleTrunk[freeid][d][1] = 0;
}
for(new d=0; d < sizeof(VehicleMods[]); d++)
{
VehicleMods[freeid][d] = 0;
}
VehiclePaintjob[freeid] = 255;
VehicleLock[freeid] = 0;
VehicleAlarm[freeid] = 0;
UpdateVehicle(freeid, 0);
SaveVehicle(freeid);
new msg[128];
format(msg, sizeof(msg), "You have bought this vehicle for $%d", VehicleValue[id]);
SendClientMessage(playerid, COLOR_WHITE, msg);
RemovePlayerFromVehicle(playerid);
}
if(!response) return RemovePlayerFromVehicle(playerid);
return 1;
}
Hope this helps
Re: Removeplayerfromvehicle -
TheDiscussionCafe - 02.06.2012
Quote:
Originally Posted by Sandiel
Change that to this:
pawn Код:
if(dialogid == DIALOG_VEHICLE_BUY) { if(response) { if(GetPlayerVehicles(playerid) >= MAX_PLAYER_VEHICLES) { ShowErrorDialog(playerid, "You can't buy any more vehicles! Max: " #MAX_PLAYER_VEHICLES ); return 1; } new id = GetPVarInt(playerid, "DialogValue1"); if(GetPlayerMoney(playerid) < VehicleValue[id]) { ShowErrorDialog(playerid, "You don't have enough money to buy this vehicle!"); return 1; } new freeid = GetFreeVehicleID(); if(!freeid) { ShowErrorDialog(playerid, "Vehicle dealership is out of stock!"); return 1; } GivePlayerMoney(playerid, -VehicleValue[id]); new dealerid = strval(VehicleOwner[id]); VehicleCreated[freeid] = VEHICLE_PLAYER; VehicleModel[freeid] = VehicleModel[id]; VehiclePos[freeid] = DealershipPos[dealerid]; VehicleColor[freeid] = VehicleColor[id]; VehicleInterior[freeid] = VehicleInterior[id]; VehicleWorld[freeid] = VehicleWorld[id]; VehicleValue[freeid] = VehicleValue[id]; GetPlayerName(playerid, VehicleOwner[freeid], sizeof(VehicleOwner[])); VehicleNumberPlate[freeid] = DEFAULT_NUMBER_PLATE; for(new d=0; d < sizeof(VehicleTrunk[]); d++) { VehicleTrunk[freeid][d][0] = 0; VehicleTrunk[freeid][d][1] = 0; } for(new d=0; d < sizeof(VehicleMods[]); d++) { VehicleMods[freeid][d] = 0; } VehiclePaintjob[freeid] = 255; VehicleLock[freeid] = 0; VehicleAlarm[freeid] = 0; UpdateVehicle(freeid, 0); SaveVehicle(freeid); new msg[128]; format(msg, sizeof(msg), "You have bought this vehicle for $%d", VehicleValue[id]); SendClientMessage(playerid, COLOR_WHITE, msg); RemovePlayerFromVehicle(playerid); } if(!response) return RemovePlayerFromVehicle(playerid); return 1; }
Hope this helps
|
sorry that dont work either.