20.02.2012, 02:41
(
Последний раз редактировалось MTCool; 20.02.2012 в 13:04.
)
I am using LARP!
Hey, I downloded this dealership filterscript:
https://sampforum.blast.hk/showthread.php?tid=299738
And when I enter a car, it asks me if I want to buy it "Yes" or "No", but when I press the "Yes" or "No" nothing happeneds.
Here are those lines in the script:
How can I fix it?
Hey, I downloded this dealership filterscript:
https://sampforum.blast.hk/showthread.php?tid=299738
And when I enter a car, it asks me if I want to buy it "Yes" or "No", but when I press the "Yes" or "No" nothing happeneds.
Here are those lines in the script:
pawn Код:
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new
vehicleid = GetPlayerVehicleID(playerid),
dialog_string[128];
if(VehicleStatistics[vehicleid][vehicle_onsale] == 1)
{
format(dialog_string, sizeof(dialog_string), "Would you like to buy this %s costing $%d?", GetVehicleName(vehicleid), VehicleStatistics[vehicleid][vehicle_price]);
ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_MSGBOX, "Car Purchase", dialog_string, "Yes", "No");
return 1;
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1337)
{
if(response)
{
new
vehicleid = GetPlayerVehicleID(playerid),
model = GetVehicleModel(vehicleid),
price = VehicleStatistics[vehicleid][vehicle_price],
Float:position[5],
string[128],
dealershipid = -1,
var[32],
playername[24];
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerPos(playerid, position[1], position[2], position[3]);
GetPlayerFacingAngle(playerid, position[4]);
if(GetPVarInt(playerid, "AmountOfCars") >= MAX_OWNABLE_CARS)
return SendClientMessage(playerid, color_grey, " You already own the maximum amount of vehicles !"), RemovePlayerFromVehicle(playerid);
if(GetPlayerMoney(playerid) < price)
return SendClientMessage(playerid, color_grey, " You can't afford that !"), RemovePlayerFromVehicle(playerid);
for(new i = 1; i < MAX_DEALERSHIPS; i++)
{
if(IsPlayerInRangeOfPoint(playerid, DealershipStatistics[i][dealership_radius], DealershipStatistics[i][dealership_x], DealershipStatistics[i][dealership_y], DealershipStatistics[i][dealership_z]))
{
dealershipid = i;
break;
}
}
DealershipStatistics[dealershipid][dealership_earnings] += (price / 4);
GivePlayerMoney(playerid, -price);
RemovePlayerFromVehicle(playerid);
vehicleid = CreateVehicle(model, (position[1] + (7.5 * floatsin(-position[4], degrees))), (position[2] + (7.5 * floatcos(position[4], degrees))), position[3], position[4], 0, 0, -1);
format(string, sizeof(string), "Thank you for purchasing at %s, we hope to see you again!", DealershipStatistics[dealershipid][dealership_name]);
SendClientMessage(playerid, color_white, string);
SendClientMessage(playerid, color_white, "Your vehicle has been spawned in front of you.");
SetPVarInt(playerid, "AmountOfCars", GetPVarInt(playerid, "AmountOfCars") + 1);
format(var, sizeof(var), "Model_%d", GetPVarInt(playerid, "AmountOfCars"));
SetPVarInt(playerid, var, model);
format(var, sizeof(var), "X_%d", GetPVarInt(playerid, "AmountOfCars"));
SetPVarFloat(playerid, var, (position[1] + (7.5 * floatsin(-position[4], degrees))));
format(var, sizeof(var), "Y_%d", GetPVarInt(playerid, "AmountOfCars"));
SetPVarFloat(playerid, var, (position[2] + (7.5 * floatcos(position[4], degrees))));
format(var, sizeof(var), "Z_%d", GetPVarInt(playerid, "AmountOfCars"));
SetPVarFloat(playerid, var, position[3]);
format(var, sizeof(var), "Angle_%d", GetPVarInt(playerid, "AmountOfCars"));
SetPVarFloat(playerid, var, position[4]);
format(var, sizeof(var), "Carkey_%d", GetPVarInt(playerid, "AmountOfCars"));
SetPVarInt(playerid, var, vehicleid);
format(var, sizeof(var), "Paintjob_%d", GetPVarInt(playerid, "AmountOfCars"));
SetPVarInt(playerid, var, -1);
strmid(owner[vehicleid], playername, 0, strlen(playername), 255);
SavePlayerVehicleData(playerid);
return 1;
}
else return RemovePlayerFromVehicle(playerid);
}
return 0;