if (strcmp(cmd, "/buygun", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(GetPlayerCash(playerid) < 1)
{
SendClientMessage(playerid, COLOR_GRAD1, "Nu ai suficienti bani!");
return 1;
}
if(P_DATA[playerid][pGunLic] == 0 || P_DATA[playerid][pGunLic] < gettime())
{
if(P_DATA[playerid][pGunLic] < gettime()) SCM(playerid,COLOR_LIGHTBLUE,"{E04534}Licenta ta de arme a expirat.");
SendClientMessage(playerid, COLOR_GRAD1, "Server: Nu ai licenta de arme!");
return 1;
}
new gun;
new gunid[16];
new gunstring3[256];
new gunstring4[256];
new infostring[256];
new guncharge;
new ammocharge;
new location = P_DATA[playerid][pLocal];
if(PlayerToPoint(9.0,playerid,310.6151,-137.2695,999.6016) || PlayerToPoint(9.0,playerid,313.2013,-163.5493,999.5938))
{
if(BizzData[location-99][bProducts] <= 0)
{
GameTextForPlayer(playerid, "~r~Out Of Stock", 5000, 1);
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
format(string, sizeof(string), "Ű Foloseste: /buygun [gunname] [ammoamount]");
SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
SendClientMessage(playerid, COLOR_WHITE,"=> Arme & Munitie <=");
SendClientMessage(playerid, COLOR_GRAD2,string);
format(gunstring3, 256, "Arme: sdpistol ($%d) deagle ($%d) mp5 ($%d)",
BizzData[location-99][bGunPrice]*500/100,BizzData[location-99][bGunPrice]*1000/100,BizzData[location-99][bGunPrice]*3000/100,BizzData[location-99][bGunPrice]*2000/100,BizzData[location-99][bGunPrice]*3000/100,BizzData[location-99][bGunPrice]*2500);
SendClientMessage(playerid, COLOR_GRAD3, gunstring3);
format(gunstring4, 256, "Arme: ak47 ($%d) m4 ($%d) rifle ($%d)",
BizzData[location-99][bGunPrice]*6000/100,BizzData[location-99][bGunPrice]*4000/100,BizzData[location-99][bGunPrice]*5000/100,BizzData[location-99][bGunPrice]*5000/100,BizzData[location-99][bGunPrice]*1000);
SendClientMessage(playerid, COLOR_GRAD3, gunstring4);
SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
return 1;
}
strmid(gunid, tmp, 0, strlen(cmdtext), 255);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
format(string, sizeof(string), "COMANDA: /buygun [gunname] [ammoamount]");
return 1;
}
new ammo = strvalEx(tmp);
if(ammo < 1 || ammo > 999) { SendClientMessage(playerid, COLOR_GRAD1, "Munitia nu poate fi mai mic de 1 dar nici mai mare de 999!"); return 1; }
if (strcmp(gunid, "parachute", true, strlen(gunid)) == 0)
{
gun = 46;
guncharge = BizzData[location-99][bGunPrice]*500;
ammocharge = 0;
}
else if (strcmp(gunid, "sdpistol", true, strlen(gunid)) == 0)
{
gun = 23; guncharge = BizzData[location-99][bGunPrice]*500/100; ammocharge = BizzData[location-99][bGunPrice]*25/100*ammo;
P_DATA[playerid][pGun2] = 23; P_DATA[playerid][pAmmo2] = ammo;
}
else if (strcmp(gunid, "deagle", true, strlen(gunid)) == 0)
{
gun = 24; guncharge = BizzData[location-99][bGunPrice]*3000/100; ammocharge = BizzData[location-99][bGunPrice]*25/100*ammo;
P_DATA[playerid][pGun2] = 24; P_DATA[playerid][pAmmo2] = ammo;
}
else if (strcmp(gunid, "mp5", true, strlen(gunid)) == 0)
{
gun = 29; guncharge = BizzData[location-99][bGunPrice]*2500/100; ammocharge = BizzData[location-99][bGunPrice]*25/100*ammo;
P_DATA[playerid][pGun3] = 29; P_DATA[playerid][pAmmo3] = ammo;
}
else if (strcmp(gunid, "shotgun", true, strlen(gunid)) == 0)
{
gun = 25; guncharge = BizzData[location-99][bGunPrice]*3000/100; ammocharge = BizzData[location-99][bGunPrice]*40/100*ammo;
P_DATA[playerid][pGun3] = 25; P_DATA[playerid][pAmmo3] = ammo;
}
else if (strcmp(gunid, "ak47", true, strlen(gunid)) == 0)
{
gun = 30; guncharge = BizzData[location-99][bGunPrice]*5000/100; ammocharge = BizzData[location-99][bGunPrice]*40/100*ammo;
P_DATA[playerid][pGun4] = 30; P_DATA[playerid][pAmmo4] = ammo;
}
else if (strcmp(gunid, "m4", true, strlen(gunid)) == 0)
{
gun = 31; guncharge = BizzData[location-99][bGunPrice]*5000/100; ammocharge = BizzData[location-99][bGunPrice]*40/100*ammo;
P_DATA[playerid][pGun4] = 31; P_DATA[playerid][pAmmo4] = ammo;
}
else if (strcmp(gunid, "rifle", true, strlen(gunid)) == 0)
{
gun = 33; guncharge = BizzData[location-99][bGunPrice]*1000/100; ammocharge = BizzData[location-99][bGunPrice]*50/100*ammo;
P_DATA[playerid][pGun4] = 33; P_DATA[playerid][pAmmo4] = ammo;
}
else
{
SendClientMessage(playerid, COLOR_GRAD6, "ShopKeeper spune: Nu am auzit niciodata de aceasta arma.");
return 1;
}
if((guncharge+ammocharge) > GetPlayerCash(playerid))
{
format(infostring, 256, "Nu ai %d$ !",guncharge+ammocharge);
SendClientMessage(playerid, COLOR_GRAD3, infostring);
return 1;
}
if(GetPlayerCash(playerid) < (guncharge+ammocharge))
{
SendClientMessage(playerid, COLOR_GRAD1, "Can't afford that !");
return 1;
}
new payout = guncharge + ammocharge;
format(infostring, 256, "Tocmai ai cumparat un %s cu %d gloante, pentru $%d",gunid,ammo,payout);
SendClientMessage(playerid, COLOR_GRAD3, infostring);
GivePlayerCash(playerid, - payout);
//hackmoney[playerid] = hackmoney[playerid] - payout;
if(payout > 4999 && payout < 50000)
{
ConsumingMoney[playerid] = 2;
}
else if(payout > 49999 && payout < 5000000)
{
ConsumingMoney[playerid] = 3;
}
BizzData[location-99][bTill] += payout;
// ExtortionBiz(location-99, payout);
BizzData[location-99][bProducts]--;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
GivePlayerWeapon(playerid, gun, ammo);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s a cumparat arme pentru $%s la bizul %d", sendername, FormatNumber(payout), location-99);
printf("%s", string);
GunLog(string);
//UpdateWeapons(playerid);
}
else
{
SendClientMessage(playerid, COLOR_WHITE,"Nu esti intr-un magazin de arme.");
return 1;
}
}
return 1;
}