pawn Код:
if(dialogid==WEAPONDEALER_DIALOG) {
if(response) {
ShowPlayerDialog(playerid,WEAPONDEALER_DIALOG,2,"Weapon Dealers List","Silenced 9mm\t\t $2500\nTec9\t\t\t $1000\nS/O Shotgun\t\t $3500\nSniper Rifle\t\t $15000\nAK47\t\t\t $8000\nArmour\t\t\t $500\n3 Blocks Of C4\t\t $3500\nParachute\t\t $10000\nM4\t\t\t $1000\nRifle\t\t\t $7000\nDesert Eagle\t\t $5000","Buy","Cancel");
new workername[24];
new playername[24];
new giveplayerid;
GetPlayerName(playerid,workername, 24);
GetPlayerName(giveplayerid, playername, 24);
if(listitem==0) {
if(GetPlayerMoney(giveplayerid) <= 2499) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(szstring, sizeof(szstring), "You cannot afford a Silenced 9mm for $2500");
SendClientMessage(giveplayerid, COLOR_ERROR, szstring);
return 1;
}
GivePlayerWeapon(giveplayerid,23,100);
GivePlayerMoney(giveplayerid, -2500);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(szstring, sizeof(szstring), "You have bought a Silenced 9mm weapon with 100 Ammo for $2500");
SendClientMessage(giveplayerid, 0x00C7FFAA, szstring);
}
if(listitem==1) {
if(GetPlayerMoney(giveplayerid) <= 999) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(szstring, sizeof(szstring), "You cannot afford a Tec9 for $1000");
SendClientMessage(giveplayerid, COLOR_ERROR, szstring);
SendClientMessage(playerid, COLOR_ERROR, szstring);
return 1;
}
GivePlayerWeapon(giveplayerid,32,500);
GivePlayerMoney(giveplayerid, -1000);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(szstring, sizeof(szstring), "You have bought a Tec9 weapon with 500 Ammo for $1000");
SendClientMessage(giveplayerid, 0x00C7FFAA, szstring);
}
if(listitem==2) {
if(GetPlayerMoney(giveplayerid) <= 3499) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(szstring, sizeof(szstring), "You cannot afford a Sawnoff Shotgun for $3500");
SendClientMessage(giveplayerid, COLOR_ERROR, szstring);
return 1;
}
GivePlayerWeapon(giveplayerid,26,30);
GivePlayerMoney(giveplayerid, -3500);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(szstring, sizeof(szstring), "You have bought a Sawnoff Shotgun weapon with 30 Ammo for $3500");
SendClientMessage(giveplayerid, 0x00C7FFAA, szstring);
}
if(listitem==3) {
if(GetPlayerMoney(giveplayerid) <= 14999) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(szstring, sizeof(szstring), "You cannot afford a Sniper Rifle for $15000");
SendClientMessage(giveplayerid, COLOR_ERROR, szstring);
return 1;
}
GivePlayerWeapon(giveplayerid,34,30);
GivePlayerMoney(giveplayerid, -15000);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(szstring, sizeof(szstring), "You have bought a Sniper Rifle weapon with 30 Ammo for $15000");
SendClientMessage(giveplayerid, 0x00C7FFAA, szstring);
}
if(listitem==4) {
if(GetPlayerMoney(giveplayerid) <= 7999) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(szstring, sizeof(szstring), "You cannot afford a AK47 for $8000");
SendClientMessage(giveplayerid, COLOR_ERROR, szstring);
return 1;
}
GivePlayerWeapon(giveplayerid,30,200);
GivePlayerMoney(giveplayerid, -8000);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(szstring, sizeof(szstring), "You have bought a AK47 with 200 Ammo for $8000");
SendClientMessage(giveplayerid, 0x00C7FFAA, szstring);
}
if(listitem==5) {
if(GetPlayerMoney(giveplayerid) <= 499) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(szstring, sizeof(szstring), "You cannot afford Armor for $500");
SendClientMessage(giveplayerid, COLOR_ERROR, szstring);
return 1;
}
SetPlayerArmour(giveplayerid, 100);
GivePlayerMoney(giveplayerid, -500);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(szstring, sizeof(szstring), "You have bought Armor for $500");
SendClientMessage(giveplayerid, 0x00C7FFAA, szstring);
}
if(listitem==6) {
if(GetPlayerMoney(giveplayerid) <= 3499) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(szstring, sizeof(szstring), "You cannot afford 3 Blocks of C4 for $3500");
SendClientMessage(giveplayerid, COLOR_ERROR, szstring);
return 1;
}
if(HasC4[giveplayerid] == 1) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(szstring, sizeof(szstring), "You already have enough C4");
SendClientMessage(giveplayerid, COLOR_ERROR, szstring);
return 1;
}
HasC4[giveplayerid] =1;
GivePlayerMoney(giveplayerid, -3500);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(szstring, sizeof(szstring), "You have bought 3 Blocks of C4 for $3500");
SendClientMessage(giveplayerid, 0x00C7FFAA, szstring);
}
if(listitem==7) {
if(GetPlayerMoney(giveplayerid) <= 9999) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(szstring, sizeof(szstring), "You cannot afford a Parachute for $10000");
SendClientMessage(giveplayerid, COLOR_ERROR, szstring);
return 1;
}
GivePlayerWeapon(giveplayerid, 46, 500);
GivePlayerMoney(giveplayerid, -10000);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(szstring, sizeof(szstring), "You have bought A Parachute for $10000");
SendClientMessage(giveplayerid, 0x00C7FFAA, szstring);
}
if(listitem==8) {
if(GetPlayerMoney(giveplayerid) <= 999) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(szstring, sizeof(szstring), "You cannot afford a M4 for $1000");
SendClientMessage(giveplayerid, COLOR_ERROR, szstring);
return 1;
}
GivePlayerWeapon(giveplayerid, 31, 50);
GivePlayerMoney(giveplayerid, -1000);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(szstring, sizeof(szstring), "You have bought a M4 for $1000");
SendClientMessage(giveplayerid, 0x00C7FFAA, szstring);
}
if(listitem==9) {
if(GetPlayerMoney(giveplayerid) <= 6999) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(szstring, sizeof(szstring), "You cannot afford a Rifle for $7000");
SendClientMessage(giveplayerid, COLOR_ERROR, szstring);
return 1;
}
GivePlayerWeapon(giveplayerid, 33, 50);
GivePlayerMoney(giveplayerid, -7000);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(szstring, sizeof(szstring), "You have bought A Rifle for $7000");
SendClientMessage(giveplayerid, 0x00C7FFAA, szstring);
}
if(listitem==10) {
if(GetPlayerMoney(giveplayerid) <= 4999) {
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Sale Failed_|");
format(szstring, sizeof(szstring), "You cannot afford a Desert Eagle for $5000");
SendClientMessage(giveplayerid, COLOR_ERROR, szstring);
return 1;
}
GivePlayerWeapon(giveplayerid, 24, 50);
GivePlayerMoney(giveplayerid, -10000);
SendClientMessage(giveplayerid, 0xA9A9A9AA, "|_Weapon Purchased_|");
format(szstring, sizeof(szstring), "You have bought A Desert Eagle for $5000");
SendClientMessage(giveplayerid, 0x00C7FFAA, szstring);
}
}
}