26.04.2011, 12:58
Here is code I made, but somehow it crashes server when I connect:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new Manana;
new Previon;
new Bravura;
new Hermes;
new Hustler;
new Majestic;
new Blista_Compact;
new Sabre;
new Euros;
new name[MAX_PLAYER_NAME], File[256];
GetPlayerName(playerid, name, sizeof(name));
format(File, sizeof(File), SERVER_VEHICLE_FILE, name);
if (dialogid == 091)
{
if (response == 1)
{
new Car_Bought[128], Buying_Result[128];
format(Car_Bought,sizeof(Car_Bought), "%i", PlayerCarInfo[playerid][pCarID]);
format(Buying_Result,sizeof(Buying_Result), "Your Car ID Is %s", Buying_Result);
SendClientMessage(playerid,0x008080FF,Buying_Result);
GivePlayerMoney(playerid, -2500);
SendClientMessage(playerid, 0xFFFFFFFF, "You Bought 'Manana' For: $2500");
dini_IntSet(File, "Last Paid",PlayerCarInfo[playerid][pLast_Paid] = 2500);
gPlayerCarBuying[playerid] = 0;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid,1);
TextDrawHideForPlayer(playerid,txtCarSelHelper);
gPlayerCarSelection[playerid] = Car_Manana;
Manana = AddStaticVehicle(410, -1920.6322021484, 287.27206420898, 40.811248779297, 270, -1, -1);
PutPlayerInVehicle(playerid, Manana, 0);
dini_IntSet(File, "CarID",PlayerCarInfo[playerid][pCarID] = 410);
dini_IntSet(File, "Vehicle Bought",PlayerCarInfo[playerid][pVehicle_Bought] = 1);
SendClientMessage(playerid,0x008080FF,"Your Car Is %s");
}
}
if (dialogid == 092)
{
if (response == 1)
{
new Car_Bought[128], Buying_Result[128];
format(Car_Bought,sizeof(Car_Bought), "%i", PlayerCarInfo[playerid][pCarID]);
format(Buying_Result,sizeof(Buying_Result), "Your Car ID Is %s", Buying_Result);
SendClientMessage(playerid,0x008080FF,Buying_Result);
GivePlayerMoney(playerid, -2700);
SendClientMessage(playerid, 0xFFFFFFFF, "You Bought 'Previon' For: $2700");
dini_IntSet(File, "Last Paid",PlayerCarInfo[playerid][pLast_Paid] = 2700);
gPlayerCarBuying[playerid] = 0;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid,1);
TextDrawHideForPlayer(playerid,txtCarSelHelper);
gPlayerCarSelection[playerid] = Car_Manana;
Previon = AddStaticVehicle(436, -1920.6322021484, 287.27206420898, 40.811248779297, 270, -1, -1);
PutPlayerInVehicle(playerid, Previon, 0);
dini_IntSet(File, "CarID",PlayerCarInfo[playerid][pCarID] = 436);
dini_IntSet(File, "Vehicle Bought",PlayerCarInfo[playerid][pVehicle_Bought] = 1);
SendClientMessage(playerid,0x008080FF,"Your Car Is %s");
}
}
if (dialogid == 093)
{
if (response == 1)
{
new Car_Bought[128], Buying_Result[128];
format(Car_Bought,sizeof(Car_Bought), "%i", PlayerCarInfo[playerid][pCarID]);
format(Buying_Result,sizeof(Buying_Result), "Your Car ID Is %s", Buying_Result);
SendClientMessage(playerid,0x008080FF,Buying_Result);
GivePlayerMoney(playerid, -3000);
SendClientMessage(playerid, 0xFFFFFFFF, "You Bought 'Bravura' For: $3000");
dini_IntSet(File, "Last Paid",PlayerCarInfo[playerid][pLast_Paid] = 3000);
gPlayerCarBuying[playerid] = 0;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid,1);
TextDrawHideForPlayer(playerid,txtCarSelHelper);
gPlayerCarSelection[playerid] = Car_Manana;
Bravura = AddStaticVehicle(401, -1920.6322021484, 287.27206420898, 40.811248779297, 270, -1, -1);
PutPlayerInVehicle(playerid, Bravura, 0);
dini_IntSet(File, "CarID",PlayerCarInfo[playerid][pCarID] = 401);
dini_IntSet(File, "Vehicle Bought",PlayerCarInfo[playerid][pVehicle_Bought] = 1);
SendClientMessage(playerid,0x008080FF,"Your Car Is %s");
}
}
if (dialogid == 094)
{
if (response == 1)
{
new Car_Bought[128], Buying_Result[128];
format(Car_Bought,sizeof(Car_Bought), "%i", PlayerCarInfo[playerid][pCarID]);
format(Buying_Result,sizeof(Buying_Result), "Your Car ID Is %s", Buying_Result);
SendClientMessage(playerid,0x008080FF,Buying_Result);
GivePlayerMoney(playerid, -4270);
SendClientMessage(playerid, 0xFFFFFFFF, "You Bought 'Hermes' For: $4270");
dini_IntSet(File, "Last Paid",PlayerCarInfo[playerid][pLast_Paid] = 4270);
gPlayerCarBuying[playerid] = 0;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid,1);
TextDrawHideForPlayer(playerid,txtCarSelHelper);
gPlayerCarSelection[playerid] = Car_Manana;
Hermes = AddStaticVehicle(474, -1920.6322021484, 287.27206420898, 40.811248779297, 270, -1, -1);
PutPlayerInVehicle(playerid, Hermes, 0);
dini_IntSet(File, "CarID",PlayerCarInfo[playerid][pCarID] = 474);
dini_IntSet(File, "Vehicle Bought",PlayerCarInfo[playerid][pVehicle_Bought] = 1);
SendClientMessage(playerid,0x008080FF,"Your Car Is %s");
}
}
if (dialogid == 095)
{
if (response == 1)
{
new Car_Bought[128], Buying_Result[128];
format(Car_Bought,sizeof(Car_Bought), "%i", PlayerCarInfo[playerid][pCarID]);
format(Buying_Result,sizeof(Buying_Result), "Your Car ID Is %s", Buying_Result);
SendClientMessage(playerid,0x008080FF,Buying_Result);
GivePlayerMoney(playerid, -5400);
SendClientMessage(playerid, 0xFFFFFFFF, "You Bought 'Hustler' For: $5400");
dini_IntSet(File, "Last Paid",PlayerCarInfo[playerid][pLast_Paid] = 5400);
gPlayerCarBuying[playerid] = 0;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid,1);
TextDrawHideForPlayer(playerid,txtCarSelHelper);
gPlayerCarSelection[playerid] = Car_Manana;
Hustler = AddStaticVehicle(545, -1920.6322021484, 287.27206420898, 40.811248779297, 270, -1, -1);
PutPlayerInVehicle(playerid, Hustler, 0);
dini_IntSet(File, "CarID",PlayerCarInfo[playerid][pCarID] = 545);
dini_IntSet(File, "Vehicle Bought",PlayerCarInfo[playerid][pVehicle_Bought] = 1);
SendClientMessage(playerid,0x008080FF,"Your Car Is %s");
}
}
if (dialogid == 096)
{
if (response == 1)
{
new Car_Bought[128], Buying_Result[128];
format(Car_Bought,sizeof(Car_Bought), "%i", PlayerCarInfo[playerid][pCarID]);
format(Buying_Result,sizeof(Buying_Result), "Your Car ID Is %s", Buying_Result);
SendClientMessage(playerid,0x008080FF,Buying_Result);
GivePlayerMoney(playerid, -6750);
SendClientMessage(playerid, 0xFFFFFFFF, "You Bought 'Majestic' For: $6750");
dini_IntSet(File, "Last Paid",PlayerCarInfo[playerid][pLast_Paid] = 6750);
gPlayerCarBuying[playerid] = 0;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid,1);
TextDrawHideForPlayer(playerid,txtCarSelHelper);
gPlayerCarSelection[playerid] = Car_Manana;
Majestic = AddStaticVehicle(517, -1920.6322021484, 287.27206420898, 40.811248779297, 270, -1, -1);
PutPlayerInVehicle(playerid, Majestic, 0);
dini_IntSet(File, "CarID",PlayerCarInfo[playerid][pCarID] = 517);
dini_IntSet(File, "Vehicle Bought",PlayerCarInfo[playerid][pVehicle_Bought] = 1);
SendClientMessage(playerid,0x008080FF,"Your Car Is %s");
}
}
if (dialogid == 097)
{
if (response == 1)
{
new Car_Bought[128], Buying_Result[128];
format(Car_Bought,sizeof(Car_Bought), "%i", PlayerCarInfo[playerid][pCarID]);
format(Buying_Result,sizeof(Buying_Result), "Your Car ID Is %s", Buying_Result);
SendClientMessage(playerid,0x008080FF,Buying_Result);
GivePlayerMoney(playerid, -7500);
SendClientMessage(playerid, 0xFFFFFFFF, "You Bought 'Blista Compact' For: $7500");
dini_IntSet(File, "Last Paid",PlayerCarInfo[playerid][pLast_Paid] = 7500);
gPlayerCarBuying[playerid] = 0;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid,1);
TextDrawHideForPlayer(playerid,txtCarSelHelper);
gPlayerCarSelection[playerid] = Car_Manana;
Blista_Compact = AddStaticVehicle(496, -1920.6322021484, 287.27206420898, 40.811248779297, 270, -1, -1);
PutPlayerInVehicle(playerid, Blista_Compact, 0);
dini_IntSet(File, "CarID",PlayerCarInfo[playerid][pCarID] = 496);
dini_IntSet(File, "Vehicle Bought",PlayerCarInfo[playerid][pVehicle_Bought] = 1);
SendClientMessage(playerid,0x008080FF,"Your Car Is %s");
}
}
if (dialogid == 098)
{
if (response == 1)
{
new Car_Bought[128], Buying_Result[128];
format(Car_Bought,sizeof(Car_Bought), "%i", PlayerCarInfo[playerid][pCarID]);
format(Buying_Result,sizeof(Buying_Result), "Your Car ID Is %s", Buying_Result);
SendClientMessage(playerid,0x008080FF,Buying_Result);
GivePlayerMoney(playerid, -9000);
SendClientMessage(playerid, 0xFFFFFFFF, "You Bought 'Sabre' For: $9000");
dini_IntSet(File, "Last Paid",PlayerCarInfo[playerid][pLast_Paid] = 9000);
gPlayerCarBuying[playerid] = 0;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid,1);
TextDrawHideForPlayer(playerid,txtCarSelHelper);
gPlayerCarSelection[playerid] = Car_Manana;
Sabre = AddStaticVehicle(475, -1920.6322021484, 287.27206420898, 40.811248779297, 270, -1, -1);
PutPlayerInVehicle(playerid, Sabre, 0);
dini_IntSet(File, "CarID",PlayerCarInfo[playerid][pCarID] = 475);
dini_IntSet(File, "Vehicle Bought",PlayerCarInfo[playerid][pVehicle_Bought] = 1);
SendClientMessage(playerid,0x008080FF,"Your Car Is %s");
}
}
if (dialogid == 099)
{
if (response == 1)
{
new Car_Bought[128], Buying_Result[128];
format(Car_Bought,sizeof(Car_Bought), "%i", PlayerCarInfo[playerid][pCarID]);
format(Buying_Result,sizeof(Buying_Result), "Your Car ID Is %s", Buying_Result);
SendClientMessage(playerid,0x008080FF,Buying_Result);
GivePlayerMoney(playerid, -10000);
SendClientMessage(playerid, 0xFFFFFFFF, "You Bought 'Euros' For: $10000");
dini_IntSet(File, "Last Paid",PlayerCarInfo[playerid][pLast_Paid] = 10000);
gPlayerCarBuying[playerid] = 0;
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid,1);
TextDrawHideForPlayer(playerid,txtCarSelHelper);
gPlayerCarSelection[playerid] = Car_Manana;
Euros = AddStaticVehicle(587, -1920.6322021484, 287.27206420898, 40.811248779297, 270, -1, -1);
PutPlayerInVehicle(playerid, Euros, 0);
dini_IntSet(File, "CarID",PlayerCarInfo[playerid][pCarID] = 587);
dini_IntSet(File, "Vehicle Bought",PlayerCarInfo[playerid][pVehicle_Bought] = 1);
}
}
return 0;
}