PHP код:
CMD:trunk(playerid, params[])
{
if(GetPlayerHouse(playerid) == 0) return SCM(playerid, COLOR_WHITE, "У вас нет машины!");
if(CarInfo[playerid][cLock] == 1) return SCM(playerid, COLOR_WHITE, "Ошибка: Ваш транспорт закрыт. Откройте его, дабы воспользоваться багажником.");
new Float: vX, Float: vY, Float: vZ;
GetCoordBootVehicle(GetPVarInt(playerid,"CREVEH"), vX, vY, vZ);
if(!IsPlayerInRangeOfPoint(playerid, 2.0, vX, vY, vZ) || IsPlayerInAnyVehicle(playerid)) return SCM(playerid, COLOR_WHITE, "Ошибка: Подсказка: Возможно использовать команду возле багажника!");
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,1,objective);
ApplyAnimation(playerid,"CASINO","dealone",4.1,1,1,1,1,1);
new string[500];
new gunname[5][32];
for(new i = 0; i < 5; i++)
{
if(CarInfo[playerid][cGun][i] != 0) GetWeaponName(CarInfo[playerid][cGun][i],gunname[i],32);
if(CarInfo[playerid][cGun][i] == 0) format(gunname[i], 6,"Пусто");
}
format(string,sizeof(string),"{ffffff}[-] Заправить транспорт\n[-] Положить оружие\n[-] Забрать все оружие\n[-] Положить наркотики\n[-] Взять наркотики\t\t%i г.\n\n[0] Слот (%s)\t\t{0BDA51}%i{ffffff} пт.\n[1] Слот (%s)\t\t{0BDA51}%i{ffffff} пт.\n[2] Слот (%s)\t\t{0BDA51}%i{ffffff} пт.\n[3] Слот (%s)\t\t{0BDA51}%i{ffffff} пт.\n[4] Слот (%s)\t\t{0BDA51}%i{ffffff} пт.",
CarInfo[playerid][cDrugs],
gunname[0],CarInfo[playerid][cGunAmmo][0],
gunname[1],CarInfo[playerid][cGunAmmo][1],
gunname[2],CarInfo[playerid][cGunAmmo][2],
gunname[3],CarInfo[playerid][cGunAmmo][3],
gunname[4],CarInfo[playerid][cGunAmmo][4]);
SPD(playerid,169,DIALOG_STYLE_LIST,"Багажник личного транспорта",string,"Выбрать","Закрыть");
return true;
}
PHP код:
case 169:
{
if(response)
{
switch(listitem)
{
case 0://Заправить авто
{
if(PlayerInfo[playerid][pJerrycan] == 0)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,0,objective);
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,0,0,0,0,0);
SCM(playerid, COLOR_GREY, "У вас нет канистры!");
return true;
}
PlayerInfo[playerid][pJerrycan] = 0;
Vehicle[vehicle][Fuel] += 50;
SCM(playerid, COLOR_LIGHTBLUE, "[Т] Вы дозаправили транспорт (+50 литров)");
}
case 1://Положить оружие, по слотам
{
new weaponid = GetPlayerWeapon(playerid);
new slot = GetWeaponSlot(weaponid);
if(slot < 2 || slot > 6)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,0,objective);
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,0,0,0,0,0);
SCM(playerid, COLOR_GREY, "Данное оружие не подходить к ячейке!");
return true;
}
if(PlayerInfo[playerid][pGun][slot] == 0)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,0,objective);
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,0,0,0,0,0);
SCM(playerid, COLOR_GREY, "Ошибка!");
return true;
}
if(CarInfo[playerid][cGun][slot-2] != 0 && PlayerInfo[playerid][pGun][slot] != CarInfo[playerid][cGun][slot-2])
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,0,objective);
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,0,0,0,0,0);
SCM(playerid, COLOR_GREY, "Данная ячейка уже занята!");
return true;
}
CarInfo[playerid][cGun][slot-2] = PlayerInfo[playerid][pGun][slot];
CarInfo[playerid][cGunAmmo][slot-2] += PlayerInfo[playerid][pGunAmmo][slot];
ResetPlayerWeaponID(playerid, PlayerInfo[playerid][pGun][slot]);
}
case 2:
{
new guns;
for(new i = 0; i < 5; i++)
{
if(CarInfo[playerid][cGun][i] == 0 || CarInfo[playerid][cGunAmmo][i] == 0) continue;
GivePlayerWeaponAC(playerid, CarInfo[playerid][cGun][i], CarInfo[playerid][cGunAmmo][i]);
CarInfo[playerid][cGunAmmo][i] = 0;
CarInfo[playerid][cGun][i] = 0;
guns++;
}
if(!guns) SCM(playerid, COLOR_GREY,"В багажнике нет оружия.");
else SCM(playerid, COLOR_GREY,"Вы забрали все оружие из багажника.");
}
case 3://Положить наркотики
{
CarInfo[playerid][cDrugs] += PlayerInfo[playerid][pDrugs];
PlayerInfo[playerid][pDrugs] = 0;
}
case 4://Взять наркотики
{
if(CarInfo[playerid][cDrugs] == 0)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,0,objective);
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,0,0,0,0,0);
SCM(playerid,COLOR_GREY,"В транспорте нет наркотиков!");
return true;
}
if(CarInfo[playerid][cDrugs] > 50)
{
CarInfo[playerid][cDrugs] -= 50;
PlayerInfo[playerid][pDrugs] += 50;
}
if(CarInfo[playerid][cDrugs] <= 50)
{
PlayerInfo[playerid][pDrugs] += CarInfo[playerid][cDrugs];
CarInfo[playerid][cDrugs] = 0;
}
}
}
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,0,objective);
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,0,0,0,0,0);
if(listitem < 6) return true;
if(CarInfo[playerid][cGunAmmo][listitem-5] == 0) return SCM(playerid, COLOR_GREY,"В данной ячейки нет оружия!");
if(CarInfo[playerid][cGunAmmo][listitem-5] > 50)
{
new gunname[32];
GetWeaponName(CarInfo[playerid][cGun][listitem-5],gunname,32);
new mes[128];
format(mes,sizeof(mes),"Вы взяли 50 патрон %s", gunname);
SCM(playerid, COLOR_GREY,mes);
GivePlayerWeaponAC(playerid, CarInfo[playerid][cGun][listitem-5], 50);
CarInfo[playerid][cGunAmmo][listitem-5] -= 50;
return true;
}
if(CarInfo[playerid][cGunAmmo][listitem-5] <= 50)
{
new gunname[32];
GetWeaponName(CarInfo[playerid][cGun][listitem-5],gunname,32);
new mes[128];
format(mes,sizeof(mes),"Вы взяли %i патрон %s", CarInfo[playerid][cGunAmmo][listitem-5], gunname);
SCM(playerid, COLOR_GREY,mes);
GivePlayerWeaponAC(playerid, CarInfo[playerid][cGun][listitem-5], CarInfo[playerid][cGunAmmo][listitem-5]);
CarInfo[playerid][cGunAmmo][listitem-5] = 0;
CarInfo[playerid][cGun][listitem-5] = 0;
return true;
}
return true;
}
else
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(GetPVarInt(playerid,"CREVEH"),engine,lights,alarm,doors,bonnet,0,objective);
ApplyAnimation(playerid,"CARRY","crry_prtial",4.0,0,0,0,0,0);
return true;
}
}