// ===========================================================================
// ============Advanced Pawn Shop by Aerotactics=============================
// =========================================================================
//
#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
//===========================================
#define Pawn_Open 753
#define Pawn_Menu 754
#define Pawn_Help1 755
#define Pawn_Help2 756
#define Pawn_Help3 757
#define Pawn_Help4 758
#define Pawn_Help5 759
#define Pawn_Don 760
#define Pawn_IGun 761
#define Pawn_Buy1 762
#define Pawn_Buy2 763
#define Pawn_Buy3 764
#define Pawn_Buy4 765
#define Pawn_Buy5 766
#define Pawn_Hand 767
#define Pawn_AYS1 768
#define Pawn_Trd1 769
#define Pawn_Trd2 770
#define Pawn_Trd3 771
#define Pawn_Trd4 772
#define Pawn_Trd5 773
#define Pawn_Trd6 774
#define Pawn_Trd7 775
#define Pawn_Trd9 776
#define Pawn_Sell 777
#define Pawn_Offer 778
#define Pawn_NSell 779
#define Pawn_Pawn 780
#define Pawn_POffer 781
#define Pawn_NPawn 782
#define Pawn_Pawn2 783
#define Pawn_Ammo 784
#define Pawn_NAmmo 785
//===========================================
new store = 0;
new Offer[MAX_PLAYERS];
new PawnOffer[MAX_PLAYERS];
new PawnedItem[MAX_PLAYERS];
new Ammo[MAX_PLAYERS];
new TIMER_SellWait[MAX_PLAYERS];
new TIMER_Pawn[MAX_PLAYERS];
new bool:CanSell[MAX_PLAYERS];
//===========================================
//Credit to a man named Michael (failed to record full name, sorry)
stock RemovePlayerWeapon(playerid, weaponid)
{
new pWeaponData[13][2];
for (new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, pWeaponData[i][0], pWeaponData[i][1]);
}
ResetPlayerWeapons(playerid);
for(new i=0; i<13; i++)
{
if(pWeaponData[i][0] != 0 && pWeaponData[i][0] != weaponid)
{
GivePlayerWeapon(playerid, pWeaponData[i][0], pWeaponData[i][1]);
}
}
return 0;
}
//===========================================
CMD:pawn(playerid,params[])
{
TogglePlayerControllable(playerid, false);
if (PawnedItem[playerid] == -1) return ShowPlayerDialog(playerid, Pawn_Open, DIALOG_STYLE_MSGBOX, "{DCB700}Pawn Shop * by Aerotactics", "{FFFFFF}Welcome to the Pawn Shop, how can I help you today?", "Continue", "Leave");
else return ShowPlayerDialog(playerid, Pawn_NPawn, DIALOG_STYLE_MSGBOX, "{DCB700}You have a pawned item!", "{FFFFFF}The owner knows you have a pawned item\nand won't do business until it's paid off. Pay it off now?", "Pay", "Leave");
}
/*CMD:test(playerid, params[])
{
for(new i=0; i<13;i++)
{
new weap, ammo, str[128];
GetPlayerWeaponData(playerid, i, weap, ammo);
format(str,sizeof(str),"S:%i W:%i A:%i", i, weap, ammo);
SendClientMessage(playerid, -1, str);
}
return 1;
}*/
forward StoreSwitch();
public StoreSwitch()
{
store = random(5);
return 1;
}
forward SellWait(playerid);
public SellWait(playerid)
{
CanSell[playerid] = true;
KillTimer(TIMER_SellWait[playerid]);
return 1;
}
forward Pawn(playerid);
public Pawn(playerid)
{
PawnedItem[playerid] = -1;
KillTimer(TIMER_Pawn[playerid]);
return 1;
}
public OnGameModeInit()
{
SetTimer("StoreSwitch", 3600000, true);
for(new i=0;i<MAX_PLAYERS;i++){Offer[i] = 0;}
for(new i=0;i<MAX_PLAYERS;i++){PawnOffer[i] = 0;}
for(new i=0;i<MAX_PLAYERS;i++){CanSell[i] = true;}
for(new i=0;i<MAX_PLAYERS;i++){PawnedItem[i] = -1;}
for(new i=0;i<MAX_PLAYERS;i++){Ammo[i] = 0;}
return 1;
}
public OnPlayerDisconnect(playerid)
{
Offer[playerid] = 0;
PawnOffer[playerid] = 0;
PawnedItem[playerid] = -1;
Ammo[playerid] = 0;
KillTimer(TIMER_Pawn[playerid]);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new MenuText[512];
MenuText = "{FFFFFF}Sell this item I'm holding\nTrade this item for a new item\nPawn this item\nDonate this item\nBrowse what's for sale\nHelp and Info\nIllegal Items";
new Header[128];
Header = "{DCB700}Pawn Shop Script * by Aerotactics";
new Header2[128];
Header2 = "{DCB700}What would you like to do?";
if(dialogid==Pawn_Open && response)
{
ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
return 1;
}
if(dialogid==Pawn_Menu)
{
if(response)
{
switch(listitem)
{
case 0:
{
if(CanSell[playerid] == true)
{
new str[128], gun;
new weap = GetPlayerWeapon(playerid);
new add = random(21);
switch(weap)
{
case 0: return ShowPlayerDialog(playerid, Pawn_Hand, DIALOG_STYLE_MSGBOX,"{DCB700}Crack Addict","{FFFFFF}You can't sell your own hands.","Continue","");
case 1,4: gun = 215;
case 2,3,5,7,8,14,15: gun = 45;
case 22,23,24: gun = 300;
case 25,26,27: gun = 415;
case 28,29,32: gun = 555;
case 30,31: gun = 1230;
case 33,34: gun = 1565;
case 43,46: gun = 250;
default: return ShowPlayerDialog(playerid, Pawn_Trd9, DIALOG_STYLE_MSGBOX,"{DCB700}Illegal Items","{FFFFFF}This item is unacceptable to sell to the shop.\nA list of illegal items can be found in the main menu.","Continue","");
}
Offer[playerid] = gun + add;
format(str,sizeof(str),"{DCB700} $%i", Offer[playerid]);
ShowPlayerDialog(playerid, Pawn_Sell, DIALOG_STYLE_MSGBOX,"{FFFFFF}The buying offer is...", str, "Accept", "Reject");
}
else ShowPlayerDialog(playerid, Pawn_NSell, DIALOG_STYLE_MSGBOX, "{DCB700}Selling your item...","{FFFFFF}You must wait a while before selling or asking for an offer again.\nPawn Shop owners aren't rich, you know.","Continue","");
}
case 1:
{
new tw=GetPlayerWeapon(playerid);
switch(tw)
{
case 0: ShowPlayerDialog(playerid, Pawn_Hand, DIALOG_STYLE_MSGBOX,"{DCB700}Crack Addict","{FFFFFF}You can't sell your own hands.","Continue","");
case 1,4: ShowPlayerDialog(playerid, Pawn_Trd1, DIALOG_STYLE_LIST, "{DCB700}Trade for...","{FFFFFF}Brass Knuckles\nKnife", "Trade", "Leave");
case 2,3,5,7,8,14,15: ShowPlayerDialog(playerid, Pawn_Trd2, DIALOG_STYLE_LIST, "{DCB700}Trade for...","{FFFFFF}Golf Club\nNightstick\nBaseball Bat\nPool Cue\nKatana\nFlowers\nCane", "Trade", "Leave");
case 22,23,24: ShowPlayerDialog(playerid, Pawn_Trd3, DIALOG_STYLE_LIST, "{DCB700}Trade for...","{FFFFFF}9mm\nSilence 9mm\nDesert Eagle", "Trade", "Leave");
case 25,26,27: ShowPlayerDialog(playerid, Pawn_Trd4, DIALOG_STYLE_LIST, "{DCB700}Trade for...","{FFFFFF}Shotgun\nSawnoff Shotgun\nCombat Shotgun", "Trade", "Leave");
case 28,29,32: ShowPlayerDialog(playerid, Pawn_Trd5, DIALOG_STYLE_LIST, "{DCB700}Trade for...","{FFFFFF}Micro SMG\nMP5\nTec-9", "Trade", "Leave");
case 30,31: ShowPlayerDialog(playerid, Pawn_Trd6, DIALOG_STYLE_LIST, "{DCB700}Trade for...","{FFFFFF}AK-47\nM4", "Continue", "Leave");
case 33,34: ShowPlayerDialog(playerid, Pawn_Trd7, DIALOG_STYLE_LIST, "{DCB700}Trade for...","{FFFFFF}Country Rifle\nSniper Rifle", "Continue", "Leave");
default: ShowPlayerDialog(playerid, Pawn_Trd9, DIALOG_STYLE_MSGBOX,"{DCB700}Illegal Items","{FFFFFF}This item is unacceptable to trade at the shop.\nCameras and Parachutes are of unequal value and type and can't be traded.\nA list of illegal items can be found in the main menu.","Continue","");
}
}
case 2:
{
new str[128], gun;
new weap = GetPlayerWeapon(playerid);
new add = random(21);
switch(weap)
{
case 0: return ShowPlayerDialog(playerid, Pawn_Hand, DIALOG_STYLE_MSGBOX,"{DCB700}Crack Addict","{FFFFFF}You can't sell your own hands.","Continue","");
case 1,4: gun = 115;
case 2,3,5,7,8,14,15: gun = 25;
case 22,23,24: gun = 145;
case 25,26,27: gun = 235;
case 28,29,32: gun = 225;
case 30,31: gun = 610;
case 33,34: gun = 750;
case 43,46: gun = 135;
default: return ShowPlayerDialog(playerid, Pawn_Trd9, DIALOG_STYLE_MSGBOX,"{DCB700}Illegal Items","{FFFFFF}This item is unacceptable to sell to the shop.\nA list of illegal items can be found in the main menu.","Continue","");
}
PawnOffer[playerid] = gun + add;
format(str,sizeof(str),"{DCB700} $%i", PawnOffer[playerid]);
ShowPlayerDialog(playerid, Pawn_Pawn, DIALOG_STYLE_MSGBOX,"{FFFFFF}The pawn offer is...", str, "Accept", "Reject");
}
case 3: ShowPlayerDialog(playerid, Pawn_AYS1, DIALOG_STYLE_MSGBOX, "{DCB700}Donating your item...","{FFFFFF}Are you sure you want to donate this item?","Yes","No");
case 4:
{
switch(store)
{
case 0: ShowPlayerDialog(playerid, Pawn_Buy1, DIALOG_STYLE_LIST, "{DCB700}What would you like to purchase?","{FFFFFF}Cane ($200)\nSawn-off Shotgun ($1850)\nSniper Rifle ($2550)\nCamera ($650)\nAmmunition", "Purchase", "Leave");
case 1: ShowPlayerDialog(playerid, Pawn_Buy2, DIALOG_STYLE_LIST, "{DCB700}What would you like to purchase?","{FFFFFF}Pool Cue ($150)\nCountry Rifle ($950)\nSilenced 9mm ($1100)\nNightstick ($500)\nAmmunition", "Purchase", "Leave");
case 2: ShowPlayerDialog(playerid, Pawn_Buy3, DIALOG_STYLE_LIST, "{DCB700}What would you like to purchase?","{FFFFFF}Katana ($350)\nTec-9 ($1450)\nDesert Eagle ($1350)\nM4 ($4500)\nAmmunition", "Purchase", "Leave");
case 3: ShowPlayerDialog(playerid, Pawn_Buy4, DIALOG_STYLE_LIST, "{DCB700}What would you like to purchase?","{FFFFFF}MP5 ($1650)\n9mm ($1000)\nFlowers ($100)\nParachute ($1250)\nAmmunition", "Purchase", "Leave");
case 4: ShowPlayerDialog(playerid, Pawn_Buy5, DIALOG_STYLE_MSGBOX, "{DCB700}Inventory is empty...","{FFFFFF}There is nothing for sale right now, please come back after later.","Continue", "Leave");
}
}
case 5: ShowPlayerDialog(playerid, Pawn_Help1, DIALOG_STYLE_MSGBOX, Header, "{FFFFFF}A pawn shop can be used to sell, trade, and pawn items for money.\nYou may also browse the items for sale, or just donate your item to the store.\nBuying an item will replace an already owned item of the same type,\nbut you will keep your ammunition.", "Continue", "");
case 6: ShowPlayerDialog(playerid, Pawn_IGun, DIALOG_STYLE_MSGBOX,"{DCB700}Illegal Items","{FFFFFF}These Items are not allowed to be sold to, nor sold from the Pawn Shop:\nShovel\nAll grenades\nAll dildos\nRPG\nRocket Launcher\nFlame Thrower\nMinigun\nSatchel Charge\nSpraycan\nFire Extinguisher\nGoggles","Continue","");
}
}
else TogglePlayerControllable(playerid, true);
}
if(dialogid==Pawn_Help1 && response) return ShowPlayerDialog(playerid, Pawn_Help2, DIALOG_STYLE_MSGBOX, Header,"{FFD700}Selling Items\n{FFFFFF}If you have an item that you just don't want anymore, you can get money for it by\nselling it along with the ammo. The price for the item will be determined by the\nshop owner.", "Continue","");
if(dialogid==Pawn_Help2 && response) return ShowPlayerDialog(playerid, Pawn_Help3, DIALOG_STYLE_MSGBOX, Header,"{FFD700}Trading Items\n{FFFFFF}If you want to keep an item, but perhaps you want a better one, or a different one,\nyou can trade your item for one of the same type or style. Each trade will cost $1000\nto cover the cost from your previous item being\nin 'used' condition.", "Continue","");
if(dialogid==Pawn_Help3 && response) return ShowPlayerDialog(playerid, Pawn_Help4, DIALOG_STYLE_MSGBOX, Header,"{FFD700}Pawning Items\n{FFFFFF}In this case, you have an item that want to keep, \nbut need some money to pay for something else. Consider this a loan, \nand the item is collateral. The shop gives you money, and takes your weapon.","Continue","");
if(dialogid==Pawn_Help4 && response) return ShowPlayerDialog(playerid, Pawn_Help5, DIALOG_STYLE_MSGBOX, Header,"{FFD700}Pawning Items (Continued)\n{FFFFFF}If you come back to the shop within sixty (60) real-life minutes,\nyou can buy back your weapon and ammunition, but if you don't have\nthe money in time, you lose your weapon and can't get it back.\nSelling your item is more profitable than pawning it.","Continue","");
if((dialogid==Pawn_Help5 || dialogid == Pawn_IGun || dialogid==Pawn_Don || dialogid == Pawn_Buy5 || dialogid == Pawn_Hand || dialogid == Pawn_NSell) && response) return ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
if((dialogid==Pawn_Buy4 || dialogid==Pawn_Buy3 || dialogid==Pawn_Buy2 || dialogid==Pawn_Buy1 || dialogid==Pawn_AYS1) && !response) return ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
if((dialogid == Pawn_Trd9 || dialogid == Pawn_Trd7 || dialogid == Pawn_Trd6 || dialogid == Pawn_Trd5 || dialogid == Pawn_Trd4 || dialogid == Pawn_Trd3 || dialogid == Pawn_Trd2 || dialogid == Pawn_Trd1) && !response) return ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
if(dialogid==Pawn_AYS1)
{
if(response)
{
new rw = GetPlayerWeapon(playerid);
if (rw==0) return ShowPlayerDialog(playerid, Pawn_Hand, DIALOG_STYLE_MSGBOX,"{DCB700}It's got fingerprints all over it.","{FFFFFF}You can't donate your own hands.","Continue","");
else
{
RemovePlayerWeapon(playerid,rw);
ShowPlayerDialog(playerid, Pawn_Don, DIALOG_STYLE_MSGBOX,"{DCB700}Thank you for donating","{FFFFFF}You have donated your weapon.","Continue","");
return 1;
}
}
}
if((dialogid == Pawn_Buy1 ))
if(dialogid==Pawn_Buy1 && response)
{
switch(listitem)
{
case 0:
{
if (GetPlayerMoney(playerid)<200) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 10, weap, ammo);
if(weap==15) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -200);
GivePlayerWeapon(playerid, 15, 1);
}
}
}
case 1:
{
if (GetPlayerMoney(playerid)<1850) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 3, weap, ammo);
if(weap==26) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -1850);
if(ammo == 0) {ammo = 1;}
GivePlayerWeapon(playerid, 26, ammo);
}
}
}
case 2:
{
if (GetPlayerMoney(playerid)<2550) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 6, weap, ammo);
if(weap==34) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -2550);
if(ammo == 0) {ammo = 1;}
GivePlayerWeapon(playerid, 34, ammo);
}
}
}
case 3:
{
if (GetPlayerMoney(playerid)<650) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 9, weap, ammo);
if(weap==43) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -650);
GivePlayerWeapon(playerid, 43, 1);
}
}
}
case 4: return ShowPlayerDialog(playerid, Pawn_Ammo, DIALOG_STYLE_LIST, "{DCB700}Ammunition Boxes", "{FFFFFF}Pistol x 20 ($250)\nShotgun x 12 ($300)\nSMG x 50 ($550)\nAssault Rifle x 100 ($1300)\nHunting Rifle x 6 ($1550)\nCamera Film (50 pictures) ($25)", "Purchase", "Leave");
}
ShowPlayerDialog(playerid, Pawn_Buy1, DIALOG_STYLE_LIST, "{DCB700}What would you like to purchase?","{FFFFFF}Cane ($200)\nSawn-off Shotgun ($1850)\nSniper Rifle ($2550)\nCamera ($650)\nAmmunition", "Purchase", "Leave");
}
if(dialogid==Pawn_Buy2 && response)
{
switch(listitem)
{
case 0:
{
if (GetPlayerMoney(playerid)<150) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 1, weap, ammo);
if(weap==7) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -150);
GivePlayerWeapon(playerid, 7, 1);
}
}
}
case 1:
{
if (GetPlayerMoney(playerid)<950) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 6, weap, ammo);
if(weap==33) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -950);
if(ammo == 0) {ammo = 1;}
GivePlayerWeapon(playerid, 33, ammo);
}
}
}
case 2:
{
if (GetPlayerMoney(playerid)<1100) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 2, weap, ammo);
if(weap==23) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -1100);
if(ammo == 0) {ammo = 1;}
GivePlayerWeapon(playerid, 23, ammo);
}
}
}
case 3:
{
if (GetPlayerMoney(playerid)<500) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 1, weap, ammo);
if(weap==3) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -500);
GivePlayerWeapon(playerid, 3, 1);
}
}
}
case 4: return ShowPlayerDialog(playerid, Pawn_Ammo, DIALOG_STYLE_LIST, "{DCB700}Ammunition Boxes", "{FFFFFF}Pistol x 20 ($250)\nShotgun x 12 ($300)\nSMG x 50 ($550)\nAssault Rifle x 100 ($1300)\nHunting Rifle x 6 ($1550)\nCamera Film (50 pictures) ($25)", "Purchase", "Leave");
}
ShowPlayerDialog(playerid, Pawn_Buy2, DIALOG_STYLE_LIST, "{DCB700}What would you like to purchase?","{FFFFFF}Pool Cue ($150)\nCountry Rifle ($950)\nSilenced 9mm ($1100)\nNightstick ($500)\nAmmunition", "Purchase", "Leave");
}
if(dialogid==Pawn_Buy3 && response)
{
switch(listitem)
{
case 0:
{
if (GetPlayerMoney(playerid)<350) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 1, weap, ammo);
if(weap==8) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -350);
GivePlayerWeapon(playerid, 8, 1);
}
}
}
case 1:
{
if (GetPlayerMoney(playerid)<1450) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 4, weap, ammo);
if(weap==32) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -1450);
if(ammo == 0) {ammo = 1;}
GivePlayerWeapon(playerid, 32, ammo);
}
}
}
case 2:
{
if (GetPlayerMoney(playerid)<1350) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 2, weap, ammo);
if(weap==24) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -1350);
if(ammo == 0) {ammo = 1;}
GivePlayerWeapon(playerid, 24, ammo);
}
}
}
case 3:
{
if (GetPlayerMoney(playerid)<4500) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 5, weap, ammo);
if(weap==31) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -4500);
if(ammo == 0) {ammo = 1;}
GivePlayerWeapon(playerid, 31, ammo);
}
}
}
case 4: return ShowPlayerDialog(playerid, Pawn_Ammo, DIALOG_STYLE_LIST, "{DCB700}Ammunition Boxes", "{FFFFFF}Pistol x 20 ($250)\nShotgun x 12 ($300)\nSMG x 50 ($550)\nAssault Rifle x 100 ($1300)\nHunting Rifle x 6 ($1550)\nCamera Film (50 pictures) ($25)", "Purchase", "Leave");
}
ShowPlayerDialog(playerid, Pawn_Buy3, DIALOG_STYLE_LIST, "{DCB700}What would you like to purchase?","{FFFFFF}Katana ($350)\nTec-9 ($1450)\nDesert Eagle ($1350)\nM4 ($4500)\nAmmunition", "Purchase", "Leave");
}
if(dialogid==Pawn_Buy4 && response)
{
switch(listitem)
{
case 0:
{
if (GetPlayerMoney(playerid)<1650) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 4, weap, ammo);
if(weap==29) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -1650);
if(ammo == 0) {ammo = 1;}
GivePlayerWeapon(playerid, 29, ammo);
}
}
}
case 1:
{
if (GetPlayerMoney(playerid)<1000) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 2, weap, ammo);
if(weap==22) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -1000);
if(ammo == 0) {ammo = 1;}
GivePlayerWeapon(playerid, 22, ammo);
}
}
}
case 2:
{
if (GetPlayerMoney(playerid)<100) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 10, weap, ammo);
if(weap==14) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -100);
GivePlayerWeapon(playerid, 14, 1);
}
}
}
case 3:
{
if (GetPlayerMoney(playerid)<1250) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 11, weap, ammo);
if(weap==46) SendClientMessage(playerid,0xFFFFFFFF,"You already own that.");
else
{
GivePlayerMoney(playerid, -1250);
GivePlayerWeapon(playerid, 46, 1);
}
}
}
case 4: return ShowPlayerDialog(playerid, Pawn_Ammo, DIALOG_STYLE_LIST, "{DCB700}Ammunition Boxes", "{FFFFFF}Pistol x 20 ($250)\nShotgun x 12 ($300)\nSMG x 50 ($550)\nAssault Rifle x 100 ($1300)\nHunting Rifle x 6 ($1550)\nCamera Film (50 pictures) ($25)", "Purchase", "Leave");
}
ShowPlayerDialog(playerid, Pawn_Buy4, DIALOG_STYLE_LIST, "{DCB700}What would you like to purchase?","{FFFFFF}MP5 ($1650)\n9mm ($1000)\nFlowers ($100)\nParachute ($1250)\nAmmunition", "Purchase", "Leave");
}
if(dialogid == Pawn_Ammo)
{
if(response)
{
switch(listitem)
{
case 0:
{
new cash = GetPlayerMoney(playerid);
if (cash<250) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 2, weap, ammo);
if(weap!=0)
{
GivePlayerMoney(playerid, -250);
GivePlayerWeapon(playerid, weap, 20);
}
else SendClientMessage(playerid,0xFFFFFFFF,"You don't own a weapon of this type.");
}
}
case 1:
{
new cash = GetPlayerMoney(playerid);
if (cash<300) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 3, weap, ammo);
if(weap!=0)
{
GivePlayerMoney(playerid, -300);
GivePlayerWeapon(playerid, weap, 12);
}
else SendClientMessage(playerid,0xFFFFFFFF,"You don't own a weapon of this type.");
}
}
case 2:
{
new cash = GetPlayerMoney(playerid);
if (cash<550) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 4, weap, ammo);
if(weap!=0)
{
GivePlayerMoney(playerid, -550);
GivePlayerWeapon(playerid, weap, 50);
}
else SendClientMessage(playerid,0xFFFFFFFF,"You don't own a weapon of this type.");
}
}
case 3:
{
new cash = GetPlayerMoney(playerid);
if (cash<1300) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 5, weap, ammo);
if(weap!=0)
{
GivePlayerMoney(playerid, -1300);
GivePlayerWeapon(playerid, weap, 100);
}
else SendClientMessage(playerid,0xFFFFFFFF,"You don't own a weapon of this type.");
}
}
case 4:
{
new cash = GetPlayerMoney(playerid);
if (cash<1550) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 6, weap, ammo);
if(weap!=0)
{
GivePlayerMoney(playerid, -1550);
GivePlayerWeapon(playerid, weap, 6);
}
else SendClientMessage(playerid,0xFFFFFFFF,"You don't own a weapon of this type.");
}
}
case 5:
{
new cash = GetPlayerMoney(playerid);
if (cash<25) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 9, weap, ammo);
if(weap==43)
{
GivePlayerMoney(playerid, -25);
GivePlayerWeapon(playerid, 43, 50);
}
else SendClientMessage(playerid,0xFFFFFFFF,"You don't own a camera.");
}
}
}
ShowPlayerDialog(playerid, Pawn_Ammo, DIALOG_STYLE_LIST, "{DCB700}Ammunition Boxes", "{FFFFFF}Pistol x 20 ($250)\nShotgun x 12 ($300)\nSMG x 50 ($550)\nAssault Rifle x 100 ($1300)\nHunting Rifle x 6 ($1550)\nCamera Film (50 pictures) ($25)", "Purchase", "Leave");
}
else ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
}
if(dialogid==Pawn_Trd1 && response)
{
new gun;
switch(listitem)
{
case 0: gun = 1;
case 1: gun = 4;
}
if (GetPlayerMoney(playerid)<1000) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 0, weap, ammo);
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, gun, ammo);
}
ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
}
if(dialogid==Pawn_Trd2 && response)
{
new gun;
switch(listitem)
{
case 0: gun = 2;
case 1: gun = 3;
case 2: gun = 5;
case 3: gun = 7;
case 4: gun = 8;
case 5: gun = 14;
case 6: gun = 15;
}
if (GetPlayerMoney(playerid)<1000) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 1, weap, ammo);
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, gun, 1);
}
ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
}
if(dialogid==Pawn_Trd3 && response)
{
new gun;
switch(listitem)
{
case 0: gun = 22;
case 1: gun = 23;
case 2: gun = 24;
}
if (GetPlayerMoney(playerid)<1000) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 2, weap, ammo);
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, gun, ammo);
}
ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
}
if(dialogid==Pawn_Trd4 && response)
{
new gun;
switch(listitem)
{
case 0: gun = 25;
case 1: gun = 26;
case 2: gun = 27;
}
if (GetPlayerMoney(playerid)<1000) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 3, weap, ammo);
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, gun, ammo);
}
ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
}
if(dialogid==Pawn_Trd5 && response)
{
new gun;
switch(listitem)
{
case 0: gun = 28;
case 1: gun = 29;
case 2: gun = 32;
}
if (GetPlayerMoney(playerid)<1000) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 4, weap, ammo);
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, gun, ammo);
}
ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
}
if(dialogid==Pawn_Trd6 && response)
{
new gun;
switch(listitem)
{
case 0: gun = 30;
case 1: gun = 31;
}
if (GetPlayerMoney(playerid)<1000) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 5, weap, ammo);
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, gun, 1);
}
ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
}
if(dialogid==Pawn_Trd7 && response)
{
new gun;
switch(listitem)
{
case 0: gun = 33;
case 1: gun = 34;
}
if (GetPlayerMoney(playerid)<1000) SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
else
{
new weap, ammo;
GetPlayerWeaponData(playerid, 6, weap, ammo);
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, gun, ammo);
}
ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
}
if(dialogid==Pawn_Sell)
{
if(response)
{
new weap = GetPlayerWeapon(playerid);
RemovePlayerWeapon(playerid, weap);
GivePlayerMoney(playerid, Offer[playerid]);
}
CanSell[playerid] = false;
TIMER_SellWait[playerid] = SetTimerEx("SellWait", 300000, false, "i", playerid);
ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
}
if(dialogid==Pawn_Pawn)
{
if(response)
{
PawnedItem[playerid] = GetPlayerWeapon(playerid);
Ammo[playerid] = GetPlayerAmmo(playerid);
RemovePlayerWeapon(playerid, PawnedItem[playerid]);
GivePlayerMoney(playerid, PawnOffer[playerid]);
TIMER_Pawn[playerid] = SetTimerEx("Pawn", 3600000, false, "i", playerid);
ShowPlayerDialog(playerid, Pawn_Pawn2, DIALOG_STYLE_MSGBOX, "{DCB700}You have pawned an item.", "{FFFFFF}Since you have pawned an item, the Pawn Shop will not\ndo business with you until you pay for your pawned item,\nor until your item has been sitting at the Pawn Shop for a week.\n(One hour in real life.)", "Leave", "");
}
else ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
}
if(dialogid==Pawn_NPawn)
{
if(response)
{
new cash = GetPlayerMoney(playerid);
if(cash < PawnOffer[playerid]) return SendClientMessage(playerid,0xFF0000FF,"You can't afford that!");
GivePlayerWeapon(playerid, PawnedItem[playerid], Ammo[playerid]);
PawnedItem[playerid] = -1;
Ammo[playerid] = 0;
GivePlayerMoney(playerid, -(PawnOffer[playerid]));
KillTimer(TIMER_Pawn[playerid]);
ShowPlayerDialog(playerid, Pawn_Menu, DIALOG_STYLE_LIST, Header2, MenuText, "Continue", "Leave");
}
else TogglePlayerControllable(playerid, true);
return 1;
}
if(dialogid==Pawn_Pawn2)
{
TogglePlayerControllable(playerid, true);
}
return 0;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
Good work, wasn't there a map at the old uncompleted version of this? I liked it.
|