if(dialogid == DIALOG_PUT) // Put items in trunk
{
new buffer[512];
new gunname[100];
new gunID = GetPlayerWeapon(playerid);
new gunAmmo = GetPlayerAmmo(playerid);
GetWeaponName(gunID, gunname, sizeof(gunname));
new vehicleid = GetPlayerVehicleID(playerid);
if(response)
{
if(listitem == 0) // Slot 1
{
iTrunk[vehicleid][tWeapon1] = gunID;
iTrunk[vehicleid][tAmmo1] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
}
if(listitem == 1) // Slot 2
{
iTrunk[vehicleid][tWeapon2] = gunID;
iTrunk[vehicleid][tAmmo2] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
}
if(listitem == 2) // Slot 3
{
iTrunk[vehicleid][tWeapon3] = gunID;
iTrunk[vehicleid][tAmmo3] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
}
if(listitem == 3) // Slot 4
{
iTrunk[vehicleid][tWeapon4] = gunID;
iTrunk[vehicleid][tAmmo4] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
}
if(listitem == 4) // Slot 5
{
iTrunk[vehicleid][tWeapon5] = gunID;
iTrunk[vehicleid][tAmmo5] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
}
if(listitem == 5) // Slot 6
{
iTrunk[vehicleid][tWeapon6] = gunID;
iTrunk[vehicleid][tAmmo6] = gunAmmo;
RemovePlayerWeapon(playerid, gunID);
}
}
return 1;
}
if(dialogid == DIALOG_TAKE) // Take items from trunk
{
new vehicleid = GetPlayerVehicleID(playerid);
if(response)
{
if(listitem == 0) // Slot 1
{
GivePlayerWeapon(playerid,iTrunk[vehicleid][tWeapon1],iTrunk[vehicleid][tAmmo1]);
}
}
return 1;
}
// Rest
return 0;
}
if(dialogid == DIALOG_TAKE) // Take items from trunk
{
new vehicleid = GetPlayerVehicleID(playerid);
if(response)
{
if(listitem == 0) // Slot 1
{
GivePlayerWeapon(playerid,iTrunk[vehicleid][tWeapon1],iTrunk[vehicleid][tAmmo1]);
}
}
return 1;
}
iTrunk[vehicleid][tWeapon1] = 0;
iTrunk[vehicleid][tAmmo1] = 0;
pawn Код:
|
new aWeaponNames[][32] =
{
{"Unarmed"}, {"BrassKnuckles"}, {"GolfClub"}, {"NightStick"}, {"Knife"}, {"BaseballBat"},
{"Shovel"}, {"PoolCue"}, {"Katana"}, {"Chainsaw"}, {"PurpleDildo"}, {"BigWhiteVibrator"},
{"MedWhiteVibrator"}, {"SmlWhiteVibrator"}, {"Flowers"}, {"Cane"}, {"Grenade"}, {"Teargas"},
{"Molotov"}, {"Empty Slot 1"}, {"Empty Slot 2"}, {"Empty Slot 3"}, {"Colt45"}, {"SDPistol"},
{"DesertEagle"}, {"Shotgun"}, {"SawnoffShotgun"}, {"Spas12"}, {"Mac10"},
{"MP5"}, {"AK47"}, {"M4"}, {"Tec9"}, {"CountryRifle"}, {"Sniper"}, {"RPG"},
{"HeatRPG"}, {"Flamethrower"}, {"Minigun"}, {"Satchel"}, {"Detonator"},
{"SprayCan"}, {"Extinguisher"}, {"Camera"}, {"NVGoggles"}, {"IRGoggles"},
{"Parachute"}, {"Fake Pistol"}
};
iTrunk[vehicleid][tWeapon1]
format(string, sizeof(string), "Slot 1: %s", aWeaponNames[ iTrunk[vehicleid][tWeapon1] ]);
if(dialogid == DIALOG_PUT) // Put items in trunk
{
new gunID = GetPlayerWeapon(playerid);
if(gunID == 0) return 1;
new gunAmmo = GetPlayerAmmo(playerid);
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid == INVALID_VEHICLE_ID) return 1;
if(response)
{
switch(listitem)
{
case 0:
{
iTrunk[vehicleid][tWeapon1] = gunID;
iTrunk[vehicleid][tAmmo1] = gunAmmo;
}
case 1:
{
iTrunk[vehicleid][tWeapon2] = gunID;
iTrunk[vehicleid][tAmmo2] = gunAmmo;
}
case 2:
{
iTrunk[vehicleid][tWeapon3] = gunID;
iTrunk[vehicleid][tAmmo3] = gunAmmo;
}
case 3:
{
iTrunk[vehicleid][tWeapon4] = gunID;
iTrunk[vehicleid][tAmmo4] = gunAmmo;
}
case 4:
{
iTrunk[vehicleid][tWeapon5] = gunID;
iTrunk[vehicleid][tAmmo5] = gunAmmo;
}
case 5:
{
iTrunk[vehicleid][tWeapon6] = gunID;
iTrunk[vehicleid][tAmmo6] = gunAmmo;
}
}
RemovePlayerWeapon(playerid, gunID);
}
return 1;
}
if(dialogid == DIALOG_TAKE) // Take items from trunk
{
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid == INVALID_VEHICLE_ID) return 1;
if(response)
{
switch(listitem)
{
case 0:
{
GivePlayerWeapon(playerid, iTrunk[vehicleid][tWeapon1], iTrunk[vehicleid][tAmmo1]);
iTrunk[vehicleid][tWeapon1] = 0;
iTrunk[vehicleid][tAmmo1] = 0;
}
case 1:
{
GivePlayerWeapon(playerid, iTrunk[vehicleid][tWeapon2], iTrunk[vehicleid][tAmmo2]);
iTrunk[vehicleid][tWeapon2] = 0;
iTrunk[vehicleid][tAmmo2] = 0;
}
case 2:
{
GivePlayerWeapon(playerid, iTrunk[vehicleid][tWeapon3], iTrunk[vehicleid][tAmmo3]);
iTrunk[vehicleid][tWeapon3] = 0;
iTrunk[vehicleid][tAmmo3] = 0;
}
case 3:
{
GivePlayerWeapon(playerid, iTrunk[vehicleid][tWeapon4], iTrunk[vehicleid][tAmmo4]);
iTrunk[vehicleid][tWeapon4] = 0;
iTrunk[vehicleid][tAmmo4] = 0;
}
case 4:
{
GivePlayerWeapon(playerid, iTrunk[vehicleid][tWeapon5], iTrunk[vehicleid][tAmmo5]);
iTrunk[vehicleid][tWeapon5] = 0;
iTrunk[vehicleid][tAmmo5] = 0;
}
case 5:
{
GivePlayerWeapon(playerid, iTrunk[vehicleid][tWeapon6], iTrunk[vehicleid][tAmmo6]);
iTrunk[vehicleid][tWeapon6] = 0;
iTrunk[vehicleid][tAmmo6] = 0;
}
}
}
return 1;
}
// Rest
return 0;
}
//Under your command to put items in the trunk:
new tstr[255];
format(tstr, sizeof(tstr), "Slot 1 - %s\nSlot 2 - %s\nSlot 3 - %s\nSlot 4 - %s\nSlot 5 - %s\nSlot 6 - %s", GetGunName(iTrunk[vehicleid][tWeapon1]), GetGunName(iTrunk[vehicleid][tWeapon2]), GetGunName(iTrunk[vehicleid][tWeapon3]), GetGunName(iTrunk[vehicleid][tWeapon4]), GetGunName(iTrunk[vehicleid][tWeapon5]), GetGunName(iTrunk[vehicleid][tWeapon6]));
ShowPlayerDialog(playerid, DIALOG_TAKE, DIALOG_STYLE_LIST, "Take A Weapon", tstr, "Select", "Cancel");
//Continue...
stock GetGunName(weaponid)
{
new gunname[32];
GetWeaponName(weaponid, gunname, sizeof(gunname));
if(weaponid == 0) gunname = "None";
return gunname;
}
enum Trunk
{
tWeapon1,
tWeapon2,
tWeapon3,
tWeapon4,
tWeapon5,
tAmmo1,
tAmmo2,
tAmmo3,
tAmmo4,
tAmmo5
};
new iTrunk[MAX_VEHICLES][Trunk];
if(listitem == 1) // Put in trunk
{
for(new i; i<MAX_VEHICLES; i++)
{
new vehicleid = GetPlayerVehicleID(playerid);
new Float: vx, Float:vy, Float:vz;
new e, l, a, d, b, bo, o;
GetVehicleParamsEx(i,e,l,a,d,b,bo,o);
GetVehiclePos(i,vx,vy,vz);
GetXYBehindCar(i, vx, vy, 2.5);
if(IsPlayerInRangeOfPoint(playerid,2.5,vx,vy,vz))
{
if(bo > 0)
{
new tstr[255];
format(tstr, sizeof(tstr), "Slot 1 - %s (%d)\nSlot 2 - %s (%d)\nSlot 3 - %s (%d)\nSlot 4 - %s (%d)\nSlot 5 - %s (%d)", GetGunName(iTrunk[vehicleid][tWeapon1]),iTrunk[vehicleid][tAmmo1], GetGunName(iTrunk[vehicleid][tWeapon2]),iTrunk[vehicleid][tAmmo2], GetGunName(iTrunk[vehicleid][tWeapon3]),iTrunk[vehicleid][tAmmo3], GetGunName(iTrunk[vehicleid][tWeapon4]),iTrunk[vehicleid][tAmmo4],GetGunName(iTrunk[vehicleid][tWeapon5]),iTrunk[vehicleid][tAmmo5]);
ShowPlayerDialog(playerid, DIALOG_PUT, DIALOG_STYLE_LIST, "Store a weapon", tstr, "Select", "Cancel");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED,"{00FF00}INFO: {FFFFFF} Open it first.");
return 1;
}
}
}
}
if(listitem == 2) // Take from trunk
{
for(new i; i<MAX_VEHICLES; i++)
{
new vehicleid = GetPlayerVehicleID(playerid);
new Float: vx, Float:vy, Float:vz;
new e, l, a, d, b, bo, o;
GetVehicleParamsEx(i,e,l,a,d,b,bo,o);
GetVehiclePos(i,vx,vy,vz);
GetXYBehindCar(i, vx, vy, 2.5);
if(IsPlayerInRangeOfPoint(playerid,2.5,vx,vy,vz))
{
if(bo > 0)
{
new tstr[255];
format(tstr, sizeof(tstr), "Slot 1 - %s (%d)\nSlot 2 - %s (%d)\nSlot 3 - %s (%d)\nSlot 4 - %s (%d)\nSlot 5 - %s (%d)", GetGunName(iTrunk[vehicleid][tWeapon1]),iTrunk[vehicleid][tAmmo1], GetGunName(iTrunk[vehicleid][tWeapon2]),iTrunk[vehicleid][tAmmo2], GetGunName(iTrunk[vehicleid][tWeapon3]),iTrunk[vehicleid][tAmmo3], GetGunName(iTrunk[vehicleid][tWeapon4]),iTrunk[vehicleid][tAmmo4],GetGunName(iTrunk[vehicleid][tWeapon5]),iTrunk[vehicleid][tAmmo5]);
ShowPlayerDialog(playerid, DIALOG_TAKE, DIALOG_STYLE_LIST, "Take A Weapon", tstr, "Select", "Cancel");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED,"{00FF00}INFO: {FFFFFF} Open it before putting something in it1");
return 1;
}
}
}
}
}
return 1;
}
if(dialogid == DIALOG_PUT) // Put items in trunk
{
new gunID = GetPlayerWeapon(playerid);
if(gunID == 0) return SendClientMessage(playerid, -1,"{00FF00}INFO: {FFFFFF} You need to have weapon in your hands.");
new gunAmmo = GetPlayerAmmo(playerid);
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid == INVALID_VEHICLE_ID) return 1;
if(response)
{
switch(listitem)
{
case 0:
{
if(iTrunk[vehicleid][tWeapon1] != 0 && iTrunk[vehicleid][tAmmo1] != 0)
{
SendClientMessage(playerid, -1,"{00FF00}INFO: {FFFFFF} This slot is already used!");
return 1;
}
iTrunk[vehicleid][tWeapon1] = gunID;
iTrunk[vehicleid][tAmmo1] = gunAmmo;
}
case 1:
{
if(iTrunk[vehicleid][tWeapon2] != 0 && iTrunk[vehicleid][tAmmo2] != 0)
{
SendClientMessage(playerid, -1,"{00FF00}INFO: {FFFFFF} This slot is already used!");
return 1;
}
iTrunk[vehicleid][tWeapon2] = gunID;
iTrunk[vehicleid][tAmmo2] = gunAmmo;
}
case 2:
{
if(iTrunk[vehicleid][tWeapon3] != 0 && iTrunk[vehicleid][tAmmo3] != 0)
{
SendClientMessage(playerid, -1,"{00FF00}INFO: {FFFFFF} This slot is already used!");
return 1;
}
iTrunk[vehicleid][tWeapon3] = gunID;
iTrunk[vehicleid][tAmmo3] = gunAmmo;
}
case 3:
{
if(iTrunk[vehicleid][tWeapon4] !=0 && iTrunk[vehicleid][tAmmo4] != 0)
{
SendClientMessage(playerid, -1,"{00FF00}INFO: {FFFFFF} This slot is already used!");
return 1;
}
iTrunk[vehicleid][tWeapon4] = gunID;
iTrunk[vehicleid][tAmmo4] = gunAmmo;
}
case 4:
{
if(iTrunk[vehicleid][tWeapon5] != 0 && iTrunk[vehicleid][tAmmo5] != 0)
{
SendClientMessage(playerid, -1,"{00FF00}INFO: {FFFFFF} This slot is already used!");
return 1;
}
iTrunk[vehicleid][tWeapon5] = gunID;
iTrunk[vehicleid][tAmmo5] = gunAmmo;
}
}
RemovePlayerWeapon(playerid, gunID);
}
return 1;
}
if(dialogid == DIALOG_TAKE) // Take items from trunk
{
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid == INVALID_VEHICLE_ID) return 1;
if(response)
{
switch(listitem)
{
case 0:
{
if(iTrunk[vehicleid][tWeapon1] == 0 && iTrunk[vehicleid][tAmmo1] == 0)
{
SendClientMessage(playerid, -1,"{00FF00}INFO: {FFFFFF} This slot is empty!");
return 1;
}
GivePlayerWeapon(playerid, iTrunk[vehicleid][tWeapon1], iTrunk[vehicleid][tAmmo1]);
iTrunk[vehicleid][tWeapon1] = 0;
iTrunk[vehicleid][tAmmo1] = 0;
}
case 1:
{
if(iTrunk[vehicleid][tWeapon2] == 0 && iTrunk[vehicleid][tAmmo2] == 0)
{
SendClientMessage(playerid, -1,"{00FF00}INFO: {FFFFFF} This slot is empty!");
return 1;
}
GivePlayerWeapon(playerid, iTrunk[vehicleid][tWeapon2], iTrunk[vehicleid][tAmmo2]);
iTrunk[vehicleid][tWeapon2] = 0;
iTrunk[vehicleid][tAmmo2] = 0;
}
case 2:
{
if(iTrunk[vehicleid][tWeapon3] == 0 && iTrunk[vehicleid][tAmmo3] == 0)
{
SendClientMessage(playerid, -1,"{00FF00}INFO: {FFFFFF} This slot is empty!");
return 1;
}
GivePlayerWeapon(playerid, iTrunk[vehicleid][tWeapon3], iTrunk[vehicleid][tAmmo3]);
iTrunk[vehicleid][tWeapon3] = 0;
iTrunk[vehicleid][tAmmo3] = 0;
}
case 3:
{
if(iTrunk[vehicleid][tWeapon4] == 0 && iTrunk[vehicleid][tAmmo4] == 0)
{
SendClientMessage(playerid, -1,"{00FF00}INFO: {FFFFFF} This slot is empty!");
return 1;
}
GivePlayerWeapon(playerid, iTrunk[vehicleid][tWeapon4], iTrunk[vehicleid][tAmmo4]);
iTrunk[vehicleid][tWeapon4] = 0;
iTrunk[vehicleid][tAmmo4] = 0;
}
case 4:
{
if(iTrunk[vehicleid][tWeapon5] == 0 && iTrunk[vehicleid][tAmmo5] == 0)
{
SendClientMessage(playerid, -1,"{00FF00}INFO: {FFFFFF} This slot is empty!");
return 1;
}
GivePlayerWeapon(playerid, iTrunk[vehicleid][tWeapon5], iTrunk[vehicleid][tAmmo5]);
iTrunk[vehicleid][tWeapon5] = 0;
iTrunk[vehicleid][tAmmo5] = 0;
}
}
}
return 1;
}