DIALOG:144(playerid, response, listitem, inputtext[])
{
if(response)
{
if(GetClosestVehicle(playerid) == INVALID_VEHICLE_ID) return 1;
switch(listitem)
{
case 0:
{
if(vData[GetClosestVehicle(playerid)][vVehicleID] == 0) return 1;
GetVehicleParamsEx(GetClosestVehicle(playerid), VehicleParams[0], VehicleParams[1], VehicleParams[2], VehicleParams[3], VehicleParams[4], VehicleParams[5], VehicleParams[6]);
if(VehicleParams[5] == 0) return SendClientMessage(playerid, -1, "{FFFFFF}[ {FF0000}KLAIDA {FFFFFF}]: Bagaюinл privalo bыti atidaryta!");
pData[playerid][pSlot] = listitem;
new Tekstas[5][20];
for(new slot; slot != 4; ++slot)
{
if(vData[GetClosestVehicle(playerid)][vWeapon][slot] == 0) format(Tekstas[slot], 20, "%s", "{6EF83C}Tuриia vieta");
else
{
new Weapon[5][15];
GetWeaponName(vData[GetClosestVehicle(playerid)][vWeapon][pData[playerid][pSlot]], Weapon[slot], 15);
Tekstas[slot] = Weapon[slot];
}
}
new Stringas[84];
format(Stringas, 84, "%s\n%s\n%s\n%s", Tekstas[0], Tekstas[1], Tekstas[2], Tekstas[3], Tekstas[4]);
ShowPlayerDialog(playerid, 145, DIALOG_STYLE_LIST, "{FFFFFF}Bagaюinлs vidus", Stringas, "Iрimti", "Atgal");
}
case 1:
{
GetVehicleParamsEx(GetClosestVehicle(playerid), VehicleParams[0], VehicleParams[1], VehicleParams[2], VehicleParams[3], VehicleParams[4], VehicleParams[5], VehicleParams[6]);
if(VehicleParams[5] == 0) SetVehicleParamsEx(GetClosestVehicle(playerid), VehicleParams[0], VehicleParams[1], VehicleParams[2], VehicleParams[3], VehicleParams[4], 1, VehicleParams[6]);
else SetVehicleParamsEx(GetClosestVehicle(playerid), VehicleParams[0], VehicleParams[1], VehicleParams[2], VehicleParams[3], VehicleParams[4], 1, VehicleParams[6]);
}
}
}
return 1;
}
can u make the script in english ?
caz i see this in first time.. and i want to get what did your script is about and how you build it |
Show the GetClosestVehicle code, this is may the problem if it does "nothing" as you said.
Also, are you sure that this style of dialog scripting (DIALOG:144) is right? Didn't saw it anywhere else. |
stock GetClosestVehicle(playerid)
{
new Float:distance = 99980001, vehicleid = Cars, Float:pPos[3];
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
for(new vehid = 1; vehid != Cars; ++vehid)
{
new Float:vPos[3];
GetVehiclePos(vehid, vPos[0], vPos[1], vPos[2]);
if(vPos[0] == 0.000 && vPos[1] == 0.000 && vPos[2] == 0.000) continue;
else
{
new Float:newdistance;
vPos[0] -= pPos[0];
vPos[1] -= pPos[1];
vPos[2] -= vPos[2];
newdistance = vPos[0] * vPos[0] + vPos[1] * vPos[1] + vPos[2] * vPos[2];
if(newdistance < distance)
{
vehicleid = vehid;
distance = newdistance;
return vehicleid;
}
}
}
return INVALID_VEHICLE_ID;
}
stock GetClosestVehicle(playerid)
{
new Float:distance = 9999.0, vehicleid = INVALID_VEHICLE_ID, Float:pPos[3];
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
for(new vehid = 1; vehid != Cars; ++vehid) if(GetVehicleDistanceFromPoint(vehid,pPos[0],pPos[1],pPos[2]) < distance) vehicleid = vehid, distance = newdistance;
return vehicleid;
}