businesscore.pwn 154 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Business System
  11. Next Generation Gaming, LLC
  12. (created by Next Generation Gaming Development Team)
  13. * Copyright (c) 2016, Next Generation Gaming, LLC
  14. *
  15. * All rights reserved.
  16. *
  17. * Redistribution and use in source and binary forms, with or without modification,
  18. * are not permitted in any case.
  19. *
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  25. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  26. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  27. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  28. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  29. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  30. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. #include <YSI\y_hooks>
  34. hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
  35. if(newkeys & KEY_YES && InBusiness(playerid) != INVALID_BUSINESS_ID) {
  36. if(IsAt247(playerid)) return cmd_buy(playerid, "");
  37. else if(IsAtRestaurant(playerid)) return cmd_buyfood(playerid, "");
  38. else if(IsAtClothingStore(playerid)) return cmd_buyclothes(playerid, "");
  39. }
  40. return 1;
  41. }
  42. stock TaxSale(amount)
  43. {
  44. new iTaxAmount = floatround(amount / 100 * BUSINESS_TAX_PERCENT);
  45. Tax += iTaxAmount;
  46. for(new iGroupID; iGroupID < MAX_GROUPS; iGroupID++)
  47. {
  48. if(arrGroupData[iGroupID][g_iGroupType] == GROUP_TYPE_GOV && arrGroupData[iGroupID][g_iAllegiance] == 1)
  49. {
  50. new str[128];
  51. format(str, sizeof(str), "A Business has paid $%s in sales tax.", number_format(iTaxAmount));
  52. GroupPayLog(iGroupID, str);
  53. }
  54. }
  55. Misc_Save();
  56. return amount - iTaxAmount;
  57. }
  58. stock GivePlayerStoreItem(playerid, type, business, item, price)
  59. {
  60. if(Businesses[business][bInventory] <= StoreItemCost[item-1][ItemValue]) return SendClientMessageEx(playerid, COLOR_GRAD2, "The store does not have enough stock for that item!");
  61. new string[256];
  62. switch (item)
  63. {
  64. case ITEM_CELLPHONE:
  65. {
  66. if(PlayerInfo[playerid][pTut] == 17)
  67. {
  68. PlayerInfo[playerid][pTut]++;
  69. AdvanceTutorial(playerid);
  70. }
  71. if(PlayerInfo[playerid][pPnumber] == 0)
  72. {
  73. new randphone = 99999 + random(900000);
  74. SetPVarInt(playerid, "WantedPh", randphone);
  75. SetPVarInt(playerid, "CurrentPh", PlayerInfo[playerid][pPnumber]);
  76. SetPVarInt(playerid, "PhChangeCost", 500);
  77. mysql_format(MainPipeline, szMiscArray, sizeof(szMiscArray), "SELECT `Username` FROM `accounts` WHERE `PhoneNr` = '%d'", randphone);
  78. mysql_tquery(MainPipeline, szMiscArray, "OnPhoneNumberCheck", "ii", playerid, 2);
  79. }
  80. Phone_PhoneColorMenu(playerid);
  81. }
  82. case ITEM_PHONEBOOK:
  83. {
  84. PlayerInfo[playerid][pPhoneBook] = 1;
  85. SendClientMessageEx(playerid, COLOR_GRAD4, "Phonebook purchased, you can now look up other player's numbers.");
  86. SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /number <id/name>.");
  87. }
  88. case ITEM_DICE:
  89. {
  90. PlayerInfo[playerid][pDice] = 1;
  91. SendClientMessageEx(playerid, COLOR_GRAD4, "Dice purchased.");
  92. }
  93. case ITEM_CONDOM:
  94. {
  95. Condom[playerid]++;
  96. SendClientMessageEx(playerid, COLOR_GRAD4, "Condom Purchased.");
  97. }
  98. case ITEM_MUSICPLAYER:
  99. {
  100. PlayerInfo[playerid][pCDPlayer] = 1;
  101. SendClientMessageEx(playerid, COLOR_GRAD4, "Music Player purchased.");
  102. SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /music");
  103. }
  104. case ITEM_ROPE:
  105. {
  106. printf("%d", Businesses[business][bItemPrices][ITEM_ROPE]);
  107. PlayerInfo[playerid][pRope]++;
  108. SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased a rope.");
  109. SendClientMessageEx(playerid, COLOR_GREY, "HINT: Type /tie while someone has their hands up to bind them.");
  110. }
  111. case ITEM_CIGAR:
  112. {
  113. PlayerInfo[playerid][pCigar] = 10;
  114. SendClientMessageEx(playerid, COLOR_GRAD4, "10 cigars purchased.");
  115. SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /usecigar to use your cigars. Left mouse button to smoke it, F to throw it away.");
  116. }
  117. case ITEM_SPRUNK:
  118. {
  119. PlayerInfo[playerid][pSprunk] += 1;
  120. SendClientMessageEx(playerid, COLOR_GRAD4, "Sprunk purchased.");
  121. SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /usesprunk to drink a can of Sprunk. Left mouse button to take a sip, F to throw it away.");
  122. }
  123. case ITEM_VEHICLELOCK:
  124. {
  125. PlayerInfo[playerid][pLock] = 1;
  126. SendClientMessageEx(playerid, COLOR_GRAD4, "Vehicle Lock purchased.");
  127. SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /lock to lock your vehicle.");
  128. }
  129. case ITEM_SPRAYCAN:
  130. {
  131. if(PlayerInfo[playerid][pSpraycan] < 20)
  132. {
  133. PlayerInfo[playerid][pSpraycan] += 10;
  134. SendClientMessageEx(playerid, COLOR_GRAD4, "10 Spraycans purchased.");
  135. SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /colorcar or /paintcar while inside a vehicle.");
  136. }
  137. else return SendClientMessageEx(playerid, COLOR_GRAD4, "You can't hold any more of this item!");
  138. }
  139. case ITEM_RADIO:
  140. {
  141. PlayerInfo[playerid][pRadio] = 1;
  142. PlayerInfo[playerid][pRadioFreq] = 0;
  143. SendClientMessageEx(playerid, COLOR_GRAD4, "Portable radio purchased.");
  144. SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /pr to talk over your portable radio.");
  145. SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /setfreq to set the frequency of your portable radio.");
  146. }
  147. case ITEM_CAMERA:
  148. {
  149. GivePlayerValidWeapon(playerid, WEAPON_CAMERA);
  150. SendClientMessageEx(playerid, COLOR_GRAD4, "Camera purchased.");
  151. SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Remember look into the viewfinder and take a picture.");
  152. }
  153. case ITEM_LOTTERYTICKET:
  154. {
  155. ShowPlayerDialogEx(playerid, LOTTOMENU, DIALOG_STYLE_INPUT, "Lottery Ticket Selection","Please enter a Lotto Number", "Select", "Cancel" );
  156. }
  157. case ITEM_CHECKBOOK:
  158. {
  159. if(PlayerInfo[playerid][pChecks] == 0)
  160. {
  161. PlayerInfo[playerid][pChecks] += 10;
  162. SendClientMessageEx(playerid, COLOR_GRAD4, "Checkbook purchased, you now have 10 checks.");
  163. SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /writecheck to write a check.");
  164. }
  165. else return SendClientMessageEx(playerid, COLOR_GREY, "You still have unused checks, please use them before getting another checkbook.");
  166. }
  167. case ITEM_PAPERS:
  168. {
  169. if(PlayerInfo[playerid][pPaper] == 0)
  170. {
  171. PlayerInfo[playerid][pPaper] = 15;
  172. SendClientMessageEx(playerid, COLOR_GRAD4, "Papers purchased, you now have 15 writing papers for sending letters.");
  173. }
  174. else return SendClientMessageEx(playerid, COLOR_GREY, "You still have unused papers, please use them before getting more papers.");
  175. }
  176. case ITEM_SCALARM:
  177. {
  178. if(GetPlayerVehicleCount(playerid) != 0)
  179. {
  180. SetPVarInt(playerid, "lockmenu", 1);
  181. for(new i=0; i<MAX_PLAYERVEHICLES; i++)
  182. {
  183. if(PlayerVehicleInfo[playerid][i][pvId] != INVALID_PLAYER_VEHICLE_ID)
  184. {
  185. format(string, sizeof(string), "Vehicle %d| Name: %s.",i+1,GetVehicleName(PlayerVehicleInfo[playerid][i][pvId]));
  186. SendClientMessageEx(playerid, COLOR_WHITE, string);
  187. }
  188. }
  189. return ShowPlayerDialogEx(playerid, DIALOG_CDLOCKMENU, DIALOG_STYLE_INPUT, "24-7;"," Select a vehicle you wish to install this on:", "Select", "Cancel");
  190. }
  191. else return SendClientMessageEx(playerid, COLOR_WHITE, "You don't have any cars - where we can install this item?");
  192. }
  193. case ITEM_ELOCK:
  194. {
  195. if(GetPlayerVehicleCount(playerid) != 0)
  196. {
  197. SetPVarInt(playerid, "lockmenu", 2);
  198. for(new i=0; i<MAX_PLAYERVEHICLES; i++)
  199. {
  200. if(PlayerVehicleInfo[playerid][i][pvId] != INVALID_PLAYER_VEHICLE_ID)
  201. {
  202. format(string, sizeof(string), "Vehicle %d | Name: %s.",i+1,GetVehicleName(PlayerVehicleInfo[playerid][i][pvId]));
  203. SendClientMessageEx(playerid, COLOR_WHITE, string);
  204. }
  205. }
  206. return ShowPlayerDialogEx(playerid, DIALOG_CDLOCKMENU, DIALOG_STYLE_INPUT, "24-7;"," Select a vehicle you wish to install this on:", "Select", "Cancel");
  207. }
  208. else return SendClientMessageEx(playerid, COLOR_WHITE, "You don't have any cars - where we can install this item?");
  209. }
  210. case ITEM_ILOCK:
  211. {
  212. if(GetPlayerVehicleCount(playerid) != 0)
  213. {
  214. SetPVarInt(playerid, "lockmenu", 3);
  215. for(new i=0; i<MAX_PLAYERVEHICLES; i++)
  216. {
  217. if(PlayerVehicleInfo[playerid][i][pvId] != INVALID_PLAYER_VEHICLE_ID)
  218. {
  219. format(string, sizeof(string), "Vehicle %d | Name: %s.",i+1,GetVehicleName(PlayerVehicleInfo[playerid][i][pvId]));
  220. SendClientMessageEx(playerid, COLOR_WHITE, string);
  221. }
  222. }
  223. return ShowPlayerDialogEx(playerid, DIALOG_CDLOCKMENU, DIALOG_STYLE_INPUT, "24-7;"," Select a vehicle you wish to install this on:", "Select", "Cancel");
  224. }
  225. else return SendClientMessageEx(playerid, COLOR_WHITE, "You don't have any cars - where we can install this item?");
  226. }
  227. case ITEM_HELMET:
  228. {
  229. /* if(GetPlayerVehicleCount(playerid) != 0)
  230. { */
  231. SetPVarInt(playerid, "helmetsel", 1);
  232. SetPVarInt(playerid, "helcost", price);
  233. SetPVarInt(playerid, "businessid", business);
  234. SetPVarInt(playerid, "item", item);
  235. new models[8] = {18936, 18937, 18938, 18976, 18977, 18978, 18979, 18645};
  236. return ShowModelSelectionMenuEx(playerid, models, sizeof(models), "Helmet Selector", 1339, 0.0, 0.0, 120.0);
  237. /* }
  238. else return SendClientMessageEx(playerid, COLOR_WHITE, "You don't have any cars - where we can install this item?"); */
  239. }
  240. case ITEM_RAG:
  241. {
  242. PlayerInfo[playerid][pRags]++;
  243. SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased a rag.");
  244. SendClientMessageEx(playerid, COLOR_GREY, "HINT: Type /blindfold while a person is tied to blindfold them.");
  245. }
  246. default:
  247. {
  248. printf("Error %d ITEM", item);
  249. return 0;
  250. }
  251. }
  252. printf("%d", Businesses[business][bItemPrices][ITEM_RAG]);
  253. Businesses[business][bInventory] -= StoreItemCost[item-1][ItemValue];
  254. Businesses[business][bTotalSales]++;
  255. Businesses[business][bSafeBalance] += TaxSale(price);
  256. GivePlayerCash(playerid, -price);
  257. if(PlayerInfo[playerid][pBusiness] != InBusiness(playerid)) Businesses[business][bLevelProgress]++;
  258. SaveBusiness(business);
  259. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  260. printf("%d", Businesses[business][bItemPrices][ITEM_RAG]);
  261. switch(type)
  262. {
  263. case 0:
  264. {
  265. format(string,sizeof(string),"%s(%d) (IP: %s) has bought a %s in %s (%d) for $%s.", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), StoreItems[item-1], Businesses[business][bName], business, number_format(price));
  266. Log("logs/business.log", string);
  267. format(string,sizeof(string),"* You have purchased a %s from %s for $%s.", StoreItems[item-1], Businesses[business][bName], number_format(price));
  268. SendClientMessage(playerid, COLOR_GRAD2, string);
  269. }
  270. case 1:
  271. {
  272. new offerer = GetPVarInt(playerid, "Business_ItemOfferer");
  273. format(string, sizeof(string), "%s %s(%d) (IP: %s) has sold a %s to %s (IP: %s) for $%s in %s (%d)", GetBusinessRankName(PlayerInfo[offerer][pBusinessRank]), GetPlayerNameEx(offerer), GetPlayerSQLId(offerer), GetPlayerIpEx(offerer), StoreItems[item-1], GetPlayerNameEx(playerid), GetPlayerIpEx(playerid), number_format(price), Businesses[business][bName], business);
  274. Log("logs/business.log", string);
  275. format(string,sizeof(string),"* %s has purchased the %s from you for $%s.", GetPlayerNameEx(playerid), StoreItems[item-1], number_format(price));
  276. SendClientMessage(offerer, COLOR_GRAD2, string);
  277. format(string,sizeof(string),"* You have purchased the %s from %s for $%s.", StoreItems[item-1], GetPlayerNameEx(offerer), number_format(price));
  278. SendClientMessage(playerid, COLOR_GRAD2, string);
  279. DeletePVar(playerid, "Business_ItemType");
  280. DeletePVar(playerid, "Business_ItemPrice");
  281. DeletePVar(playerid, "Business_ItemOfferer");
  282. DeletePVar(playerid, "Business_ItemOffererSQLId");
  283. }
  284. }
  285. return 1;
  286. }
  287. stock DisplayItemPricesDialog(businessid, playerid)
  288. {
  289. new szDialog[612], pvar[25], iListIndex, i;
  290. if (Businesses[businessid][bType] == BUSINESS_TYPE_STORE || Businesses[businessid][bType] == BUSINESS_TYPE_GASSTATION) i = sizeof(StoreItems);
  291. if (Businesses[businessid][bType] == BUSINESS_TYPE_SEXSHOP) i = sizeof(SexItems);
  292. if (Businesses[businessid][bType] == BUSINESS_TYPE_RESTAURANT) i = sizeof(RestaurantItems);
  293. for(new item; item < i; item++)
  294. {
  295. if(Businesses[businessid][bItemPrices][item] == 0) continue;
  296. new cost = (PlayerInfo[playerid][pDonateRank] >= 1) ? (floatround(Businesses[businessid][bItemPrices][item] * 0.8)) : (Businesses[businessid][bItemPrices][item]);
  297. if(Businesses[businessid][bType] == BUSINESS_TYPE_STORE || Businesses[businessid][bType] == BUSINESS_TYPE_GASSTATION) format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, StoreItems[item], number_format(cost));
  298. else if(Businesses[businessid][bType] == BUSINESS_TYPE_SEXSHOP) format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, SexItems[item], number_format(cost));
  299. else if(Businesses[businessid][bType] == BUSINESS_TYPE_RESTAURANT) format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, RestaurantItems[item], number_format(cost));
  300. format(pvar, sizeof(pvar), "Business_MenuItem%d", iListIndex);
  301. SetPVarInt(playerid, pvar, item + 1);
  302. format(pvar, sizeof(pvar), "Business_MenuItemPrice%d", iListIndex++);
  303. SetPVarInt(playerid, pvar, Businesses[businessid][bItemPrices][item]);
  304. }
  305. if(strlen(szDialog) == 0) {
  306. SendClientMessageEx(playerid, COLOR_GRAD2, " Store is not selling any items!");
  307. }
  308. else {
  309. if (Businesses[businessid][bType] == BUSINESS_TYPE_SEXSHOP)
  310. {
  311. ShowPlayerDialogEx(playerid, SHOPMENU, DIALOG_STYLE_LIST, GetBusinessTypeName(Businesses[businessid][bType]), szDialog, "Buy", "Cancel");
  312. }
  313. else if (Businesses[businessid][bType] == BUSINESS_TYPE_RESTAURANT)
  314. {
  315. ShowPlayerDialogEx(playerid, RESTAURANTMENU2, DIALOG_STYLE_LIST, GetBusinessTypeName(Businesses[businessid][bType]), szDialog, "Buy", "Cancel");
  316. }
  317. else
  318. {
  319. ShowPlayerDialogEx(playerid, STOREMENU, DIALOG_STYLE_LIST, GetBusinessTypeName(Businesses[businessid][bType]), szDialog, "Buy", "Cancel");
  320. }
  321. }
  322. }
  323. stock IsAt247(playerid)
  324. {
  325. new iBusiness = InBusiness(playerid);
  326. return (iBusiness != INVALID_BUSINESS_ID && (Businesses[iBusiness][bType] == BUSINESS_TYPE_STORE || Businesses[iBusiness][bType] == BUSINESS_TYPE_GASSTATION));
  327. }
  328. stock IsAtCasino(playerid)
  329. {
  330. new iBusiness = InBusiness(playerid);
  331. return (iBusiness != INVALID_BUSINESS_ID && (Businesses[iBusiness][bType] == BUSINESS_TYPE_CASINO));
  332. }
  333. stock IsAtClothingStore(playerid)
  334. {
  335. new iBusiness = InBusiness(playerid);
  336. return (iBusiness != INVALID_BUSINESS_ID && Businesses[iBusiness][bType] == BUSINESS_TYPE_CLOTHING);
  337. }
  338. stock IsAtRestaurant(playerid)
  339. {
  340. new iBusiness = InBusiness(playerid);
  341. return (iBusiness != INVALID_BUSINESS_ID && Businesses[iBusiness][bType] == BUSINESS_TYPE_RESTAURANT);
  342. }
  343. stock IsAtGym(playerid)
  344. {
  345. new iBusiness = InBusiness(playerid);
  346. return (iBusiness != INVALID_BUSINESS_ID && Businesses[iBusiness][bType] == BUSINESS_TYPE_GYM);
  347. }
  348. stock StopRefueling(playerid, iBusinessID, iPumpID)
  349. {
  350. new
  351. iCost = floatround(Businesses[iBusinessID][GasPumpSalePrice][iPumpID]),
  352. iVehicleID = Businesses[iBusinessID][GasPumpVehicleID][iPumpID],
  353. string[128];
  354. format(string, sizeof(string), "Your vehicle's tank has been refilled for $%d.", iCost);
  355. if( DynVeh[iVehicleID] != -1)
  356. {
  357. DynVehicleInfo[DynVeh[iVehicleID]][gv_fFuel] = VehicleFuel[iVehicleID];
  358. DynVeh_Save(DynVeh[iVehicleID]);
  359. }
  360. if(IsDynamicCrateVehicle(iVehicleID) != -1) {
  361. SaveCrateVehicle(IsDynamicCrateVehicle(iVehicleID));
  362. }
  363. if (DynVeh[iVehicleID] != -1 && DynVehicleInfo[DynVeh[iVehicleID]][gv_igID] != INVALID_GROUP_ID)
  364. {
  365. new iGroupID = DynVehicleInfo[DynVeh[iVehicleID]][gv_igID];
  366. arrGroupData[iGroupID][g_iBudget] -= iCost;
  367. new str[128];
  368. format(str, sizeof(str), "%s has refueled vehicle %d at a cost of $%d to %s's budget fund.", GetPlayerNameEx(playerid), iVehicleID, iCost, arrGroupData[iGroupID][g_szGroupName]);
  369. GroupPayLog(iGroupID, str);
  370. SendClientMessageEx(playerid, COLOR_GREY, "This is a group vehicle and the refueling cost has been paid by the government.");
  371. }
  372. else GivePlayerCash(playerid, -iCost);
  373. Businesses[iBusinessID][bSafeBalance] += TaxSale(iCost);
  374. KillTimer(Businesses[iBusinessID][GasPumpTimer][iPumpID]);
  375. SendClientMessageEx(playerid, COLOR_WHITE, string);
  376. new vehicleslot = GetPlayerVehicle(playerid, iVehicleID);
  377. // Save Fuel to MySQL
  378. if(vehicleslot != -1) {
  379. PlayerVehicleInfo[playerid][vehicleslot][pvFuel] = VehicleFuel[iVehicleID];
  380. mysql_format(MainPipeline, string, sizeof(string), "UPDATE `vehicles` SET `pvFuel` = %0.5f WHERE `id` = '%d'", VehicleFuel[iVehicleID], PlayerVehicleInfo[playerid][vehicleslot][pvSlotId]);
  381. mysql_tquery(MainPipeline, string, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);
  382. }
  383. Businesses[iBusinessID][GasPumpVehicleID][iPumpID] = 0;
  384. DeletePVar(playerid, "Refueling");
  385. format(string,sizeof(string),"%s(%d) (IP: %s) has refueled their vehicle for $%d at %s (%d)",GetPlayerNameEx(playerid),GetPlayerSQLId(playerid),GetPlayerIpEx(playerid),iCost,Businesses[iBusinessID][bName], iBusinessID);
  386. Log("logs/business.log", string);
  387. return true;
  388. }
  389. stock GetCarBusiness(carid)
  390. {
  391. for(new b = 0; b < MAX_BUSINESSES; b++)
  392. {
  393. for(new i = 0; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++)
  394. {
  395. if (Businesses[b][bVehID][i] == carid) return b;
  396. }
  397. }
  398. return INVALID_BUSINESS_ID;
  399. }
  400. stock GetBusinessCarSlot(carid)
  401. {
  402. for(new b = 0; b < MAX_BUSINESSES; b++)
  403. {
  404. for(new i = 0; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++)
  405. {
  406. if (Businesses[b][bVehID][i] == carid) return i;
  407. }
  408. }
  409. return INVALID_BUSINESS_ID;
  410. }
  411. stock IsValidBusinessID(id)
  412. {
  413. if(id == INVALID_BUSINESS_ID) return 0;
  414. else if(id >= 0 && id < MAX_BUSINESSES) return 1;
  415. return 0;
  416. }
  417. stock DestroyDynamicGasPump(iBusiness, iPump)
  418. {
  419. DestroyDynamicObject(Businesses[iBusiness][GasPumpObjectID][iPump]);
  420. DestroyDynamic3DTextLabel(Businesses[iBusiness][GasPumpInfoTextID][iPump]);
  421. DestroyDynamic3DTextLabel(Businesses[iBusiness][GasPumpSaleTextID][iPump]);
  422. #if defined TEXTLABEL_DEBUG
  423. Streamer_SetIntData(STREAMER_TYPE_3D_TEXT_LABEL, Businesses[iBusiness][GasPumpInfoTextID][iPump], E_STREAMER_EXTRA_ID, 10);
  424. Streamer_SetIntData(STREAMER_TYPE_3D_TEXT_LABEL, Businesses[iBusiness][GasPumpSaleTextID][iPump], E_STREAMER_EXTRA_ID, 1);
  425. #endif
  426. }
  427. stock CreateDynamicGasPump(iPlayerID = INVALID_PLAYER_ID, iBusiness, iPump)
  428. {
  429. if (iPlayerID != INVALID_PLAYER_ID)
  430. {
  431. new Float: arr_fPos[4];
  432. GetPlayerPos(iPlayerID, arr_fPos[0], arr_fPos[1], arr_fPos[2]);
  433. GetPlayerFacingAngle(iPlayerID, arr_fPos[3]);
  434. Businesses[iBusiness][GasPumpPosX][iPump] = arr_fPos[0];
  435. Businesses[iBusiness][GasPumpPosY][iPump] = arr_fPos[1];
  436. Businesses[iBusiness][GasPumpPosZ][iPump] = arr_fPos[2] + 0.4;
  437. Businesses[iBusiness][GasPumpAngle][iPump] = arr_fPos[3];
  438. }
  439. new szLabel[148];
  440. Businesses[iBusiness][GasPumpObjectID][iPump] = CreateDynamicObject(1676, Businesses[iBusiness][GasPumpPosX][iPump], Businesses[iBusiness][GasPumpPosY][iPump], Businesses[iBusiness][GasPumpPosZ][iPump], 0, 0, Businesses[iBusiness][GasPumpAngle][iPump], .worldid = 0, .streamdistance = 100);
  441. format(szLabel, sizeof(szLabel), "{33AA33}Gas Pump\nID: %d\n{FFFF00}Type '/refuel' to refill your vehicle's tank.", iPump);
  442. Businesses[iBusiness][GasPumpInfoTextID][iPump] = CreateDynamic3DTextLabel(szLabel, COLOR_YELLOW, Businesses[iBusiness][GasPumpPosX][iPump], Businesses[iBusiness][GasPumpPosY][iPump], Businesses[iBusiness][GasPumpPosZ][iPump] - 0.3, 10.00);
  443. format(szLabel, sizeof(szLabel), "Price Per Gallon: $%.2f\nThis Sale: $0.00\nGallons: 0.000\nGas Available: %.2f/%.2f gallons", Businesses[iBusiness][bGasPrice], Businesses[iBusiness][GasPumpGallons][iPump], Businesses[iBusiness][GasPumpCapacity][iPump]);
  444. Businesses[iBusiness][GasPumpSaleTextID][iPump] = CreateDynamic3DTextLabel(szLabel, COLOR_YELLOW, Businesses[iBusiness][GasPumpPosX][iPump], Businesses[iBusiness][GasPumpPosY][iPump], Businesses[iBusiness][GasPumpPosZ][iPump] + 0.7, 10.00);
  445. }
  446. stock RefreshBusinessPickup(i)
  447. {
  448. DestroyDynamic3DTextLabel(Businesses[i][bDoorText]);
  449. DestroyDynamic3DTextLabel(Businesses[i][bStateText]);
  450. DestroyDynamic3DTextLabel(Businesses[i][bSupplyText]);
  451. #if defined TEXTLABEL_DEBUG
  452. Streamer_SetIntData(STREAMER_TYPE_3D_TEXT_LABEL, Businesses[i][bDoorText], E_STREAMER_EXTRA_ID, 2);
  453. Streamer_SetIntData(STREAMER_TYPE_3D_TEXT_LABEL, Businesses[i][bStateText], E_STREAMER_EXTRA_ID, 3);
  454. Streamer_SetIntData(STREAMER_TYPE_3D_TEXT_LABEL, Businesses[i][bSupplyText], E_STREAMER_EXTRA_ID, 4);
  455. #endif
  456. DestroyDynamicPickup(Businesses[i][bPickup]);
  457. DestroyDynamicPickup(Businesses[i][bPickup_int]);
  458. if(IsValidDynamicArea(Businesses[i][bAreaID][0])) DestroyDynamicArea(Businesses[i][bAreaID][0]);
  459. if(IsValidDynamicArea(Businesses[i][bAreaID][1])) DestroyDynamicArea(Businesses[i][bAreaID][1]);
  460. if (!(Businesses[i][bExtPos][0] == 0.0 && Businesses[i][bExtPos][1] == 0.0 && Businesses[i][bExtPos][2] == 0.0)) {
  461. Businesses[i][bPickup] = CreateDynamicPickup(GetBusinessDefaultPickup(i), 23, Businesses[i][bExtPos][0], Businesses[i][bExtPos][1], Businesses[i][bExtPos][2]);
  462. Businesses[i][bAreaID][0] = CreateDynamicSphere(Businesses[i][bExtPos][0], Businesses[i][bExtPos][1], Businesses[i][bExtPos][2], 2.5);
  463. if (Businesses[i][bOwner] < 1) {
  464. format(szMiscArray,sizeof(szMiscArray),"%s\n\nBusiness For Sale!\nCost: %s\nID: %d", GetBusinessTypeName(Businesses[i][bType]), number_format(Businesses[i][bValue]), i);
  465. }
  466. else {
  467. if(Businesses[i][bType] != BUSINESS_TYPE_GYM) {
  468. format(szMiscArray,sizeof(szMiscArray),"%s\n\n%s [Owner: %s]\nID: %d", GetBusinessTypeName(Businesses[i][bType]), Businesses[i][bName], StripUnderscore(Businesses[i][bOwnerName]), i);
  469. }
  470. else {
  471. format(szMiscArray,sizeof(szMiscArray),"%s\n\n%s [Owner: %s]\nID: %d\nGym Entrance: $%s", GetBusinessTypeName(Businesses[i][bType]), Businesses[i][bName], StripUnderscore(Businesses[i][bOwnerName]), i, number_format(Businesses[i][bGymEntryFee]));
  472. }
  473. }
  474. Businesses[i][bDoorText] = CreateDynamic3DTextLabel(szMiscArray, BUSINESS_NAME_COLOR, Businesses[i][bExtPos][0], Businesses[i][bExtPos][1], Businesses[i][bExtPos][2] + 0.85, 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1);
  475. Businesses[i][bStateText] = CreateDynamic3DTextLabel((Businesses[i][bStatus]) ? ("Open") : ("Closed"), (Businesses[i][bStatus]) ? BUSINESS_OPEN_COLOR : BUSINESS_CLOSED_COLOR, Businesses[i][bExtPos][0], Businesses[i][bExtPos][1], Businesses[i][bExtPos][2] + 1.05, 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1);
  476. if(Businesses[i][bSupplyPos][0] != 0.0)
  477. {
  478. format(szMiscArray,sizeof(szMiscArray),"%s\nSupply Delivery Point", Businesses[i][bName]);
  479. Businesses[i][bSupplyText] = CreateDynamic3DTextLabel(szMiscArray, BUSINESS_NAME_COLOR, Businesses[i][bSupplyPos][0], Businesses[i][bSupplyPos][1], Businesses[i][bSupplyPos][2], 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1);
  480. }
  481. }
  482. if(Businesses[i][bVW] == 0) {
  483. Businesses[i][bPickup_int] = CreateDynamicPickup(1559, 23, Businesses[i][bIntPos][0], Businesses[i][bIntPos][1], Businesses[i][bIntPos][2], .worldid = BUSINESS_BASE_VW + i);
  484. Businesses[i][bAreaID][1] = CreateDynamicSphere(Businesses[i][bIntPos][0], Businesses[i][bIntPos][1], Businesses[i][bIntPos][2], 2.5, .worldid = BUSINESS_BASE_VW + i);
  485. }
  486. else {
  487. Businesses[i][bPickup_int] = CreateDynamicPickup(1559, 23, Businesses[i][bIntPos][0], Businesses[i][bIntPos][1], Businesses[i][bIntPos][2], .worldid = Businesses[i][bVW]);
  488. Businesses[i][bAreaID][1] = CreateDynamicSphere(Businesses[i][bIntPos][0], Businesses[i][bIntPos][1], Businesses[i][bIntPos][2], 2.5, .worldid = Businesses[i][bVW]);
  489. }
  490. /*
  491. Streamer_SetIntData(STREAMER_TYPE_AREA, Businesses[i][bAreaID][0], E_STREAMER_EXTRA_ID, i);
  492. Streamer_SetIntData(STREAMER_TYPE_AREA, Businesses[i][bAreaID][1], E_STREAMER_EXTRA_ID, i);
  493. */
  494. format(szMiscArray, sizeof(szMiscArray), "[Business] Created Business: %d | Exterior Area ID: %d | Interior Area ID: %d", i, Businesses[i][bAreaID][0], Businesses[i][bAreaID][1]);
  495. Log("debug/door_business.log", szMiscArray);
  496. }
  497. stock GetBusinessDefaultPickup(business)
  498. {
  499. switch (Businesses[business][bType]) {
  500. case BUSINESS_TYPE_GASSTATION: return 1650;
  501. case BUSINESS_TYPE_CLOTHING: return 1275;
  502. case BUSINESS_TYPE_RESTAURANT: return 19094;
  503. case BUSINESS_TYPE_SEXSHOP: return 321;
  504. case BUSINESS_TYPE_BAR:
  505. {
  506. new rnd = random(4);
  507. if (rnd == 0) return 1486;
  508. if (rnd == 1) return 1543;
  509. if (rnd == 2) return 1544;
  510. if (rnd == 3) return 1951;
  511. }
  512. case BUSINESS_TYPE_GYM: return 1318;
  513. default: return 1274;
  514. }
  515. return 1318;
  516. }
  517. stock GetBusinessRankName(rank)
  518. {
  519. new string[16];
  520. switch (rank) {
  521. case 0: string = "Trainee";
  522. case 1: string = "Employee";
  523. case 2: string = "Senior Employee";
  524. case 3: string = "Manager";
  525. case 4: string = "Co-Owner";
  526. case 5: string = "Owner";
  527. default: string = "Undefined";
  528. }
  529. return string;
  530. }
  531. stock GetBusinessTypeName(type)
  532. {
  533. new string[20];
  534. switch (type) {
  535. case 1: string = "Gas Station";
  536. case 2: string = "Clothing Store";
  537. case 3: string = "Restaurant";
  538. case 4: string = "Gun Shop";
  539. case 5: string = "New Car Dealership";
  540. case 6: string = "Used Car Dealership";
  541. case 7: string = "Mechanic";
  542. case 8: string = "24/7";
  543. case 9: string = "Bar";
  544. case 10: string = "Club";
  545. case 11: string = "Sex Shop";
  546. case 12: string = "Gym";
  547. case 13: string = "Casino";
  548. default: string = "Undefined";
  549. }
  550. return string;
  551. }
  552. stock GetInventoryType(businessid)
  553. {
  554. new string[30];
  555. if(businessid == INVALID_BUSINESS_ID) {
  556. string = "Empty";
  557. return string;
  558. }
  559. switch (Businesses[businessid][bType]) {
  560. case BUSINESS_TYPE_NEWCARDEALERSHIP: string = "Vehicles";
  561. case BUSINESS_TYPE_GASSTATION: string = "Petrol";
  562. case BUSINESS_TYPE_GUNSHOP: string = "Illegal Materials";
  563. case BUSINESS_TYPE_MECHANIC: string = "Car Parts";
  564. case BUSINESS_TYPE_STORE: string = "24/7 Items";
  565. case BUSINESS_TYPE_CLOTHING: string = "Clothing";
  566. case BUSINESS_TYPE_RESTAURANT, BUSINESS_TYPE_BAR, BUSINESS_TYPE_CLUB: string = "Food & Beverages";
  567. default: string = "Empty";
  568. }
  569. return string;
  570. }
  571. stock GetSupplyState(stateid)
  572. {
  573. new string[28];
  574. switch (stateid) {
  575. case 0: string = "{FF3333}Inactive";
  576. case 1: string = "{FFFF00}Pending Shipment";
  577. case 2: string = "{FFAA00}Shipping";
  578. case 3: string = "{00AA00}Delivered";
  579. case 4: string = "{FF3333}Cancelled";
  580. default: string = "Undefined";
  581. }
  582. return string;
  583. }
  584. stock InBusiness(playerid)
  585. {
  586. if(GetPVarType(playerid, "BusinessesID")) return GetPVarInt(playerid, "BusinessesID");
  587. else return INVALID_BUSINESS_ID;
  588. }
  589. stock GetClosestGasPump(playerid, &businessid, &pumpslot)
  590. {
  591. new Float: minrange = 5.0, Float: range;
  592. businessid = INVALID_BUSINESS_ID;
  593. for(new b = 0; b < MAX_BUSINESSES; b++)
  594. {
  595. for(new i = 0; i < MAX_BUSINESS_GAS_PUMPS; i++)
  596. {
  597. range = GetPlayerDistanceFromPoint(playerid, Businesses[b][GasPumpPosX][i], Businesses[b][GasPumpPosY][i], Businesses[b][GasPumpPosZ][i]);
  598. if (range < minrange)
  599. {
  600. businessid = b;
  601. pumpslot = i;
  602. minrange = range;
  603. }
  604. }
  605. }
  606. }
  607. stock IsBusinessGasAble(iBusinessType) {
  608. switch (iBusinessType) {
  609. case 1,7,8: return 1;
  610. }
  611. return 0;
  612. }
  613. stock GetFreeGasPumpID(biz)
  614. {
  615. for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++) {
  616. if (Businesses[biz][GasPumpPosX][i] == 0.0) return i;
  617. }
  618. return INVALID_GAS_PUMP;
  619. }
  620. forward GasPumpSaleTimer(playerid, iBusinessID, iPumpID);
  621. public GasPumpSaleTimer(playerid, iBusinessID, iPumpID)
  622. {
  623. new
  624. Float: fPumpAmount = FUEL_PUMP_RATE / 4,
  625. iVehicleID = Businesses[iBusinessID][GasPumpVehicleID][iPumpID],
  626. szSaleText[148];
  627. if (GetVehicleDistanceFromPoint(iVehicleID, Businesses[iBusinessID][GasPumpPosX][iPumpID], Businesses[iBusinessID][GasPumpPosY][iPumpID], Businesses[iBusinessID][GasPumpPosZ][iPumpID]) > 5.0)
  628. {
  629. StopRefueling(playerid, iBusinessID, iPumpID);
  630. return 1;
  631. }
  632. if (fPumpAmount*10 + VehicleFuel[iVehicleID] > 100.0)
  633. {
  634. SendClientMessageEx(playerid, COLOR_GREEN, "Your vehicle tank is now full.");
  635. StopRefueling(playerid, iBusinessID, iPumpID);
  636. return 1;
  637. }
  638. if (GetPVarInt(playerid, "Refueling") == -1)
  639. {
  640. SendClientMessageEx(playerid, COLOR_GREEN, "You have stopped refueling.");
  641. StopRefueling(playerid, iBusinessID, iPumpID);
  642. return 1;
  643. }
  644. if (fPumpAmount > Businesses[iBusinessID][GasPumpGallons][iPumpID])
  645. {
  646. SendClientMessageEx(playerid, COLOR_RED, "No more gas left in the station's gas pump.");
  647. StopRefueling(playerid, iBusinessID, iPumpID);
  648. return 1;
  649. }
  650. if(DynVeh[iVehicleID] != -1 && DynVehicleInfo[DynVeh[iVehicleID]][gv_igID] != INVALID_GROUP_ID) {
  651. if(arrGroupData[DynVehicleInfo[DynVeh[iVehicleID]][gv_igID]][g_iBudget] < floatround(Businesses[iBusinessID][GasPumpSalePrice][iPumpID])) {
  652. SendClientMessageEx(playerid, COLOR_RED, "The group vehicle this belongs to has ran out of cash!");
  653. StopRefueling(playerid, iBusinessID, iPumpID);
  654. return 1;
  655. }
  656. }
  657. else {
  658. if(GetPlayerCash(playerid) < floatround(Businesses[iBusinessID][GasPumpSalePrice][iPumpID])) {
  659. SendClientMessageEx(playerid, COLOR_RED, "You are out of cash.");
  660. StopRefueling(playerid, iBusinessID, iPumpID);
  661. return 1;
  662. }
  663. }
  664. Businesses[iBusinessID][GasPumpGallons][iPumpID] -= fPumpAmount;
  665. VehicleFuel[iVehicleID] += fPumpAmount*10;
  666. Businesses[iBusinessID][GasPumpSaleGallons][iPumpID] += fPumpAmount;
  667. Businesses[iBusinessID][GasPumpSalePrice][iPumpID] += fPumpAmount * Businesses[iBusinessID][bGasPrice];
  668. format(szSaleText,sizeof(szSaleText),"Price Per Gallon: $%.2f\nThis Sale: $%.2f\nGallons: %.3f\nGas Available: %.2f/%.2f gallons", Businesses[iBusinessID][bGasPrice], Businesses[iBusinessID][GasPumpSalePrice][iPumpID], Businesses[iBusinessID][GasPumpSaleGallons][iPumpID], Businesses[iBusinessID][GasPumpGallons][iPumpID], Businesses[iBusinessID][GasPumpCapacity][iPumpID]);
  669. UpdateDynamic3DTextLabelText(Businesses[iBusinessID][GasPumpSaleTextID][iPumpID], COLOR_YELLOW, szSaleText);
  670. return 1;
  671. }
  672. stock GetWeaponPrice(business, id)
  673. {
  674. for (new i; i < sizeof(Weapons); i++)
  675. {
  676. if (Weapons[i][WeaponId] == id) return Businesses[business][bItemPrices][i];
  677. }
  678. return 0;
  679. }
  680. CMD:businessdate(playerid, params[]) {
  681. new giveplayerid;
  682. if(PlayerInfo[playerid][pAdmin] < 2)
  683. {
  684. giveplayerid = playerid;
  685. }
  686. else
  687. {
  688. if(sscanf(params, "u", giveplayerid)) giveplayerid = playerid;
  689. }
  690. if(IsValidBusinessID(PlayerInfo[playerid][pBusiness]))
  691. {
  692. new string[128];
  693. new datestring[32];
  694. datestring = date(Businesses[PlayerInfo[giveplayerid][pBusiness]][bMonths], 4);
  695. if(Businesses[PlayerInfo[giveplayerid][pBusiness]][bMonths] == 0) format(string, sizeof(string), "* Your business subscription is not set to expire.");
  696. else format(string, sizeof(string), "* Your business subscription expires on %s.", datestring);
  697. SendClientMessageEx(playerid, COLOR_VIP, string);
  698. }
  699. else SendClientMessageEx(playerid, COLOR_GRAD2, "You don't have a business subscription.");
  700. return 1;
  701. }
  702. CMD:businesshelp(playerid, params[])
  703. {
  704. SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
  705. SendClientMessageEx(playerid, COLOR_WHITE,"*** BUSINESS HELP *** - type a command for more infomation.");
  706. SendClientMessageEx(playerid, COLOR_GRAD3,"*** BUSINESS *** /buybizlevel /binvite /buninvite /bouninvite /bgiverank /resign /bsafe");
  707. SendClientMessageEx(playerid, COLOR_GRAD3,"*** BUSINESS *** /binventory /offeritem /resupply /checkresupply /cancelresupply /minrank");
  708. SendClientMessageEx(playerid, COLOR_GRAD3,"*** BUSINESS *** /employeepayset /employeeautopay /editgasprice /editprices /bizlock");
  709. SendClientMessageEx(playerid, COLOR_GRAD3,"*** BUSINESS *** /bauto /bonline /bpanic /b(iz)r(adio)");
  710. if(IsValidBusinessID(PlayerInfo[playerid][pBusiness]))
  711. {
  712. if(Businesses[PlayerInfo[playerid][pBusiness]][bType] == BUSINESS_TYPE_NEWCARDEALERSHIP || Businesses[PlayerInfo[playerid][pBusiness]][bType] == BUSINESS_TYPE_OLDCARDEALERSHIP) {
  713. SendClientMessageEx(playerid, COLOR_GRAD3, "*** BUSINESS *** /editcarprice /editcarspawn");
  714. }
  715. else if(Businesses[PlayerInfo[playerid][pBusiness]][bType] == BUSINESS_TYPE_GUNSHOP) {
  716. SendClientMessageEx(playerid, COLOR_GRAD3, "*** BUSINESS *** /addmat(erial)s");
  717. }
  718. else if(Businesses[PlayerInfo[playerid][pBusiness]][bType] == BUSINESS_TYPE_STORE) {
  719. SendClientMessageEx(playerid, COLOR_GRAD3, "*** BUSINESS *** /offeritem /editprices");
  720. }
  721. else if (Businesses[PlayerInfo[playerid][pBusiness]][bType] == BUSINESS_TYPE_BAR || Businesses[PlayerInfo[playerid][pBusiness]][bType] == BUSINESS_TYPE_CLUB || Businesses[PlayerInfo[playerid][pBusiness]][bType] == BUSINESS_TYPE_RESTAURANT) {
  722. SendClientMessageEx(playerid, COLOR_GRAD3, "*** BUSINESS *** /offermenu");
  723. }
  724. }
  725. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pShopTech] > 0 || PlayerInfo[playerid][pBM] > 0)
  726. {
  727. SendClientMessageEx(playerid, COLOR_GRAD3, "*** BIZ ADMIN *** /bedit /bname (ST) /bnext (ST) /bnear (ST) /gotobiz (ST) /goinbiz (ST)");
  728. SendClientMessageEx(playerid, COLOR_GRAD3, "*** BIZ ADMIN *** /deletegaspump /asellbiz /creategaspump /editgaspump");
  729. }
  730. return 1;
  731. }
  732. CMD:bhelp(playerid, params[]) {
  733. return cmd_businesshelp(playerid, params);
  734. }
  735. CMD:bonline(playerid, params[]) {
  736. new iBusinessID = PlayerInfo[playerid][pBusiness];
  737. if((0 <= iBusinessID < MAX_BUSINESSES) && PlayerInfo[playerid][pBusinessRank] >= Businesses[iBusinessID][bMinInviteRank])
  738. {
  739. new szDialog[1024];
  740. foreach(new i: Player)
  741. {
  742. if(PlayerInfo[i][pBusiness] == PlayerInfo[playerid][pBusiness] && (PlayerInfo[i][pTogReports] == 1 || PlayerInfo[i][pAdmin] < 2))
  743. {
  744. format(szDialog, sizeof(szDialog), "%s\n* %s (%s)", szDialog, GetPlayerNameEx(i), GetBusinessRankName(PlayerInfo[i][pBusinessRank]));
  745. }
  746. }
  747. if(!isnull(szDialog)) {
  748. strdel(szDialog, 0, 1);
  749. ShowPlayerDialogEx(playerid, 0, DIALOG_STYLE_LIST, "Online Members", szDialog, "Select", "Cancel");
  750. }
  751. else SendClientMessageEx(playerid, COLOR_GREY, "No members are online at this time.");
  752. }
  753. else SendClientMessageEx(playerid, COLOR_GREY, "Only business leaders may use this command.");
  754. return 1;
  755. }
  756. CMD:buy(playerid, params[])
  757. {
  758. if (!IsAt247(playerid)) {
  759. SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a 24/7!");
  760. return 1;
  761. }
  762. new iBusiness = InBusiness(playerid);
  763. if (Businesses[iBusiness][bAutoSale]) {
  764. if (Businesses[iBusiness][bInventory] < 1) {
  765. SendClientMessageEx(playerid, COLOR_WHITE, "This store does not have any items at the moment!");
  766. return 1;
  767. }
  768. if (!Businesses[iBusiness][bStatus]) {
  769. SendClientMessageEx(playerid, COLOR_WHITE, "This store is closed!");
  770. return 1;
  771. }
  772. } else return SendClientMessageEx(playerid, COLOR_WHITE, "You need to interact with the business employees to buy.");
  773. DisplayItemPricesDialog(iBusiness, playerid);
  774. return 1;
  775. }
  776. CMD:beginswimming(playerid, params[])
  777. {
  778. if (!IsAtGym(playerid))
  779. {
  780. SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a gym!");
  781. return 1;
  782. }
  783. new iBusiness = InBusiness(playerid);
  784. if(CheckPointCheck(playerid))
  785. {
  786. return SendClientMessageEx(playerid, COLOR_GRAD2, "You must kill your current checkpoint first. (/killcheckpoint)");
  787. }
  788. if (Businesses[iBusiness][bGymType] != 1)
  789. {
  790. SendClientMessageEx(playerid, COLOR_GRAD2, " You can not /beginswimming in this type of gym!");
  791. return 1;
  792. }
  793. if (GetPVarInt(playerid, "_BoxingQueue") == 1)
  794. {
  795. SendClientMessageEx(playerid, COLOR_GRAD2, " You must leave the boxing queue first! (/leaveboxing)");
  796. return 1;
  797. }
  798. if (GetPVarInt(playerid, "_SwimmingActivity") >= 1)
  799. {
  800. SendClientMessageEx(playerid, COLOR_GRAD2, " You are already swimming! Use /stopswimming first.");
  801. return 1;
  802. }
  803. SetPVarInt(playerid, "_SwimmingActivity", 1);
  804. SetPlayerCheckpoint(playerid, 2892.5071, -2261.9607, 1.4645, 2.0);
  805. SendClientMessageEx(playerid, COLOR_WHITE, "Proceed to the first checkpoint to begin exercising.");
  806. SendClientMessageEx(playerid, COLOR_WHITE, "Type /stopswimming to exit your current activity.");
  807. /*if(!PlayerInfo[playerid][mCooldown][4] && !PlayerInfo[playerid][pShopNotice])
  808. {
  809. PlayerTextDrawSetString(playerid, MicroNotice[playerid], ShopMsg[10]);
  810. PlayerTextDrawShow(playerid, MicroNotice[playerid]);
  811. SetTimerEx("HidePlayerTextDraw", 10000, false, "ii", playerid, _:MicroNotice[playerid]);
  812. }*/
  813. return 1;
  814. }
  815. CMD:stopswimming(playerid, params[])
  816. {
  817. if (!IsAtGym(playerid))
  818. {
  819. SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a gym!");
  820. return 1;
  821. }
  822. if (GetPVarInt(playerid, "_SwimmingActivity") < 1)
  823. {
  824. SendClientMessageEx(playerid, COLOR_GREY, " You are not swimming!");
  825. return 1;
  826. }
  827. DeletePVar(playerid, "_SwimmingActivity");
  828. DisablePlayerCheckpoint(playerid);
  829. SendClientMessageEx(playerid, COLOR_GREY, "You have stopped exercising.");
  830. return 1;
  831. }
  832. CMD:joinboxing(playerid, params[])
  833. {
  834. if (!IsAtGym(playerid))
  835. {
  836. SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a gym!");
  837. return 1;
  838. }
  839. new iBusiness = InBusiness(playerid);
  840. if (Businesses[iBusiness][bGymType] != 1)
  841. {
  842. SendClientMessageEx(playerid, COLOR_GRAD2, " You can not /joinboxing in this type of gym!");
  843. return 1;
  844. }
  845. if (GetPVarInt(playerid, "_SwimmingActivity") >= 1)
  846. {
  847. SendClientMessageEx(playerid, COLOR_GRAD2, " You must stop swimming first! (/stopswimming)");
  848. return 1;
  849. }
  850. if (GetPVarInt(playerid, "_BoxingQueue") == 1)
  851. {
  852. SendClientMessageEx(playerid, COLOR_GRAD2, " You are already in the boxing queue!");
  853. return 1;
  854. }
  855. if (GetPVarInt(playerid, "_BoxingFight") != 0)
  856. {
  857. SendClientMessageEx(playerid, COLOR_GRAD2, " You are already in a boxing match!");
  858. return 1;
  859. }
  860. SetPVarInt(playerid, "_BoxingQueue", 1);
  861. SetPVarInt(playerid, "_BoxingQueueTick", 1);
  862. SendClientMessageEx(playerid, COLOR_WHITE, "You have joined the boxing queue.");
  863. return 1;
  864. }
  865. CMD:leaveboxing(playerid, params[])
  866. {
  867. if (!IsAtGym(playerid))
  868. {
  869. SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a gym!");
  870. return 1;
  871. }
  872. if (GetPVarInt(playerid, "_BoxingQueue") != 1)
  873. {
  874. SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in the boxing queue.");
  875. return 1;
  876. }
  877. DeletePVar(playerid, "_BoxingQueue");
  878. DeletePVar(playerid, "_BoxingQueueTick");
  879. SendClientMessageEx(playerid, COLOR_WHITE, "You have left the boxing queue.");
  880. return 1;
  881. }
  882. CMD:beginparkour(playerid, params[])
  883. {
  884. if (!IsAtGym(playerid))
  885. {
  886. SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a gym!");
  887. return 1;
  888. }
  889. new iBusiness = InBusiness(playerid);
  890. if (Businesses[iBusiness][bGymType] != 1)
  891. {
  892. SendClientMessageEx(playerid, COLOR_GRAD2, " You can not /beginparkour in this type of gym!");
  893. return 1;
  894. }
  895. if (GetPVarInt(playerid, "_BikeParkourStage") != 0)
  896. {
  897. SendClientMessageEx(playerid, COLOR_GRAD2, " You are already participating in that activity!");
  898. return 1;
  899. }
  900. new bool:available = false;
  901. new pos;
  902. for (new it = 0; it < 9; ++it)
  903. {
  904. if (Businesses[iBusiness][bGymBikePlayers][it] == INVALID_PLAYER_ID)
  905. {
  906. available = true;
  907. Businesses[iBusiness][bGymBikePlayers][it] = playerid;
  908. pos = it;
  909. break;
  910. }
  911. }
  912. if (available == false)
  913. {
  914. SendClientMessageEx(playerid, COLOR_GRAD2, " Too many people are on this track, try again later.");
  915. return 1;
  916. }
  917. SendClientMessage(playerid, COLOR_WHITE, "Proceed to the pickup point to collect your bike.");
  918. SetPVarInt(playerid, "_BikeParkourStage", 1);
  919. SetPVarInt(playerid, "_BikeParkourSlot", pos);
  920. new pickup = CreateDynamicPickup(1318, 23, 2833.8757, -2256.8293, 95.9497, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
  921. SetPVarInt(playerid, "_BikeParkourPickup", pickup);
  922. /*if(!PlayerInfo[playerid][mCooldown][4] && !PlayerInfo[playerid][pShopNotice])
  923. {
  924. PlayerTextDrawSetString(playerid, MicroNotice[playerid], ShopMsg[10]);
  925. PlayerTextDrawShow(playerid, MicroNotice[playerid]);
  926. SetTimerEx("HidePlayerTextDraw", 10000, false, "ii", playerid, _:MicroNotice[playerid]);
  927. }*/
  928. return 1;
  929. }
  930. CMD:leaveparkour(playerid, params[])
  931. {
  932. if (!IsAtGym(playerid))
  933. {
  934. SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a gym!");
  935. return 1;
  936. }
  937. if (GetPVarInt(playerid, "_BikeParkourStage") == 0)
  938. {
  939. SendClientMessageEx(playerid, COLOR_GRAD2, " You are not participating in that activity.");
  940. return 1;
  941. }
  942. new iBusiness = InBusiness(playerid);
  943. Businesses[iBusiness][bGymBikePlayers][GetPVarInt(playerid, "_BikeParkourSlot")] = INVALID_PLAYER_ID;
  944. SendClientMessageEx(playerid, COLOR_WHITE, "You have left the biking activity.");
  945. new vehicle = Businesses[iBusiness][bGymBikeVehicles][GetPVarInt(playerid, "_BikeParkourSlot")];
  946. if (vehicle != INVALID_VEHICLE_ID)
  947. {
  948. DestroyVehicle(vehicle);
  949. Businesses[iBusiness][bGymBikeVehicles][GetPVarInt(playerid, "_BikeParkourSlot")] = INVALID_VEHICLE_ID;
  950. }
  951. DeletePVar(playerid, "_BikeParkourStage");
  952. DeletePVar(playerid, "_BikeParkourSlot");
  953. new pickup = GetPVarInt(playerid, "_BikeParkourPickup");
  954. if (pickup != 0)
  955. {
  956. DestroyDynamicPickup(pickup);
  957. DeletePVar(playerid, "_BikeParkourPickup");
  958. }
  959. return 1;
  960. }
  961. CMD:bauto(playerid, params[])
  962. {
  963. new
  964. iBusiness = PlayerInfo[playerid][pBusiness],
  965. iRank = PlayerInfo[playerid][pBusinessRank];
  966. if (iBusiness != INVALID_BUSINESS_ID && iRank >= 5)
  967. {
  968. new iType = Businesses[iBusiness][bType];
  969. if (iType == BUSINESS_TYPE_GASSTATION || iType == BUSINESS_TYPE_STORE || iType == BUSINESS_TYPE_CLOTHING) {
  970. if (Businesses[iBusiness][bAutoSale]) {
  971. Businesses[iBusiness][bAutoSale] = 0;
  972. SendClientMessageEx(playerid, COLOR_WHITE, "You have toggled off the automatic sales mode!");
  973. SaveBusiness(iBusiness);
  974. }
  975. else {
  976. Businesses[iBusiness][bAutoSale] = 1;
  977. SendClientMessageEx(playerid, COLOR_WHITE, "You have toggled on the automatic sales mode!");
  978. SendClientMessageEx(playerid, COLOR_GREY, "Note that this will cause decrease in profits!");
  979. SaveBusiness(iBusiness);
  980. }
  981. } else SendClientMessageEx(playerid, COLOR_WHITE, "Command not available for your business type!");
  982. } else SendClientMessageEx(playerid, COLOR_WHITE, "Only business owners can use this command!");
  983. return 1;
  984. }
  985. CMD:shop(playerid, params[])
  986. {
  987. new iBusiness = InBusiness(playerid);
  988. if (iBusiness == INVALID_BUSINESS_ID || Businesses[iBusiness][bType] != BUSINESS_TYPE_SEXSHOP) {
  989. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in a sex shop!");
  990. return 1;
  991. }
  992. if (Businesses[iBusiness][bAutoSale]) {
  993. if (Businesses[iBusiness][bInventory] < 1) {
  994. SendClientMessageEx(playerid, COLOR_WHITE, "This sex shop does not have any items at the moment!");
  995. return 1;
  996. }
  997. if (!Businesses[iBusiness][bStatus]) {
  998. SendClientMessageEx(playerid, COLOR_WHITE, "This sex shop is closed!");
  999. return 1;
  1000. }
  1001. } else return SendClientMessageEx(playerid, COLOR_WHITE, "You need to interact with the business employees to buy.");
  1002. DisplayItemPricesDialog(iBusiness, playerid);
  1003. return 1;
  1004. }
  1005. CMD:refuel(playerid, params[])
  1006. {
  1007. if(zombieevent) return SendClientMessageEx(playerid, -1, "You can't use Gas Stations during the Zombie Event!");
  1008. if (GetPVarType(playerid, "Refueling"))
  1009. {
  1010. SetPVarInt(playerid, "Refueling", -1);
  1011. }
  1012. else
  1013. {
  1014. new vehicleid = GetPlayerVehicleID(playerid);
  1015. new
  1016. iBusinessID,
  1017. iPumpID;
  1018. GetClosestGasPump(playerid, iBusinessID, iPumpID);
  1019. if (iBusinessID == INVALID_BUSINESS_ID) return SendClientMessageEx(playerid, COLOR_RED, "You're not at a fuel station.");
  1020. if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_RED, "You are not in a vehicle.");
  1021. if (!Businesses[iBusinessID][bStatus]) return SendClientMessageEx(playerid, COLOR_RED, "This fuel station is closed.");
  1022. if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_RED, "You're not the driver.");
  1023. if (IsVIPcar(vehicleid)) return SendClientMessageEx(playerid, COLOR_RED, "This is a vehicle from the VIP garage and it has already unlimited amount of fuel.");
  1024. if (IsFamedVeh(vehicleid)) return SendClientMessageEx(playerid, COLOR_RED, "This is a vehicle from the Famed garage and it has already unlimited amount of fuel.");
  1025. if (IsAdminSpawnedVehicle(vehicleid)) return SendClientMessageEx(playerid, COLOR_RED, "This is an admin-spawned vehicle and it has already unlimited amount of fuel.");
  1026. new engine,lights,alarm,doors,bonnet,boot,objective;
  1027. GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
  1028. if(engine == VEHICLE_PARAMS_ON) return SendClientMessageEx(playerid, COLOR_RED, "You need to shut off the engine before filling up (press ~k~~CONVERSATION_YES~).");
  1029. if (Businesses[iBusinessID][GasPumpGallons][iPumpID] == 0.0) return SendClientMessageEx(playerid, COLOR_RED, "No gas left in the gas station tank.");
  1030. if (!IsRefuelableVehicle(vehicleid)) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle does not need fuel.");
  1031. if (VehicleFuel[vehicleid] >= 100.0) return SendClientMessageEx(playerid, COLOR_RED, "This vehicle's tank is already full.");
  1032. if (Businesses[iBusinessID][GasPumpVehicleID][iPumpID] > 0) return SendClientMessageEx(playerid, COLOR_RED, "This gas pump is occupied.");
  1033. SendClientMessageEx(playerid, COLOR_WHITE, "Refueling your vehicle's tank, please wait.");
  1034. SendClientMessageEx(playerid, COLOR_YELLOW, "Type /refuel again to stop refueling.");
  1035. SetPVarInt(playerid, "Refueling", vehicleid);
  1036. Businesses[iBusinessID][GasPumpSaleGallons][iPumpID] = 0;
  1037. Businesses[iBusinessID][GasPumpSalePrice][iPumpID] = 0;
  1038. Businesses[iBusinessID][GasPumpVehicleID][iPumpID] = vehicleid;
  1039. Businesses[iBusinessID][GasPumpTimer][iPumpID] = SetTimerEx("GasPumpSaleTimer", 200, true, "iii", playerid, iBusinessID, iPumpID);
  1040. }
  1041. return 1;
  1042. }
  1043. CMD:editcarspawn(playerid, params[])
  1044. {
  1045. if(PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
  1046. SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
  1047. }
  1048. else if(Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_NEWCARDEALERSHIP && Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_OLDCARDEALERSHIP) {
  1049. SendClientMessageEx(playerid, COLOR_GREY, "You don't own a vehicle dealership.");
  1050. }
  1051. else if(!IsPlayerInRangeOfPoint(playerid, 20.0, Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][2])) {
  1052. SendClientMessageEx(playerid, COLOR_GREY, "The location needs to be near the business entrance.");
  1053. }
  1054. else if(PlayerInfo[playerid][pBusinessRank] < 5) {
  1055. SendClientMessageEx(playerid, COLOR_GREY, "You aren't high enough rank to edit the car dealership.");
  1056. }
  1057. else {
  1058. new Float: Positionsz[4];
  1059. GetPlayerPos(playerid, Positionsz[0], Positionsz[1], Positionsz[2]);
  1060. GetPlayerFacingAngle(playerid, Positionsz[3]);
  1061. Businesses[PlayerInfo[playerid][pBusiness]][bPurchaseX] = Positionsz[0];
  1062. Businesses[PlayerInfo[playerid][pBusiness]][bPurchaseY] = Positionsz[1];
  1063. Businesses[PlayerInfo[playerid][pBusiness]][bPurchaseZ] = Positionsz[2];
  1064. Businesses[PlayerInfo[playerid][pBusiness]][bPurchaseAngle] = Positionsz[3];
  1065. SendClientMessageEx(playerid, COLOR_WHITE, "You have moved the vehicle purchase spawn location.");
  1066. SaveDealershipSpawn(PlayerInfo[playerid][pBusiness]);
  1067. }
  1068. return 1;
  1069. }
  1070. CMD:entrancefee(playerid, params[])
  1071. {
  1072. if(PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
  1073. return SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
  1074. }
  1075. else if(Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_GYM) {
  1076. return SendClientMessageEx(playerid, COLOR_GREY, "You don't own a gym.");
  1077. }
  1078. else if(!IsPlayerInRangeOfPoint(playerid, 5.0, Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][2])) {
  1079. return SendClientMessageEx(playerid, COLOR_GREY, "You need to be standing near the gym entrance.");
  1080. }
  1081. else {
  1082. new amount;
  1083. if(sscanf(params, "d", amount)) {
  1084. return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /entrancefee [Price]");
  1085. }
  1086. else if(amount < 0 || amount > 10000) {
  1087. return SendClientMessageEx(playerid, COLOR_GREY, "The price can't be set the price below $0 and above $10,000.");
  1088. }
  1089. else {
  1090. new string[128];
  1091. Businesses[PlayerInfo[playerid][pBusiness]][bGymEntryFee] = amount;
  1092. format(string, sizeof(string), "You have set the gym entry fee to $%s.", number_format(amount));
  1093. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1094. RefreshBusinessPickup(PlayerInfo[playerid][pBusiness]);
  1095. SaveBusiness(PlayerInfo[playerid][pBusiness]);
  1096. }
  1097. }
  1098. return 1;
  1099. }
  1100. CMD:editcarprice(playerid, params[])
  1101. {
  1102. if(PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
  1103. SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
  1104. }
  1105. else if(Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_NEWCARDEALERSHIP && Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_OLDCARDEALERSHIP) {
  1106. SendClientMessageEx(playerid, COLOR_GREY, "You don't own a vehicle dealership.");
  1107. }
  1108. else if(!IsPlayerInRangeOfPoint(playerid, 5.0, Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][2])) {
  1109. SendClientMessageEx(playerid, COLOR_GREY, "You need to be standing near the dealership entrance.");
  1110. }
  1111. else if(PlayerInfo[playerid][pBusinessRank] < Businesses[PlayerInfo[playerid][pBusiness]][bMinSupplyRank]) {
  1112. SendClientMessageEx(playerid, COLOR_GREY, "You aren't high enough rank to edit the car dealership.");
  1113. }
  1114. else {
  1115. new vehicleid, amount;
  1116. if(sscanf(params, "dd", vehicleid, amount)) {
  1117. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /editcarprice [VehicleID] [Price]");
  1118. }
  1119. else if(PlayerInfo[playerid][pBusiness] != GetCarBusiness(vehicleid)) {
  1120. SendClientMessageEx(playerid, COLOR_GREY, "That vehicle is not part of your dealership.");
  1121. }
  1122. else if(amount < 0) {
  1123. SendClientMessageEx(playerid, COLOR_GREY, "The price can't be set below 0");
  1124. }
  1125. else {
  1126. new
  1127. iSlot = GetBusinessCarSlot(vehicleid),
  1128. Message[128];
  1129. Businesses[PlayerInfo[playerid][pBusiness]][bPrice][iSlot] = amount;
  1130. format(Message, sizeof(Message), "%s For Sale | Price: $%s", GetVehicleName(Businesses[PlayerInfo[playerid][pBusiness]][bVehID][iSlot]), number_format(Businesses[PlayerInfo[playerid][pBusiness]][bPrice][iSlot]));
  1131. UpdateDynamic3DTextLabelText(Businesses[PlayerInfo[playerid][pBusiness]][bVehicleLabel][iSlot], COLOR_LIGHTBLUE, Message);
  1132. format(Message, sizeof(Message), "%s price has been set to $%s", GetVehicleName(vehicleid), number_format(amount));
  1133. SendClientMessageEx(playerid, COLOR_WHITE, Message);
  1134. SaveDealershipVehicle(PlayerInfo[playerid][pBusiness], iSlot);
  1135. }
  1136. }
  1137. return 1;
  1138. }
  1139. CMD:deletecdveh(playerid, params[]) {
  1140. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pBM] == 2) {
  1141. new
  1142. iBusiness,
  1143. iVehicle;
  1144. if(sscanf(params, "ii", iBusiness, iVehicle )) {
  1145. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /deletecdveh [business ID] [model id]");
  1146. }
  1147. else if(Businesses[iBusiness][bType] != BUSINESS_TYPE_NEWCARDEALERSHIP && Businesses[iBusiness][bType] != BUSINESS_TYPE_OLDCARDEALERSHIP) {
  1148. SendClientMessageEx(playerid, COLOR_GRAD2, "Business is not a car dealership!");
  1149. }
  1150. else if(iBusiness != GetCarBusiness(iVehicle)) {
  1151. SendClientMessageEx(playerid, COLOR_GREY, "That vehicle isn't a dealership vehicle.");
  1152. }
  1153. else {
  1154. new
  1155. ID = GetBusinessCarSlot(iVehicle);
  1156. if(Businesses[iBusiness][bVehID][ID] != INVALID_VEHICLE_ID) {
  1157. if(IsValidDynamic3DTextLabel(Businesses[iBusiness][bVehicleLabel][ID])) DestroyDynamic3DTextLabel(Businesses[iBusiness][bVehicleLabel][ID]), Businesses[iBusiness][bVehicleLabel][ID] = Text3D:-1;
  1158. DestroyVehicle(Businesses[iBusiness][bVehID][ID]);
  1159. Businesses[iBusiness][bModel][ID] = 0;
  1160. Businesses[iBusiness][bParkPosX][ID] = 0;
  1161. Businesses[iBusiness][bParkPosY][ID] = 0;
  1162. Businesses[iBusiness][bParkPosZ][ID] = 0;
  1163. Businesses[iBusiness][bParkAngle][ID] = 0;
  1164. Businesses[iBusiness][bVehID][ID] = 0;
  1165. Businesses[iBusiness][bPrice][ID] = 0;
  1166. SaveDealershipVehicle(iBusiness, ID);
  1167. return 1;
  1168. }
  1169. return SendClientMessageEx(playerid, COLOR_GREY, "The max number of vehicles for this business has been reached.");
  1170. }
  1171. }
  1172. else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
  1173. return 1;
  1174. }
  1175. CMD:createcdveh(playerid, params[]) {
  1176. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pBM] == 2) {
  1177. new
  1178. iBusiness,
  1179. iVehicle,
  1180. iColors[2];
  1181. if(sscanf(params, "iiii", iBusiness, iVehicle, iColors[0], iColors[1])) {
  1182. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /createcdveh [business ID] [model id] [color 1] [color 2]");
  1183. }
  1184. else if(!(400 <= iVehicle <= 611)) {
  1185. SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid model specified (model IDs start at 400, and end at 611).");
  1186. }
  1187. else if(IsATrain(iVehicle)) {
  1188. SendClientMessageEx(playerid, COLOR_GREY, "Trains cannot be spawned during runtime.");
  1189. }
  1190. else if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255)) {
  1191. SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid color specified (IDs start at 0, and end at 255).");
  1192. }
  1193. else if(Businesses[iBusiness][bType] != BUSINESS_TYPE_NEWCARDEALERSHIP && Businesses[iBusiness][bType] != BUSINESS_TYPE_OLDCARDEALERSHIP) {
  1194. SendClientMessageEx(playerid, COLOR_GRAD2, "Business is not a car dealership!");
  1195. }
  1196. else {
  1197. new
  1198. Float: fVehPos[4], label[50];
  1199. GetPlayerPos(playerid, fVehPos[0], fVehPos[1], fVehPos[2]);
  1200. GetPlayerFacingAngle(playerid, fVehPos[3]);
  1201. for (new i; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++)
  1202. {
  1203. if (Businesses[iBusiness][bVehID][i] == 0) {
  1204. Businesses[iBusiness][bVehID][i] = CreateVehicle(iVehicle, fVehPos[0], fVehPos[1], fVehPos[2], fVehPos[3], iColors[0], iColors[1], 10);
  1205. VehicleFuel[Businesses[iBusiness][bVehID][i]] = 100.0;
  1206. Businesses[iBusiness][bModel][i] = iVehicle;
  1207. Businesses[iBusiness][bParkPosX][i] = fVehPos[0];
  1208. Businesses[iBusiness][bParkPosY][i] = fVehPos[1];
  1209. Businesses[iBusiness][bParkPosZ][i] = fVehPos[2];
  1210. Businesses[iBusiness][bParkAngle][i] = fVehPos[3];
  1211. format(label, sizeof(label), "%s For Sale | Price: $%s", GetVehicleName(Businesses[iBusiness][bVehID][i]), number_format(Businesses[iBusiness][bPrice][i]));
  1212. Businesses[iBusiness][bVehicleLabel][i] = CreateDynamic3DTextLabel(label,COLOR_LIGHTBLUE,Businesses[iBusiness][bParkPosX][i], Businesses[iBusiness][bParkPosY][i], Businesses[iBusiness][bParkPosZ][i],8.0,INVALID_PLAYER_ID, Businesses[iBusiness][bVehID][i]);
  1213. Businesses[iBusiness][DealershipVehStock][i] = 1;
  1214. Vehicle_ResetData(Businesses[iBusiness][bVehID][i]);
  1215. SaveDealershipVehicle(iBusiness, i);
  1216. return 1;
  1217. }
  1218. }
  1219. return SendClientMessageEx(playerid, COLOR_GREY, "The max number of vehicles for this business has been reached.");
  1220. }
  1221. }
  1222. else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
  1223. return 1;
  1224. }
  1225. CMD:switchbiz(playerid, params[])
  1226. {
  1227. if(PlayerInfo[playerid][pAdmin] >= 3 || PlayerInfo[playerid][pBM] >= 1)
  1228. {
  1229. new string[128], bizid;
  1230. if(sscanf(params, "d", bizid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /switchbiz [bizid]");
  1231. if(bizid < 1 || bizid > MAX_BUSINESSES) return SendClientMessageEx(playerid, COLOR_WHITE, "Invalid business ID.");
  1232. format(string, sizeof(string), "You have switched to business ID %d (%s).", bizid, Businesses[bizid][bName]);
  1233. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  1234. PlayerInfo[playerid][pBusinessRank] = 5;
  1235. PlayerInfo[playerid][pBusiness] = bizid;
  1236. }
  1237. else return SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use this command");
  1238. return 1;
  1239. }
  1240. CMD:brenewal(playerid, params[])
  1241. {
  1242. if(PlayerInfo[playerid][pShopTech] >= 1)
  1243. {
  1244. new
  1245. iType,
  1246. iOrderID,
  1247. iBusiness,
  1248. szMessage[128],
  1249. months;
  1250. if(sscanf(params, "dddd", iBusiness, iType, months, iOrderID)) {
  1251. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /brenewal [Business ID] [Type (1-3)] [Months] [OrderID]");
  1252. }
  1253. else if(!IsValidBusinessID(iBusiness)) {
  1254. SendClientMessageEx(playerid, COLOR_GREY, "Invalid business ID");
  1255. }
  1256. else {
  1257. Businesses[iBusiness][bMonths] = 259200+gettime()+(2592000*months);
  1258. format(szMessage, sizeof(szMessage), "You have renewed business %i for %i months.", iBusiness, months);
  1259. SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
  1260. format(szMessage, sizeof(szMessage), "[BUSINESS RENEWAL] %s(%d) has renewed BusinessID %i, Type %i, Months %i, OrderID %i", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), iBusiness, iType, months, iOrderID);
  1261. Log("logs/shoplog.log", szMessage);
  1262. SaveBusiness(iBusiness);
  1263. }
  1264. }
  1265. else
  1266. {
  1267. SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command.");
  1268. }
  1269. return 1;
  1270. }
  1271. CMD:shopbusiness(playerid, params[])
  1272. {
  1273. if(PlayerInfo[playerid][pShopTech] < 1 && PlayerInfo[playerid][pBM] < 1)
  1274. {
  1275. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
  1276. return 1;
  1277. }
  1278. new string[128], choice[32], businessid, amount, invoice[64];
  1279. if(sscanf(params, "s[32]dDs[64]", choice, businessid, amount, invoice))
  1280. {
  1281. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /shopbusiness [name] [business ID] [Amount] [invoice #]");
  1282. SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, SupplyPoint, Price, Type, Inventory, InventoryCapacity, Delete");
  1283. SendClientMessageEx(playerid, COLOR_GREY, "Available names: CustomInterior, CustomExterior, Months, VW, grade");
  1284. return 1;
  1285. }
  1286. if (!IsValidBusinessID(businessid))
  1287. {
  1288. SendClientMessageEx(playerid, COLOR_GREY, "Invalid business ID entered.");
  1289. return 1;
  1290. }
  1291. if(!strcmp(choice, "grade", true))
  1292. {
  1293. SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the grade on this business!");
  1294. format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Grade to %i", GetPlayerNameEx(playerid), businessid, amount);
  1295. Businesses[businessid][bGrade] = amount;
  1296. Log("logs/shoplog.log", string);
  1297. }
  1298. if(!strcmp(choice, "months", true))
  1299. {
  1300. SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the months left on this business!");
  1301. format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Months to %i", GetPlayerNameEx(playerid), businessid, amount);
  1302. Businesses[businessid][bMonths] = (2592000*amount)+gettime()+259200;
  1303. Log("logs/shoplog.log", string);
  1304. }
  1305. else if(!strcmp(choice, "vw", true))
  1306. {
  1307. Businesses[businessid][bVW] = amount;
  1308. SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the VW!");
  1309. format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's vw to %d", GetPlayerNameEx(playerid), businessid, amount);
  1310. Log("logs/shoplog.log", string);
  1311. }
  1312. if(!strcmp(choice, "exterior", true))
  1313. {
  1314. GetPlayerPos(playerid, Businesses[businessid][bExtPos][0], Businesses[businessid][bExtPos][1], Businesses[businessid][bExtPos][2]);
  1315. GetPlayerFacingAngle(playerid, Businesses[businessid][bExtPos][3]);
  1316. SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the exterior!");
  1317. format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Exterior to X:%f Y:%f Z:%f", GetPlayerNameEx(playerid), businessid, Businesses[businessid][bExtPos][0], Businesses[businessid][bExtPos][1],Businesses[businessid][bExtPos][2]);
  1318. Log("logs/shoplog.log", string);
  1319. }
  1320. else if(!strcmp(choice, "interior", true))
  1321. {
  1322. GetPlayerPos(playerid, Businesses[businessid][bIntPos][0], Businesses[businessid][bIntPos][1], Businesses[businessid][bIntPos][2]);
  1323. GetPlayerFacingAngle(playerid, Businesses[businessid][bIntPos][3]);
  1324. Businesses[businessid][bInt] = GetPlayerInterior(playerid);
  1325. SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the interior!");
  1326. format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Interior to X:%f Y:%f Z:%f", GetPlayerNameEx(playerid), businessid, Businesses[businessid][bIntPos][0], Businesses[businessid][bIntPos][1],Businesses[businessid][bIntPos][2]);
  1327. Log("logs/shoplog.log", string);
  1328. }
  1329. else if(strcmp(choice, "custominterior", true) == 0)
  1330. {
  1331. if(Businesses[businessid][bCustomInterior] == 0)
  1332. {
  1333. Businesses[businessid][bCustomInterior] = 1;
  1334. SendClientMessageEx(playerid, COLOR_WHITE, "Business set to custom interior!");
  1335. }
  1336. else
  1337. {
  1338. Businesses[businessid][bCustomInterior] = 0;
  1339. SendClientMessageEx(playerid, COLOR_WHITE, "Business set to normal (not custom) interior!");
  1340. }
  1341. format(string, sizeof(string), "[SHOPBUSINESS] %s has edited BusinessID %d's CustomInterior.", GetPlayerNameEx(playerid), businessid);
  1342. Log("logs/shoplog.log", string);
  1343. return 1;
  1344. }
  1345. else if(strcmp(choice, "customexterior", true) == 0)
  1346. {
  1347. if(Businesses[businessid][bCustomExterior] == 0)
  1348. {
  1349. Businesses[businessid][bCustomExterior] = 1;
  1350. SendClientMessageEx(playerid, COLOR_WHITE, "Business set to custom exterior!");
  1351. }
  1352. else
  1353. {
  1354. Businesses[businessid][bCustomExterior] = 0;
  1355. SendClientMessageEx(playerid, COLOR_WHITE, "Business set to normal (not custom) exterior!");
  1356. }
  1357. format(string, sizeof(string), "[SHOPBUSINESS] %s has edited BusinessID %d's CustomExterior.", GetPlayerNameEx(playerid), businessid);
  1358. Log("logs/shoplog.log", string);
  1359. return 1;
  1360. }
  1361. else if(!strcmp(choice, "supplypoint", true))
  1362. {
  1363. if(Businesses[businessid][bOrderState] == 2)
  1364. {
  1365. return SendClientMessageEx(playerid, COLOR_GREY, "You can't change the supply point when a delivery is on its way.");
  1366. }
  1367. GetPlayerPos(playerid, Businesses[businessid][bSupplyPos][0], Businesses[businessid][bSupplyPos][1], Businesses[businessid][bSupplyPos][2]);
  1368. SendClientMessageEx(playerid, COLOR_WHITE, "You have edited the supply point!");
  1369. format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Supply Point to X:%f Y:%f Z:%f", GetPlayerNameEx(playerid), businessid, Businesses[businessid][bSupplyPos][0], Businesses[businessid][bSupplyPos][1],Businesses[businessid][bSupplyPos][2]);
  1370. Log("logs/shoplog.log", string);
  1371. }
  1372. else if(!strcmp(choice, "price", true))
  1373. {
  1374. Businesses[businessid][bValue] = amount;
  1375. format(string, sizeof(string), "You have set the business price to $%d.", amount);
  1376. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1377. format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Price to $%d.", GetPlayerNameEx(playerid), businessid, amount);
  1378. Log("logs/shoplog.log", string);
  1379. }
  1380. else if(!strcmp(choice, "type", true))
  1381. {
  1382. if(Businesses[businessid][bOrderState] == 2)
  1383. {
  1384. return SendClientMessageEx(playerid, COLOR_GREY, "You can't change the business type when a delivery is on its way.");
  1385. }
  1386. Businesses[businessid][bType] = amount;
  1387. format(string, sizeof(string), "You have set the business type to %s.", GetBusinessTypeName(amount));
  1388. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1389. format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Type to %s (%d).", GetPlayerNameEx(playerid), businessid, GetBusinessTypeName(amount), amount);
  1390. Log("logs/shoplog.log", string);
  1391. }
  1392. else if(!strcmp(choice, "inventory", true))
  1393. {
  1394. Businesses[businessid][bInventory] = amount;
  1395. format(string, sizeof(string), "You have set the business inventory to %d.", amount);
  1396. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1397. format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Inventory to %d.", GetPlayerNameEx(playerid), businessid, amount);
  1398. Log("logs/shoplog.log", string);
  1399. }
  1400. else if(!strcmp(choice, "InventoryCapacity", true))
  1401. {
  1402. Businesses[businessid][bInventoryCapacity] = amount;
  1403. format(string, sizeof(string), "You have set the business inventory capacity to %d.", amount);
  1404. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1405. format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Inventory Capacity to %d.", GetPlayerNameEx(playerid), businessid, amount);
  1406. Log("logs/shoplog.log", string);
  1407. }
  1408. else if(!strcmp(choice, "delete", true))
  1409. {
  1410. Businesses[businessid][bExtPos][0] = 0;
  1411. Businesses[businessid][bExtPos][1] = 0;
  1412. Businesses[businessid][bExtPos][2] = 0;
  1413. Businesses[businessid][bName][0] = 0;
  1414. Businesses[businessid][bType] = 0;
  1415. format(string, sizeof(string), "You have deleted the business.", amount);
  1416. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1417. format(string, sizeof(string), "[SHOPBUSINESS] %s has deleted BusinessID %d.", GetPlayerNameEx(playerid), businessid);
  1418. Log("logs/bedit.log", string);
  1419. //TODO IMPROVE
  1420. for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++) {
  1421. DestroyDynamicGasPump(businessid, i);
  1422. }
  1423. for (new i; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++) {
  1424. if(IsValidVehicle(Businesses[businessid][bVehID][i])) DestroyVehicle(Businesses[businessid][bVehID][i]);
  1425. if(IsValidDynamic3DTextLabel(Businesses[businessid][bVehicleLabel][i])) DestroyDynamic3DTextLabel(Businesses[businessid][bVehicleLabel][i]), Businesses[businessid][bVehicleLabel][i] = Text3D:-1;
  1426. Businesses[businessid][bModel][i] = 0;
  1427. Businesses[businessid][bParkPosX][i] = 0;
  1428. Businesses[businessid][bParkPosY][i] = 0;
  1429. Businesses[businessid][bParkPosZ][i] = 0;
  1430. Businesses[businessid][bParkAngle][i] = 0;
  1431. Businesses[businessid][bVehID][i] = 0;
  1432. Businesses[businessid][bPrice][i] = 0;
  1433. SaveDealershipVehicle(businessid, i);
  1434. }
  1435. }
  1436. RefreshBusinessPickup(businessid);
  1437. SaveBusiness(businessid);
  1438. Streamer_UpdateEx(playerid, Businesses[businessid][bExtPos][0], Businesses[businessid][bExtPos][1], Businesses[businessid][bExtPos][2]);
  1439. return 1;
  1440. }
  1441. CMD:shopbusinessname(playerid, params[])
  1442. {
  1443. if(PlayerInfo[playerid][pShopTech] < 1 && PlayerInfo[playerid][pBM] < 1)
  1444. {
  1445. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
  1446. return 1;
  1447. }
  1448. new string[128], houseid, ownername, invoice[64];
  1449. if(sscanf(params, "dus[64]", houseid, ownername, invoice)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /shopbusinessname [Business ID] [Player] [invoice]");
  1450. if(!IsPlayerConnected(ownername)) {
  1451. return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
  1452. }
  1453. if(PlayerInfo[ownername][pLevel] == 1 && PlayerInfo[ownername][pAdmin] < 2) return SendClientMessageEx(playerid, COLOR_RED, "You can't use /shopbusinessname on level 1's");
  1454. if(PlayerInfo[ownername][pBusiness] != INVALID_BUSINESS_ID) {
  1455. return SendClientMessageEx(playerid, COLOR_GREY, "That player already owns another business.");
  1456. }
  1457. Businesses[houseid][bOwner] = GetPlayerSQLId(ownername);
  1458. strcpy(Businesses[houseid][bOwnerName], GetPlayerNameEx(ownername), MAX_PLAYER_NAME);
  1459. PlayerInfo[ownername][pBusiness] = houseid;
  1460. PlayerInfo[ownername][pBusinessRank] = 5;
  1461. SaveBusiness(houseid);
  1462. OnPlayerStatsUpdate(ownername);
  1463. RefreshBusinessPickup(houseid);
  1464. format(string, sizeof(string), "[SHOPBUSINESS] %s modified Owner on Business %d to %s(%d) - Invoice %s", GetPlayerNameEx(playerid), houseid, GetPlayerNameEx(ownername), GetPlayerSQLId(ownername), invoice);
  1465. Log("logs/shoplog.log", string);
  1466. return 1;
  1467. }
  1468. CMD:buyclothes(playerid, params[])
  1469. {
  1470. new biz = InBusiness(playerid);
  1471. if (biz == INVALID_BUSINESS_ID || Businesses[biz][bType] != BUSINESS_TYPE_CLOTHING) {
  1472. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in a clothing shop!");
  1473. return 1;
  1474. }
  1475. if (Businesses[biz][bInventory] < 1) {
  1476. SendClientMessageEx(playerid, COLOR_GRAD2, "Store does not have any clothes!");
  1477. return 1;
  1478. }
  1479. if (!Businesses[biz][bStatus]) {
  1480. SendClientMessageEx(playerid, COLOR_GRAD2, "This clothing store is closed!");
  1481. return 1;
  1482. }
  1483. #if defined zombiemode
  1484. if(zombieevent == 1 && GetPVarType(playerid, "pIsZombie")) return SendClientMessageEx(playerid, COLOR_GREY, "Zombies can't use this.");
  1485. #endif
  1486. new string[64];
  1487. format(string, sizeof(string), "Note: Clothes changes cost %s", number_format(Businesses[biz][bItemPrices][0]));
  1488. SetPVarInt(playerid, "SkinChangeCost", Businesses[biz][bItemPrices][0]);
  1489. SendClientMessageEx(playerid, COLOR_YELLOW, string);
  1490. if(PlayerInfo[playerid][mInventory][13] && PlayerInfo[playerid][pDonateRank] < 2) SendClientMessageEx(playerid, -1, "You have Restricted Skin tokens in your inventory, if you select a restricted skin you will use a token and no additional fees will come.");
  1491. ShowModelSelectionMenu(playerid, SkinList, "Change your clothes.");
  1492. return 1;
  1493. }
  1494. CMD:buybizlevel(playerid, params[])
  1495. {
  1496. if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || PlayerInfo[playerid][pBusinessRank] < 5)
  1497. {
  1498. return SendClientMessageEx(playerid, COLOR_GREY, "Only business owners can use this command.");
  1499. }
  1500. if (Businesses[PlayerInfo[playerid][pBusiness]][bLevel] >= 5)
  1501. {
  1502. return SendClientMessageEx(playerid, COLOR_GREY, "You cannot buy levels anymore.");
  1503. }
  1504. new newLevel = Businesses[PlayerInfo[playerid][pBusiness]][bLevel] + 1;
  1505. new totalSales = Businesses[PlayerInfo[playerid][pBusiness]][bTotalSales];
  1506. new totalProfits = Businesses[PlayerInfo[playerid][pBusiness]][bTotalProfits];
  1507. if (newLevel == 2 && totalSales < 1000 && totalProfits < 300000)
  1508. return SendClientMessageEx(playerid, COLOR_GREY, "This business does not have enough total sales/profits to purchase this uprgade!");
  1509. else if (newLevel == 3 && totalSales < 5000 && totalProfits < 2000000)
  1510. return SendClientMessageEx(playerid, COLOR_GREY, "This business does not have enough total sales/profits to purchase this uprgade!");
  1511. else if (newLevel == 4 && totalSales < 15000 && totalProfits < 10000000)
  1512. return SendClientMessageEx(playerid, COLOR_GREY, "This business does not have enough total sales/profits to purchase this uprgade!");
  1513. new cost = Businesses[PlayerInfo[playerid][pBusiness]][bLevel] * 100000;
  1514. if(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] < cost)
  1515. {
  1516. return SendClientMessageEx(playerid, COLOR_GREY, "The business does not have enough money in the safe to purchase this upgrade!");
  1517. }
  1518. Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] -= cost;
  1519. OnPlayerStatsUpdate(playerid);
  1520. new string[128];
  1521. format(string, sizeof(string), "~g~BUSINESS LEVEL UP~n~~w~Current Level %d", ++Businesses[PlayerInfo[playerid][pBusiness]][bLevel]);
  1522. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  1523. Businesses[PlayerInfo[playerid][pBusiness]][bLevelProgress] = 0;
  1524. Businesses[PlayerInfo[playerid][pBusiness]][bInventoryCapacity] *= 2;
  1525. if(IsBusinessGasAble(Businesses[PlayerInfo[playerid][pBusiness]][bType]))
  1526. {
  1527. for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++)
  1528. {
  1529. Businesses[PlayerInfo[playerid][pBusiness]][GasPumpCapacity][i] *= 2;
  1530. }
  1531. }
  1532. SaveBusiness(PlayerInfo[playerid][pBusiness]);
  1533. return 1;
  1534. }
  1535. // Business Leadership Commands Start
  1536. CMD:binvite(playerid, params[]) {
  1537. new iBusinessID = PlayerInfo[playerid][pBusiness];
  1538. if((0 <= iBusinessID < MAX_BUSINESSES) && PlayerInfo[playerid][pBusinessRank] >= Businesses[iBusinessID][bMinInviteRank]) {
  1539. new
  1540. iTargetID,
  1541. string[128];
  1542. if(sscanf(params, "u", iTargetID)) {
  1543. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /binvite [player]");
  1544. }
  1545. else if(IsPlayerConnected(iTargetID)) {
  1546. if (iTargetID != playerid) {
  1547. if(!(0 <= PlayerInfo[iTargetID][pBusiness] < MAX_BUSINESSES)) {
  1548. SetPVarInt(iTargetID, "Business_Inviter", playerid);
  1549. SetPVarInt(iTargetID, "Business_InviterSQLId", GetPlayerSQLId(playerid));
  1550. SetPVarInt(iTargetID, "Business_Invited", iBusinessID);
  1551. format(string, sizeof(string), "You have invited %s to join %s", GetPlayerNameEx(iTargetID), Businesses[iBusinessID][bName]);
  1552. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  1553. format(string, sizeof(string), "%s %s has offered you a job at %s - type /accept business", GetBusinessRankName(PlayerInfo[playerid][pBusinessRank]), GetPlayerNameEx(playerid), Businesses[iBusinessID][bName]);
  1554. SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, string);
  1555. format(string, sizeof(string), "%s(%d) has invited %s(%d) to join %s", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerNameEx(iTargetID), GetPlayerSQLId(iTargetID), Businesses[iBusinessID][bName]);
  1556. Log("logs/business.log", string);
  1557. }
  1558. else SendClientMessageEx(playerid, COLOR_GREY, "The person you're trying to invite is already in another business.");
  1559. }
  1560. else SendClientMessageEx(playerid, COLOR_GREY, "You cannot use this command on yourself.");
  1561. }
  1562. else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  1563. }
  1564. else SendClientMessageEx(playerid, COLOR_GRAD1, "Only authorized business employees may use this command.");
  1565. return 1;
  1566. }
  1567. CMD:buninvite(playerid, params[]) {
  1568. if(0 <= PlayerInfo[playerid][pBusiness] < MAX_BUSINESSES && PlayerInfo[playerid][pBusinessRank] >= Businesses[PlayerInfo[playerid][pBusiness]][bMinInviteRank]) {
  1569. new
  1570. iTargetID,
  1571. iGroupID = PlayerInfo[playerid][pBusiness];
  1572. if(sscanf(params, "u", iTargetID)) {
  1573. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /buninvite [player]");
  1574. }
  1575. else if(IsPlayerConnected(iTargetID)) {
  1576. if(iGroupID == PlayerInfo[iTargetID][pBusiness]) {
  1577. if(playerid == iTargetID) {
  1578. SendClientMessageEx(playerid, COLOR_GREY, "You can't uninvite yourself.");
  1579. }
  1580. else if(PlayerInfo[playerid][pBusinessRank] > PlayerInfo[iTargetID][pBusinessRank]) {
  1581. new
  1582. szMessage[128],
  1583. iRank = PlayerInfo[iTargetID][pBusinessRank];
  1584. format(szMessage, sizeof(szMessage), "You have kicked %s from the business.", GetPlayerNameEx(iTargetID));
  1585. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
  1586. format(szMessage, sizeof(szMessage), "* You have been kicked from the business by %s %s.", GetPlayerNameEx(playerid));
  1587. SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
  1588. format(szMessage, sizeof(szMessage), "%s(%d) uninvited %s(%d) from the %s as a rank %i.", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerNameEx(iTargetID), GetPlayerSQLId(iTargetID), Businesses[PlayerInfo[iTargetID][pBusiness]][bName], iRank);
  1589. Log("logs/business.log", szMessage);
  1590. PlayerInfo[iTargetID][pBusiness] = INVALID_BUSINESS_ID;
  1591. PlayerInfo[iTargetID][pBusinessRank] = 0;
  1592. OnPlayerStatsUpdate(iTargetID);
  1593. }
  1594. else SendClientMessageEx(playerid, COLOR_GREY, "You can't do this to a person of equal or higher rank.");
  1595. }
  1596. else SendClientMessageEx(playerid, COLOR_GRAD1, "That person is not in your business.");
  1597. }
  1598. else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
  1599. }
  1600. else SendClientMessageEx(playerid, COLOR_GRAD1, "Only authorized business employees may use this command.");
  1601. return 1;
  1602. }
  1603. CMD:bouninvite(playerid, params[])
  1604. {
  1605. new name[32], query[128];
  1606. if (sscanf(params, "s[32]", name)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bouninvite [account name]");
  1607. if(PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
  1608. SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
  1609. return 1;
  1610. }
  1611. if(PlayerInfo[playerid][pBusinessRank] != 5) {
  1612. SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
  1613. return 1;
  1614. }
  1615. mysql_format(MainPipeline, query, sizeof(query), "UPDATE `accounts` SET `Business` = "#INVALID_BUSINESS_ID", `BusinessRank` = 0 WHERE `Username` = '%e' AND `Business` = %d", name, PlayerInfo[playerid][pBusiness]);
  1616. mysql_tquery(MainPipeline, query, "OnQueryFinish", "i", SENDDATA_THREAD);
  1617. SendClientMessageEx(playerid, COLOR_GREY, "You have offline kicked that person.");
  1618. return 1;
  1619. }
  1620. CMD:bgiverank(playerid, params[])
  1621. {
  1622. new string[128], targetid, rank;
  1623. if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID)
  1624. {
  1625. return SendClientMessageEx(playerid, COLOR_GREY, "You are not in a business!");
  1626. }
  1627. if(sscanf(params, "ud", targetid, rank)) {
  1628. return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bgiverank [player] [rank]");
  1629. }
  1630. else if (PlayerInfo[playerid][pBusinessRank] < Businesses[PlayerInfo[playerid][pBusiness]][bMinGiveRankRank]) {
  1631. return SendClientMessageEx(playerid, COLOR_GREY, "Your rank is not high enough for promoting or demoting someone!");
  1632. }
  1633. else if (!IsPlayerConnected(targetid)) {
  1634. return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified!");
  1635. }
  1636. else if (playerid == targetid) {
  1637. return SendClientMessageEx(playerid, COLOR_GREY, "You can not use this command on yourself!");
  1638. }
  1639. else if(PlayerInfo[playerid][pBusiness] != PlayerInfo[targetid][pBusiness]) {
  1640. return SendClientMessageEx(playerid, COLOR_GREY, "That person is not in your business!");
  1641. }
  1642. else if (PlayerInfo[targetid][pBusinessRank] > PlayerInfo[playerid][pBusinessRank]) {
  1643. return SendClientMessageEx(playerid, COLOR_GREY, "You can not use this command on that rank persons!");
  1644. }
  1645. else if(rank > PlayerInfo[playerid][pBusinessRank])
  1646. {
  1647. return SendClientMessageEx(playerid, COLOR_GREY, "You can not give a rank higher than your own!");
  1648. }
  1649. else if(rank < 0 || rank > 5) {
  1650. return SendClientMessageEx(playerid, COLOR_GREY, "Don't go below number 0 or above number 5!");
  1651. }
  1652. if (rank > PlayerInfo[targetid][pBusinessRank]) {
  1653. format(string, sizeof(string), "* You have been promoted to a higher rank (%s) by %s.", GetBusinessRankName(rank), GetPlayerNameEx(playerid));
  1654. SendClientMessageEx(targetid, COLOR_LIGHTBLUE, string);
  1655. }
  1656. else if (rank < PlayerInfo[targetid][pBusinessRank]) {
  1657. format(string, sizeof(string), "* You have been demoted to a lower rank (%s) by %s.", GetBusinessRankName(rank), GetPlayerNameEx(playerid));
  1658. SendClientMessageEx(targetid, COLOR_LIGHTBLUE, string);
  1659. }
  1660. else {
  1661. return SendClientMessageEx(playerid, COLOR_GREY, "That person already has this rank.");
  1662. }
  1663. PlayerInfo[targetid][pBusinessRank] = rank;
  1664. format(string, sizeof(string), "* You have given %s rank %d.", GetPlayerNameEx(targetid), rank);
  1665. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  1666. format(string, sizeof(string), "%s(%d) has given %s(%d) rank %i in %s", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerNameEx(targetid), GetPlayerSQLId(targetid), rank, Businesses[PlayerInfo[targetid][pBusiness]][bName]);
  1667. Log("logs/business.log", string);
  1668. return 1;
  1669. }
  1670. CMD:resign(playerid, params[])
  1671. {
  1672. if (PlayerInfo[playerid][pBusiness] != INVALID_BUSINESS_ID)
  1673. {
  1674. new string[128];
  1675. format(string, sizeof(string), "%s(%d) has resigned from their business as a rank %i", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), PlayerInfo[playerid][pBusinessRank]);
  1676. Log("logs/business.log", string);
  1677. PlayerInfo[playerid][pBusiness] = INVALID_BUSINESS_ID;
  1678. PlayerInfo[playerid][pBusinessRank] = INVALID_RANK;
  1679. return SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have resigned from your business.");
  1680. }
  1681. else return SendClientMessageEx(playerid, COLOR_GREY, "You are not in a business!");
  1682. }
  1683. CMD:bsafe(playerid, params[])
  1684. {
  1685. if(PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
  1686. SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
  1687. return 1;
  1688. }
  1689. else if(!IsPlayerInRangeOfPoint(playerid, 25.0, Businesses[PlayerInfo[playerid][pBusiness]][bIntPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bIntPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bIntPos][2])) {
  1690. SendClientMessageEx(playerid, COLOR_GREY, "You need to be inside your business to access your business safe.");
  1691. return 1;
  1692. }
  1693. else if(PlayerInfo[playerid][pBusinessRank] < Businesses[PlayerInfo[playerid][pBusiness]][bMinSafeRank]) {
  1694. SendClientMessageEx(playerid, COLOR_GREY, "You aren't high enough rank to access the business safe.");
  1695. return 1;
  1696. }
  1697. else {
  1698. new choice[10], Amount, string[256];
  1699. if(sscanf(params, "s[10]D", choice, Amount)) {
  1700. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bsafe [name] [amount]");
  1701. SendClientMessageEx(playerid, COLOR_GREY, "Available names: Balance, Withdraw, Deposit");
  1702. return 1;
  1703. }
  1704. else if(!strcmp(choice, "Balance", true))
  1705. {
  1706. format(string, sizeof(string), "Business(%d) Safe Balance: $%s", PlayerInfo[playerid][pBusiness], number_format(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance]));
  1707. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1708. }
  1709. else if(Amount < 1) {
  1710. SendClientMessageEx(playerid, COLOR_GREY, "The amount can't be under 1.");
  1711. return 1;
  1712. }
  1713. else if(!strcmp(choice, "Withdraw", true))
  1714. {
  1715. if(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] >= Amount) {
  1716. format(string, sizeof(string), "You have withdrew $%s from your business safe.", number_format(Amount));
  1717. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1718. format(string, sizeof(string), "Business(%d) Safe Balance: $%s", PlayerInfo[playerid][pBusiness], number_format(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance]));
  1719. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1720. format(string,sizeof(string),"%s(%d) (IP: %s) has withdrawn $%s from their business safe (BusinessID - %d)[PT: $%s][NT: $%s]",GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), number_format(Amount), PlayerInfo[playerid][pBusiness], number_format(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance]), number_format(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] - Amount));
  1721. Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] -= Amount;
  1722. Log("logs/business.log", string);
  1723. GivePlayerCash(playerid, Amount);
  1724. SaveBusiness(PlayerInfo[playerid][pBusiness]);
  1725. OnPlayerStatsUpdate(playerid);
  1726. }
  1727. else {
  1728. SendClientMessageEx(playerid, COLOR_GREY, "You don't have that much in your business safe.");
  1729. }
  1730. }
  1731. else if(!strcmp(choice, "Deposit", true))
  1732. {
  1733. if(GetPlayerCash(playerid) >= Amount) {
  1734. format(string, sizeof(string), "You have deposited $%s into your business safe.", number_format(Amount));
  1735. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1736. format(string, sizeof(string), "Business(%d) Safe Balance: $%s", PlayerInfo[playerid][pBusiness], number_format(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance]));
  1737. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1738. format(string,sizeof(string),"%s(%d) (IP: %s) has deposited $%s into their business safe (BusinessID - %d)[PT: $%s][NT: $%s]",GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), number_format(Amount), PlayerInfo[playerid][pBusiness], number_format(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance]), number_format(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] + Amount));
  1739. Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] += Amount;
  1740. Log("logs/business.log", string);
  1741. GivePlayerCash(playerid, -Amount);
  1742. SaveBusiness(PlayerInfo[playerid][pBusiness]);
  1743. OnPlayerStatsUpdate(playerid);
  1744. }
  1745. else {
  1746. SendClientMessageEx(playerid, COLOR_GREY, "You don't have that much cash on you.");
  1747. }
  1748. }
  1749. }
  1750. return 1;
  1751. }
  1752. // Business Admin Commands
  1753. CMD:bedit(playerid, params[])
  1754. {
  1755. if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pASM] < 1 && PlayerInfo[playerid][pBM] < 1)
  1756. {
  1757. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
  1758. return 1;
  1759. }
  1760. new choice[32], businessid, amount, string[128];
  1761. if(sscanf(params, "s[32]dD(0)", choice, businessid, amount))
  1762. {
  1763. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bedit [name] [businessid] [amount]");
  1764. SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, SupplyPoint, Price, Type, Inventory, InventoryCapacity, SafeBalance, Delete");
  1765. SendClientMessageEx(playerid, COLOR_GREY, "Available names: CustomInterior, CustomExterior, Months, GymEntryFee, GymType, VW, Grade, MaxLevel");
  1766. return 1;
  1767. }
  1768. if (!IsValidBusinessID(businessid))
  1769. {
  1770. SendClientMessageEx(playerid, COLOR_GREY, "Invalid business ID entered.");
  1771. return 1;
  1772. }
  1773. if(!strcmp(choice, "maxlevel", true))
  1774. {
  1775. SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the max level allowed to enter this business!");
  1776. format(string, sizeof(string), "%s has changed BusinessID %d's MaxLevel to %i", GetPlayerNameEx(playerid), businessid, amount);
  1777. Businesses[businessid][bMaxLevel] = amount;
  1778. Log("logs/bedit.log", string);
  1779. }
  1780. if(!strcmp(choice, "grade", true))
  1781. {
  1782. SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the grade on this business!");
  1783. format(string, sizeof(string), "%s has changed BusinessID %d's Grade to %i", GetPlayerNameEx(playerid), businessid, amount);
  1784. Businesses[businessid][bGrade] = amount;
  1785. Log("logs/bedit.log", string);
  1786. }
  1787. if(!strcmp(choice, "months", true))
  1788. {
  1789. SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the months left on this business!");
  1790. format(string, sizeof(string), "%s has changed BusinessID %d's Months to %i", GetPlayerNameEx(playerid), businessid, amount);
  1791. Businesses[businessid][bMonths] = 2592000*amount+gettime()+259200;
  1792. Log("logs/bedit.log", string);
  1793. }
  1794. else if(!strcmp(choice, "vw", true))
  1795. {
  1796. Businesses[businessid][bVW] = amount;
  1797. SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the VW!");
  1798. format(string, sizeof(string), "%s has changed BusinessID %d's vw to %d", GetPlayerNameEx(playerid), businessid, amount);
  1799. Log("logs/bedit.log", string);
  1800. }
  1801. if(!strcmp(choice, "exterior", true))
  1802. {
  1803. GetPlayerPos(playerid, Businesses[businessid][bExtPos][0], Businesses[businessid][bExtPos][1], Businesses[businessid][bExtPos][2]);
  1804. GetPlayerFacingAngle(playerid, Businesses[businessid][bExtPos][3]);
  1805. SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the exterior!");
  1806. format(string, sizeof(string), "%s has changed BusinessID %d's Exterior to X:%f Y:%f Z:%f", GetPlayerNameEx(playerid), businessid, Businesses[businessid][bExtPos][0], Businesses[businessid][bExtPos][1],Businesses[businessid][bExtPos][2]);
  1807. Log("logs/bedit.log", string);
  1808. }
  1809. else if(!strcmp(choice, "interior", true))
  1810. {
  1811. GetPlayerPos(playerid, Businesses[businessid][bIntPos][0], Businesses[businessid][bIntPos][1], Businesses[businessid][bIntPos][2]);
  1812. GetPlayerFacingAngle(playerid, Businesses[businessid][bIntPos][3]);
  1813. Businesses[businessid][bInt] = GetPlayerInterior(playerid);
  1814. SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the interior!");
  1815. format(string, sizeof(string), "%s has changed BusinessID %d's Interior to X:%f Y:%f Z:%f", GetPlayerNameEx(playerid), businessid, Businesses[businessid][bIntPos][0], Businesses[businessid][bIntPos][1],Businesses[businessid][bIntPos][2]);
  1816. Log("logs/bedit.log", string);
  1817. }
  1818. else if(strcmp(choice, "custominterior", true) == 0)
  1819. {
  1820. if(Businesses[businessid][bCustomInterior] == 0)
  1821. {
  1822. Businesses[businessid][bCustomInterior] = 1;
  1823. SendClientMessageEx(playerid, COLOR_WHITE, "Business set to custom interior!");
  1824. }
  1825. else
  1826. {
  1827. Businesses[businessid][bCustomInterior] = 0;
  1828. SendClientMessageEx(playerid, COLOR_WHITE, "Business set to normal (not custom) interior!");
  1829. }
  1830. format(string, sizeof(string), "%s has edited BusinessID %d's CustomInterior.", GetPlayerNameEx(playerid), businessid);
  1831. Log("logs/bedit.log", string);
  1832. return 1;
  1833. }
  1834. else if(strcmp(choice, "customexterior", true) == 0)
  1835. {
  1836. if(Businesses[businessid][bCustomExterior] == 0)
  1837. {
  1838. Businesses[businessid][bCustomExterior] = 1;
  1839. SendClientMessageEx(playerid, COLOR_WHITE, "Business set to custom exterior!");
  1840. }
  1841. else
  1842. {
  1843. Businesses[businessid][bCustomExterior] = 0;
  1844. SendClientMessageEx(playerid, COLOR_WHITE, "Business set to normal (not custom) exterior!");
  1845. }
  1846. format(string, sizeof(string), "%s has edited BusinessID %d's CustomExterior.", GetPlayerNameEx(playerid), businessid);
  1847. Log("logs/bedit.log", string);
  1848. return 1;
  1849. }
  1850. else if(!strcmp(choice, "supplypoint", true))
  1851. {
  1852. if(Businesses[businessid][bOrderState] == 2)
  1853. {
  1854. return SendClientMessageEx(playerid, COLOR_GREY, "You can't change the supply point when a delivery is on its way.");
  1855. }
  1856. GetPlayerPos(playerid, Businesses[businessid][bSupplyPos][0], Businesses[businessid][bSupplyPos][1], Businesses[businessid][bSupplyPos][2]);
  1857. SendClientMessageEx(playerid, COLOR_WHITE, "You have edited the supply point!");
  1858. format(string, sizeof(string), "%s has changed BusinessID %d's Supply Point to X:%f Y:%f Z:%f", GetPlayerNameEx(playerid), businessid, Businesses[businessid][bSupplyPos][0], Businesses[businessid][bSupplyPos][1],Businesses[businessid][bSupplyPos][2]);
  1859. Log("logs/bedit.log", string);
  1860. }
  1861. else if(!strcmp(choice, "price", true))
  1862. {
  1863. Businesses[businessid][bValue] = amount;
  1864. format(string, sizeof(string), "You have set the business price to $%d.", amount);
  1865. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1866. format(string, sizeof(string), "%s has changed BusinessID %d's Price to $%d.", GetPlayerNameEx(playerid), businessid, amount);
  1867. Log("logs/bedit.log", string);
  1868. }
  1869. else if(!strcmp(choice, "type", true))
  1870. {
  1871. if(Businesses[businessid][bOrderState] == 2)
  1872. {
  1873. return SendClientMessageEx(playerid, COLOR_GREY, "You can't change the business type when a delivery is on its way.");
  1874. }
  1875. Businesses[businessid][bType] = amount;
  1876. format(string, sizeof(string), "You have set the business type to %s.", GetBusinessTypeName(amount));
  1877. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1878. format(string, sizeof(string), "%s has changed BusinessID %d's Type to %s (%d).", GetPlayerNameEx(playerid), businessid, GetBusinessTypeName(amount), amount);
  1879. Log("logs/bedit.log", string);
  1880. }
  1881. else if(!strcmp(choice, "inventory", true))
  1882. {
  1883. Businesses[businessid][bInventory] = amount;
  1884. format(string, sizeof(string), "You have set the business inventory to %d.", amount);
  1885. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1886. format(string, sizeof(string), "%s has changed BusinessID %d's Inventory to %d.", GetPlayerNameEx(playerid), businessid, amount);
  1887. Log("logs/bedit.log", string);
  1888. }
  1889. else if(!strcmp(choice, "InventoryCapacity", true))
  1890. {
  1891. Businesses[businessid][bInventoryCapacity] = amount;
  1892. format(string, sizeof(string), "You have set the business inventory capacity to %d.", amount);
  1893. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1894. format(string, sizeof(string), "%s has changed BusinessID %d's Inventory Capacity to %d.", GetPlayerNameEx(playerid), businessid, amount);
  1895. Log("logs/bedit.log", string);
  1896. }
  1897. else if(!strcmp(choice, "safebalance", true))
  1898. {
  1899. Businesses[businessid][bSafeBalance] = amount;
  1900. format(string, sizeof(string), "You have set the business safe to %d.", amount);
  1901. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1902. format(string, sizeof(string), "%s has changed BusinessID %d's safe to %d.", GetPlayerNameEx(playerid), businessid, amount);
  1903. Log("logs/bedit.log", string);
  1904. }
  1905. else if (!strcmp(choice, "gymentryfee", true))
  1906. {
  1907. if (Businesses[businessid][bType] != BUSINESS_TYPE_GYM)
  1908. {
  1909. return SendClientMessageEx(playerid, COLOR_GRAD2, "Only Gyms can have entrance fees!");
  1910. }
  1911. Businesses[businessid][bGymEntryFee] = amount;
  1912. format(string, sizeof(string), "You have set the gym entry fee to %i.", amount);
  1913. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1914. format(string, sizeof(string), "%s has changed BusinessID %i's gym entry fee to %i.", GetPlayerNameEx(playerid), businessid, amount);
  1915. Log("logs/bedit.log", string);
  1916. }
  1917. else if (!strcmp(choice, "gymtype", true))
  1918. {
  1919. if (Businesses[businessid][bType] != BUSINESS_TYPE_GYM)
  1920. {
  1921. return SendClientMessageEx(playerid, COLOR_GRAD2, "You can only use this command on a gym!");
  1922. }
  1923. if (amount == 1) // swimming pool & boxing arena
  1924. {
  1925. Businesses[businessid][bGymType] = amount;
  1926. }
  1927. else if (amount == 2) // bike parkour
  1928. {
  1929. Businesses[businessid][bGymType] = amount;
  1930. }
  1931. else
  1932. {
  1933. return SendClientMessageEx(playerid, COLOR_GRAD2, "Available types are: Swimming Pool / Boxing Arena(1) or Bike Parkour (2)");
  1934. }
  1935. format(string, sizeof(string), "You have the set the gym type to %i.", amount);
  1936. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1937. format(string, sizeof(string), "%s has changed BusinessID %i's gym type to %i.", GetPlayerNameEx(playerid), businessid, amount);
  1938. Log("logs/bedit.log", string);
  1939. }
  1940. else if(!strcmp(choice, "delete", true))
  1941. {
  1942. Businesses[businessid][bExtPos][0] = 0;
  1943. Businesses[businessid][bExtPos][1] = 0;
  1944. Businesses[businessid][bExtPos][2] = 0;
  1945. Businesses[businessid][bName][0] = 0;
  1946. Businesses[businessid][bType] = 0;
  1947. format(string, sizeof(string), "You have deleted the business.", amount);
  1948. SendClientMessageEx(playerid, COLOR_WHITE, string);
  1949. format(string, sizeof(string), "%s has deleted BusinessID %d.", GetPlayerNameEx(playerid), businessid);
  1950. Log("logs/bedit.log", string);
  1951. for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++) {
  1952. DestroyDynamicGasPump(businessid, i);
  1953. }
  1954. for (new i; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++) {
  1955. if(IsValidVehicle(Businesses[businessid][bVehID][i])) DestroyVehicle(Businesses[businessid][bVehID][i]);
  1956. if(IsValidDynamic3DTextLabel(Businesses[businessid][bVehicleLabel][i])) DestroyDynamic3DTextLabel(Businesses[businessid][bVehicleLabel][i]), Businesses[businessid][bVehicleLabel][i] = Text3D:-1;
  1957. Businesses[businessid][bModel][i] = 0;
  1958. Businesses[businessid][bParkPosX][i] = 0;
  1959. Businesses[businessid][bParkPosY][i] = 0;
  1960. Businesses[businessid][bParkPosZ][i] = 0;
  1961. Businesses[businessid][bParkAngle][i] = 0;
  1962. Businesses[businessid][bVehID][i] = 0;
  1963. Businesses[businessid][bPrice][i] = 0;
  1964. SaveDealershipVehicle(businessid, i);
  1965. }
  1966. }
  1967. RefreshBusinessPickup(businessid);
  1968. SaveBusiness(businessid);
  1969. Streamer_UpdateEx(playerid, Businesses[businessid][bExtPos][0], Businesses[businessid][bExtPos][1], Businesses[businessid][bExtPos][2]);
  1970. return 1;
  1971. }
  1972. CMD:bname(playerid, params[])
  1973. {
  1974. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pBM] >= 1)
  1975. {
  1976. new name[40], businessid;
  1977. if(sscanf(params, "ds[40]", businessid, name)) {
  1978. return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bname [business id] [name]");
  1979. }
  1980. else if (!IsValidBusinessID(businessid)) {
  1981. return SendClientMessageEx(playerid, COLOR_GREY, "Invalid business specified.");
  1982. }
  1983. else if(strfind(name, "\r") != -1 || strfind(name, "\n") != -1) {
  1984. return SendClientMessageEx(playerid, COLOR_GREY, "Newline characters are forbidden.");
  1985. }
  1986. strcpy(Businesses[businessid][bName], name, sizeof(name));
  1987. SaveBusiness(businessid);
  1988. SendClientMessageEx(playerid, COLOR_WHITE, "You have successfully changed the name of this business.");
  1989. RefreshBusinessPickup(businessid);
  1990. new string[128];
  1991. format(string, sizeof(string), "%s has edited business ID %d's name to %s.", GetPlayerNameEx(playerid), businessid, Businesses[businessid][bName]);
  1992. Log("logs/bedit.log", string);
  1993. }
  1994. else
  1995. {
  1996. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
  1997. }
  1998. return 1;
  1999. }
  2000. CMD:bnext(playerid, params[])
  2001. {
  2002. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pBM] >= 1)
  2003. {
  2004. SendClientMessageEx(playerid, COLOR_RED, "* Listing next available business...");
  2005. for(new i; i<MAX_BUSINESSES;i++)
  2006. {
  2007. if(Businesses[i][bExtPos] == 0.0)
  2008. {
  2009. new string[128];
  2010. format(string, sizeof(string), "%d is available to use.", i);
  2011. SendClientMessageEx(playerid, COLOR_WHITE, string);
  2012. break;
  2013. }
  2014. }
  2015. }
  2016. else
  2017. {
  2018. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
  2019. }
  2020. return 1;
  2021. }
  2022. CMD:bnear(playerid, params[])
  2023. {
  2024. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pBM] >= 1)
  2025. {
  2026. SendClientMessageEx(playerid, COLOR_RED, "* Listing businesses within 30 meters of you");
  2027. for(new i;i<MAX_BUSINESSES;i++)
  2028. {
  2029. if(IsPlayerInRangeOfPoint(playerid, 30, Businesses[i][bExtPos][0], Businesses[i][bExtPos][1], Businesses[i][bExtPos][2]))
  2030. {
  2031. new string[128];
  2032. format(string, sizeof(string), "Business ID %d | %f from you", i, GetPlayerDistanceFromPoint(playerid,Businesses[i][bExtPos][0], Businesses[i][bExtPos][1], Businesses[i][bExtPos][2]));
  2033. SendClientMessageEx(playerid, COLOR_WHITE, string);
  2034. }
  2035. }
  2036. }
  2037. else
  2038. {
  2039. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
  2040. }
  2041. return 1;
  2042. }
  2043. CMD:gotobiz(playerid, params[])
  2044. {
  2045. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pBM] >= 1)
  2046. {
  2047. new id;
  2048. if(sscanf(params, "d", id)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /gotobiz [business id]");
  2049. if(!IsValidBusinessID(id)) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid business ID specified.");
  2050. if (Businesses[id][bExtPos][0] == 0.0) return SendClientMessageEx(playerid, COLOR_GREY, "No exterior set for this business.");
  2051. GameTextForPlayer(playerid, "~w~Teleporting", 5000, 1);
  2052. SetPlayerInterior(playerid, 0);
  2053. SetPlayerVirtualWorld(playerid, 0);
  2054. PlayerInfo[playerid][pInt] = 0;
  2055. PlayerInfo[playerid][pVW] = 0;
  2056. SetPlayerPos(playerid,Businesses[id][bExtPos][0],Businesses[id][bExtPos][1],Businesses[id][bExtPos][2]);
  2057. SetPlayerFacingAngle(playerid,Businesses[id][bExtPos][3]);
  2058. }
  2059. else
  2060. {
  2061. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
  2062. }
  2063. return 1;
  2064. }
  2065. CMD:goinbiz(playerid, params[])
  2066. {
  2067. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pBM] >= 1)
  2068. {
  2069. new id;
  2070. if(sscanf(params, "d", id)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /goinbiz [businessid]");
  2071. if(!IsValidBusinessID(id)) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid business ID specified.");
  2072. if (Businesses[id][bExtPos][0] == 0.0) return SendClientMessageEx(playerid, COLOR_GREY, "No interior set for this business.");
  2073. SetPlayerInterior(playerid,Businesses[id][bInt]);
  2074. SetPlayerPos(playerid,Businesses[id][bIntPos][0],Businesses[id][bIntPos][1],Businesses[id][bIntPos][2]);
  2075. SetPlayerFacingAngle(playerid,Businesses[id][bIntPos][3]);
  2076. SetPVarInt(playerid, "BusinessesID", id);
  2077. if(Businesses[id][bVW] == 0) SetPlayerVirtualWorld(playerid, BUSINESS_BASE_VW + id), PlayerInfo[playerid][pVW] = BUSINESS_BASE_VW + id;
  2078. else SetPlayerVirtualWorld(playerid, Businesses[id][bVW]), PlayerInfo[playerid][pVW] = Businesses[id][bVW];
  2079. }
  2080. else
  2081. {
  2082. SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
  2083. }
  2084. return 1;
  2085. }
  2086. CMD:asellbiz(playerid, params[])
  2087. {
  2088. if (PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pASM] < 1 && PlayerInfo[playerid][pBM] < 2) {
  2089. return SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use that command.");
  2090. }
  2091. new string[128], biz;
  2092. if(sscanf(params, "d", biz)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /asellbiz [business id]");
  2093. Businesses[biz][bOwner] = -1;
  2094. SaveBusiness(biz);
  2095. RefreshBusinessPickup(biz);
  2096. new ip[16];
  2097. GetPlayerIp(playerid,ip,sizeof(ip));
  2098. format(string,sizeof(string),"Administrator %s (IP: %s) has admin-sold business ID %d (was owned by %d).",GetPlayerNameEx(playerid),ip,biz,Businesses[biz][bOwner]);
  2099. Log("logs/business.log", string);
  2100. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  2101. format(string, sizeof(string), "~w~You have sold business %d.", biz);
  2102. GameTextForPlayer(playerid, string, 10000, 3);
  2103. foreach(new j: Player)
  2104. {
  2105. if(PlayerInfo[j][pBusiness] == biz)
  2106. {
  2107. PlayerInfo[j][pBusiness] = INVALID_BUSINESS_ID;
  2108. PlayerInfo[j][pBusinessRank] = 0;
  2109. SendClientMessageEx(playerid, COLOR_WHITE, "An admin has sold this business, your business stats have been reset.");
  2110. }
  2111. }
  2112. mysql_format(MainPipeline, string, sizeof(string), "UPDATE `accounts` SET `Business` = "#INVALID_BUSINESS_ID", `BusinessRank` = 0 WHERE `Business` = '%d'", biz);
  2113. mysql_tquery(MainPipeline, string, "OnQueryFinish", "i", SENDDATA_THREAD);
  2114. return 1;
  2115. }
  2116. /*CMD:sellbiz(playerid, params[])
  2117. {
  2118. if(PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID )
  2119. {
  2120. return SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business!");
  2121. }
  2122. else if(PlayerInfo[playerid][pBusinessRank] < 5 && Businesses[PlayerInfo[playerid][pBusiness]][bOwner] != GetPlayerSQLId(playerid)) {
  2123. return SendClientMessageEx(playerid, COLOR_GREY, "You aren't the owner of the business.");
  2124. }
  2125. else if (IsPlayerInRangeOfPoint(playerid, 2.0, Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][2]))
  2126. {
  2127. new i = PlayerInfo[playerid][pBusiness];
  2128. PlayerInfo[playerid][pBusiness] = INVALID_BUSINESS_ID;
  2129. PlayerInfo[playerid][pBusinessRank] = 0;
  2130. GivePlayerCash(playerid,Businesses[i][bValue]);
  2131. OnPlayerStatsUpdate(playerid);
  2132. Businesses[i][bOwner] = -1;
  2133. SaveBusiness(i);
  2134. RefreshBusinessPickup(i);
  2135. new string[128];
  2136. format(string,sizeof(string),"%s (IP: %s) has sold business ID %d for $%d",GetPlayerNameEx(playerid),GetPlayerIpEx(playerid),i, Businesses[i][bValue]);
  2137. Log("logs/business.log", string);
  2138. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  2139. format(string, sizeof(string), "~w~Congratulations~n~You have sold your business for ~n~~g~$%d", Businesses[i][bValue]);
  2140. GameTextForPlayer(playerid, string, 10000, 3);
  2141. foreach(new j: Player) {
  2142. if(PlayerInfo[j][pBusiness] == i) {
  2143. PlayerInfo[j][pBusiness] = INVALID_BUSINESS_ID;
  2144. PlayerInfo[j][pBusinessRank] = 0;
  2145. SendClientMessageEx(playerid, COLOR_WHITE, "The owner of the business you were a part of has sold his business.");
  2146. }
  2147. }
  2148. format(string, sizeof(string), "UPDATE `accounts` SET `Business` = "#INVALID_BUSINESS_ID", `BusinessRank` = 0 WHERE `Business` = '%d'", i);
  2149. mysql_tquery(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
  2150. return 1;
  2151. }
  2152. else
  2153. {
  2154. SendClientMessageEx(playerid, COLOR_WHITE, "You need to be at your business in order to sell it.");
  2155. return 1;
  2156. }
  2157. }
  2158. CMD:buybiz(playerid, params[])
  2159. {
  2160. if(PlayerInfo[playerid][pBusiness] != INVALID_BUSINESS_ID) return SendClientMessageEx(playerid, COLOR_GREY, "You already own a business!");
  2161. for(new i = 0; i < sizeof(Businesses); i++)
  2162. {
  2163. if(IsPlayerInRangeOfPoint(playerid, 2.0, Businesses[i][bExtPos][0], Businesses[i][bExtPos][1], Businesses[i][bExtPos][2]))
  2164. {
  2165. if (Businesses[i][bOwner] >= 1)
  2166. {
  2167. return SendClientMessageEx(playerid, COLOR_GREY, "This business is already owned!");
  2168. }
  2169. if (GetPlayerCash(playerid) < Businesses[i][bValue])
  2170. {
  2171. return SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough cash!");
  2172. }
  2173. GivePlayerCash(playerid, -Businesses[i][bValue]);
  2174. Businesses[i][bOwner] = GetPlayerSQLId(playerid);
  2175. strcpy(Businesses[i][bOwnerName], GetPlayerNameEx(playerid), MAX_PLAYER_NAME);
  2176. PlayerInfo[playerid][pBusiness] = i;
  2177. PlayerInfo[playerid][pBusinessRank] = 5;
  2178. SendClientMessageEx(playerid, COLOR_WHITE, "Congratulations on your new purchase!");
  2179. SendClientMessageEx(playerid, COLOR_WHITE, "Type /help to review the business help section!");
  2180. SaveBusiness(i);
  2181. OnPlayerStatsUpdate(playerid);
  2182. RefreshBusinessPickup(i);
  2183. new string[128];
  2184. format(string,sizeof(string),"%s (IP: %s) has bought business ID %d for $%d.", GetPlayerNameEx(playerid), GetPlayerIpEx(playerid), i, Businesses[i][bValue]);
  2185. Log("logs/business.log", string);
  2186. return 1;
  2187. }
  2188. }
  2189. return SendClientMessageEx(playerid, COLOR_WHITE, "You're not near a business!");
  2190. }
  2191. */
  2192. CMD:creategaspump(playerid, params[])
  2193. {
  2194. new string[128], iBusinessID;
  2195. if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pBM] >= 1) {
  2196. if(sscanf(params, "d", iBusinessID)) {
  2197. return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /creategaspump [business id]");
  2198. }
  2199. else
  2200. {
  2201. if (GetFreeGasPumpID(iBusinessID) == INVALID_GAS_PUMP)
  2202. return SendClientMessageEx(playerid, COLOR_GRAD1, "The maximum number of gas pumps has been reached for this business.");
  2203. if (!(0 <= iBusinessID < MAX_BUSINESSES)) {
  2204. return SendClientMessageEx(playerid, COLOR_GREY, "Invalid business specified.");
  2205. }
  2206. if (!Businesses[iBusinessID][bType]) {
  2207. return SendClientMessageEx(playerid, COLOR_GREY, "Type of this business must have been set before using this command.");
  2208. }
  2209. if(!IsBusinessGasAble(Businesses[iBusinessID][bType])) {
  2210. return SendClientMessageEx(playerid, COLOR_GREY, "You can't create gas pumps for this type of business.");
  2211. }
  2212. if(!IsPlayerInRangeOfPoint(playerid, 150.0, Businesses[iBusinessID][bExtPos][0], Businesses[iBusinessID][bExtPos][1], Businesses[iBusinessID][bExtPos][2])) {
  2213. return SendClientMessageEx(playerid, COLOR_GREY, "You are too far away from the business.");
  2214. }
  2215. new iPump = GetFreeGasPumpID(iBusinessID);
  2216. Businesses[iBusinessID][GasPumpCapacity][iPump] = Businesses[iBusinessID][bLevel] * 100;
  2217. CreateDynamicGasPump(playerid, iBusinessID, iPump);
  2218. SaveBusiness(iBusinessID);
  2219. format(string, sizeof(string), "%s has created a gas pump for %s (%d)", Businesses[iBusinessID][bName], iBusinessID);
  2220. Log("logs/bedit.log", string);
  2221. return 1;
  2222. }
  2223. } else return SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use this command.");
  2224. }
  2225. CMD:editgaspump(playerid, params[])
  2226. {
  2227. new iBusinessID, iPumpID, szLog[128], szName[9], Float: fValue;
  2228. if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pASM] < 1 && PlayerInfo[playerid][pBM] < 1) {
  2229. return SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use this command.");
  2230. }
  2231. if(sscanf(params, "dds[9]F(0)", iBusinessID, iPumpID, szName, fValue)) {
  2232. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /editgaspump [business id] [pump id] [name] [value]");
  2233. SendClientMessageEx(playerid, COLOR_GREY, "Available Names: Capacity, Gas, Position");
  2234. }
  2235. if (!(0 <= iBusinessID < MAX_BUSINESSES))
  2236. {
  2237. return SendClientMessageEx(playerid, COLOR_GREY, "Invalid business specified.");
  2238. }
  2239. else if (!(0 <= iPumpID < MAX_BUSINESS_GAS_PUMPS))
  2240. {
  2241. return SendClientMessageEx(playerid, COLOR_GREY, "Invalid gas pump specified.");
  2242. }
  2243. else if(Businesses[iBusinessID][GasPumpVehicleID][iPumpID])
  2244. {
  2245. return SendClientMessageEx(playerid, COLOR_GREY, "You can't edit a gas pump while it is in use.");
  2246. }
  2247. if(!strcmp(szName, "position", true))
  2248. {
  2249. if(!IsPlayerInRangeOfPoint(playerid, 150.0, Businesses[iBusinessID][bExtPos][0], Businesses[iBusinessID][bExtPos][1], Businesses[iBusinessID][bExtPos][2])) {
  2250. return SendClientMessageEx(playerid, COLOR_GREY, "You are far away from the business.");
  2251. }
  2252. format(szLog, sizeof(szLog), "%s has changed the position of pump %d for business %d", GetPlayerNameEx(playerid), iPumpID, iBusinessID);
  2253. DestroyDynamicGasPump(iBusinessID, iPumpID);
  2254. CreateDynamicGasPump(playerid, iBusinessID, iPumpID);
  2255. SaveBusiness(iBusinessID);
  2256. }
  2257. else if(!strcmp(szName, "gas", true))
  2258. {
  2259. if (fValue > Businesses[iBusinessID][GasPumpCapacity][iPumpID])
  2260. {
  2261. SendClientMessageEx(playerid, COLOR_GREY, "The value cannot be higher than the capacity!");
  2262. return 1;
  2263. }
  2264. Businesses[iBusinessID][GasPumpGallons][iPumpID] = fValue;
  2265. SendClientMessageEx(playerid, COLOR_WHITE, "You have edited the gas pump gas amount!");
  2266. format(szLog, sizeof(szLog), "%s has changed the gas amount of pump %d for %s (%d) to %.2f", GetPlayerNameEx(playerid), iPumpID, Businesses[iBusinessID][bName], iBusinessID, fValue);
  2267. }
  2268. else if(!strcmp(szName, "capacity", true))
  2269. {
  2270. Businesses[iBusinessID][GasPumpCapacity][iPumpID] = fValue;
  2271. SendClientMessageEx(playerid, COLOR_WHITE, "You have edited the gas pump capacity!");
  2272. format(szLog, sizeof(szLog), "%s has changed the gas capacity of pump %d for %s (%d) to %.2f", GetPlayerNameEx(playerid), iPumpID, Businesses[iBusinessID][bName], iBusinessID, fValue);
  2273. }
  2274. SaveBusiness(iBusinessID);
  2275. Log("logs/bedit.log", szLog);
  2276. return 1;
  2277. }
  2278. CMD:deletegaspump(playerid, params[])
  2279. {
  2280. if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pASM] < 1 && PlayerInfo[playerid][pBM] < 1) {
  2281. return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
  2282. }
  2283. new businessid, id, string[128];
  2284. if(sscanf(params, "dd", businessid, id)) {
  2285. return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /deletegaspump [business id] [pump id]");
  2286. }
  2287. if(!IsValidBusinessID(businessid) || id < 0 || id >= MAX_BUSINESS_GAS_PUMPS || Businesses[businessid][GasPumpPosX][id] == 0) {
  2288. return SendClientMessageEx(playerid, COLOR_GREY, "No gas pump found with that ID.");
  2289. }
  2290. if(Businesses[businessid][GasPumpVehicleID][id]) {
  2291. return SendClientMessageEx(playerid, COLOR_GREY, "You can't delete a gas pump while it is in use.");
  2292. }
  2293. DestroyDynamicGasPump(businessid, id);
  2294. Businesses[businessid][GasPumpPosX][id] = 0;
  2295. Businesses[businessid][GasPumpPosY][id] = 0;
  2296. Businesses[businessid][GasPumpPosZ][id] = 0;
  2297. Businesses[businessid][GasPumpAngle][id] = 0;
  2298. Businesses[businessid][GasPumpCapacity][id] = 0;
  2299. Businesses[businessid][GasPumpGallons][id] = 0;
  2300. Businesses[businessid][GasPumpSaleGallons][id] = 0;
  2301. Businesses[businessid][GasPumpSalePrice][id] = 0;
  2302. SaveBusiness(businessid);
  2303. format(string, sizeof(string), "You have successfully deleted the gas pump %d for business %d.", id, businessid);
  2304. SendClientMessageEx(playerid, COLOR_WHITE, string);
  2305. format(string, sizeof(string), "Admin %s deleted a gas pump for business %d", businessid);
  2306. Log("logs/bedit.log", string);
  2307. return 1;
  2308. }
  2309. CMD:addmats(playerid, params[]) {
  2310. return cmd_addmaterials(playerid, params);
  2311. }
  2312. CMD:addmaterials(playerid, params[])
  2313. {
  2314. new string[128], amount;
  2315. if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
  2316. return SendClientMessageEx(playerid, COLOR_GREY, "You are not in a business!");
  2317. }
  2318. if (Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_GUNSHOP) {
  2319. return SendClientMessageEx(playerid, COLOR_GREY, "Command not available for this type of business.");
  2320. }
  2321. if(sscanf(params, "d", amount) || amount < 0) {
  2322. return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /addmaterials [amount]");
  2323. }
  2324. if (amount > PlayerInfo[playerid][pMats]) {
  2325. return SendClientMessageEx(playerid, COLOR_GREY, "You don't have that many materials.");
  2326. }
  2327. if (Businesses[PlayerInfo[playerid][pBusiness]][bInventory] + amount > Businesses[PlayerInfo[playerid][pBusiness]][bInventoryCapacity]) {
  2328. return SendClientMessageEx(playerid, COLOR_GREY, "Inventory capacity exceeded.");
  2329. }
  2330. if (InBusiness(playerid) != PlayerInfo[playerid][pBusiness]) {
  2331. return SendClientMessageEx(playerid, COLOR_GREY, "You must be inside the business.");
  2332. }
  2333. Businesses[PlayerInfo[playerid][pBusiness]][bInventory] += amount;
  2334. PlayerInfo[playerid][pMats] -= amount;
  2335. OnPlayerStatsUpdate(playerid);
  2336. SaveBusiness(PlayerInfo[playerid][pBusiness]);
  2337. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have successfully added materials to the business inventory!");
  2338. format(string, sizeof(string), "INVENTORY: %d/%d materials", Businesses[PlayerInfo[playerid][pBusiness]][bInventory], Businesses[PlayerInfo[playerid][pBusiness]][bInventoryCapacity]);
  2339. SendClientMessageEx(playerid, COLOR_WHITE, string);
  2340. return 1;
  2341. }
  2342. /*CMD:offergun(playerid, params[])
  2343. {
  2344. if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_GUNSHOP) {
  2345. return SendClientMessageEx(playerid, COLOR_GREY, "You are not working for a gun store!");
  2346. }
  2347. new buyerid, weapon;
  2348. if (sscanf(params, "uk<sweapon>", buyerid, weapon)) {
  2349. return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /offergun [player] [weapon name]");
  2350. }
  2351. if (!IsPlayerConnected(buyerid)) {
  2352. return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified!");
  2353. }
  2354. if (playerid == buyerid) {
  2355. return SendClientMessageEx(playerid, COLOR_GREY, "You can't offer a gun to yourself!");
  2356. }
  2357. if(!ProxDetectorS(5.0, playerid, buyerid)) {
  2358. return SendClientMessageEx(playerid, COLOR_GREY, "The customer is not near you!");
  2359. }
  2360. if (InBusiness(playerid) != PlayerInfo[playerid][pBusiness]) {
  2361. return SendClientMessageEx(playerid, COLOR_GREY, "You are not inside the business!");
  2362. }
  2363. if(PlayerInfo[buyerid][pConnectHours] < 2 || PlayerInfo[buyerid][pWRestricted] > 0) {
  2364. return SendClientMessageEx(playerid, COLOR_GREY, "That player is currently weapon restricted!");
  2365. }
  2366. new b = InBusiness(playerid);
  2367. if (Businesses[b][bInventory] < GetWeaponParam(weapon, WeaponMats)) {
  2368. return SendClientMessageEx(playerid, COLOR_GREY, "Business inventory does not have enough materials for that weapon.");
  2369. }
  2370. if (Businesses[b][bInventory] < GetWeaponParam(weapon, WeaponMinLevel)) {
  2371. return SendClientMessageEx(playerid, COLOR_GREY, "Business level is not high enough to sell that type of gun.");
  2372. }
  2373. new price = GetWeaponPrice(PlayerInfo[playerid][pBusiness], weapon);
  2374. new string[128];
  2375. format(string, sizeof(string), "* You offered %s to buy a %s for $%s", GetPlayerNameEx(buyerid), Weapon_ReturnName(weapon), number_format(price));
  2376. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  2377. format(string, sizeof(string), "* Employee %s offers you a %s for $%s (type /accept gun) to buy.", GetPlayerNameEx(playerid), Weapon_ReturnName(weapon), number_format(price));
  2378. SendClientMessageEx(buyerid, COLOR_LIGHTBLUE, string);
  2379. SetPVarInt(buyerid, "Business_WeapType", weapon);
  2380. SetPVarInt(buyerid, "Business_WeapOfferer", playerid);
  2381. SetPVarInt(buyerid, "Business_WeapOffererSQLId", GetPlayerSQLId(playerid));
  2382. SetPVarInt(buyerid, "Business_WeapPrice", price);
  2383. return 1;
  2384. }*/
  2385. CMD:offermenu(playerid, params[])
  2386. {
  2387. new iBusiness = InBusiness(playerid);
  2388. if(iBusiness == INVALID_BUSINESS_ID || (Businesses[iBusiness][bType] != BUSINESS_TYPE_BAR && Businesses[iBusiness][bType] != BUSINESS_TYPE_CLUB && Businesses[iBusiness][bType] != BUSINESS_TYPE_RESTAURANT)) return SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a bar, club or restaurant!");
  2389. else if(Businesses[iBusiness][bInventory] < 1) return SendClientMessageEx(playerid, COLOR_GRAD2, " Business does not have enough inventory!");
  2390. if(GetPlayerInterior(playerid) != Businesses[iBusiness][bInt]) return 1;
  2391. new szDialog[512], pvar[25], line;
  2392. if (Businesses[iBusiness][bType] == BUSINESS_TYPE_BAR || Businesses[iBusiness][bType] == BUSINESS_TYPE_CLUB)
  2393. {
  2394. for (new item; item < sizeof(Drinks); item++)
  2395. {
  2396. new cost = (PlayerInfo[playerid][pDonateRank] >= 1) ? (floatround(Businesses[iBusiness][bItemPrices][item] * 0.8)) : (Businesses[iBusiness][bItemPrices][item]);
  2397. format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, Drinks[item], number_format(cost));
  2398. format(pvar, sizeof(pvar), "Business_MenuItem%d", line);
  2399. SetPVarInt(playerid, pvar, item);
  2400. format(pvar, sizeof(pvar), "Business_MenuItemPrice%d", line);
  2401. SetPVarInt(playerid, pvar, Businesses[iBusiness][bItemPrices][item]);
  2402. line++;
  2403. }
  2404. }
  2405. else if(Businesses[iBusiness][bType] == BUSINESS_TYPE_RESTAURANT)
  2406. {
  2407. for (new item; item < sizeof(RestaurantItems); ++item)
  2408. {
  2409. new cost = (PlayerInfo[playerid][pDonateRank] >= 1) ? (floatround(Businesses[iBusiness][bItemPrices][item] * 0.8)) : (Businesses[iBusiness][bItemPrices][item]);
  2410. format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, RestaurantItems[item], number_format(cost));
  2411. format(pvar, sizeof(pvar), "Business_MenuItem%d", line);
  2412. SetPVarInt(playerid, pvar, item);
  2413. format(pvar, sizeof(pvar), "Business_MenuItemPrice%d", line);
  2414. SetPVarInt(playerid, pvar, Businesses[iBusiness][bItemPrices][item]);
  2415. line++;
  2416. }
  2417. }
  2418. if(strlen(szDialog) == 0) SendClientMessageEx(playerid, COLOR_GRAD2, " Store is not selling any items!");
  2419. else ShowPlayerDialogEx(playerid, RESTAURANTMENU, DIALOG_STYLE_LIST, "Menu", szDialog, "Buy", "Cancel");
  2420. return 1;
  2421. }
  2422. CMD:buyfood(playerid, params[])
  2423. {
  2424. if (!IsAtRestaurant(playerid))
  2425. {
  2426. SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a restaurant!");
  2427. return 1;
  2428. }
  2429. new iBusiness = InBusiness(playerid);
  2430. if (Businesses[iBusiness][bInventory] < 1) {
  2431. SendClientMessageEx(playerid, COLOR_GRAD2, " Business does not have enough inventory!");
  2432. return 1;
  2433. }
  2434. if (!Businesses[iBusiness][bStatus])
  2435. {
  2436. SendClientMessageEx(playerid, COLOR_WHITE, "This restaurant is closed!");
  2437. return 1;
  2438. }
  2439. if(Businesses[iBusiness][bMaxLevel] > 0 && PlayerInfo[playerid][pConnectHours] > Businesses[iBusiness][bMaxLevel])
  2440. return SendClientMessageEx(playerid, COLOR_GRAD2, "The cashier has denied you service, this discount store is for new citizens only.");
  2441. new szDialog[512], pvar[25], line;
  2442. for (new item; item < sizeof(RestaurantItems); ++item)
  2443. {
  2444. format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, RestaurantItems[item], number_format(Businesses[iBusiness][bItemPrices][item]));
  2445. format(pvar, sizeof(pvar), "Business_MenuItem%d", line);
  2446. SetPVarInt(playerid, pvar, item);
  2447. format(pvar, sizeof(pvar), "Business_MenuItemPrice%d", line);
  2448. SetPVarInt(playerid, pvar, Businesses[iBusiness][bItemPrices][item]);
  2449. line++;
  2450. }
  2451. if (strlen(szDialog) == 0)
  2452. {
  2453. SendClientMessageEx(playerid, COLOR_GRAD2, " Store is not selling any items!");
  2454. }
  2455. else
  2456. {
  2457. ShowPlayerDialogEx(playerid, RESTAURANTMENU, DIALOG_STYLE_LIST, "Menu", szDialog, "Buy", "Cancel");
  2458. }
  2459. return 1;
  2460. }
  2461. CMD:bpanic(playerid, params[])
  2462. {
  2463. if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
  2464. return SendClientMessageEx(playerid, COLOR_GREY, "You are not working for a business!");
  2465. }
  2466. if (PlayerInfo[playerid][pBusiness] != InBusiness(playerid)) {
  2467. return SendClientMessageEx(playerid, COLOR_GREY, "You are not in the business interior!");
  2468. }
  2469. new string[128];
  2470. if(GetPVarInt(playerid, "bizpanic") == 0)
  2471. {
  2472. format(string, sizeof(string), "** %s hits a small button.", GetPlayerNameEx(playerid));
  2473. ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  2474. format(string, sizeof(string), "* %s %s has hit the panic button at %s - /bizfind %d for a gps location.", GetBusinessRankName(PlayerInfo[playerid][pBusinessRank]), GetPlayerNameEx(playerid), Businesses[InBusiness(playerid)][bName], InBusiness(playerid));
  2475. SendClientMessage(playerid, COLOR_GRAD2, "* The police have been notified that you require help. ");
  2476. SetPVarInt(playerid, "bizpanic", 1);
  2477. }
  2478. else
  2479. {
  2480. format(string, sizeof(string), "** %s hits a small button.", GetPlayerNameEx(playerid));
  2481. ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  2482. format(string, sizeof(string), "* %s %s no longer requires help at %s.", GetBusinessRankName(PlayerInfo[playerid][pBusinessRank]), GetPlayerNameEx(playerid), Businesses[InBusiness(playerid)][bName]);
  2483. SendClientMessage(playerid, COLOR_GRAD2, "* The police have been notified that you no longer require help. ");
  2484. SetPVarInt(playerid, "bizpanic", 0);
  2485. }
  2486. foreach(new i: Player)
  2487. {
  2488. if(IsACop(i))
  2489. {
  2490. SetPlayerMarkerForPlayer(i, playerid, 0x2641FEAA);
  2491. SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
  2492. }
  2493. }
  2494. return 1;
  2495. }
  2496. CMD:bizfind(playerid, params[])
  2497. {
  2498. if(IsACop(playerid))
  2499. {
  2500. new iBusinessID, string[128];
  2501. if(sscanf(params, "d", iBusinessID))
  2502. {
  2503. return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bizfind [business id]");
  2504. }
  2505. if(IsValidBusinessID(iBusinessID))
  2506. {
  2507. if(Businesses[iBusinessID][bOwner])
  2508. {
  2509. SetPVarInt(playerid,"bpanic", 1);
  2510. format(string, sizeof(string), "* Setting your GPS Waypoint to find %s", Businesses[iBusinessID][bName]);
  2511. SetPlayerCheckpoint(playerid, Businesses[iBusinessID][bExtPos][0], Businesses[iBusinessID][bExtPos][1], Businesses[iBusinessID][bExtPos][2], 4.0);
  2512. return 1;
  2513. }
  2514. return SendClientMessageEx(playerid, COLOR_GRAD2, " That business doesn't have an owner. ");
  2515. }
  2516. return SendClientMessageEx(playerid, COLOR_GRAD2, " Invalid Business ID.");
  2517. }
  2518. return SendClientMessageEx(playerid, COLOR_GRAD2, " You do not have access to the Business Directory. (Law Enforcement Only)");
  2519. }
  2520. CMD:binventory(playerid, params[])
  2521. {
  2522. new
  2523. string[128],
  2524. iBusiness = PlayerInfo[playerid][pBusiness];
  2525. if(iBusiness != INVALID_BUSINESS_ID)
  2526. {
  2527. SendClientMessageEx(playerid, COLOR_GREEN, "|_________ Business Inventory_________|");
  2528. format(string, sizeof(string), "Amount: %d / Capacity: %d / Type: %s", Businesses[iBusiness][bInventory], Businesses[iBusiness][bInventoryCapacity], GetInventoryType(iBusiness));
  2529. SendClientMessageEx(playerid, COLOR_WHITE, string);
  2530. for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++) {
  2531. if (Businesses[iBusiness][GasPumpPosX][i] != 0.0) {
  2532. format(string, sizeof(string), "Gas Tank %d: %.2f gal / %.2f gal", i+1, Businesses[iBusiness][GasPumpGallons][i], Businesses[iBusiness][GasPumpCapacity][i]);
  2533. SendClientMessageEx(playerid, COLOR_WHITE, string);
  2534. }
  2535. }
  2536. }
  2537. else SendClientMessage(playerid, COLOR_GRAD2, " You don't own or work for a business.");
  2538. return 1;
  2539. }
  2540. CMD:offeritem(playerid, params[])
  2541. {
  2542. new buyerid, item;
  2543. if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_STORE && Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_GASSTATION) {
  2544. return SendClientMessageEx(playerid, COLOR_GREY, "You are not working for a 24/7 store!");
  2545. }
  2546. if (sscanf(params, "uk<storeitem>", buyerid, item)) {
  2547. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /offeritem [Player] [Item]");
  2548. SendClientMessageEx(playerid, COLOR_GREY, "Items - cellphone, phonebook, dice, condom, musicplayer, rope, cigar, sprunk, lock, spraycan, radio, camera, lotteryticket,");
  2549. return SendClientMessageEx(playerid, COLOR_GREY, "checkbook, paper, industriallock, elock, standardcaralarm, helmet");
  2550. }
  2551. if (PlayerInfo[playerid][pBusiness] != InBusiness(playerid)) {
  2552. return SendClientMessageEx(playerid, COLOR_GREY, "You are not in the business interior!");
  2553. }
  2554. if (Businesses[PlayerInfo[playerid][pBusiness]][bInventory] < 1) {
  2555. return SendClientMessageEx(playerid, COLOR_GREY, "Business inventory has no items.");
  2556. }
  2557. if (!IsPlayerConnected(buyerid)) {
  2558. return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified!");
  2559. }
  2560. if (item == INVALID_STORE_ITEM) {
  2561. return SendClientMessageEx(playerid, COLOR_GREY, "Invalid item specified!");
  2562. }
  2563. if (!Businesses[PlayerInfo[playerid][pBusiness]][bItemPrices][item-1]) {
  2564. SendClientMessageEx(playerid, COLOR_GRAD4, "This item is not for sale.");
  2565. return 1;
  2566. }
  2567. if (playerid == buyerid) {
  2568. return SendClientMessageEx(playerid, COLOR_GREY, "You can't offer an item to yourself!");
  2569. }
  2570. if(!ProxDetectorS(5.0, playerid, buyerid)) {
  2571. return SendClientMessageEx(playerid, COLOR_GREY, "The customer is not near you!");
  2572. }
  2573. new string[128];
  2574. format(string, sizeof(string), "* You offered %s to buy a %s.", GetPlayerNameEx(buyerid), StoreItems[item-1]);
  2575. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  2576. format(string, sizeof(string), "* %s wants to sell you a %s for $%s (type /accept item to buy)", GetPlayerNameEx(playerid), StoreItems[item-1], number_format(Businesses[PlayerInfo[playerid][pBusiness]][bItemPrices][item-1]));
  2577. SendClientMessageEx(buyerid, COLOR_LIGHTBLUE, string);
  2578. SetPVarInt(buyerid, "Business_ItemType", item-1);
  2579. SetPVarInt(buyerid, "Business_ItemPrice", Businesses[PlayerInfo[playerid][pBusiness]][bItemPrices][item-1]);
  2580. SetPVarInt(buyerid, "Business_ItemOfferer", playerid);
  2581. SetPVarInt(buyerid, "Business_ItemOffererSQLId", GetPlayerSQLId(playerid));
  2582. return 1;
  2583. }
  2584. CMD:resupply(playerid, params[])
  2585. {
  2586. new iBusiness = PlayerInfo[playerid][pBusiness];
  2587. new amount;
  2588. new string[128];
  2589. new year, month, day;
  2590. if (sscanf(params, "d", amount))
  2591. {
  2592. return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /resupply [amount]");
  2593. }
  2594. if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
  2595. return SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
  2596. }
  2597. if (PlayerInfo[playerid][pBusinessRank] < Businesses[iBusiness][bMinSupplyRank]) {
  2598. return SendClientMessageEx(playerid, COLOR_GREY, "Your rank is not high enough for placing resupply orders!");
  2599. }
  2600. if(amount < 1) {
  2601. return SendClientMessageEx(playerid, COLOR_GREY, "Resupply amount cannot be below 1.");
  2602. }
  2603. if (Businesses[iBusiness][bOrderState] == 1) {
  2604. return SendClientMessageEx(playerid, COLOR_WHITE, "You already have a pending order. Either cancel it or wait for it to be delivered before placing orders.");
  2605. }
  2606. if (Businesses[iBusiness][bOrderState] == 2) {
  2607. return SendClientMessageEx(playerid, COLOR_WHITE, "You already have an order which is being delivered.");
  2608. }
  2609. if (Businesses[iBusiness][bSupplyPos][0] == 0.0) {
  2610. return SendClientMessageEx(playerid, COLOR_GREY, "This business does not have a delivery point for Shipment Contractors.");
  2611. }
  2612. if (Businesses[iBusiness][bInventory] >= Businesses[iBusiness][bInventoryCapacity]) {
  2613. return SendClientMessageEx(playerid, COLOR_GREY, "Inventory is already at full capacity.");
  2614. }
  2615. if(Businesses[iBusiness][bInventory] + amount > Businesses[iBusiness][bInventoryCapacity])
  2616. {
  2617. return SendClientMessageEx(playerid, COLOR_GREY, "Your inventory does not have the capacity.");
  2618. }
  2619. new rSupCost = floatround(amount * BUSINESS_ITEMS_COST);
  2620. if (!Businesses[iBusiness][bSafeBalance] || Businesses[iBusiness][bSafeBalance] < rSupCost || rSupCost < 0) {
  2621. if(rSupCost < 0) format(string, sizeof(string), "!! %s attempted to exploit resupply with an amount of %d in BizID: %d !!", GetPlayerNameEx(playerid), amount, iBusiness), Log("/logs/business.log", string);
  2622. format(string, sizeof(string), "Safe balance is not enough for this. ($%s)", number_format(floatround(amount * BUSINESS_ITEMS_COST)));
  2623. return SendClientMessageEx(playerid, COLOR_GREY, string);
  2624. }
  2625. format(Businesses[iBusiness][bOrderBy], MAX_PLAYER_NAME, "%s", GetPlayerNameEx(playerid));
  2626. getdate(year, month, day);
  2627. format(Businesses[iBusiness][bOrderDate], 30, "%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minuite, second);
  2628. Businesses[iBusiness][bSafeBalance] -= floatround(amount * BUSINESS_ITEMS_COST);
  2629. Businesses[iBusiness][bOrderAmount] = amount;
  2630. Businesses[iBusiness][bOrderState] = 1;
  2631. SaveBusiness(iBusiness);
  2632. format(string, sizeof(string), "%s (IP: %s) has placed a resupply order for %s (%d) - Amount: %d", GetPlayerNameEx(playerid), GetPlayerIpEx(playerid), Businesses[PlayerInfo[playerid][pBusiness]][bName], PlayerInfo[playerid][pBusiness], amount);
  2633. Log("logs/business.log", string);
  2634. format(string, sizeof(string), "* You have placed a resupply order for %s", Businesses[PlayerInfo[playerid][pBusiness]][bName]);
  2635. SendClientMessage(playerid, COLOR_GRAD2, string);
  2636. return 1;
  2637. }
  2638. CMD:checkresupply(playerid, params[])
  2639. {
  2640. new iBusinessID = PlayerInfo[playerid][pBusiness];
  2641. if((0 <= iBusinessID < MAX_BUSINESSES) && PlayerInfo[playerid][pBusinessRank] >= Businesses[iBusinessID][bMinSupplyRank])
  2642. {
  2643. new iOrderState = Businesses[iBusinessID][bOrderState];
  2644. if (!iOrderState)
  2645. {
  2646. SendClientMessageEx(playerid, COLOR_WHITE, "Your business has never placed a resupply order.");
  2647. return 1;
  2648. }
  2649. else
  2650. {
  2651. new string[128];
  2652. SendClientMessageEx(playerid, COLOR_GREEN, "|___________ Latest Resupply Order ___________|");
  2653. format(string,sizeof(string), "Date/Time: %s -- Amount: %s -- Status: %s", Businesses[iBusinessID][bOrderDate], number_format(Businesses[iBusinessID][bOrderAmount]), GetSupplyState(iOrderState));
  2654. //if (iOrderState == 2) format(string,sizeof(string), "%s {DDDDDD}(Truck Distance: %d)");
  2655. SendClientMessageEx(playerid, COLOR_WHITE, string);
  2656. format(string,sizeof(string), "This order was submitted by %s", Businesses[iBusinessID][bOrderBy]);
  2657. SendClientMessageEx(playerid, COLOR_WHITE, string);
  2658. if (iOrderState == 1) SendClientMessageEx(playerid, COLOR_YELLOW, "You can use /cancelresupply to cancel this order.");
  2659. }
  2660. }
  2661. else SendClientMessageEx(playerid, COLOR_GRAD1, "Only authorized business employees may use this command.");
  2662. return 1;
  2663. }
  2664. CMD:cancelresupply(playerid, params[])
  2665. {
  2666. if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
  2667. return SendClientMessageEx(playerid, COLOR_GREY, "You are not in a business!");
  2668. }
  2669. else if (PlayerInfo[playerid][pBusinessRank] < Businesses[PlayerInfo[playerid][pBusiness]][bMinSupplyRank]) {
  2670. return SendClientMessageEx(playerid, COLOR_GREY, "Your rank is not high enough for cancelling resupply orders!");
  2671. }
  2672. else {
  2673. new orderstate = Businesses[PlayerInfo[playerid][pBusiness]][bOrderState];
  2674. if (orderstate == 0) {
  2675. return SendClientMessageEx(playerid, COLOR_WHITE, "Your business has never placed a resupply order.");
  2676. }
  2677. else if (orderstate == 2) {
  2678. foreach(new i : Player)
  2679. {
  2680. if(TruckDeliveringTo[GetPlayerVehicleID(i)] == PlayerInfo[playerid][pBusiness])
  2681. {
  2682. SendClientMessageEx(playerid, COLOR_WHITE, "You can't cancel an order while it is being shipped!");
  2683. return 1;
  2684. }
  2685. }
  2686. Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] += floatround(Businesses[PlayerInfo[playerid][pBusiness]][bOrderAmount] * BUSINESS_ITEMS_COST);
  2687. Businesses[PlayerInfo[playerid][pBusiness]][bOrderState] = 4;
  2688. SaveBusiness(PlayerInfo[playerid][pBusiness]);
  2689. new string[128];
  2690. format(string, sizeof(string), "%s(%d) (IP: %s) has cancelled the resupply order for %s (%d)", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), Businesses[PlayerInfo[playerid][pBusiness]][bName], PlayerInfo[playerid][pBusiness]);
  2691. Log("logs/business.log", string);
  2692. format(string, sizeof(string), "You have cancelled your resupply order! A refund of $%s has been given.", number_format(floatround(Businesses[PlayerInfo[playerid][pBusiness]][bOrderAmount] * (BUSINESS_ITEMS_COST * 0.8))));
  2693. return SendClientMessageEx(playerid, COLOR_WHITE, string);
  2694. }
  2695. else if (orderstate == 1) {
  2696. Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] += floatround(Businesses[PlayerInfo[playerid][pBusiness]][bOrderAmount] * BUSINESS_ITEMS_COST);
  2697. Businesses[PlayerInfo[playerid][pBusiness]][bOrderState] = 4;
  2698. SaveBusiness(PlayerInfo[playerid][pBusiness]);
  2699. new string[128];
  2700. format(string, sizeof(string), "%s(%d) (IP: %s) has cancelled the resupply order for %s (%d)", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerIpEx(playerid), Businesses[PlayerInfo[playerid][pBusiness]][bName], PlayerInfo[playerid][pBusiness]);
  2701. Log("logs/business.log", string);
  2702. format(string, sizeof(string), "You have cancelled your resupply order! A refund of $%s has been given.", number_format(floatround(Businesses[PlayerInfo[playerid][pBusiness]][bOrderAmount] * (BUSINESS_ITEMS_COST * 0.8))));
  2703. return SendClientMessageEx(playerid, COLOR_WHITE, string);
  2704. }
  2705. }
  2706. return 1;
  2707. }
  2708. CMD:minrank(playerid, params[])
  2709. {
  2710. new rank, command[32];
  2711. if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || PlayerInfo[playerid][pBusinessRank] < 5)
  2712. {
  2713. return SendClientMessageEx(playerid, COLOR_GREY, "Only business owners can use this command.");
  2714. }
  2715. if (sscanf(params, "ds[32]", rank, command))
  2716. {
  2717. return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /minrank [rank] [invite/giverank/supply]");
  2718. }
  2719. if(rank < 0 || rank > 5)
  2720. {
  2721. SendClientMessageEx(playerid, COLOR_GREY, "Don't go below number 0 or above number 5!");
  2722. }
  2723. if (strcmp(command, "invite", true) == 0) Businesses[PlayerInfo[playerid][pBusiness]][bMinInviteRank] = rank, SaveBusiness(PlayerInfo[playerid][pBusiness]);
  2724. else if (strcmp(command, "giverank", true) == 0) Businesses[PlayerInfo[playerid][pBusiness]][bMinGiveRankRank] = rank, SaveBusiness(PlayerInfo[playerid][pBusiness]);
  2725. else if (strcmp(command, "supply", true) == 0) Businesses[PlayerInfo[playerid][pBusiness]][bMinSupplyRank] = rank, SaveBusiness(PlayerInfo[playerid][pBusiness]);
  2726. else return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid Permission Name");
  2727. new string[128];
  2728. format(string, sizeof(string), "You have set the minimum rank for %s to %d (%s)", command, rank, GetBusinessRankName(rank));
  2729. SendClientMessageEx(playerid, COLOR_GREY, string);
  2730. return 1;
  2731. }
  2732. CMD:br(playerid, params[])
  2733. {
  2734. return cmd_bizradio(playerid, params);
  2735. }
  2736. CMD:bizradio(playerid, params[])
  2737. {
  2738. if(PlayerInfo[playerid][pJailTime] && strfind(PlayerInfo[playerid][pPrisonReason], "[OOC]", true) != -1) return SendClientMessageEx(playerid, COLOR_GREY, "OOC prisoners are restricted to only speak in /b");
  2739. new
  2740. string[128],
  2741. iBusinessID = PlayerInfo[playerid][pBusiness],
  2742. iRank = PlayerInfo[playerid][pBusinessRank];
  2743. if (!IsValidBusinessID(iBusinessID)) return SendClientMessageEx(playerid, COLOR_GRAD2, "You're not an employee of a business!");
  2744. else if(iBusinessID == INVALID_BUSINESS_ID) return SendClientMessageEx(playerid, COLOR_GRAD2, "You're not an employee of a business!");
  2745. if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot do this at this time.");
  2746. if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /b(iz)r(radio) [biz chat]");
  2747. format(string, sizeof(string), "(radio) %s", params);
  2748. SetPlayerChatBubble(playerid,string,COLOR_WHITE,15.0,5000);
  2749. format(string, sizeof(string), "** (%d) %s %s: %s **", iRank, GetBusinessRankName(iRank), GetPlayerNameEx(playerid), params);
  2750. foreach(new i: Player)
  2751. {
  2752. if (PlayerInfo[i][pBusiness] == iBusinessID && GetPVarInt(i, "BusinessRadio") != 1) {
  2753. ChatTrafficProcess(i, COLOR_BR, string, 14);
  2754. }
  2755. }
  2756. return 1;
  2757. }
  2758. CMD:employeepayset(playerid, params[])
  2759. {
  2760. if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || PlayerInfo[playerid][pBusinessRank] != 5)
  2761. {
  2762. return SendClientMessageEx(playerid, COLOR_GREY, "Not authorized to use this command!");
  2763. }
  2764. new rank, amount;
  2765. if (sscanf(params, "dd", rank, amount))
  2766. {
  2767. SendClientMessageEx(playerid, COLOR_RED, "Listing current paycheck amounts...");
  2768. for (new i, string[64]; i < 5; i++) {
  2769. format(string,sizeof(string), "Rank %d (%s): $%s", i, GetBusinessRankName(i), number_format(Businesses[PlayerInfo[playerid][pBusiness]][bRankPay][i]));
  2770. SendClientMessageEx(playerid, COLOR_WHITE, string);
  2771. }
  2772. return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /employeepayset [rank] [amount]");
  2773. }
  2774. if (rank < 0 || rank > 4)
  2775. {
  2776. return SendClientMessageEx(playerid, COLOR_WHITE, "Invalid rank entered!");
  2777. }
  2778. if (amount < 1 || amount > 100000)
  2779. {
  2780. return SendClientMessageEx(playerid, COLOR_WHITE, "Amount can't be lower than $1 or higher than $100,000!");
  2781. }
  2782. Businesses[PlayerInfo[playerid][pBusiness]][bRankPay][rank] = amount;
  2783. SaveBusiness(PlayerInfo[playerid][pBusiness]);
  2784. new string[128];
  2785. format(string, sizeof(string), "You have set paycheck amount for rank %d (%s) to $%s", rank, GetBusinessRankName(rank), number_format(amount));
  2786. SendClientMessageEx(playerid, COLOR_WHITE, string);
  2787. format(string,sizeof(string),"%s(%d) has changed paycheck of rank %d to $%s for business %d", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), rank, number_format(amount), PlayerInfo[playerid][pBusiness]);
  2788. Log("logs/business.log", string);
  2789. return 1;
  2790. }
  2791. CMD:employeeautopay(playerid, params[])
  2792. {
  2793. if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || PlayerInfo[playerid][pBusinessRank] != 5)
  2794. {
  2795. return SendClientMessageEx(playerid, COLOR_GREY, "Not authorized to use this command!");
  2796. }
  2797. if (Businesses[PlayerInfo[playerid][pBusiness]][bAutoPay])
  2798. {
  2799. Businesses[PlayerInfo[playerid][pBusiness]][bAutoPay] = 0;
  2800. SendClientMessageEx(playerid, COLOR_WHITE, "You have disabled paychecks for the business.");
  2801. SaveBusiness(PlayerInfo[playerid][pBusiness]);
  2802. return 1;
  2803. }
  2804. else
  2805. {
  2806. Businesses[PlayerInfo[playerid][pBusiness]][bAutoPay] = 1;
  2807. SendClientMessageEx(playerid, COLOR_WHITE, "You have enabled paychecks for the business.");
  2808. SaveBusiness(PlayerInfo[playerid][pBusiness]);
  2809. return 1;
  2810. }
  2811. }
  2812. CMD:editgasprice(playerid, params[])
  2813. {
  2814. if (PlayerInfo[playerid][pBusiness] != INVALID_BUSINESS_ID && PlayerInfo[playerid][pBusinessRank] >= 5 && IsBusinessGasAble(Businesses[PlayerInfo[playerid][pBusiness]][bType]))
  2815. {
  2816. ShowPlayerDialogEx(playerid, DIALOG_GASPRICE, DIALOG_STYLE_INPUT, "Edit Gas Price", "Enter the new price per 1 gallon (e.g. 4.52)", "OK", "Cancel");
  2817. SetPVarInt(playerid, "EditingBusiness", PlayerInfo[playerid][pBusiness]);
  2818. }
  2819. else SendClientMessageEx(playerid, COLOR_GREY, "Your are not the owner of a gas station!");
  2820. return 1;
  2821. }
  2822. CMD:editprices(playerid, params[])
  2823. {
  2824. new
  2825. iBusiness = PlayerInfo[playerid][pBusiness];
  2826. if (iBusiness != INVALID_BUSINESS_ID)
  2827. {
  2828. if(PlayerInfo[playerid][pBusinessRank] >= 5)
  2829. {
  2830. if(Businesses[iBusiness][bType] == BUSINESS_TYPE_STORE || Businesses[iBusiness][bType] == BUSINESS_TYPE_GASSTATION) {
  2831. new szDialog[912];
  2832. for (new i = 0; i < sizeof(StoreItems); i++) format(szDialog, sizeof(szDialog), "%s%s ($%s) (Cost of Good: $%s)\n", szDialog, StoreItems[i], number_format(Businesses[iBusiness][bItemPrices][i]), number_format(floatround(StoreItemCost[i][ItemValue] * BUSINESS_ITEMS_COST)) );
  2833. ShowPlayerDialogEx(playerid, DIALOG_STOREPRICES, DIALOG_STYLE_LIST, "Edit 24/7 Prices", szDialog, "Edit", "Cancel");
  2834. SetPVarInt(playerid, "EditingBusiness", iBusiness);
  2835. }
  2836. else if(Businesses[iBusiness][bType] == BUSINESS_TYPE_CLOTHING) {
  2837. ShowPlayerDialogEx(playerid, DIALOG_STORECLOTHINGPRICE, DIALOG_STYLE_INPUT, "Edit Price", "{FFFFFF}Enter the new sale price for clothing\n(Items with the price of $0 will not be for sale)", "Okay", "Cancel");
  2838. SetPVarInt(playerid, "EditingBusiness", iBusiness);
  2839. }
  2840. else if(Businesses[iBusiness][bType] == BUSINESS_TYPE_GUNSHOP) {
  2841. new szDialog[512];
  2842. for (new i = 0; i < sizeof(Weapons); i++) format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, GetWeaponNameEx(Weapons[i][WeaponId]), number_format(Businesses[iBusiness][bItemPrices][i]));
  2843. ShowPlayerDialogEx(playerid, DIALOG_GUNPRICES, DIALOG_STYLE_LIST, "Edit Weapon Prices", szDialog, "Edit", "Cancel");
  2844. SetPVarInt(playerid, "EditingBusiness", iBusiness);
  2845. }
  2846. else if(Businesses[iBusiness][bType] == BUSINESS_TYPE_BAR || Businesses[iBusiness][bType] == BUSINESS_TYPE_CLUB /*|| Businesses[iBusiness][bType] == BUSINESS_TYPE_RESTAURANT*/)
  2847. {
  2848. new szDialog[512];
  2849. for (new i; i < sizeof(Drinks); i++) format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, Drinks[i], number_format(Businesses[iBusiness][bItemPrices][i]));
  2850. ShowPlayerDialogEx(playerid, DIALOG_BARPRICE, DIALOG_STYLE_LIST, "Edit Business Prices", szDialog, "Edit", "Cancel");
  2851. SetPVarInt(playerid, "EditingBusiness", iBusiness);
  2852. }
  2853. else if(Businesses[iBusiness][bType] == BUSINESS_TYPE_SEXSHOP)
  2854. {
  2855. new szDialog[512];
  2856. for (new i = 0; i < sizeof(SexItems); i++) format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, SexItems[i], number_format(Businesses[iBusiness][bItemPrices][i]));
  2857. ShowPlayerDialogEx(playerid, DIALOG_SEXSHOP, DIALOG_STYLE_LIST, "Edit Business Prices", szDialog, "Edit", "Cancel");
  2858. SetPVarInt(playerid, "EditingBusiness", iBusiness);
  2859. }
  2860. else if (Businesses[iBusiness][bType] == BUSINESS_TYPE_RESTAURANT)
  2861. {
  2862. new buf[512];
  2863. for (new i = 0; i < sizeof(RestaurantItems); ++i)
  2864. {
  2865. format(buf, sizeof(buf), "%s%s ($%s)\n", buf, RestaurantItems[i], number_format(Businesses[iBusiness][bItemPrices][i]));
  2866. }
  2867. ShowPlayerDialogEx(playerid, DIALOG_RESTAURANT, DIALOG_STYLE_LIST, "Edit Business Prices", buf, "Edit", "Cancel");
  2868. SetPVarInt(playerid, "EditingBusiness", iBusiness);
  2869. }
  2870. }
  2871. else
  2872. {
  2873. SendClientMessageEx(playerid, COLOR_GREY, "You aren't a store owner.");
  2874. return 1;
  2875. }
  2876. }
  2877. else
  2878. {
  2879. SendClientMessageEx(playerid, COLOR_WHITE, "You are not a store owner.");
  2880. }
  2881. return 1;
  2882. }
  2883. CMD:bizlock(playerid, params[])
  2884. {
  2885. if(PlayerInfo[playerid][pBusiness] != INVALID_BUSINESS_ID && PlayerInfo[playerid][pBusinessRank] >= Businesses[PlayerInfo[playerid][pBusiness]][bMinDoorRank] &&
  2886. IsPlayerInRangeOfPoint(playerid, 2.0, Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][2]))
  2887. {
  2888. if(Businesses[PlayerInfo[playerid][pBusiness]][bStatus] == 1)
  2889. {
  2890. Businesses[PlayerInfo[playerid][pBusiness]][bStatus] = 0;
  2891. new string[MAX_PLAYER_NAME + 28];
  2892. format(string, sizeof(string), "* %s has locked the door.", GetPlayerNameEx(playerid));
  2893. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  2894. }
  2895. else
  2896. {
  2897. Businesses[PlayerInfo[playerid][pBusiness]][bStatus] = 1;
  2898. new string[MAX_PLAYER_NAME + 28];
  2899. format(string, sizeof(string), "* %s has unlocked the door.", GetPlayerNameEx(playerid));
  2900. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  2901. }
  2902. RefreshBusinessPickup(PlayerInfo[playerid][pBusiness]);
  2903. Streamer_UpdateEx(playerid, Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][2]);
  2904. }
  2905. else
  2906. {
  2907. SendClientMessageEx(playerid, COLOR_WHITE, "You are not near your business or not authorized.");
  2908. return 1;
  2909. }
  2910. return 1;
  2911. }
  2912. stock LoadBusinesses() {
  2913. printf("[LoadBusinesses] Loading data from database...");
  2914. mysql_tquery(MainPipeline, "SELECT OwnerName.Username, b.* FROM businesses b LEFT JOIN accounts OwnerName ON b.OwnerID = OwnerName.id", "BusinessesLoadQueryFinish", "");
  2915. }
  2916. forward BusinessesLoadQueryFinish();
  2917. public BusinessesLoadQueryFinish()
  2918. {
  2919. new i, rows;
  2920. cache_get_row_count(rows);
  2921. while(i < rows)
  2922. {
  2923. cache_get_value_name(i, "Name", Businesses[i][bName], MAX_BUSINESS_NAME);
  2924. cache_get_value_name_int(i, "OwnerID", Businesses[i][bOwner]);
  2925. cache_get_value_name(i, "Username", Businesses[i][bOwnerName], MAX_PLAYER_NAME);
  2926. cache_get_value_name_int(i, "Type", Businesses[i][bType]);
  2927. cache_get_value_name_int(i, "Value", Businesses[i][bValue]);
  2928. cache_get_value_name_int(i, "Status", Businesses[i][bStatus]);
  2929. cache_get_value_name_int(i, "Level", Businesses[i][bLevel]);
  2930. cache_get_value_name_int(i, "LevelProgress", Businesses[i][bLevelProgress]);
  2931. cache_get_value_name_int(i, "SafeBalance", Businesses[i][bSafeBalance]);
  2932. cache_get_value_name_int(i, "Inventory", Businesses[i][bInventory]);
  2933. cache_get_value_name_int(i, "InventoryCapacity", Businesses[i][bInventoryCapacity]);
  2934. cache_get_value_name_int(i, "AutoSale", Businesses[i][bAutoSale]);
  2935. cache_get_value_name_int(i, "TotalSales", Businesses[i][bTotalSales]);
  2936. cache_get_value_name_float(i, "ExteriorX", Businesses[i][bExtPos][0]);
  2937. cache_get_value_name_float(i, "ExteriorY", Businesses[i][bExtPos][1]);
  2938. cache_get_value_name_float(i, "ExteriorZ", Businesses[i][bExtPos][2]);
  2939. cache_get_value_name_float(i, "ExteriorA", Businesses[i][bExtPos][3]);
  2940. cache_get_value_name_float(i, "InteriorX", Businesses[i][bIntPos][0]);
  2941. cache_get_value_name_float(i, "InteriorY", Businesses[i][bIntPos][1]);
  2942. cache_get_value_name_float(i, "InteriorZ", Businesses[i][bIntPos][2]);
  2943. cache_get_value_name_float(i, "InteriorA", Businesses[i][bIntPos][3]);
  2944. cache_get_value_name_int(i, "Interior", Businesses[i][bInt]);
  2945. cache_get_value_name_float(i, "SupplyPointX", Businesses[i][bSupplyPos][0]);
  2946. cache_get_value_name_float(i, "SupplyPointY", Businesses[i][bSupplyPos][1]);
  2947. cache_get_value_name_float(i, "SupplyPointZ", Businesses[i][bSupplyPos][2]);
  2948. cache_get_value_name_float(i, "GasPrice", Businesses[i][bGasPrice]);
  2949. cache_get_value_name(i, "OrderBy", Businesses[i][bOrderBy], MAX_PLAYER_NAME);
  2950. cache_get_value_name_int(i, "OrderState", Businesses[i][bOrderState]);
  2951. cache_get_value_name_int(i, "OrderAmount", Businesses[i][bOrderAmount]);
  2952. cache_get_value_name(i, "OrderDate", Businesses[i][bOrderDate], 30);
  2953. cache_get_value_name_int(i, "CustomExterior", Businesses[i][bCustomExterior]);
  2954. cache_get_value_name_int(i, "CustomInterior", Businesses[i][bCustomInterior]);
  2955. cache_get_value_name_int(i, "Grade", Businesses[i][bGrade]);
  2956. cache_get_value_name_int(i, "CustomVW", Businesses[i][bVW]);
  2957. cache_get_value_name_int(i, "Pay", Businesses[i][bAutoPay]);
  2958. cache_get_value_name_int(i, "MinInviteRank", Businesses[i][bMinInviteRank]);
  2959. cache_get_value_name_int(i, "MinSupplyRank", Businesses[i][bMinSupplyRank]);
  2960. cache_get_value_name_int(i, "MinGiveRankRank", Businesses[i][bMinGiveRankRank]);
  2961. cache_get_value_name_int(i, "MinSafeRank", Businesses[i][bMinSafeRank]);
  2962. cache_get_value_name_int(i, "Months", Businesses[i][bMonths]);
  2963. cache_get_value_name_int(i, "GymEntryFee", Businesses[i][bGymEntryFee]);
  2964. cache_get_value_name_int(i, "GymType", Businesses[i][bGymType]);
  2965. if (Businesses[i][bOrderState] == 2) {
  2966. Businesses[i][bOrderState] = 1;
  2967. }
  2968. if(Businesses[i][bExtPos][0] != 0.0) RefreshBusinessPickup(i); // If the business is at blueberry, do not spawn it
  2969. for (new j; j <= 5; j++)
  2970. {
  2971. new col[9];
  2972. format(col, sizeof(col), "Rank%dPay", j);
  2973. cache_get_value_name_int(i, col, Businesses[i][bRankPay][j]);
  2974. }
  2975. if (Businesses[i][bType] == BUSINESS_TYPE_GASSTATION)
  2976. {
  2977. for (new j, column[17]; j < MAX_BUSINESS_GAS_PUMPS; j++)
  2978. {
  2979. format(column, sizeof(column), "GasPump%dPosX", j + 1);
  2980. cache_get_value_name_float(i, column, Businesses[i][GasPumpPosX][j]);
  2981. format(column, sizeof(column), "GasPump%dPosY", j + 1);
  2982. cache_get_value_name_float(i, column, Businesses[i][GasPumpPosY][j]);
  2983. format(column, sizeof(column), "GasPump%dPosZ", j + 1);
  2984. cache_get_value_name_float(i, column, Businesses[i][GasPumpPosZ][j]);
  2985. format(column, sizeof(column), "GasPump%dAngle", j + 1);
  2986. cache_get_value_name_float(i, column, Businesses[i][GasPumpAngle][j]);
  2987. format(column, sizeof(column), "GasPump%dCapacity", j + 1);
  2988. cache_get_value_name_float(i, column, Businesses[i][GasPumpCapacity][j]);
  2989. format(column, sizeof(column), "GasPump%dGas", j + 1);
  2990. cache_get_value_name_float(i, column, Businesses[i][GasPumpGallons][j]);
  2991. if(Businesses[i][GasPumpPosX][j] != 0.0) CreateDynamicGasPump(_, i, j);
  2992. for (new z; z < sizeof(StoreItems); z++)
  2993. {
  2994. new col[12];
  2995. format(col, sizeof(col), "Item%dPrice", z + 1);
  2996. cache_get_value_name_int(i, col, Businesses[i][bItemPrices][z]);
  2997. }
  2998. }
  2999. }
  3000. else if (Businesses[i][bType] == BUSINESS_TYPE_NEWCARDEALERSHIP || Businesses[i][bType] == BUSINESS_TYPE_OLDCARDEALERSHIP)
  3001. {
  3002. for (new j, column[16], label[50]; j < MAX_BUSINESS_DEALERSHIP_VEHICLES; j++)
  3003. {
  3004. format(column, sizeof(column), "Car%dModelId", j);
  3005. cache_get_value_name_int(i, column, Businesses[i][bModel][j]);
  3006. format(column, sizeof(column), "Car%dPosX", j);
  3007. cache_get_value_name_float(i, column, Businesses[i][bParkPosX][j]);
  3008. format(column, sizeof(column), "Car%dPosY", j);
  3009. cache_get_value_name_float(i, column, Businesses[i][bParkPosY][j]);
  3010. format(column, sizeof(column), "Car%dPosZ", j);
  3011. cache_get_value_name_float(i, column, Businesses[i][bParkPosZ][j]);
  3012. format(column, sizeof(column), "Car%dPosAngle", j);
  3013. cache_get_value_name_float(i, column, Businesses[i][bParkAngle][j]);
  3014. format(column, sizeof(column), "Car%dPrice", j);
  3015. cache_get_value_name_int(i, column, Businesses[i][bPrice][j]);
  3016. cache_get_value_name_float(i, "PurchaseX", Businesses[i][bPurchaseX][j]);
  3017. cache_get_value_name_float(i, "PurchaseY", Businesses[i][bPurchaseY][j]);
  3018. cache_get_value_name_float(i, "PurchaseZ", Businesses[i][bPurchaseZ][j]);
  3019. cache_get_value_name_float(i, "PurchaseAngle", Businesses[i][bPurchaseAngle][j]);
  3020. if(400 < Businesses[i][bModel][j] < 612 || Businesses[i][bParkPosX][j] != 0.0)
  3021. {
  3022. Businesses[i][bVehID][j] = CreateVehicle(Businesses[i][bModel][j], Businesses[i][bParkPosX][j], Businesses[i][bParkPosY][j], Businesses[i][bParkPosZ][j], Businesses[i][bParkAngle][j], Businesses[i][bColor1][j], Businesses[i][bColor2][j], 10);
  3023. format(label, sizeof(label), "%s For Sale | Price: $%s", GetVehicleName(Businesses[i][bVehID][j]), number_format(Businesses[i][bPrice][j]));
  3024. Businesses[i][bVehicleLabel][j] = CreateDynamic3DTextLabel(label,COLOR_LIGHTBLUE,Businesses[i][bParkPosX][j], Businesses[i][bParkPosY][j], Businesses[i][bParkPosZ][j],8.0,INVALID_PLAYER_ID, Businesses[i][bVehID][j]);
  3025. }
  3026. }
  3027. }
  3028. else
  3029. {
  3030. for (new j; j < sizeof(StoreItems); j++)
  3031. {
  3032. new col[12];
  3033. format(col, sizeof(col), "Item%dPrice", j + 1);
  3034. cache_get_value_name_int(i, col, Businesses[i][bItemPrices][j]);
  3035. }
  3036. }
  3037. Businesses[i][bGymBoxingArena1][0] = INVALID_PLAYER_ID;
  3038. Businesses[i][bGymBoxingArena1][1] = INVALID_PLAYER_ID;
  3039. Businesses[i][bGymBoxingArena2][0] = INVALID_PLAYER_ID;
  3040. Businesses[i][bGymBoxingArena2][1] = INVALID_PLAYER_ID;
  3041. for (new it = 0; it < 10; ++it)
  3042. {
  3043. Businesses[i][bGymBikePlayers][it] = INVALID_PLAYER_ID;
  3044. Businesses[i][bGymBikeVehicles][it] = INVALID_VEHICLE_ID;
  3045. }
  3046. cache_get_value_name_int(i, "MaxLevel", Businesses[i][bMaxLevel]);
  3047. i++;
  3048. }
  3049. if(i > 0) printf("[LoadBusinesses] %d businesses rehashed/loaded.", i);
  3050. else printf("[LoadBusinesses] Failed to load any businesses.");
  3051. }
  3052. stock SaveBusiness(id)
  3053. {
  3054. new query[4019];
  3055. mysql_format(MainPipeline, query, sizeof(query), "UPDATE `businesses` SET ");
  3056. mysql_format(MainPipeline, query, sizeof(query), "%s \
  3057. `Name` = '%e', `Type` = %d, `Value` = %d, `OwnerID` = %d, `Months` = %d, `SafeBalance` = %d, `Inventory` = %d, `InventoryCapacity` = %d, `Status` = %d, `Level` = %d, \
  3058. `LevelProgress` = %d, `AutoSale` = %d, `OrderDate` = '%s', `OrderAmount` = %d, `OrderBy` = '%e', `OrderState` = %d, `TotalSales` = %d, ",
  3059. query,
  3060. Businesses[id][bName], Businesses[id][bType], Businesses[id][bValue], Businesses[id][bOwner], Businesses[id][bMonths], Businesses[id][bSafeBalance], Businesses[id][bInventory], Businesses[id][bInventoryCapacity], Businesses[id][bStatus], Businesses[id][bLevel],
  3061. Businesses[id][bLevelProgress], Businesses[id][bAutoSale], Businesses[id][bOrderDate], Businesses[id][bOrderAmount], Businesses[id][bOrderBy], Businesses[id][bOrderState], Businesses[id][bTotalSales]);
  3062. mysql_format(MainPipeline, query, sizeof(query), "%s \
  3063. `ExteriorX` = %f, `ExteriorY` = %f, `ExteriorZ` = %f, `ExteriorA` = %f, \
  3064. `InteriorX` = %f, `InteriorY` = %f, `InteriorZ` = %f, `InteriorA` = %f, \
  3065. `Interior` = %d, `CustomExterior` = %d, `CustomInterior` = %d, `Grade` = %d, `CustomVW` = %d, `SupplyPointX` = %f, `SupplyPointY` = %f, `SupplyPointZ` = %f, ",
  3066. query,
  3067. Businesses[id][bExtPos][0], Businesses[id][bExtPos][1], Businesses[id][bExtPos][2], Businesses[id][bExtPos][3],
  3068. Businesses[id][bIntPos][0], Businesses[id][bIntPos][1], Businesses[id][bIntPos][2], Businesses[id][bIntPos][3],
  3069. Businesses[id][bInt], Businesses[id][bCustomExterior], Businesses[id][bCustomInterior], Businesses[id][bGrade], Businesses[id][bVW], Businesses[id][bSupplyPos][0],Businesses[id][bSupplyPos][1], Businesses[id][bSupplyPos][2]);
  3070. for (new i; i < sizeof(StoreItems); i++) mysql_format(MainPipeline, query, sizeof(query), "%s`Item%dPrice` = %d, ", query, i+1, Businesses[id][bItemPrices][i]);
  3071. for (new i; i < 5; i++) mysql_format(MainPipeline, query, sizeof(query), "%s`Rank%dPay` = %d, ", query, i, Businesses[id][bRankPay][i], id);
  3072. for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++) mysql_format(MainPipeline, query, sizeof(query), "%s `GasPump%dPosX` = %f, `GasPump%dPosY` = %f, `GasPump%dPosZ` = %f, `GasPump%dAngle` = %f, `GasPump%dModel` = %d, `GasPump%dCapacity` = %f, `GasPump%dGas` = %f, ", query, i+1, Businesses[id][GasPumpPosX][i], i+1, Businesses[id][GasPumpPosY][i], i+1, Businesses[id][GasPumpPosZ][i], i+1, Businesses[id][GasPumpAngle][i], i+1, 1646,i+1, Businesses[id][GasPumpCapacity], i+1, Businesses[id][GasPumpGallons]);
  3073. mysql_format(MainPipeline, query, sizeof(query), "%s \
  3074. `Pay` = %d, `GasPrice` = %f, `MinInviteRank` = %d, `MinSupplyRank` = %d, `MinGiveRankRank` = %d, `MinSafeRank` = %d, `GymEntryFee` = %d, `GymType` = %d, `TotalProfits` = %d, `MaxLevel` = %d WHERE `Id` = %d",
  3075. query,
  3076. Businesses[id][bAutoPay], Businesses[id][bGasPrice], Businesses[id][bMinInviteRank], Businesses[id][bMinSupplyRank], Businesses[id][bMinGiveRankRank], Businesses[id][bMinSafeRank], Businesses[id][bGymEntryFee], Businesses[id][bGymType], Businesses[id][bTotalProfits], Businesses[id][bMaxLevel], id+1);
  3077. mysql_tquery(MainPipeline, query, "OnQueryFinish", "i", SENDDATA_THREAD);
  3078. //printf("Len :%d", strlen(query));
  3079. printf("[business] saved %i", id);
  3080. return 1;
  3081. }
  3082. stock LoadBusinessSales() {
  3083. print("[LoadBusinessSales] Loading data from database...");
  3084. mysql_tquery(MainPipeline, "SELECT * FROM `businesssales`", "LoadBusinessesSaless", "");
  3085. }
  3086. forward LoadBusinessesSaless();
  3087. public LoadBusinessesSaless() {
  3088. new
  3089. iRows,
  3090. iIndex;
  3091. cache_get_row_count(iRows);
  3092. while((iIndex < iRows)) {
  3093. cache_get_value_name_int(iIndex, "bID", BusinessSales[iIndex][bID]);
  3094. cache_get_value_name_int(iIndex, "BusinessID", BusinessSales[iIndex][bBusinessID]);
  3095. cache_get_value_name(iIndex, "Text", BusinessSales[iIndex][bText], 128);
  3096. cache_get_value_name_int(iIndex, "Price", BusinessSales[iIndex][bPrice]);
  3097. cache_get_value_name_int(iIndex, "Available", BusinessSales[iIndex][bAvailable]);
  3098. cache_get_value_name_int(iIndex, "Purchased", BusinessSales[iIndex][bPurchased]);
  3099. cache_get_value_name_int(iIndex, "Type", BusinessSales[iIndex][bType]);
  3100. iIndex++;
  3101. }
  3102. return 1;
  3103. }
  3104. stock SaveBusinessSale(id)
  3105. {
  3106. new query[200];
  3107. mysql_format(MainPipeline, query, 200, "UPDATE `businesssales` SET `BusinessID` = '%d', `Text` = '%e', `Price` = '%d', `Available` = '%d', `Purchased` = '%d', `Type` = '%d' WHERE `bID` = '%d'", BusinessSales[id][bBusinessID], BusinessSales[id][bText],
  3108. BusinessSales[id][bPrice], BusinessSales[id][bAvailable], BusinessSales[id][bPurchased], BusinessSales[id][bType], BusinessSales[id][bID]);
  3109. mysql_tquery(MainPipeline, query, "OnQueryFinish", "i", SENDDATA_THREAD);
  3110. printf("[BusinessSale] saved %i", id);
  3111. return 1;
  3112. }
  3113. stock SaveDealershipSpawn(businessid) {
  3114. new query[200];
  3115. mysql_format(MainPipeline, query, sizeof(query), "UPDATE `businesses` SET");
  3116. mysql_format(MainPipeline, query, sizeof(query), "%s `PurchaseX` = %0.5f, `PurchaseY` = %0.5f, `PurchaseZ` = %0.5f, `PurchaseAngle` = %0.5f", query, Businesses[businessid][bPurchaseX], Businesses[businessid][bPurchaseY], Businesses[businessid][bPurchaseZ], Businesses[businessid][bPurchaseAngle]);
  3117. mysql_format(MainPipeline, query, sizeof(query), "%s WHERE `Id` = %d", query, businessid+1);
  3118. mysql_tquery(MainPipeline, query, "OnQueryFinish", "ii", SENDDATA_THREAD, INVALID_PLAYER_ID);
  3119. }
  3120. stock SaveDealershipVehicle(businessid, slotid)
  3121. {
  3122. new query[256];
  3123. //slotid++;
  3124. mysql_format(MainPipeline, query, sizeof(query), "UPDATE `businesses` SET");
  3125. mysql_format(MainPipeline, query, sizeof(query), "%s `Car%dPosX` = %0.5f,", query, slotid, Businesses[businessid][bParkPosX][slotid]);
  3126. mysql_format(MainPipeline, query, sizeof(query), "%s `Car%dPosY` = %0.5f,", query, slotid, Businesses[businessid][bParkPosY][slotid]);
  3127. mysql_format(MainPipeline, query, sizeof(query), "%s `Car%dPosZ` = %0.5f,", query, slotid, Businesses[businessid][bParkPosZ][slotid]);
  3128. mysql_format(MainPipeline, query, sizeof(query), "%s `Car%dPosAngle` = %0.5f,", query, slotid, Businesses[businessid][bParkAngle][slotid]);
  3129. mysql_format(MainPipeline, query, sizeof(query), "%s `Car%dModelId` = %d,", query, slotid, Businesses[businessid][bModel][slotid]);
  3130. mysql_format(MainPipeline, query, sizeof(query), "%s `Car%dPrice` = %d", query, slotid, Businesses[businessid][bPrice][slotid]);
  3131. mysql_format(MainPipeline, query, sizeof(query), "%s WHERE `Id` = %d", query, businessid+1);
  3132. mysql_tquery(MainPipeline, query, "OnQueryFinish", "ii", SENDDATA_THREAD, INVALID_PLAYER_ID);
  3133. }
  3134. CMD:dealershiprespawn(playerid, params[])
  3135. {
  3136. if(!PlayerInfo[playerid][pBM]) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
  3137. new business = PlayerInfo[playerid][pBusiness];
  3138. if(business == INVALID_BUSINESS_ID) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in a business, use /switchbiz first.");
  3139. SendClientMessageEx(playerid, COLOR_GREY, "** Respawning dealership vehicles..");
  3140. for (new i; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++)
  3141. {
  3142. if(Businesses[business][bVehID][i] != 0) SetVehicleToRespawn(Businesses[business][bVehID][i]);
  3143. }
  3144. return 1;
  3145. }