Define :
Код:
#define AMMUMENU 5500
Ammunation Interiors :
Код:
IsAtAmmu(playerid)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInRangeOfPoint(playerid, 50.0, 2539, -133.7294, 999.6016))
{
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid, 50.0, 295.1320, -38.5151, 1001.5156))
{
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid, 50.0, 296.919982, -108.071998, 1001.515625))
{
return 1;
}
}
return 0;
}
Command
Код:
CMD:buygun(playerid, params[])
{
if(!IsAtAmmu(playerid))
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a Ammunation Shop");
return 1;
}
else
{
ShowPlayerDialog(playerid, AMMUMENU, DIALOG_STYLE_LIST, "Ammunation Shop", "Shotgun (5000)\nMp5 (20000)\nDeagle (35000)\nM4 (75000)\nFullVest (3000)", "Buy", "Cancel");
}
return 1;
}
Dialog Entry
Код:
if(dialogid == AMMUMENU)
{
if(response)
{
if(listitem == 0)
{
if (GetPlayerCash(playerid) >= 5000)
{
GivePlayerCash(playerid, -5000);
GivePlayerValidWeapon(playerid, 25, 60000);
format(string, sizeof(string), "Pumped Shotgun Purchase.");
SendClientMessageEx(playerid, COLOR_RED, string);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
}
}
if(listitem == 1)
{
if (GetPlayerCash(playerid) >= 20000)
{
GivePlayerCash(playerid, -20000);
GivePlayerValidWeapon(playerid, 29, 60000);
format(string, sizeof(string), "Mp5 Purchase");
SendClientMessageEx(playerid, COLOR_RED, string);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
}
}
if(listitem == 2)
{
if (GetPlayerCash(playerid) >= 35000)
{
GivePlayerCash(playerid, -35000);
GivePlayerValidWeapon(playerid, 24, 60000);
format(string, sizeof(string), "Deagle Purchase");
SendClientMessageEx(playerid, COLOR_RED, string);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
}
}
if(listitem == 3)
{
if (GetPlayerCash(playerid) >= 75000)
{
GivePlayerCash(playerid, -75000);
GivePlayerValidWeapon(playerid, 31, 60000);
format(string, sizeof(string), "M4 Purchase");
SendClientMessageEx(playerid, COLOR_RED, string);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
}
}
if(listitem == 4)
{
if (GetPlayerCash(playerid) >= 3000)
{
GivePlayerCash(playerid, -3000);
SetPlayerArmour(playerid, 100);
format(string, sizeof(string), "KevlarVest Purchase");
SendClientMessageEx(playerid, COLOR_RED, string);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD4, "You don't have the cash for this item!");
}
}
}
}
Hope these codes help,
Note: This was taken from my script so they should work 100 percent.