14.06.2013, 09:30
Hey just added a business system to my server and everytime I type /buy its says me :
"You don't have enough money to do this."'
And I have 750k$ on cash. Something bugged ? Can u fix it please ? Ty...
"You don't have enough money to do this."'
And I have 750k$ on cash. Something bugged ? Can u fix it please ? Ty...
Код:
CMD:buy(playerid, params[]) { new idx = GetPlayerVirtualWorld(playerid)-100, string[128], type, price; if(idx > 0 && idx < MAX_BIZ && BizInfo[idx][bType] != 1 && BizInfo[idx][bType] != 2 && BizInfo[idx][bType] != 3 && BizInfo[idx][bType] != 4 && BizInfo[idx][bType] != 6 || idx < 1 || idx > MAX_BIZ) return SendClientMessage(playerid, COLOR_GREY, "You are not inside a business."); if(BizInfo[idx][bType] == 1) { if(sscanf(params, "s[32]", params)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /buy [item]"); if(BizInfo[idx][bProducts] < 1) return SendClientMessage(playerid, COLOR_GREY, "This business is currently out of products."); if(!strcmp(params, "cellphone", true)) { if(PlayerInfo[playerid][pCash] < 100) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); new randphone = random(100) + random(8999);//minimum 100 max 9999 PlayerInfo[playerid][pPnumber] = randphone; BizInfo[idx][bMoney] += 100; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; GivePlayerCash(playerid, -100); format(string, sizeof(string), "* %s has bought a cellphone for $100.", RPN(playerid)); SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SendClientMessage(playerid, COLOR_WHITE, " (( Check /stats to check your new Phone Number ))"); } if(!strcmp(params, "phonebook", true)) { if(PlayerInfo[playerid][pCash] < 50) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); PlayerInfo[playerid][pPhoneBook] = 1; BizInfo[idx][bMoney] += 50; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; GivePlayerCash(playerid, -50); format(string, sizeof(string), "* %s has bought an electronic phonebook for $50.", RPN(playerid)); SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SendClientMessage(playerid, COLOR_WHITE, " You can use /phonebook to find someone's number."); } if(!strcmp(params, "dice", true)) { if(PlayerInfo[playerid][pCash] < 20) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); PlayerInfo[playerid][pDice] = 1; BizInfo[idx][bMoney] += 20; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; GivePlayerCash(playerid, -20); format(string, sizeof(string), "* %s has bought a pair of special dice for $20.", RPN(playerid)); SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SendClientMessage(playerid, COLOR_WHITE, " You can use /rolldice to roll a dice."); } if(!strcmp(params, "cigar", true)) { if(PlayerInfo[playerid][pCash] < 100) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); PlayerInfo[playerid][pCigar] = 5; BizInfo[idx][bMoney] += 100; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; GivePlayerCash(playerid, -100); format(string, sizeof(string), "* %s has bought 5 cuban cigars for $100.", RPN(playerid)); SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SendClientMessage(playerid, COLOR_WHITE, " You can use /use to smoke a cigar."); } if(!strcmp(params, "sprunk", true)) { if(PlayerInfo[playerid][pCash] < 30) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); PlayerInfo[playerid][pSprunk] = 5; BizInfo[idx][bMoney] += 30; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; GivePlayerCash(playerid, -30); format(string, sizeof(string), "* %s has bought 5 redbull cans for $30.", RPN(playerid)); SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SendClientMessage(playerid, COLOR_WHITE, " You can use /sprunk to drink a sprunk can."); } if(!strcmp(params, "spraycan", true)) { if(PlayerInfo[playerid][pCash] < 100) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); PlayerInfo[playerid][pSpraycan] = 10; BizInfo[idx][bMoney] += 100; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; GivePlayerCash(playerid, -100); format(string, sizeof(string), "* %s has bought a duko spraycan $100.", RPN(playerid)); SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SendClientMessage(playerid, COLOR_WHITE, " You can use /colorcar & /paintcar to color/paint a car."); } if(!strcmp(params, "rope", true)) { if(PlayerInfo[playerid][pCash] < 60) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); PlayerInfo[playerid][pRope] = 5; BizInfo[idx][bMoney] += 60; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; GivePlayerCash(playerid, -60); format(string, sizeof(string), "* %s has bought 5 strong ropes for $60.", RPN(playerid)); SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SendClientMessage(playerid, COLOR_WHITE, " You can use /tie to tie someone."); } if(!strcmp(params, "walkietalkie", true)) { if(PlayerInfo[playerid][pCash] < 200) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); PlayerInfo[playerid][pRadio] = 1; PlayerInfo[playerid][pRadioFreq] = 1; BizInfo[idx][bMoney] += 200; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; GivePlayerCash(playerid, -200); format(string, sizeof(string), "* %s has bought a WalkieTalkie for $200.", RPN(playerid)); SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SendClientMessage(playerid, COLOR_WHITE, " You can use /setfreq to adjust the WalkieTalkie's channel, /pr to talk on it."); } // Level 4: Camera | Gas if(!strcmp(params, "camera", true)) { if(PlayerInfo[playerid][pCash] < 300) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); GivePlayerValidWeapon(playerid, 43, 999999); BizInfo[idx][bMoney] += 300; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; GivePlayerCash(playerid, -300); format(string, sizeof(string), "* %s has bought a professional camera for $300.", RPN(playerid)); SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SendClientMessage(playerid, COLOR_WHITE, " You can start taking photos using your camera."); } if(!strcmp(params, "gascan", true)) { if(PlayerInfo[playerid][pCash] < 100) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); PlayerInfo[playerid][pFuelcan] = 1; BizInfo[idx][bMoney] += 100; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; GivePlayerCash(playerid, -100); format(string, sizeof(string), "* %s has bought a gas can for $100.", RPN(playerid)); SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SendClientMessage(playerid, COLOR_WHITE, " You can use /gascan inside a vehicle anywhere now."); } // Level 5: Radio /*if(!strcmp(params, "radio", true)) { if(BizInfo[idx][bLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "This 24/7 Market doesn't have this product yet."); if(PlayerInfo[playerid][pCash] < 600) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); PlayerInfo[playerid][pRadio] = 1; BizInfo[idx][bMoney] += 600; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; GivePlayerCash(playerid, -600); format(string, sizeof(string), "* %s has bought a radio for $600.", RPN(playerid)); SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); SendClientMessage(playerid, COLOR_WHITE, " You can use /music to play music using your radio."); }*/ } else if(BizInfo[idx][bType] == 3) { if(sscanf(params, "i", type)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /buy [type]"); if(BizInfo[idx][bProducts] < 1) return SendClientMessage(playerid, COLOR_GREY, "This business is currently out of products."); if(type == 1) price = 400; else if(type == 2) price = 2000; else if(type == 3) price = 800; else if(type == 4) price = 1200; else if(type == 5) price = 2200; else if(type == 6) price = 1000; else if(type == 7) price = 5000; if(type < 1 || type > 7) return SendClientMessage(playerid, COLOR_GREY, "Products are between 1 and 7"); if(PlayerInfo[playerid][pCash] < price) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); switch(type) { case 1: { if(GetPlayerWeapon(playerid) != 25 && GetPlayerWeapon(playerid) != 26 && GetPlayerWeapon(playerid) != 27) return SendClientMessage(playerid, COLOR_GREY, "You are not holding the right weapon for this type of ammo."); if(GetPlayerWeapon(playerid) == 25) GivePlayerValidWeapon(playerid, 25, 120); if(GetPlayerWeapon(playerid) == 26) GivePlayerValidWeapon(playerid, 26, 120); if(GetPlayerWeapon(playerid) == 27) GivePlayerValidWeapon(playerid, 27, 120); format(string, sizeof(string), "* %s has bought 120 shotgun bullets for $%d.", RPN(playerid), price); } case 2: { if(GetPlayerWeapon(playerid) != 33 && GetPlayerWeapon(playerid) != 34) return SendClientMessage(playerid, COLOR_GREY, "You are not holding the right weapon for this type of ammo."); if(GetPlayerWeapon(playerid) == 33) GivePlayerValidWeapon(playerid, 33, 200); if(GetPlayerWeapon(playerid) == 34) GivePlayerValidWeapon(playerid, 34, 200); format(string, sizeof(string), "* %s has bought 100 rifle bullets for $%d.", RPN(playerid), price); } case 3: { if(GetPlayerWeapon(playerid) != 22 && GetPlayerWeapon(playerid) != 23 && GetPlayerWeapon(playerid) != 24) return SendClientMessage(playerid, COLOR_GREY, "You are not holding the right weapon for this type of ammo."); if(GetPlayerWeapon(playerid) == 22) GivePlayerValidWeapon(playerid, 22, 120); if(GetPlayerWeapon(playerid) == 23) GivePlayerValidWeapon(playerid, 23, 120); if(GetPlayerWeapon(playerid) == 24) GivePlayerValidWeapon(playerid, 24, 120); format(string, sizeof(string), "* %s has bought 120 gun bullets for $%d.", RPN(playerid), price); } case 4: { if(GetPlayerWeapon(playerid) != 28 && GetPlayerWeapon(playerid) != 29 && GetPlayerWeapon(playerid) != 32) return SendClientMessage(playerid, COLOR_GREY, "You are not holding the right weapon for this type of ammo."); if(GetPlayerWeapon(playerid) == 28) GivePlayerValidWeapon(playerid, 28, 200); if(GetPlayerWeapon(playerid) == 29) GivePlayerValidWeapon(playerid, 29, 200); if(GetPlayerWeapon(playerid) == 32) GivePlayerValidWeapon(playerid, 32, 200); format(string, sizeof(string), "* %s has bought 200 light-machinegun bullets for $%d.", RPN(playerid), price); } case 5: { if(GetPlayerWeapon(playerid) != 30 && GetPlayerWeapon(playerid) != 31) return SendClientMessage(playerid, COLOR_GREY, "You are not holding the right weapon for this type of ammo."); if(GetPlayerWeapon(playerid) == 30) GivePlayerValidWeapon(playerid, 30, 200); if(GetPlayerWeapon(playerid) == 31) GivePlayerValidWeapon(playerid, 31, 200); format(string, sizeof(string), "* %s has bought 200 heavy-machinegun bullets for $%d.", RPN(playerid), price); } case 6: { new Float:Armour; GetPlayerArmour(playerid, Armour); if(Armour >= 80) return SendClientMessage(playerid, COLOR_GREY, "You don't need a vest."); SetPlayerArmour(playerid, 80); format(string, sizeof(string), "* %s has bought a vest for $%d.", RPN(playerid), price); } } GivePlayerCash(playerid, -price); BizInfo[idx][bMoney] += price; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); return 1; } else if(BizInfo[idx][bType] == 4) { if(sscanf(params, "i", type)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /buy [type]"); if(BizInfo[idx][bProducts] < 1) return SendClientMessage(playerid, COLOR_GREY, "This business is currently out of products."); if(type == 1) price = 50; else if(type == 2) price = 100; else if(type == 3) price = 200; if(PlayerInfo[playerid][pCash] < price) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); switch(type) { case 1: { SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK); format(string, sizeof(string), "* %s has bought a sprunk can $%d.", RPN(playerid), price); } case 2: { SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER); format(string, sizeof(string), "* %s has bought a bottle of beer for $%d.", RPN(playerid), price); } case 3: { SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE); format(string, sizeof(string), "* %s has bought a bottle of vodka for $%d.", RPN(playerid), price); } } GivePlayerCash(playerid, -price); BizInfo[idx][bMoney] += price; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); } else if(BizInfo[idx][bType] == 6) { if(sscanf(params, "i", type)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /buy [type]"); if(BizInfo[idx][bProducts] < 1) return SendClientMessage(playerid, COLOR_GREY, "This business is currently out of products."); if(type == 1) price = 10; else if(type == 2) price = 30; else if(type == 3) price = 50; if(PlayerInfo[playerid][pCash] < price) return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to do this."); new Float:pH; switch(type) { case 1: { GetPlayerHealth(playerid, pH); SetPlayerHealth(playerid, pH+20); GetPlayerHealth(playerid, pH); if(pH > 100) SetPlayerHealth(playerid, 100); format(string, sizeof(string), "* %s has bought a small meal for $%d.", RPN(playerid), price); } case 2: { GetPlayerHealth(playerid, pH); SetPlayerHealth(playerid, pH+40); GetPlayerHealth(playerid, pH); if(pH > 100) SetPlayerHealth(playerid, 100); format(string, sizeof(string), "* %s has bought a medium meal for $%d.", RPN(playerid), price); } case 3: { SetPlayerHealth(playerid, 100); format(string, sizeof(string), "* %s has bought a large meal for $%d.", RPN(playerid), price); } } GivePlayerCash(playerid, -price); BizInfo[idx][bMoney] += price; BizInfo[idx][bProducts] --; BizInfo[idx][bSold] ++; SendClientMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); } return 1; }