| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477 |
- /*
- /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
- | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
- | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
- | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
- | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
- | $$\ $$$| $$ \ $$ | $$ \ $$| $$
- | $$ \ $$| $$$$$$/ | $$ | $$| $$
- |__/ \__/ \______/ |__/ |__/|__/
- Business System
- Next Generation Gaming, LLC
- (created by Next Generation Gaming Development Team)
-
- * Copyright (c) 2016, Next Generation Gaming, LLC
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are not permitted in any case.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- #include <YSI\y_hooks>
- hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
- if(newkeys & KEY_YES && InBusiness(playerid) != INVALID_BUSINESS_ID) {
- if(IsAt247(playerid)) return cmd_buy(playerid, "");
- else if(IsAtRestaurant(playerid)) return cmd_buyfood(playerid, "");
- else if(IsAtClothingStore(playerid)) return cmd_buyclothes(playerid, "");
- }
- return 1;
- }
- stock TaxSale(amount)
- {
- new iTaxAmount = floatround(amount / 100 * BUSINESS_TAX_PERCENT);
- Tax += iTaxAmount;
- for(new iGroupID; iGroupID < MAX_GROUPS; iGroupID++)
- {
- if(arrGroupData[iGroupID][g_iGroupType] == GROUP_TYPE_GOV && arrGroupData[iGroupID][g_iAllegiance] == 1)
- {
- new str[128];
- format(str, sizeof(str), "A Business has paid $%s in sales tax.", number_format(iTaxAmount));
- GroupPayLog(iGroupID, str);
- }
- }
- Misc_Save();
- return amount - iTaxAmount;
- }
- stock GivePlayerStoreItem(playerid, type, business, item, price)
- {
- if(Businesses[business][bInventory] <= StoreItemCost[item-1][ItemValue]) return SendClientMessageEx(playerid, COLOR_GRAD2, "The store does not have enough stock for that item!");
- new string[256];
- switch (item)
- {
- case ITEM_CELLPHONE:
- {
- if(PlayerInfo[playerid][pTut] == 17)
- {
- PlayerInfo[playerid][pTut]++;
- AdvanceTutorial(playerid);
- }
- if(PlayerInfo[playerid][pPnumber] == 0)
- {
- new randphone = 99999 + random(900000);
- SetPVarInt(playerid, "WantedPh", randphone);
- SetPVarInt(playerid, "CurrentPh", PlayerInfo[playerid][pPnumber]);
- SetPVarInt(playerid, "PhChangeCost", 500);
- mysql_format(MainPipeline, szMiscArray, sizeof(szMiscArray), "SELECT `Username` FROM `accounts` WHERE `PhoneNr` = '%d'", randphone);
- mysql_tquery(MainPipeline, szMiscArray, "OnPhoneNumberCheck", "ii", playerid, 2);
- }
- Phone_PhoneColorMenu(playerid);
- }
- case ITEM_PHONEBOOK:
- {
- PlayerInfo[playerid][pPhoneBook] = 1;
- SendClientMessageEx(playerid, COLOR_GRAD4, "Phonebook purchased, you can now look up other player's numbers.");
- SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /number <id/name>.");
- }
- case ITEM_DICE:
- {
- PlayerInfo[playerid][pDice] = 1;
- SendClientMessageEx(playerid, COLOR_GRAD4, "Dice purchased.");
- }
- case ITEM_CONDOM:
- {
- Condom[playerid]++;
- SendClientMessageEx(playerid, COLOR_GRAD4, "Condom Purchased.");
- }
- case ITEM_MUSICPLAYER:
- {
- PlayerInfo[playerid][pCDPlayer] = 1;
- SendClientMessageEx(playerid, COLOR_GRAD4, "Music Player purchased.");
- SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /music");
- }
- case ITEM_ROPE:
- {
- printf("%d", Businesses[business][bItemPrices][ITEM_ROPE]);
- PlayerInfo[playerid][pRope]++;
- SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased a rope.");
- SendClientMessageEx(playerid, COLOR_GREY, "HINT: Type /tie while someone has their hands up to bind them.");
- }
- case ITEM_CIGAR:
- {
- PlayerInfo[playerid][pCigar] = 10;
- SendClientMessageEx(playerid, COLOR_GRAD4, "10 cigars purchased.");
- SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /usecigar to use your cigars. Left mouse button to smoke it, F to throw it away.");
- }
- case ITEM_SPRUNK:
- {
- PlayerInfo[playerid][pSprunk] += 1;
- SendClientMessageEx(playerid, COLOR_GRAD4, "Sprunk purchased.");
- 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.");
- }
- case ITEM_VEHICLELOCK:
- {
- PlayerInfo[playerid][pLock] = 1;
- SendClientMessageEx(playerid, COLOR_GRAD4, "Vehicle Lock purchased.");
- SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /lock to lock your vehicle.");
- }
- case ITEM_SPRAYCAN:
- {
- if(PlayerInfo[playerid][pSpraycan] < 20)
- {
- PlayerInfo[playerid][pSpraycan] += 10;
- SendClientMessageEx(playerid, COLOR_GRAD4, "10 Spraycans purchased.");
- SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /colorcar or /paintcar while inside a vehicle.");
- }
- else return SendClientMessageEx(playerid, COLOR_GRAD4, "You can't hold any more of this item!");
- }
- case ITEM_RADIO:
- {
- PlayerInfo[playerid][pRadio] = 1;
- PlayerInfo[playerid][pRadioFreq] = 0;
- SendClientMessageEx(playerid, COLOR_GRAD4, "Portable radio purchased.");
- SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /pr to talk over your portable radio.");
- SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /setfreq to set the frequency of your portable radio.");
- }
- case ITEM_CAMERA:
- {
- GivePlayerValidWeapon(playerid, WEAPON_CAMERA);
- SendClientMessageEx(playerid, COLOR_GRAD4, "Camera purchased.");
- SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Remember look into the viewfinder and take a picture.");
- }
- case ITEM_LOTTERYTICKET:
- {
- ShowPlayerDialogEx(playerid, LOTTOMENU, DIALOG_STYLE_INPUT, "Lottery Ticket Selection","Please enter a Lotto Number", "Select", "Cancel" );
- }
- case ITEM_CHECKBOOK:
- {
- if(PlayerInfo[playerid][pChecks] == 0)
- {
- PlayerInfo[playerid][pChecks] += 10;
- SendClientMessageEx(playerid, COLOR_GRAD4, "Checkbook purchased, you now have 10 checks.");
- SendClientMessageEx(playerid, COLOR_WHITE, "HINT: Type /writecheck to write a check.");
- }
- else return SendClientMessageEx(playerid, COLOR_GREY, "You still have unused checks, please use them before getting another checkbook.");
- }
- case ITEM_PAPERS:
- {
- if(PlayerInfo[playerid][pPaper] == 0)
- {
- PlayerInfo[playerid][pPaper] = 15;
- SendClientMessageEx(playerid, COLOR_GRAD4, "Papers purchased, you now have 15 writing papers for sending letters.");
- }
- else return SendClientMessageEx(playerid, COLOR_GREY, "You still have unused papers, please use them before getting more papers.");
- }
- case ITEM_SCALARM:
- {
- if(GetPlayerVehicleCount(playerid) != 0)
- {
- SetPVarInt(playerid, "lockmenu", 1);
- for(new i=0; i<MAX_PLAYERVEHICLES; i++)
- {
- if(PlayerVehicleInfo[playerid][i][pvId] != INVALID_PLAYER_VEHICLE_ID)
- {
- format(string, sizeof(string), "Vehicle %d| Name: %s.",i+1,GetVehicleName(PlayerVehicleInfo[playerid][i][pvId]));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- }
- }
- return ShowPlayerDialogEx(playerid, DIALOG_CDLOCKMENU, DIALOG_STYLE_INPUT, "24-7;"," Select a vehicle you wish to install this on:", "Select", "Cancel");
- }
- else return SendClientMessageEx(playerid, COLOR_WHITE, "You don't have any cars - where we can install this item?");
- }
- case ITEM_ELOCK:
- {
- if(GetPlayerVehicleCount(playerid) != 0)
- {
- SetPVarInt(playerid, "lockmenu", 2);
- for(new i=0; i<MAX_PLAYERVEHICLES; i++)
- {
- if(PlayerVehicleInfo[playerid][i][pvId] != INVALID_PLAYER_VEHICLE_ID)
- {
- format(string, sizeof(string), "Vehicle %d | Name: %s.",i+1,GetVehicleName(PlayerVehicleInfo[playerid][i][pvId]));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- }
- }
- return ShowPlayerDialogEx(playerid, DIALOG_CDLOCKMENU, DIALOG_STYLE_INPUT, "24-7;"," Select a vehicle you wish to install this on:", "Select", "Cancel");
- }
- else return SendClientMessageEx(playerid, COLOR_WHITE, "You don't have any cars - where we can install this item?");
- }
- case ITEM_ILOCK:
- {
- if(GetPlayerVehicleCount(playerid) != 0)
- {
- SetPVarInt(playerid, "lockmenu", 3);
- for(new i=0; i<MAX_PLAYERVEHICLES; i++)
- {
- if(PlayerVehicleInfo[playerid][i][pvId] != INVALID_PLAYER_VEHICLE_ID)
- {
- format(string, sizeof(string), "Vehicle %d | Name: %s.",i+1,GetVehicleName(PlayerVehicleInfo[playerid][i][pvId]));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- }
- }
- return ShowPlayerDialogEx(playerid, DIALOG_CDLOCKMENU, DIALOG_STYLE_INPUT, "24-7;"," Select a vehicle you wish to install this on:", "Select", "Cancel");
- }
- else return SendClientMessageEx(playerid, COLOR_WHITE, "You don't have any cars - where we can install this item?");
- }
- case ITEM_HELMET:
- {
- /* if(GetPlayerVehicleCount(playerid) != 0)
- { */
- SetPVarInt(playerid, "helmetsel", 1);
- SetPVarInt(playerid, "helcost", price);
- SetPVarInt(playerid, "businessid", business);
- SetPVarInt(playerid, "item", item);
- new models[8] = {18936, 18937, 18938, 18976, 18977, 18978, 18979, 18645};
- return ShowModelSelectionMenuEx(playerid, models, sizeof(models), "Helmet Selector", 1339, 0.0, 0.0, 120.0);
- /* }
- else return SendClientMessageEx(playerid, COLOR_WHITE, "You don't have any cars - where we can install this item?"); */
- }
- case ITEM_RAG:
- {
- PlayerInfo[playerid][pRags]++;
- SendClientMessageEx(playerid, COLOR_WHITE, "You have purchased a rag.");
- SendClientMessageEx(playerid, COLOR_GREY, "HINT: Type /blindfold while a person is tied to blindfold them.");
- }
- default:
- {
- printf("Error %d ITEM", item);
- return 0;
- }
- }
- printf("%d", Businesses[business][bItemPrices][ITEM_RAG]);
- Businesses[business][bInventory] -= StoreItemCost[item-1][ItemValue];
- Businesses[business][bTotalSales]++;
- Businesses[business][bSafeBalance] += TaxSale(price);
- GivePlayerCash(playerid, -price);
- if(PlayerInfo[playerid][pBusiness] != InBusiness(playerid)) Businesses[business][bLevelProgress]++;
- SaveBusiness(business);
- PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
- printf("%d", Businesses[business][bItemPrices][ITEM_RAG]);
- switch(type)
- {
- case 0:
- {
- 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));
- Log("logs/business.log", string);
- format(string,sizeof(string),"* You have purchased a %s from %s for $%s.", StoreItems[item-1], Businesses[business][bName], number_format(price));
- SendClientMessage(playerid, COLOR_GRAD2, string);
- }
- case 1:
- {
- new offerer = GetPVarInt(playerid, "Business_ItemOfferer");
- 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);
- Log("logs/business.log", string);
- format(string,sizeof(string),"* %s has purchased the %s from you for $%s.", GetPlayerNameEx(playerid), StoreItems[item-1], number_format(price));
- SendClientMessage(offerer, COLOR_GRAD2, string);
- format(string,sizeof(string),"* You have purchased the %s from %s for $%s.", StoreItems[item-1], GetPlayerNameEx(offerer), number_format(price));
- SendClientMessage(playerid, COLOR_GRAD2, string);
- DeletePVar(playerid, "Business_ItemType");
- DeletePVar(playerid, "Business_ItemPrice");
- DeletePVar(playerid, "Business_ItemOfferer");
- DeletePVar(playerid, "Business_ItemOffererSQLId");
- }
- }
- return 1;
- }
- stock DisplayItemPricesDialog(businessid, playerid)
- {
- new szDialog[612], pvar[25], iListIndex, i;
- if (Businesses[businessid][bType] == BUSINESS_TYPE_STORE || Businesses[businessid][bType] == BUSINESS_TYPE_GASSTATION) i = sizeof(StoreItems);
- if (Businesses[businessid][bType] == BUSINESS_TYPE_SEXSHOP) i = sizeof(SexItems);
- if (Businesses[businessid][bType] == BUSINESS_TYPE_RESTAURANT) i = sizeof(RestaurantItems);
- for(new item; item < i; item++)
- {
- if(Businesses[businessid][bItemPrices][item] == 0) continue;
- new cost = (PlayerInfo[playerid][pDonateRank] >= 1) ? (floatround(Businesses[businessid][bItemPrices][item] * 0.8)) : (Businesses[businessid][bItemPrices][item]);
- 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));
- else if(Businesses[businessid][bType] == BUSINESS_TYPE_SEXSHOP) format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, SexItems[item], number_format(cost));
- else if(Businesses[businessid][bType] == BUSINESS_TYPE_RESTAURANT) format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, RestaurantItems[item], number_format(cost));
- format(pvar, sizeof(pvar), "Business_MenuItem%d", iListIndex);
- SetPVarInt(playerid, pvar, item + 1);
- format(pvar, sizeof(pvar), "Business_MenuItemPrice%d", iListIndex++);
- SetPVarInt(playerid, pvar, Businesses[businessid][bItemPrices][item]);
- }
- if(strlen(szDialog) == 0) {
- SendClientMessageEx(playerid, COLOR_GRAD2, " Store is not selling any items!");
- }
- else {
- if (Businesses[businessid][bType] == BUSINESS_TYPE_SEXSHOP)
- {
- ShowPlayerDialogEx(playerid, SHOPMENU, DIALOG_STYLE_LIST, GetBusinessTypeName(Businesses[businessid][bType]), szDialog, "Buy", "Cancel");
- }
- else if (Businesses[businessid][bType] == BUSINESS_TYPE_RESTAURANT)
- {
- ShowPlayerDialogEx(playerid, RESTAURANTMENU2, DIALOG_STYLE_LIST, GetBusinessTypeName(Businesses[businessid][bType]), szDialog, "Buy", "Cancel");
- }
- else
- {
- ShowPlayerDialogEx(playerid, STOREMENU, DIALOG_STYLE_LIST, GetBusinessTypeName(Businesses[businessid][bType]), szDialog, "Buy", "Cancel");
- }
- }
- }
- stock IsAt247(playerid)
- {
- new iBusiness = InBusiness(playerid);
- return (iBusiness != INVALID_BUSINESS_ID && (Businesses[iBusiness][bType] == BUSINESS_TYPE_STORE || Businesses[iBusiness][bType] == BUSINESS_TYPE_GASSTATION));
- }
- stock IsAtCasino(playerid)
- {
- new iBusiness = InBusiness(playerid);
- return (iBusiness != INVALID_BUSINESS_ID && (Businesses[iBusiness][bType] == BUSINESS_TYPE_CASINO));
- }
- stock IsAtClothingStore(playerid)
- {
- new iBusiness = InBusiness(playerid);
- return (iBusiness != INVALID_BUSINESS_ID && Businesses[iBusiness][bType] == BUSINESS_TYPE_CLOTHING);
- }
- stock IsAtRestaurant(playerid)
- {
- new iBusiness = InBusiness(playerid);
- return (iBusiness != INVALID_BUSINESS_ID && Businesses[iBusiness][bType] == BUSINESS_TYPE_RESTAURANT);
- }
- stock IsAtGym(playerid)
- {
- new iBusiness = InBusiness(playerid);
- return (iBusiness != INVALID_BUSINESS_ID && Businesses[iBusiness][bType] == BUSINESS_TYPE_GYM);
- }
- stock StopRefueling(playerid, iBusinessID, iPumpID)
- {
- new
- iCost = floatround(Businesses[iBusinessID][GasPumpSalePrice][iPumpID]),
- iVehicleID = Businesses[iBusinessID][GasPumpVehicleID][iPumpID],
- string[128];
- format(string, sizeof(string), "Your vehicle's tank has been refilled for $%d.", iCost);
- if( DynVeh[iVehicleID] != -1)
- {
- DynVehicleInfo[DynVeh[iVehicleID]][gv_fFuel] = VehicleFuel[iVehicleID];
- DynVeh_Save(DynVeh[iVehicleID]);
- }
- if(IsDynamicCrateVehicle(iVehicleID) != -1) {
- SaveCrateVehicle(IsDynamicCrateVehicle(iVehicleID));
- }
- if (DynVeh[iVehicleID] != -1 && DynVehicleInfo[DynVeh[iVehicleID]][gv_igID] != INVALID_GROUP_ID)
- {
- new iGroupID = DynVehicleInfo[DynVeh[iVehicleID]][gv_igID];
- arrGroupData[iGroupID][g_iBudget] -= iCost;
- new str[128];
- 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]);
- GroupPayLog(iGroupID, str);
- SendClientMessageEx(playerid, COLOR_GREY, "This is a group vehicle and the refueling cost has been paid by the government.");
- }
- else GivePlayerCash(playerid, -iCost);
- Businesses[iBusinessID][bSafeBalance] += TaxSale(iCost);
- KillTimer(Businesses[iBusinessID][GasPumpTimer][iPumpID]);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- new vehicleslot = GetPlayerVehicle(playerid, iVehicleID);
- // Save Fuel to MySQL
- if(vehicleslot != -1) {
- PlayerVehicleInfo[playerid][vehicleslot][pvFuel] = VehicleFuel[iVehicleID];
- mysql_format(MainPipeline, string, sizeof(string), "UPDATE `vehicles` SET `pvFuel` = %0.5f WHERE `id` = '%d'", VehicleFuel[iVehicleID], PlayerVehicleInfo[playerid][vehicleslot][pvSlotId]);
- mysql_tquery(MainPipeline, string, "OnQueryFinish", "ii", SENDDATA_THREAD, playerid);
- }
- Businesses[iBusinessID][GasPumpVehicleID][iPumpID] = 0;
- DeletePVar(playerid, "Refueling");
- 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);
- Log("logs/business.log", string);
- return true;
- }
- stock GetCarBusiness(carid)
- {
- for(new b = 0; b < MAX_BUSINESSES; b++)
- {
- for(new i = 0; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++)
- {
- if (Businesses[b][bVehID][i] == carid) return b;
- }
- }
- return INVALID_BUSINESS_ID;
- }
- stock GetBusinessCarSlot(carid)
- {
- for(new b = 0; b < MAX_BUSINESSES; b++)
- {
- for(new i = 0; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++)
- {
- if (Businesses[b][bVehID][i] == carid) return i;
- }
- }
- return INVALID_BUSINESS_ID;
- }
- stock IsValidBusinessID(id)
- {
- if(id == INVALID_BUSINESS_ID) return 0;
- else if(id >= 0 && id < MAX_BUSINESSES) return 1;
- return 0;
- }
- stock DestroyDynamicGasPump(iBusiness, iPump)
- {
- DestroyDynamicObject(Businesses[iBusiness][GasPumpObjectID][iPump]);
- DestroyDynamic3DTextLabel(Businesses[iBusiness][GasPumpInfoTextID][iPump]);
- DestroyDynamic3DTextLabel(Businesses[iBusiness][GasPumpSaleTextID][iPump]);
- #if defined TEXTLABEL_DEBUG
- Streamer_SetIntData(STREAMER_TYPE_3D_TEXT_LABEL, Businesses[iBusiness][GasPumpInfoTextID][iPump], E_STREAMER_EXTRA_ID, 10);
- Streamer_SetIntData(STREAMER_TYPE_3D_TEXT_LABEL, Businesses[iBusiness][GasPumpSaleTextID][iPump], E_STREAMER_EXTRA_ID, 1);
- #endif
- }
- stock CreateDynamicGasPump(iPlayerID = INVALID_PLAYER_ID, iBusiness, iPump)
- {
- if (iPlayerID != INVALID_PLAYER_ID)
- {
- new Float: arr_fPos[4];
- GetPlayerPos(iPlayerID, arr_fPos[0], arr_fPos[1], arr_fPos[2]);
- GetPlayerFacingAngle(iPlayerID, arr_fPos[3]);
- Businesses[iBusiness][GasPumpPosX][iPump] = arr_fPos[0];
- Businesses[iBusiness][GasPumpPosY][iPump] = arr_fPos[1];
- Businesses[iBusiness][GasPumpPosZ][iPump] = arr_fPos[2] + 0.4;
- Businesses[iBusiness][GasPumpAngle][iPump] = arr_fPos[3];
- }
- new szLabel[148];
- 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);
- format(szLabel, sizeof(szLabel), "{33AA33}Gas Pump\nID: %d\n{FFFF00}Type '/refuel' to refill your vehicle's tank.", iPump);
- Businesses[iBusiness][GasPumpInfoTextID][iPump] = CreateDynamic3DTextLabel(szLabel, COLOR_YELLOW, Businesses[iBusiness][GasPumpPosX][iPump], Businesses[iBusiness][GasPumpPosY][iPump], Businesses[iBusiness][GasPumpPosZ][iPump] - 0.3, 10.00);
- 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]);
- Businesses[iBusiness][GasPumpSaleTextID][iPump] = CreateDynamic3DTextLabel(szLabel, COLOR_YELLOW, Businesses[iBusiness][GasPumpPosX][iPump], Businesses[iBusiness][GasPumpPosY][iPump], Businesses[iBusiness][GasPumpPosZ][iPump] + 0.7, 10.00);
- }
- stock RefreshBusinessPickup(i)
- {
- DestroyDynamic3DTextLabel(Businesses[i][bDoorText]);
- DestroyDynamic3DTextLabel(Businesses[i][bStateText]);
- DestroyDynamic3DTextLabel(Businesses[i][bSupplyText]);
- #if defined TEXTLABEL_DEBUG
- Streamer_SetIntData(STREAMER_TYPE_3D_TEXT_LABEL, Businesses[i][bDoorText], E_STREAMER_EXTRA_ID, 2);
- Streamer_SetIntData(STREAMER_TYPE_3D_TEXT_LABEL, Businesses[i][bStateText], E_STREAMER_EXTRA_ID, 3);
- Streamer_SetIntData(STREAMER_TYPE_3D_TEXT_LABEL, Businesses[i][bSupplyText], E_STREAMER_EXTRA_ID, 4);
- #endif
- DestroyDynamicPickup(Businesses[i][bPickup]);
- DestroyDynamicPickup(Businesses[i][bPickup_int]);
- if(IsValidDynamicArea(Businesses[i][bAreaID][0])) DestroyDynamicArea(Businesses[i][bAreaID][0]);
- if(IsValidDynamicArea(Businesses[i][bAreaID][1])) DestroyDynamicArea(Businesses[i][bAreaID][1]);
-
- if (!(Businesses[i][bExtPos][0] == 0.0 && Businesses[i][bExtPos][1] == 0.0 && Businesses[i][bExtPos][2] == 0.0)) {
- Businesses[i][bPickup] = CreateDynamicPickup(GetBusinessDefaultPickup(i), 23, Businesses[i][bExtPos][0], Businesses[i][bExtPos][1], Businesses[i][bExtPos][2]);
- Businesses[i][bAreaID][0] = CreateDynamicSphere(Businesses[i][bExtPos][0], Businesses[i][bExtPos][1], Businesses[i][bExtPos][2], 2.5);
- if (Businesses[i][bOwner] < 1) {
- format(szMiscArray,sizeof(szMiscArray),"%s\n\nBusiness For Sale!\nCost: %s\nID: %d", GetBusinessTypeName(Businesses[i][bType]), number_format(Businesses[i][bValue]), i);
- }
- else {
- if(Businesses[i][bType] != BUSINESS_TYPE_GYM) {
- format(szMiscArray,sizeof(szMiscArray),"%s\n\n%s [Owner: %s]\nID: %d", GetBusinessTypeName(Businesses[i][bType]), Businesses[i][bName], StripUnderscore(Businesses[i][bOwnerName]), i);
- }
- else {
- 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]));
- }
- }
- 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);
- 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);
- if(Businesses[i][bSupplyPos][0] != 0.0)
- {
- format(szMiscArray,sizeof(szMiscArray),"%s\nSupply Delivery Point", Businesses[i][bName]);
- 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);
- }
- }
- if(Businesses[i][bVW] == 0) {
- Businesses[i][bPickup_int] = CreateDynamicPickup(1559, 23, Businesses[i][bIntPos][0], Businesses[i][bIntPos][1], Businesses[i][bIntPos][2], .worldid = BUSINESS_BASE_VW + i);
- Businesses[i][bAreaID][1] = CreateDynamicSphere(Businesses[i][bIntPos][0], Businesses[i][bIntPos][1], Businesses[i][bIntPos][2], 2.5, .worldid = BUSINESS_BASE_VW + i);
- }
- else {
- Businesses[i][bPickup_int] = CreateDynamicPickup(1559, 23, Businesses[i][bIntPos][0], Businesses[i][bIntPos][1], Businesses[i][bIntPos][2], .worldid = Businesses[i][bVW]);
- Businesses[i][bAreaID][1] = CreateDynamicSphere(Businesses[i][bIntPos][0], Businesses[i][bIntPos][1], Businesses[i][bIntPos][2], 2.5, .worldid = Businesses[i][bVW]);
- }
- /*
- Streamer_SetIntData(STREAMER_TYPE_AREA, Businesses[i][bAreaID][0], E_STREAMER_EXTRA_ID, i);
- Streamer_SetIntData(STREAMER_TYPE_AREA, Businesses[i][bAreaID][1], E_STREAMER_EXTRA_ID, i);
- */
- 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]);
- Log("debug/door_business.log", szMiscArray);
- }
- stock GetBusinessDefaultPickup(business)
- {
- switch (Businesses[business][bType]) {
- case BUSINESS_TYPE_GASSTATION: return 1650;
- case BUSINESS_TYPE_CLOTHING: return 1275;
- case BUSINESS_TYPE_RESTAURANT: return 19094;
- case BUSINESS_TYPE_SEXSHOP: return 321;
- case BUSINESS_TYPE_BAR:
- {
- new rnd = random(4);
- if (rnd == 0) return 1486;
- if (rnd == 1) return 1543;
- if (rnd == 2) return 1544;
- if (rnd == 3) return 1951;
- }
- case BUSINESS_TYPE_GYM: return 1318;
- default: return 1274;
- }
- return 1318;
- }
- stock GetBusinessRankName(rank)
- {
- new string[16];
- switch (rank) {
- case 0: string = "Trainee";
- case 1: string = "Employee";
- case 2: string = "Senior Employee";
- case 3: string = "Manager";
- case 4: string = "Co-Owner";
- case 5: string = "Owner";
- default: string = "Undefined";
- }
- return string;
- }
- stock GetBusinessTypeName(type)
- {
- new string[20];
- switch (type) {
- case 1: string = "Gas Station";
- case 2: string = "Clothing Store";
- case 3: string = "Restaurant";
- case 4: string = "Gun Shop";
- case 5: string = "New Car Dealership";
- case 6: string = "Used Car Dealership";
- case 7: string = "Mechanic";
- case 8: string = "24/7";
- case 9: string = "Bar";
- case 10: string = "Club";
- case 11: string = "Sex Shop";
- case 12: string = "Gym";
- case 13: string = "Casino";
- default: string = "Undefined";
- }
- return string;
- }
- stock GetInventoryType(businessid)
- {
- new string[30];
- if(businessid == INVALID_BUSINESS_ID) {
- string = "Empty";
- return string;
- }
- switch (Businesses[businessid][bType]) {
- case BUSINESS_TYPE_NEWCARDEALERSHIP: string = "Vehicles";
- case BUSINESS_TYPE_GASSTATION: string = "Petrol";
- case BUSINESS_TYPE_GUNSHOP: string = "Illegal Materials";
- case BUSINESS_TYPE_MECHANIC: string = "Car Parts";
- case BUSINESS_TYPE_STORE: string = "24/7 Items";
- case BUSINESS_TYPE_CLOTHING: string = "Clothing";
- case BUSINESS_TYPE_RESTAURANT, BUSINESS_TYPE_BAR, BUSINESS_TYPE_CLUB: string = "Food & Beverages";
- default: string = "Empty";
- }
- return string;
- }
- stock GetSupplyState(stateid)
- {
- new string[28];
- switch (stateid) {
- case 0: string = "{FF3333}Inactive";
- case 1: string = "{FFFF00}Pending Shipment";
- case 2: string = "{FFAA00}Shipping";
- case 3: string = "{00AA00}Delivered";
- case 4: string = "{FF3333}Cancelled";
- default: string = "Undefined";
- }
- return string;
- }
- stock InBusiness(playerid)
- {
- if(GetPVarType(playerid, "BusinessesID")) return GetPVarInt(playerid, "BusinessesID");
- else return INVALID_BUSINESS_ID;
- }
- stock GetClosestGasPump(playerid, &businessid, &pumpslot)
- {
- new Float: minrange = 5.0, Float: range;
- businessid = INVALID_BUSINESS_ID;
- for(new b = 0; b < MAX_BUSINESSES; b++)
- {
- for(new i = 0; i < MAX_BUSINESS_GAS_PUMPS; i++)
- {
- range = GetPlayerDistanceFromPoint(playerid, Businesses[b][GasPumpPosX][i], Businesses[b][GasPumpPosY][i], Businesses[b][GasPumpPosZ][i]);
- if (range < minrange)
- {
- businessid = b;
- pumpslot = i;
- minrange = range;
- }
- }
- }
- }
- stock IsBusinessGasAble(iBusinessType) {
- switch (iBusinessType) {
- case 1,7,8: return 1;
- }
- return 0;
- }
- stock GetFreeGasPumpID(biz)
- {
- for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++) {
- if (Businesses[biz][GasPumpPosX][i] == 0.0) return i;
- }
- return INVALID_GAS_PUMP;
- }
- forward GasPumpSaleTimer(playerid, iBusinessID, iPumpID);
- public GasPumpSaleTimer(playerid, iBusinessID, iPumpID)
- {
- new
- Float: fPumpAmount = FUEL_PUMP_RATE / 4,
- iVehicleID = Businesses[iBusinessID][GasPumpVehicleID][iPumpID],
- szSaleText[148];
- if (GetVehicleDistanceFromPoint(iVehicleID, Businesses[iBusinessID][GasPumpPosX][iPumpID], Businesses[iBusinessID][GasPumpPosY][iPumpID], Businesses[iBusinessID][GasPumpPosZ][iPumpID]) > 5.0)
- {
- StopRefueling(playerid, iBusinessID, iPumpID);
- return 1;
- }
- if (fPumpAmount*10 + VehicleFuel[iVehicleID] > 100.0)
- {
- SendClientMessageEx(playerid, COLOR_GREEN, "Your vehicle tank is now full.");
- StopRefueling(playerid, iBusinessID, iPumpID);
- return 1;
- }
- if (GetPVarInt(playerid, "Refueling") == -1)
- {
- SendClientMessageEx(playerid, COLOR_GREEN, "You have stopped refueling.");
- StopRefueling(playerid, iBusinessID, iPumpID);
- return 1;
- }
- if (fPumpAmount > Businesses[iBusinessID][GasPumpGallons][iPumpID])
- {
- SendClientMessageEx(playerid, COLOR_RED, "No more gas left in the station's gas pump.");
- StopRefueling(playerid, iBusinessID, iPumpID);
- return 1;
- }
- if(DynVeh[iVehicleID] != -1 && DynVehicleInfo[DynVeh[iVehicleID]][gv_igID] != INVALID_GROUP_ID) {
- if(arrGroupData[DynVehicleInfo[DynVeh[iVehicleID]][gv_igID]][g_iBudget] < floatround(Businesses[iBusinessID][GasPumpSalePrice][iPumpID])) {
- SendClientMessageEx(playerid, COLOR_RED, "The group vehicle this belongs to has ran out of cash!");
- StopRefueling(playerid, iBusinessID, iPumpID);
- return 1;
- }
- }
- else {
- if(GetPlayerCash(playerid) < floatround(Businesses[iBusinessID][GasPumpSalePrice][iPumpID])) {
- SendClientMessageEx(playerid, COLOR_RED, "You are out of cash.");
- StopRefueling(playerid, iBusinessID, iPumpID);
- return 1;
- }
- }
- Businesses[iBusinessID][GasPumpGallons][iPumpID] -= fPumpAmount;
- VehicleFuel[iVehicleID] += fPumpAmount*10;
- Businesses[iBusinessID][GasPumpSaleGallons][iPumpID] += fPumpAmount;
- Businesses[iBusinessID][GasPumpSalePrice][iPumpID] += fPumpAmount * Businesses[iBusinessID][bGasPrice];
- 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]);
- UpdateDynamic3DTextLabelText(Businesses[iBusinessID][GasPumpSaleTextID][iPumpID], COLOR_YELLOW, szSaleText);
- return 1;
- }
- stock GetWeaponPrice(business, id)
- {
- for (new i; i < sizeof(Weapons); i++)
- {
- if (Weapons[i][WeaponId] == id) return Businesses[business][bItemPrices][i];
- }
- return 0;
- }
- CMD:businessdate(playerid, params[]) {
- new giveplayerid;
- if(PlayerInfo[playerid][pAdmin] < 2)
- {
- giveplayerid = playerid;
- }
- else
- {
- if(sscanf(params, "u", giveplayerid)) giveplayerid = playerid;
- }
- if(IsValidBusinessID(PlayerInfo[playerid][pBusiness]))
- {
- new string[128];
- new datestring[32];
- datestring = date(Businesses[PlayerInfo[giveplayerid][pBusiness]][bMonths], 4);
- if(Businesses[PlayerInfo[giveplayerid][pBusiness]][bMonths] == 0) format(string, sizeof(string), "* Your business subscription is not set to expire.");
- else format(string, sizeof(string), "* Your business subscription expires on %s.", datestring);
- SendClientMessageEx(playerid, COLOR_VIP, string);
- }
- else SendClientMessageEx(playerid, COLOR_GRAD2, "You don't have a business subscription.");
- return 1;
- }
- CMD:businesshelp(playerid, params[])
- {
- SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________");
- SendClientMessageEx(playerid, COLOR_WHITE,"*** BUSINESS HELP *** - type a command for more infomation.");
- SendClientMessageEx(playerid, COLOR_GRAD3,"*** BUSINESS *** /buybizlevel /binvite /buninvite /bouninvite /bgiverank /resign /bsafe");
- SendClientMessageEx(playerid, COLOR_GRAD3,"*** BUSINESS *** /binventory /offeritem /resupply /checkresupply /cancelresupply /minrank");
- SendClientMessageEx(playerid, COLOR_GRAD3,"*** BUSINESS *** /employeepayset /employeeautopay /editgasprice /editprices /bizlock");
- SendClientMessageEx(playerid, COLOR_GRAD3,"*** BUSINESS *** /bauto /bonline /bpanic /b(iz)r(adio)");
- if(IsValidBusinessID(PlayerInfo[playerid][pBusiness]))
- {
- if(Businesses[PlayerInfo[playerid][pBusiness]][bType] == BUSINESS_TYPE_NEWCARDEALERSHIP || Businesses[PlayerInfo[playerid][pBusiness]][bType] == BUSINESS_TYPE_OLDCARDEALERSHIP) {
- SendClientMessageEx(playerid, COLOR_GRAD3, "*** BUSINESS *** /editcarprice /editcarspawn");
- }
- else if(Businesses[PlayerInfo[playerid][pBusiness]][bType] == BUSINESS_TYPE_GUNSHOP) {
- SendClientMessageEx(playerid, COLOR_GRAD3, "*** BUSINESS *** /addmat(erial)s");
- }
- else if(Businesses[PlayerInfo[playerid][pBusiness]][bType] == BUSINESS_TYPE_STORE) {
- SendClientMessageEx(playerid, COLOR_GRAD3, "*** BUSINESS *** /offeritem /editprices");
- }
- 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) {
- SendClientMessageEx(playerid, COLOR_GRAD3, "*** BUSINESS *** /offermenu");
- }
- }
- if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pShopTech] > 0 || PlayerInfo[playerid][pBM] > 0)
- {
- SendClientMessageEx(playerid, COLOR_GRAD3, "*** BIZ ADMIN *** /bedit /bname (ST) /bnext (ST) /bnear (ST) /gotobiz (ST) /goinbiz (ST)");
- SendClientMessageEx(playerid, COLOR_GRAD3, "*** BIZ ADMIN *** /deletegaspump /asellbiz /creategaspump /editgaspump");
- }
- return 1;
- }
- CMD:bhelp(playerid, params[]) {
- return cmd_businesshelp(playerid, params);
- }
- CMD:bonline(playerid, params[]) {
- new iBusinessID = PlayerInfo[playerid][pBusiness];
- if((0 <= iBusinessID < MAX_BUSINESSES) && PlayerInfo[playerid][pBusinessRank] >= Businesses[iBusinessID][bMinInviteRank])
- {
- new szDialog[1024];
- foreach(new i: Player)
- {
- if(PlayerInfo[i][pBusiness] == PlayerInfo[playerid][pBusiness] && (PlayerInfo[i][pTogReports] == 1 || PlayerInfo[i][pAdmin] < 2))
- {
- format(szDialog, sizeof(szDialog), "%s\n* %s (%s)", szDialog, GetPlayerNameEx(i), GetBusinessRankName(PlayerInfo[i][pBusinessRank]));
- }
- }
- if(!isnull(szDialog)) {
- strdel(szDialog, 0, 1);
- ShowPlayerDialogEx(playerid, 0, DIALOG_STYLE_LIST, "Online Members", szDialog, "Select", "Cancel");
- }
- else SendClientMessageEx(playerid, COLOR_GREY, "No members are online at this time.");
- }
- else SendClientMessageEx(playerid, COLOR_GREY, "Only business leaders may use this command.");
- return 1;
- }
- CMD:buy(playerid, params[])
- {
- if (!IsAt247(playerid)) {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a 24/7!");
- return 1;
- }
- new iBusiness = InBusiness(playerid);
- if (Businesses[iBusiness][bAutoSale]) {
- if (Businesses[iBusiness][bInventory] < 1) {
- SendClientMessageEx(playerid, COLOR_WHITE, "This store does not have any items at the moment!");
- return 1;
- }
- if (!Businesses[iBusiness][bStatus]) {
- SendClientMessageEx(playerid, COLOR_WHITE, "This store is closed!");
- return 1;
- }
- } else return SendClientMessageEx(playerid, COLOR_WHITE, "You need to interact with the business employees to buy.");
- DisplayItemPricesDialog(iBusiness, playerid);
- return 1;
- }
- CMD:beginswimming(playerid, params[])
- {
- if (!IsAtGym(playerid))
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a gym!");
- return 1;
- }
- new iBusiness = InBusiness(playerid);
- if(CheckPointCheck(playerid))
- {
- return SendClientMessageEx(playerid, COLOR_GRAD2, "You must kill your current checkpoint first. (/killcheckpoint)");
- }
- if (Businesses[iBusiness][bGymType] != 1)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You can not /beginswimming in this type of gym!");
- return 1;
- }
- if (GetPVarInt(playerid, "_BoxingQueue") == 1)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You must leave the boxing queue first! (/leaveboxing)");
- return 1;
- }
- if (GetPVarInt(playerid, "_SwimmingActivity") >= 1)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are already swimming! Use /stopswimming first.");
- return 1;
- }
- SetPVarInt(playerid, "_SwimmingActivity", 1);
- SetPlayerCheckpoint(playerid, 2892.5071, -2261.9607, 1.4645, 2.0);
- SendClientMessageEx(playerid, COLOR_WHITE, "Proceed to the first checkpoint to begin exercising.");
- SendClientMessageEx(playerid, COLOR_WHITE, "Type /stopswimming to exit your current activity.");
- /*if(!PlayerInfo[playerid][mCooldown][4] && !PlayerInfo[playerid][pShopNotice])
- {
- PlayerTextDrawSetString(playerid, MicroNotice[playerid], ShopMsg[10]);
- PlayerTextDrawShow(playerid, MicroNotice[playerid]);
- SetTimerEx("HidePlayerTextDraw", 10000, false, "ii", playerid, _:MicroNotice[playerid]);
- }*/
- return 1;
- }
- CMD:stopswimming(playerid, params[])
- {
- if (!IsAtGym(playerid))
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a gym!");
- return 1;
- }
- if (GetPVarInt(playerid, "_SwimmingActivity") < 1)
- {
- SendClientMessageEx(playerid, COLOR_GREY, " You are not swimming!");
- return 1;
- }
- DeletePVar(playerid, "_SwimmingActivity");
- DisablePlayerCheckpoint(playerid);
- SendClientMessageEx(playerid, COLOR_GREY, "You have stopped exercising.");
- return 1;
- }
- CMD:joinboxing(playerid, params[])
- {
- if (!IsAtGym(playerid))
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a gym!");
- return 1;
- }
- new iBusiness = InBusiness(playerid);
- if (Businesses[iBusiness][bGymType] != 1)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You can not /joinboxing in this type of gym!");
- return 1;
- }
- if (GetPVarInt(playerid, "_SwimmingActivity") >= 1)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You must stop swimming first! (/stopswimming)");
- return 1;
- }
- if (GetPVarInt(playerid, "_BoxingQueue") == 1)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are already in the boxing queue!");
- return 1;
- }
- if (GetPVarInt(playerid, "_BoxingFight") != 0)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are already in a boxing match!");
- return 1;
- }
- SetPVarInt(playerid, "_BoxingQueue", 1);
- SetPVarInt(playerid, "_BoxingQueueTick", 1);
- SendClientMessageEx(playerid, COLOR_WHITE, "You have joined the boxing queue.");
- return 1;
- }
- CMD:leaveboxing(playerid, params[])
- {
- if (!IsAtGym(playerid))
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a gym!");
- return 1;
- }
- if (GetPVarInt(playerid, "_BoxingQueue") != 1)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in the boxing queue.");
- return 1;
- }
- DeletePVar(playerid, "_BoxingQueue");
- DeletePVar(playerid, "_BoxingQueueTick");
- SendClientMessageEx(playerid, COLOR_WHITE, "You have left the boxing queue.");
- return 1;
- }
- CMD:beginparkour(playerid, params[])
- {
- if (!IsAtGym(playerid))
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a gym!");
- return 1;
- }
- new iBusiness = InBusiness(playerid);
- if (Businesses[iBusiness][bGymType] != 1)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You can not /beginparkour in this type of gym!");
- return 1;
- }
- if (GetPVarInt(playerid, "_BikeParkourStage") != 0)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are already participating in that activity!");
- return 1;
- }
- new bool:available = false;
- new pos;
- for (new it = 0; it < 9; ++it)
- {
- if (Businesses[iBusiness][bGymBikePlayers][it] == INVALID_PLAYER_ID)
- {
- available = true;
- Businesses[iBusiness][bGymBikePlayers][it] = playerid;
- pos = it;
- break;
- }
- }
- if (available == false)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " Too many people are on this track, try again later.");
- return 1;
- }
- SendClientMessage(playerid, COLOR_WHITE, "Proceed to the pickup point to collect your bike.");
- SetPVarInt(playerid, "_BikeParkourStage", 1);
- SetPVarInt(playerid, "_BikeParkourSlot", pos);
- new pickup = CreateDynamicPickup(1318, 23, 2833.8757, -2256.8293, 95.9497, .playerid = playerid, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = 0);
- SetPVarInt(playerid, "_BikeParkourPickup", pickup);
- /*if(!PlayerInfo[playerid][mCooldown][4] && !PlayerInfo[playerid][pShopNotice])
- {
- PlayerTextDrawSetString(playerid, MicroNotice[playerid], ShopMsg[10]);
- PlayerTextDrawShow(playerid, MicroNotice[playerid]);
- SetTimerEx("HidePlayerTextDraw", 10000, false, "ii", playerid, _:MicroNotice[playerid]);
- }*/
- return 1;
- }
- CMD:leaveparkour(playerid, params[])
- {
- if (!IsAtGym(playerid))
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a gym!");
- return 1;
- }
- if (GetPVarInt(playerid, "_BikeParkourStage") == 0)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are not participating in that activity.");
- return 1;
- }
- new iBusiness = InBusiness(playerid);
- Businesses[iBusiness][bGymBikePlayers][GetPVarInt(playerid, "_BikeParkourSlot")] = INVALID_PLAYER_ID;
- SendClientMessageEx(playerid, COLOR_WHITE, "You have left the biking activity.");
- new vehicle = Businesses[iBusiness][bGymBikeVehicles][GetPVarInt(playerid, "_BikeParkourSlot")];
- if (vehicle != INVALID_VEHICLE_ID)
- {
- DestroyVehicle(vehicle);
- Businesses[iBusiness][bGymBikeVehicles][GetPVarInt(playerid, "_BikeParkourSlot")] = INVALID_VEHICLE_ID;
- }
- DeletePVar(playerid, "_BikeParkourStage");
- DeletePVar(playerid, "_BikeParkourSlot");
- new pickup = GetPVarInt(playerid, "_BikeParkourPickup");
- if (pickup != 0)
- {
- DestroyDynamicPickup(pickup);
- DeletePVar(playerid, "_BikeParkourPickup");
- }
- return 1;
- }
- CMD:bauto(playerid, params[])
- {
- new
- iBusiness = PlayerInfo[playerid][pBusiness],
- iRank = PlayerInfo[playerid][pBusinessRank];
- if (iBusiness != INVALID_BUSINESS_ID && iRank >= 5)
- {
- new iType = Businesses[iBusiness][bType];
- if (iType == BUSINESS_TYPE_GASSTATION || iType == BUSINESS_TYPE_STORE || iType == BUSINESS_TYPE_CLOTHING) {
- if (Businesses[iBusiness][bAutoSale]) {
- Businesses[iBusiness][bAutoSale] = 0;
- SendClientMessageEx(playerid, COLOR_WHITE, "You have toggled off the automatic sales mode!");
- SaveBusiness(iBusiness);
- }
- else {
- Businesses[iBusiness][bAutoSale] = 1;
- SendClientMessageEx(playerid, COLOR_WHITE, "You have toggled on the automatic sales mode!");
- SendClientMessageEx(playerid, COLOR_GREY, "Note that this will cause decrease in profits!");
- SaveBusiness(iBusiness);
- }
- } else SendClientMessageEx(playerid, COLOR_WHITE, "Command not available for your business type!");
- } else SendClientMessageEx(playerid, COLOR_WHITE, "Only business owners can use this command!");
- return 1;
- }
- CMD:shop(playerid, params[])
- {
- new iBusiness = InBusiness(playerid);
- if (iBusiness == INVALID_BUSINESS_ID || Businesses[iBusiness][bType] != BUSINESS_TYPE_SEXSHOP) {
- SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in a sex shop!");
- return 1;
- }
- if (Businesses[iBusiness][bAutoSale]) {
- if (Businesses[iBusiness][bInventory] < 1) {
- SendClientMessageEx(playerid, COLOR_WHITE, "This sex shop does not have any items at the moment!");
- return 1;
- }
- if (!Businesses[iBusiness][bStatus]) {
- SendClientMessageEx(playerid, COLOR_WHITE, "This sex shop is closed!");
- return 1;
- }
- } else return SendClientMessageEx(playerid, COLOR_WHITE, "You need to interact with the business employees to buy.");
- DisplayItemPricesDialog(iBusiness, playerid);
- return 1;
- }
- CMD:refuel(playerid, params[])
- {
- if(zombieevent) return SendClientMessageEx(playerid, -1, "You can't use Gas Stations during the Zombie Event!");
- if (GetPVarType(playerid, "Refueling"))
- {
- SetPVarInt(playerid, "Refueling", -1);
- }
- else
- {
- new vehicleid = GetPlayerVehicleID(playerid);
- new
- iBusinessID,
- iPumpID;
- GetClosestGasPump(playerid, iBusinessID, iPumpID);
- if (iBusinessID == INVALID_BUSINESS_ID) return SendClientMessageEx(playerid, COLOR_RED, "You're not at a fuel station.");
- if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_RED, "You are not in a vehicle.");
- if (!Businesses[iBusinessID][bStatus]) return SendClientMessageEx(playerid, COLOR_RED, "This fuel station is closed.");
- if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playerid, COLOR_RED, "You're not the driver.");
- if (IsVIPcar(vehicleid)) return SendClientMessageEx(playerid, COLOR_RED, "This is a vehicle from the VIP garage and it has already unlimited amount of fuel.");
- if (IsFamedVeh(vehicleid)) return SendClientMessageEx(playerid, COLOR_RED, "This is a vehicle from the Famed garage and it has already unlimited amount of fuel.");
- if (IsAdminSpawnedVehicle(vehicleid)) return SendClientMessageEx(playerid, COLOR_RED, "This is an admin-spawned vehicle and it has already unlimited amount of fuel.");
- new engine,lights,alarm,doors,bonnet,boot,objective;
- GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
- if(engine == VEHICLE_PARAMS_ON) return SendClientMessageEx(playerid, COLOR_RED, "You need to shut off the engine before filling up (press ~k~~CONVERSATION_YES~).");
- if (Businesses[iBusinessID][GasPumpGallons][iPumpID] == 0.0) return SendClientMessageEx(playerid, COLOR_RED, "No gas left in the gas station tank.");
- if (!IsRefuelableVehicle(vehicleid)) return SendClientMessageEx(playerid,COLOR_RED,"This vehicle does not need fuel.");
- if (VehicleFuel[vehicleid] >= 100.0) return SendClientMessageEx(playerid, COLOR_RED, "This vehicle's tank is already full.");
- if (Businesses[iBusinessID][GasPumpVehicleID][iPumpID] > 0) return SendClientMessageEx(playerid, COLOR_RED, "This gas pump is occupied.");
- SendClientMessageEx(playerid, COLOR_WHITE, "Refueling your vehicle's tank, please wait.");
- SendClientMessageEx(playerid, COLOR_YELLOW, "Type /refuel again to stop refueling.");
- SetPVarInt(playerid, "Refueling", vehicleid);
- Businesses[iBusinessID][GasPumpSaleGallons][iPumpID] = 0;
- Businesses[iBusinessID][GasPumpSalePrice][iPumpID] = 0;
- Businesses[iBusinessID][GasPumpVehicleID][iPumpID] = vehicleid;
- Businesses[iBusinessID][GasPumpTimer][iPumpID] = SetTimerEx("GasPumpSaleTimer", 200, true, "iii", playerid, iBusinessID, iPumpID);
- }
- return 1;
- }
- CMD:editcarspawn(playerid, params[])
- {
- if(PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
- }
- else if(Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_NEWCARDEALERSHIP && Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_OLDCARDEALERSHIP) {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't own a vehicle dealership.");
- }
- else if(!IsPlayerInRangeOfPoint(playerid, 20.0, Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][2])) {
- SendClientMessageEx(playerid, COLOR_GREY, "The location needs to be near the business entrance.");
- }
- else if(PlayerInfo[playerid][pBusinessRank] < 5) {
- SendClientMessageEx(playerid, COLOR_GREY, "You aren't high enough rank to edit the car dealership.");
- }
- else {
- new Float: Positionsz[4];
- GetPlayerPos(playerid, Positionsz[0], Positionsz[1], Positionsz[2]);
- GetPlayerFacingAngle(playerid, Positionsz[3]);
- Businesses[PlayerInfo[playerid][pBusiness]][bPurchaseX] = Positionsz[0];
- Businesses[PlayerInfo[playerid][pBusiness]][bPurchaseY] = Positionsz[1];
- Businesses[PlayerInfo[playerid][pBusiness]][bPurchaseZ] = Positionsz[2];
- Businesses[PlayerInfo[playerid][pBusiness]][bPurchaseAngle] = Positionsz[3];
- SendClientMessageEx(playerid, COLOR_WHITE, "You have moved the vehicle purchase spawn location.");
- SaveDealershipSpawn(PlayerInfo[playerid][pBusiness]);
- }
- return 1;
- }
- CMD:entrancefee(playerid, params[])
- {
- if(PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
- }
- else if(Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_GYM) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You don't own a gym.");
- }
- else if(!IsPlayerInRangeOfPoint(playerid, 5.0, Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][2])) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You need to be standing near the gym entrance.");
- }
- else {
- new amount;
- if(sscanf(params, "d", amount)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /entrancefee [Price]");
- }
- else if(amount < 0 || amount > 10000) {
- return SendClientMessageEx(playerid, COLOR_GREY, "The price can't be set the price below $0 and above $10,000.");
- }
- else {
- new string[128];
- Businesses[PlayerInfo[playerid][pBusiness]][bGymEntryFee] = amount;
- format(string, sizeof(string), "You have set the gym entry fee to $%s.", number_format(amount));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- RefreshBusinessPickup(PlayerInfo[playerid][pBusiness]);
- SaveBusiness(PlayerInfo[playerid][pBusiness]);
- }
- }
- return 1;
- }
- CMD:editcarprice(playerid, params[])
- {
- if(PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
- }
- else if(Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_NEWCARDEALERSHIP && Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_OLDCARDEALERSHIP) {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't own a vehicle dealership.");
- }
- else if(!IsPlayerInRangeOfPoint(playerid, 5.0, Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][2])) {
- SendClientMessageEx(playerid, COLOR_GREY, "You need to be standing near the dealership entrance.");
- }
- else if(PlayerInfo[playerid][pBusinessRank] < Businesses[PlayerInfo[playerid][pBusiness]][bMinSupplyRank]) {
- SendClientMessageEx(playerid, COLOR_GREY, "You aren't high enough rank to edit the car dealership.");
- }
- else {
- new vehicleid, amount;
- if(sscanf(params, "dd", vehicleid, amount)) {
- SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /editcarprice [VehicleID] [Price]");
- }
- else if(PlayerInfo[playerid][pBusiness] != GetCarBusiness(vehicleid)) {
- SendClientMessageEx(playerid, COLOR_GREY, "That vehicle is not part of your dealership.");
- }
- else if(amount < 0) {
- SendClientMessageEx(playerid, COLOR_GREY, "The price can't be set below 0");
- }
- else {
- new
- iSlot = GetBusinessCarSlot(vehicleid),
- Message[128];
- Businesses[PlayerInfo[playerid][pBusiness]][bPrice][iSlot] = amount;
- format(Message, sizeof(Message), "%s For Sale | Price: $%s", GetVehicleName(Businesses[PlayerInfo[playerid][pBusiness]][bVehID][iSlot]), number_format(Businesses[PlayerInfo[playerid][pBusiness]][bPrice][iSlot]));
- UpdateDynamic3DTextLabelText(Businesses[PlayerInfo[playerid][pBusiness]][bVehicleLabel][iSlot], COLOR_LIGHTBLUE, Message);
- format(Message, sizeof(Message), "%s price has been set to $%s", GetVehicleName(vehicleid), number_format(amount));
- SendClientMessageEx(playerid, COLOR_WHITE, Message);
- SaveDealershipVehicle(PlayerInfo[playerid][pBusiness], iSlot);
- }
- }
- return 1;
- }
- CMD:deletecdveh(playerid, params[]) {
- if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pBM] == 2) {
- new
- iBusiness,
- iVehicle;
- if(sscanf(params, "ii", iBusiness, iVehicle )) {
- SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /deletecdveh [business ID] [model id]");
- }
- else if(Businesses[iBusiness][bType] != BUSINESS_TYPE_NEWCARDEALERSHIP && Businesses[iBusiness][bType] != BUSINESS_TYPE_OLDCARDEALERSHIP) {
- SendClientMessageEx(playerid, COLOR_GRAD2, "Business is not a car dealership!");
- }
- else if(iBusiness != GetCarBusiness(iVehicle)) {
- SendClientMessageEx(playerid, COLOR_GREY, "That vehicle isn't a dealership vehicle.");
- }
- else {
- new
- ID = GetBusinessCarSlot(iVehicle);
- if(Businesses[iBusiness][bVehID][ID] != INVALID_VEHICLE_ID) {
- if(IsValidDynamic3DTextLabel(Businesses[iBusiness][bVehicleLabel][ID])) DestroyDynamic3DTextLabel(Businesses[iBusiness][bVehicleLabel][ID]), Businesses[iBusiness][bVehicleLabel][ID] = Text3D:-1;
- DestroyVehicle(Businesses[iBusiness][bVehID][ID]);
- Businesses[iBusiness][bModel][ID] = 0;
- Businesses[iBusiness][bParkPosX][ID] = 0;
- Businesses[iBusiness][bParkPosY][ID] = 0;
- Businesses[iBusiness][bParkPosZ][ID] = 0;
- Businesses[iBusiness][bParkAngle][ID] = 0;
- Businesses[iBusiness][bVehID][ID] = 0;
- Businesses[iBusiness][bPrice][ID] = 0;
- SaveDealershipVehicle(iBusiness, ID);
- return 1;
- }
- return SendClientMessageEx(playerid, COLOR_GREY, "The max number of vehicles for this business has been reached.");
- }
- }
- else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
- return 1;
- }
- CMD:createcdveh(playerid, params[]) {
- if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pBM] == 2) {
- new
- iBusiness,
- iVehicle,
- iColors[2];
- if(sscanf(params, "iiii", iBusiness, iVehicle, iColors[0], iColors[1])) {
- SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /createcdveh [business ID] [model id] [color 1] [color 2]");
- }
- else if(!(400 <= iVehicle <= 611)) {
- SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid model specified (model IDs start at 400, and end at 611).");
- }
- else if(IsATrain(iVehicle)) {
- SendClientMessageEx(playerid, COLOR_GREY, "Trains cannot be spawned during runtime.");
- }
- else if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255)) {
- SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid color specified (IDs start at 0, and end at 255).");
- }
- else if(Businesses[iBusiness][bType] != BUSINESS_TYPE_NEWCARDEALERSHIP && Businesses[iBusiness][bType] != BUSINESS_TYPE_OLDCARDEALERSHIP) {
- SendClientMessageEx(playerid, COLOR_GRAD2, "Business is not a car dealership!");
- }
- else {
- new
- Float: fVehPos[4], label[50];
- GetPlayerPos(playerid, fVehPos[0], fVehPos[1], fVehPos[2]);
- GetPlayerFacingAngle(playerid, fVehPos[3]);
- for (new i; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++)
- {
- if (Businesses[iBusiness][bVehID][i] == 0) {
- Businesses[iBusiness][bVehID][i] = CreateVehicle(iVehicle, fVehPos[0], fVehPos[1], fVehPos[2], fVehPos[3], iColors[0], iColors[1], 10);
- VehicleFuel[Businesses[iBusiness][bVehID][i]] = 100.0;
- Businesses[iBusiness][bModel][i] = iVehicle;
- Businesses[iBusiness][bParkPosX][i] = fVehPos[0];
- Businesses[iBusiness][bParkPosY][i] = fVehPos[1];
- Businesses[iBusiness][bParkPosZ][i] = fVehPos[2];
- Businesses[iBusiness][bParkAngle][i] = fVehPos[3];
- format(label, sizeof(label), "%s For Sale | Price: $%s", GetVehicleName(Businesses[iBusiness][bVehID][i]), number_format(Businesses[iBusiness][bPrice][i]));
- 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]);
- Businesses[iBusiness][DealershipVehStock][i] = 1;
- Vehicle_ResetData(Businesses[iBusiness][bVehID][i]);
- SaveDealershipVehicle(iBusiness, i);
- return 1;
- }
- }
- return SendClientMessageEx(playerid, COLOR_GREY, "The max number of vehicles for this business has been reached.");
- }
- }
- else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
- return 1;
- }
- CMD:switchbiz(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 3 || PlayerInfo[playerid][pBM] >= 1)
- {
- new string[128], bizid;
- if(sscanf(params, "d", bizid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /switchbiz [bizid]");
- if(bizid < 1 || bizid > MAX_BUSINESSES) return SendClientMessageEx(playerid, COLOR_WHITE, "Invalid business ID.");
- format(string, sizeof(string), "You have switched to business ID %d (%s).", bizid, Businesses[bizid][bName]);
- SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
- PlayerInfo[playerid][pBusinessRank] = 5;
- PlayerInfo[playerid][pBusiness] = bizid;
- }
- else return SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use this command");
- return 1;
- }
- CMD:brenewal(playerid, params[])
- {
- if(PlayerInfo[playerid][pShopTech] >= 1)
- {
- new
- iType,
- iOrderID,
- iBusiness,
- szMessage[128],
- months;
- if(sscanf(params, "dddd", iBusiness, iType, months, iOrderID)) {
- SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /brenewal [Business ID] [Type (1-3)] [Months] [OrderID]");
- }
- else if(!IsValidBusinessID(iBusiness)) {
- SendClientMessageEx(playerid, COLOR_GREY, "Invalid business ID");
- }
- else {
- Businesses[iBusiness][bMonths] = 259200+gettime()+(2592000*months);
- format(szMessage, sizeof(szMessage), "You have renewed business %i for %i months.", iBusiness, months);
- SendClientMessageEx(playerid, COLOR_WHITE, szMessage);
- 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);
- Log("logs/shoplog.log", szMessage);
- SaveBusiness(iBusiness);
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command.");
- }
- return 1;
- }
- CMD:shopbusiness(playerid, params[])
- {
- if(PlayerInfo[playerid][pShopTech] < 1 && PlayerInfo[playerid][pBM] < 1)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
- return 1;
- }
- new string[128], choice[32], businessid, amount, invoice[64];
- if(sscanf(params, "s[32]dDs[64]", choice, businessid, amount, invoice))
- {
- SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /shopbusiness [name] [business ID] [Amount] [invoice #]");
- SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, SupplyPoint, Price, Type, Inventory, InventoryCapacity, Delete");
- SendClientMessageEx(playerid, COLOR_GREY, "Available names: CustomInterior, CustomExterior, Months, VW, grade");
- return 1;
- }
- if (!IsValidBusinessID(businessid))
- {
- SendClientMessageEx(playerid, COLOR_GREY, "Invalid business ID entered.");
- return 1;
- }
- if(!strcmp(choice, "grade", true))
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the grade on this business!");
- format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Grade to %i", GetPlayerNameEx(playerid), businessid, amount);
- Businesses[businessid][bGrade] = amount;
- Log("logs/shoplog.log", string);
- }
- if(!strcmp(choice, "months", true))
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the months left on this business!");
- format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Months to %i", GetPlayerNameEx(playerid), businessid, amount);
- Businesses[businessid][bMonths] = (2592000*amount)+gettime()+259200;
- Log("logs/shoplog.log", string);
- }
- else if(!strcmp(choice, "vw", true))
- {
- Businesses[businessid][bVW] = amount;
- SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the VW!");
- format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's vw to %d", GetPlayerNameEx(playerid), businessid, amount);
- Log("logs/shoplog.log", string);
- }
- if(!strcmp(choice, "exterior", true))
- {
- GetPlayerPos(playerid, Businesses[businessid][bExtPos][0], Businesses[businessid][bExtPos][1], Businesses[businessid][bExtPos][2]);
- GetPlayerFacingAngle(playerid, Businesses[businessid][bExtPos][3]);
- SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the exterior!");
- 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]);
- Log("logs/shoplog.log", string);
- }
- else if(!strcmp(choice, "interior", true))
- {
- GetPlayerPos(playerid, Businesses[businessid][bIntPos][0], Businesses[businessid][bIntPos][1], Businesses[businessid][bIntPos][2]);
- GetPlayerFacingAngle(playerid, Businesses[businessid][bIntPos][3]);
- Businesses[businessid][bInt] = GetPlayerInterior(playerid);
- SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the interior!");
- 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]);
- Log("logs/shoplog.log", string);
- }
- else if(strcmp(choice, "custominterior", true) == 0)
- {
- if(Businesses[businessid][bCustomInterior] == 0)
- {
- Businesses[businessid][bCustomInterior] = 1;
- SendClientMessageEx(playerid, COLOR_WHITE, "Business set to custom interior!");
- }
- else
- {
- Businesses[businessid][bCustomInterior] = 0;
- SendClientMessageEx(playerid, COLOR_WHITE, "Business set to normal (not custom) interior!");
- }
- format(string, sizeof(string), "[SHOPBUSINESS] %s has edited BusinessID %d's CustomInterior.", GetPlayerNameEx(playerid), businessid);
- Log("logs/shoplog.log", string);
- return 1;
- }
- else if(strcmp(choice, "customexterior", true) == 0)
- {
- if(Businesses[businessid][bCustomExterior] == 0)
- {
- Businesses[businessid][bCustomExterior] = 1;
- SendClientMessageEx(playerid, COLOR_WHITE, "Business set to custom exterior!");
- }
- else
- {
- Businesses[businessid][bCustomExterior] = 0;
- SendClientMessageEx(playerid, COLOR_WHITE, "Business set to normal (not custom) exterior!");
- }
- format(string, sizeof(string), "[SHOPBUSINESS] %s has edited BusinessID %d's CustomExterior.", GetPlayerNameEx(playerid), businessid);
- Log("logs/shoplog.log", string);
- return 1;
- }
- else if(!strcmp(choice, "supplypoint", true))
- {
- if(Businesses[businessid][bOrderState] == 2)
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can't change the supply point when a delivery is on its way.");
- }
- GetPlayerPos(playerid, Businesses[businessid][bSupplyPos][0], Businesses[businessid][bSupplyPos][1], Businesses[businessid][bSupplyPos][2]);
- SendClientMessageEx(playerid, COLOR_WHITE, "You have edited the supply point!");
- 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]);
- Log("logs/shoplog.log", string);
- }
- else if(!strcmp(choice, "price", true))
- {
- Businesses[businessid][bValue] = amount;
- format(string, sizeof(string), "You have set the business price to $%d.", amount);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Price to $%d.", GetPlayerNameEx(playerid), businessid, amount);
- Log("logs/shoplog.log", string);
- }
- else if(!strcmp(choice, "type", true))
- {
- if(Businesses[businessid][bOrderState] == 2)
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can't change the business type when a delivery is on its way.");
- }
- Businesses[businessid][bType] = amount;
- format(string, sizeof(string), "You have set the business type to %s.", GetBusinessTypeName(amount));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Type to %s (%d).", GetPlayerNameEx(playerid), businessid, GetBusinessTypeName(amount), amount);
- Log("logs/shoplog.log", string);
- }
- else if(!strcmp(choice, "inventory", true))
- {
- Businesses[businessid][bInventory] = amount;
- format(string, sizeof(string), "You have set the business inventory to %d.", amount);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Inventory to %d.", GetPlayerNameEx(playerid), businessid, amount);
- Log("logs/shoplog.log", string);
- }
- else if(!strcmp(choice, "InventoryCapacity", true))
- {
- Businesses[businessid][bInventoryCapacity] = amount;
- format(string, sizeof(string), "You have set the business inventory capacity to %d.", amount);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "[SHOPBUSINESS] %s has changed BusinessID %d's Inventory Capacity to %d.", GetPlayerNameEx(playerid), businessid, amount);
- Log("logs/shoplog.log", string);
- }
- else if(!strcmp(choice, "delete", true))
- {
- Businesses[businessid][bExtPos][0] = 0;
- Businesses[businessid][bExtPos][1] = 0;
- Businesses[businessid][bExtPos][2] = 0;
- Businesses[businessid][bName][0] = 0;
- Businesses[businessid][bType] = 0;
- format(string, sizeof(string), "You have deleted the business.", amount);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "[SHOPBUSINESS] %s has deleted BusinessID %d.", GetPlayerNameEx(playerid), businessid);
- Log("logs/bedit.log", string);
- //TODO IMPROVE
- for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++) {
- DestroyDynamicGasPump(businessid, i);
- }
- for (new i; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++) {
- if(IsValidVehicle(Businesses[businessid][bVehID][i])) DestroyVehicle(Businesses[businessid][bVehID][i]);
- if(IsValidDynamic3DTextLabel(Businesses[businessid][bVehicleLabel][i])) DestroyDynamic3DTextLabel(Businesses[businessid][bVehicleLabel][i]), Businesses[businessid][bVehicleLabel][i] = Text3D:-1;
- Businesses[businessid][bModel][i] = 0;
- Businesses[businessid][bParkPosX][i] = 0;
- Businesses[businessid][bParkPosY][i] = 0;
- Businesses[businessid][bParkPosZ][i] = 0;
- Businesses[businessid][bParkAngle][i] = 0;
- Businesses[businessid][bVehID][i] = 0;
- Businesses[businessid][bPrice][i] = 0;
- SaveDealershipVehicle(businessid, i);
- }
- }
- RefreshBusinessPickup(businessid);
- SaveBusiness(businessid);
- Streamer_UpdateEx(playerid, Businesses[businessid][bExtPos][0], Businesses[businessid][bExtPos][1], Businesses[businessid][bExtPos][2]);
- return 1;
- }
- CMD:shopbusinessname(playerid, params[])
- {
- if(PlayerInfo[playerid][pShopTech] < 1 && PlayerInfo[playerid][pBM] < 1)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
- return 1;
- }
- new string[128], houseid, ownername, invoice[64];
- if(sscanf(params, "dus[64]", houseid, ownername, invoice)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /shopbusinessname [Business ID] [Player] [invoice]");
- if(!IsPlayerConnected(ownername)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
- }
- if(PlayerInfo[ownername][pLevel] == 1 && PlayerInfo[ownername][pAdmin] < 2) return SendClientMessageEx(playerid, COLOR_RED, "You can't use /shopbusinessname on level 1's");
- if(PlayerInfo[ownername][pBusiness] != INVALID_BUSINESS_ID) {
- return SendClientMessageEx(playerid, COLOR_GREY, "That player already owns another business.");
- }
- Businesses[houseid][bOwner] = GetPlayerSQLId(ownername);
- strcpy(Businesses[houseid][bOwnerName], GetPlayerNameEx(ownername), MAX_PLAYER_NAME);
- PlayerInfo[ownername][pBusiness] = houseid;
- PlayerInfo[ownername][pBusinessRank] = 5;
- SaveBusiness(houseid);
- OnPlayerStatsUpdate(ownername);
- RefreshBusinessPickup(houseid);
- format(string, sizeof(string), "[SHOPBUSINESS] %s modified Owner on Business %d to %s(%d) - Invoice %s", GetPlayerNameEx(playerid), houseid, GetPlayerNameEx(ownername), GetPlayerSQLId(ownername), invoice);
- Log("logs/shoplog.log", string);
- return 1;
- }
- CMD:buyclothes(playerid, params[])
- {
- new biz = InBusiness(playerid);
- if (biz == INVALID_BUSINESS_ID || Businesses[biz][bType] != BUSINESS_TYPE_CLOTHING) {
- SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in a clothing shop!");
- return 1;
- }
- if (Businesses[biz][bInventory] < 1) {
- SendClientMessageEx(playerid, COLOR_GRAD2, "Store does not have any clothes!");
- return 1;
- }
- if (!Businesses[biz][bStatus]) {
- SendClientMessageEx(playerid, COLOR_GRAD2, "This clothing store is closed!");
- return 1;
- }
- #if defined zombiemode
- if(zombieevent == 1 && GetPVarType(playerid, "pIsZombie")) return SendClientMessageEx(playerid, COLOR_GREY, "Zombies can't use this.");
- #endif
- new string[64];
- format(string, sizeof(string), "Note: Clothes changes cost %s", number_format(Businesses[biz][bItemPrices][0]));
- SetPVarInt(playerid, "SkinChangeCost", Businesses[biz][bItemPrices][0]);
- SendClientMessageEx(playerid, COLOR_YELLOW, string);
- 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.");
- ShowModelSelectionMenu(playerid, SkinList, "Change your clothes.");
- return 1;
- }
- CMD:buybizlevel(playerid, params[])
- {
- if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || PlayerInfo[playerid][pBusinessRank] < 5)
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "Only business owners can use this command.");
- }
- if (Businesses[PlayerInfo[playerid][pBusiness]][bLevel] >= 5)
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "You cannot buy levels anymore.");
- }
- new newLevel = Businesses[PlayerInfo[playerid][pBusiness]][bLevel] + 1;
- new totalSales = Businesses[PlayerInfo[playerid][pBusiness]][bTotalSales];
- new totalProfits = Businesses[PlayerInfo[playerid][pBusiness]][bTotalProfits];
- if (newLevel == 2 && totalSales < 1000 && totalProfits < 300000)
- return SendClientMessageEx(playerid, COLOR_GREY, "This business does not have enough total sales/profits to purchase this uprgade!");
- else if (newLevel == 3 && totalSales < 5000 && totalProfits < 2000000)
- return SendClientMessageEx(playerid, COLOR_GREY, "This business does not have enough total sales/profits to purchase this uprgade!");
- else if (newLevel == 4 && totalSales < 15000 && totalProfits < 10000000)
- return SendClientMessageEx(playerid, COLOR_GREY, "This business does not have enough total sales/profits to purchase this uprgade!");
- new cost = Businesses[PlayerInfo[playerid][pBusiness]][bLevel] * 100000;
- if(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] < cost)
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "The business does not have enough money in the safe to purchase this upgrade!");
- }
- Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] -= cost;
- OnPlayerStatsUpdate(playerid);
- new string[128];
- format(string, sizeof(string), "~g~BUSINESS LEVEL UP~n~~w~Current Level %d", ++Businesses[PlayerInfo[playerid][pBusiness]][bLevel]);
- PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
- Businesses[PlayerInfo[playerid][pBusiness]][bLevelProgress] = 0;
- Businesses[PlayerInfo[playerid][pBusiness]][bInventoryCapacity] *= 2;
- if(IsBusinessGasAble(Businesses[PlayerInfo[playerid][pBusiness]][bType]))
- {
- for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++)
- {
- Businesses[PlayerInfo[playerid][pBusiness]][GasPumpCapacity][i] *= 2;
- }
- }
- SaveBusiness(PlayerInfo[playerid][pBusiness]);
- return 1;
- }
-
- // Business Leadership Commands Start
- CMD:binvite(playerid, params[]) {
- new iBusinessID = PlayerInfo[playerid][pBusiness];
- if((0 <= iBusinessID < MAX_BUSINESSES) && PlayerInfo[playerid][pBusinessRank] >= Businesses[iBusinessID][bMinInviteRank]) {
- new
- iTargetID,
- string[128];
- if(sscanf(params, "u", iTargetID)) {
- SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /binvite [player]");
- }
- else if(IsPlayerConnected(iTargetID)) {
- if (iTargetID != playerid) {
- if(!(0 <= PlayerInfo[iTargetID][pBusiness] < MAX_BUSINESSES)) {
- SetPVarInt(iTargetID, "Business_Inviter", playerid);
- SetPVarInt(iTargetID, "Business_InviterSQLId", GetPlayerSQLId(playerid));
- SetPVarInt(iTargetID, "Business_Invited", iBusinessID);
- format(string, sizeof(string), "You have invited %s to join %s", GetPlayerNameEx(iTargetID), Businesses[iBusinessID][bName]);
- SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
- 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]);
- SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, string);
- format(string, sizeof(string), "%s(%d) has invited %s(%d) to join %s", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), GetPlayerNameEx(iTargetID), GetPlayerSQLId(iTargetID), Businesses[iBusinessID][bName]);
- Log("logs/business.log", string);
- }
- else SendClientMessageEx(playerid, COLOR_GREY, "The person you're trying to invite is already in another business.");
- }
- else SendClientMessageEx(playerid, COLOR_GREY, "You cannot use this command on yourself.");
- }
- else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
- }
- else SendClientMessageEx(playerid, COLOR_GRAD1, "Only authorized business employees may use this command.");
- return 1;
- }
- CMD:buninvite(playerid, params[]) {
- if(0 <= PlayerInfo[playerid][pBusiness] < MAX_BUSINESSES && PlayerInfo[playerid][pBusinessRank] >= Businesses[PlayerInfo[playerid][pBusiness]][bMinInviteRank]) {
- new
- iTargetID,
- iGroupID = PlayerInfo[playerid][pBusiness];
- if(sscanf(params, "u", iTargetID)) {
- SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /buninvite [player]");
- }
- else if(IsPlayerConnected(iTargetID)) {
- if(iGroupID == PlayerInfo[iTargetID][pBusiness]) {
- if(playerid == iTargetID) {
- SendClientMessageEx(playerid, COLOR_GREY, "You can't uninvite yourself.");
- }
- else if(PlayerInfo[playerid][pBusinessRank] > PlayerInfo[iTargetID][pBusinessRank]) {
- new
- szMessage[128],
- iRank = PlayerInfo[iTargetID][pBusinessRank];
- format(szMessage, sizeof(szMessage), "You have kicked %s from the business.", GetPlayerNameEx(iTargetID));
- SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
- format(szMessage, sizeof(szMessage), "* You have been kicked from the business by %s %s.", GetPlayerNameEx(playerid));
- SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
- 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);
- Log("logs/business.log", szMessage);
- PlayerInfo[iTargetID][pBusiness] = INVALID_BUSINESS_ID;
- PlayerInfo[iTargetID][pBusinessRank] = 0;
- OnPlayerStatsUpdate(iTargetID);
- }
- else SendClientMessageEx(playerid, COLOR_GREY, "You can't do this to a person of equal or higher rank.");
- }
- else SendClientMessageEx(playerid, COLOR_GRAD1, "That person is not in your business.");
- }
- else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
- }
- else SendClientMessageEx(playerid, COLOR_GRAD1, "Only authorized business employees may use this command.");
- return 1;
- }
- CMD:bouninvite(playerid, params[])
- {
- new name[32], query[128];
- if (sscanf(params, "s[32]", name)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bouninvite [account name]");
- if(PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
- return 1;
- }
- if(PlayerInfo[playerid][pBusinessRank] != 5) {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
- return 1;
- }
- 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]);
- mysql_tquery(MainPipeline, query, "OnQueryFinish", "i", SENDDATA_THREAD);
- SendClientMessageEx(playerid, COLOR_GREY, "You have offline kicked that person.");
- return 1;
- }
- CMD:bgiverank(playerid, params[])
- {
- new string[128], targetid, rank;
- if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID)
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not in a business!");
- }
- if(sscanf(params, "ud", targetid, rank)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bgiverank [player] [rank]");
- }
- else if (PlayerInfo[playerid][pBusinessRank] < Businesses[PlayerInfo[playerid][pBusiness]][bMinGiveRankRank]) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Your rank is not high enough for promoting or demoting someone!");
- }
- else if (!IsPlayerConnected(targetid)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified!");
- }
- else if (playerid == targetid) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can not use this command on yourself!");
- }
- else if(PlayerInfo[playerid][pBusiness] != PlayerInfo[targetid][pBusiness]) {
- return SendClientMessageEx(playerid, COLOR_GREY, "That person is not in your business!");
- }
- else if (PlayerInfo[targetid][pBusinessRank] > PlayerInfo[playerid][pBusinessRank]) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can not use this command on that rank persons!");
- }
- else if(rank > PlayerInfo[playerid][pBusinessRank])
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can not give a rank higher than your own!");
- }
- else if(rank < 0 || rank > 5) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Don't go below number 0 or above number 5!");
- }
- if (rank > PlayerInfo[targetid][pBusinessRank]) {
- format(string, sizeof(string), "* You have been promoted to a higher rank (%s) by %s.", GetBusinessRankName(rank), GetPlayerNameEx(playerid));
- SendClientMessageEx(targetid, COLOR_LIGHTBLUE, string);
- }
- else if (rank < PlayerInfo[targetid][pBusinessRank]) {
- format(string, sizeof(string), "* You have been demoted to a lower rank (%s) by %s.", GetBusinessRankName(rank), GetPlayerNameEx(playerid));
- SendClientMessageEx(targetid, COLOR_LIGHTBLUE, string);
- }
- else {
- return SendClientMessageEx(playerid, COLOR_GREY, "That person already has this rank.");
- }
- PlayerInfo[targetid][pBusinessRank] = rank;
- format(string, sizeof(string), "* You have given %s rank %d.", GetPlayerNameEx(targetid), rank);
- SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
- 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]);
- Log("logs/business.log", string);
- return 1;
- }
- CMD:resign(playerid, params[])
- {
- if (PlayerInfo[playerid][pBusiness] != INVALID_BUSINESS_ID)
- {
- new string[128];
- format(string, sizeof(string), "%s(%d) has resigned from their business as a rank %i", GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), PlayerInfo[playerid][pBusinessRank]);
- Log("logs/business.log", string);
- PlayerInfo[playerid][pBusiness] = INVALID_BUSINESS_ID;
- PlayerInfo[playerid][pBusinessRank] = INVALID_RANK;
- return SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have resigned from your business.");
- }
- else return SendClientMessageEx(playerid, COLOR_GREY, "You are not in a business!");
- }
- CMD:bsafe(playerid, params[])
- {
- if(PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
- return 1;
- }
- else if(!IsPlayerInRangeOfPoint(playerid, 25.0, Businesses[PlayerInfo[playerid][pBusiness]][bIntPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bIntPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bIntPos][2])) {
- SendClientMessageEx(playerid, COLOR_GREY, "You need to be inside your business to access your business safe.");
- return 1;
- }
- else if(PlayerInfo[playerid][pBusinessRank] < Businesses[PlayerInfo[playerid][pBusiness]][bMinSafeRank]) {
- SendClientMessageEx(playerid, COLOR_GREY, "You aren't high enough rank to access the business safe.");
- return 1;
- }
- else {
- new choice[10], Amount, string[256];
- if(sscanf(params, "s[10]D", choice, Amount)) {
- SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bsafe [name] [amount]");
- SendClientMessageEx(playerid, COLOR_GREY, "Available names: Balance, Withdraw, Deposit");
- return 1;
- }
- else if(!strcmp(choice, "Balance", true))
- {
- format(string, sizeof(string), "Business(%d) Safe Balance: $%s", PlayerInfo[playerid][pBusiness], number_format(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance]));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- }
- else if(Amount < 1) {
- SendClientMessageEx(playerid, COLOR_GREY, "The amount can't be under 1.");
- return 1;
- }
- else if(!strcmp(choice, "Withdraw", true))
- {
- if(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] >= Amount) {
- format(string, sizeof(string), "You have withdrew $%s from your business safe.", number_format(Amount));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "Business(%d) Safe Balance: $%s", PlayerInfo[playerid][pBusiness], number_format(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance]));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- 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));
- Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] -= Amount;
- Log("logs/business.log", string);
- GivePlayerCash(playerid, Amount);
- SaveBusiness(PlayerInfo[playerid][pBusiness]);
- OnPlayerStatsUpdate(playerid);
- }
- else {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't have that much in your business safe.");
- }
- }
- else if(!strcmp(choice, "Deposit", true))
- {
- if(GetPlayerCash(playerid) >= Amount) {
- format(string, sizeof(string), "You have deposited $%s into your business safe.", number_format(Amount));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "Business(%d) Safe Balance: $%s", PlayerInfo[playerid][pBusiness], number_format(Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance]));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- 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));
- Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] += Amount;
- Log("logs/business.log", string);
- GivePlayerCash(playerid, -Amount);
- SaveBusiness(PlayerInfo[playerid][pBusiness]);
- OnPlayerStatsUpdate(playerid);
- }
- else {
- SendClientMessageEx(playerid, COLOR_GREY, "You don't have that much cash on you.");
- }
- }
- }
- return 1;
- }
- // Business Admin Commands
- CMD:bedit(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pASM] < 1 && PlayerInfo[playerid][pBM] < 1)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
- return 1;
- }
- new choice[32], businessid, amount, string[128];
- if(sscanf(params, "s[32]dD(0)", choice, businessid, amount))
- {
- SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bedit [name] [businessid] [amount]");
- SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, SupplyPoint, Price, Type, Inventory, InventoryCapacity, SafeBalance, Delete");
- SendClientMessageEx(playerid, COLOR_GREY, "Available names: CustomInterior, CustomExterior, Months, GymEntryFee, GymType, VW, Grade, MaxLevel");
- return 1;
- }
- if (!IsValidBusinessID(businessid))
- {
- SendClientMessageEx(playerid, COLOR_GREY, "Invalid business ID entered.");
- return 1;
- }
- if(!strcmp(choice, "maxlevel", true))
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the max level allowed to enter this business!");
- format(string, sizeof(string), "%s has changed BusinessID %d's MaxLevel to %i", GetPlayerNameEx(playerid), businessid, amount);
- Businesses[businessid][bMaxLevel] = amount;
- Log("logs/bedit.log", string);
- }
- if(!strcmp(choice, "grade", true))
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the grade on this business!");
- format(string, sizeof(string), "%s has changed BusinessID %d's Grade to %i", GetPlayerNameEx(playerid), businessid, amount);
- Businesses[businessid][bGrade] = amount;
- Log("logs/bedit.log", string);
- }
- if(!strcmp(choice, "months", true))
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the months left on this business!");
- format(string, sizeof(string), "%s has changed BusinessID %d's Months to %i", GetPlayerNameEx(playerid), businessid, amount);
- Businesses[businessid][bMonths] = 2592000*amount+gettime()+259200;
- Log("logs/bedit.log", string);
- }
- else if(!strcmp(choice, "vw", true))
- {
- Businesses[businessid][bVW] = amount;
- SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the VW!");
- format(string, sizeof(string), "%s has changed BusinessID %d's vw to %d", GetPlayerNameEx(playerid), businessid, amount);
- Log("logs/bedit.log", string);
- }
- if(!strcmp(choice, "exterior", true))
- {
- GetPlayerPos(playerid, Businesses[businessid][bExtPos][0], Businesses[businessid][bExtPos][1], Businesses[businessid][bExtPos][2]);
- GetPlayerFacingAngle(playerid, Businesses[businessid][bExtPos][3]);
- SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the exterior!");
- 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]);
- Log("logs/bedit.log", string);
- }
- else if(!strcmp(choice, "interior", true))
- {
- GetPlayerPos(playerid, Businesses[businessid][bIntPos][0], Businesses[businessid][bIntPos][1], Businesses[businessid][bIntPos][2]);
- GetPlayerFacingAngle(playerid, Businesses[businessid][bIntPos][3]);
- Businesses[businessid][bInt] = GetPlayerInterior(playerid);
- SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the interior!");
- 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]);
- Log("logs/bedit.log", string);
- }
- else if(strcmp(choice, "custominterior", true) == 0)
- {
- if(Businesses[businessid][bCustomInterior] == 0)
- {
- Businesses[businessid][bCustomInterior] = 1;
- SendClientMessageEx(playerid, COLOR_WHITE, "Business set to custom interior!");
- }
- else
- {
- Businesses[businessid][bCustomInterior] = 0;
- SendClientMessageEx(playerid, COLOR_WHITE, "Business set to normal (not custom) interior!");
- }
- format(string, sizeof(string), "%s has edited BusinessID %d's CustomInterior.", GetPlayerNameEx(playerid), businessid);
- Log("logs/bedit.log", string);
- return 1;
- }
- else if(strcmp(choice, "customexterior", true) == 0)
- {
- if(Businesses[businessid][bCustomExterior] == 0)
- {
- Businesses[businessid][bCustomExterior] = 1;
- SendClientMessageEx(playerid, COLOR_WHITE, "Business set to custom exterior!");
- }
- else
- {
- Businesses[businessid][bCustomExterior] = 0;
- SendClientMessageEx(playerid, COLOR_WHITE, "Business set to normal (not custom) exterior!");
- }
- format(string, sizeof(string), "%s has edited BusinessID %d's CustomExterior.", GetPlayerNameEx(playerid), businessid);
- Log("logs/bedit.log", string);
- return 1;
- }
- else if(!strcmp(choice, "supplypoint", true))
- {
- if(Businesses[businessid][bOrderState] == 2)
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can't change the supply point when a delivery is on its way.");
- }
- GetPlayerPos(playerid, Businesses[businessid][bSupplyPos][0], Businesses[businessid][bSupplyPos][1], Businesses[businessid][bSupplyPos][2]);
- SendClientMessageEx(playerid, COLOR_WHITE, "You have edited the supply point!");
- 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]);
- Log("logs/bedit.log", string);
- }
- else if(!strcmp(choice, "price", true))
- {
- Businesses[businessid][bValue] = amount;
- format(string, sizeof(string), "You have set the business price to $%d.", amount);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "%s has changed BusinessID %d's Price to $%d.", GetPlayerNameEx(playerid), businessid, amount);
- Log("logs/bedit.log", string);
- }
- else if(!strcmp(choice, "type", true))
- {
- if(Businesses[businessid][bOrderState] == 2)
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can't change the business type when a delivery is on its way.");
- }
- Businesses[businessid][bType] = amount;
- format(string, sizeof(string), "You have set the business type to %s.", GetBusinessTypeName(amount));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "%s has changed BusinessID %d's Type to %s (%d).", GetPlayerNameEx(playerid), businessid, GetBusinessTypeName(amount), amount);
- Log("logs/bedit.log", string);
- }
- else if(!strcmp(choice, "inventory", true))
- {
- Businesses[businessid][bInventory] = amount;
- format(string, sizeof(string), "You have set the business inventory to %d.", amount);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "%s has changed BusinessID %d's Inventory to %d.", GetPlayerNameEx(playerid), businessid, amount);
- Log("logs/bedit.log", string);
- }
- else if(!strcmp(choice, "InventoryCapacity", true))
- {
- Businesses[businessid][bInventoryCapacity] = amount;
- format(string, sizeof(string), "You have set the business inventory capacity to %d.", amount);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "%s has changed BusinessID %d's Inventory Capacity to %d.", GetPlayerNameEx(playerid), businessid, amount);
- Log("logs/bedit.log", string);
- }
- else if(!strcmp(choice, "safebalance", true))
- {
- Businesses[businessid][bSafeBalance] = amount;
- format(string, sizeof(string), "You have set the business safe to %d.", amount);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "%s has changed BusinessID %d's safe to %d.", GetPlayerNameEx(playerid), businessid, amount);
- Log("logs/bedit.log", string);
- }
- else if (!strcmp(choice, "gymentryfee", true))
- {
- if (Businesses[businessid][bType] != BUSINESS_TYPE_GYM)
- {
- return SendClientMessageEx(playerid, COLOR_GRAD2, "Only Gyms can have entrance fees!");
- }
- Businesses[businessid][bGymEntryFee] = amount;
- format(string, sizeof(string), "You have set the gym entry fee to %i.", amount);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "%s has changed BusinessID %i's gym entry fee to %i.", GetPlayerNameEx(playerid), businessid, amount);
- Log("logs/bedit.log", string);
- }
- else if (!strcmp(choice, "gymtype", true))
- {
- if (Businesses[businessid][bType] != BUSINESS_TYPE_GYM)
- {
- return SendClientMessageEx(playerid, COLOR_GRAD2, "You can only use this command on a gym!");
- }
- if (amount == 1) // swimming pool & boxing arena
- {
- Businesses[businessid][bGymType] = amount;
- }
- else if (amount == 2) // bike parkour
- {
- Businesses[businessid][bGymType] = amount;
- }
- else
- {
- return SendClientMessageEx(playerid, COLOR_GRAD2, "Available types are: Swimming Pool / Boxing Arena(1) or Bike Parkour (2)");
- }
- format(string, sizeof(string), "You have the set the gym type to %i.", amount);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "%s has changed BusinessID %i's gym type to %i.", GetPlayerNameEx(playerid), businessid, amount);
- Log("logs/bedit.log", string);
- }
- else if(!strcmp(choice, "delete", true))
- {
- Businesses[businessid][bExtPos][0] = 0;
- Businesses[businessid][bExtPos][1] = 0;
- Businesses[businessid][bExtPos][2] = 0;
- Businesses[businessid][bName][0] = 0;
- Businesses[businessid][bType] = 0;
- format(string, sizeof(string), "You have deleted the business.", amount);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "%s has deleted BusinessID %d.", GetPlayerNameEx(playerid), businessid);
- Log("logs/bedit.log", string);
- for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++) {
- DestroyDynamicGasPump(businessid, i);
- }
- for (new i; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++) {
- if(IsValidVehicle(Businesses[businessid][bVehID][i])) DestroyVehicle(Businesses[businessid][bVehID][i]);
- if(IsValidDynamic3DTextLabel(Businesses[businessid][bVehicleLabel][i])) DestroyDynamic3DTextLabel(Businesses[businessid][bVehicleLabel][i]), Businesses[businessid][bVehicleLabel][i] = Text3D:-1;
- Businesses[businessid][bModel][i] = 0;
- Businesses[businessid][bParkPosX][i] = 0;
- Businesses[businessid][bParkPosY][i] = 0;
- Businesses[businessid][bParkPosZ][i] = 0;
- Businesses[businessid][bParkAngle][i] = 0;
- Businesses[businessid][bVehID][i] = 0;
- Businesses[businessid][bPrice][i] = 0;
- SaveDealershipVehicle(businessid, i);
- }
- }
- RefreshBusinessPickup(businessid);
- SaveBusiness(businessid);
- Streamer_UpdateEx(playerid, Businesses[businessid][bExtPos][0], Businesses[businessid][bExtPos][1], Businesses[businessid][bExtPos][2]);
- return 1;
- }
- CMD:bname(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pBM] >= 1)
- {
- new name[40], businessid;
- if(sscanf(params, "ds[40]", businessid, name)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bname [business id] [name]");
- }
- else if (!IsValidBusinessID(businessid)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Invalid business specified.");
- }
- else if(strfind(name, "\r") != -1 || strfind(name, "\n") != -1) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Newline characters are forbidden.");
- }
- strcpy(Businesses[businessid][bName], name, sizeof(name));
- SaveBusiness(businessid);
- SendClientMessageEx(playerid, COLOR_WHITE, "You have successfully changed the name of this business.");
- RefreshBusinessPickup(businessid);
- new string[128];
- format(string, sizeof(string), "%s has edited business ID %d's name to %s.", GetPlayerNameEx(playerid), businessid, Businesses[businessid][bName]);
- Log("logs/bedit.log", string);
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
- }
- return 1;
- }
- CMD:bnext(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pBM] >= 1)
- {
- SendClientMessageEx(playerid, COLOR_RED, "* Listing next available business...");
- for(new i; i<MAX_BUSINESSES;i++)
- {
- if(Businesses[i][bExtPos] == 0.0)
- {
- new string[128];
- format(string, sizeof(string), "%d is available to use.", i);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- break;
- }
- }
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
- }
- return 1;
- }
- CMD:bnear(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pBM] >= 1)
- {
- SendClientMessageEx(playerid, COLOR_RED, "* Listing businesses within 30 meters of you");
- for(new i;i<MAX_BUSINESSES;i++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 30, Businesses[i][bExtPos][0], Businesses[i][bExtPos][1], Businesses[i][bExtPos][2]))
- {
- new string[128];
- 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]));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- }
- }
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
- }
- return 1;
- }
- CMD:gotobiz(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pBM] >= 1)
- {
- new id;
- if(sscanf(params, "d", id)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /gotobiz [business id]");
- if(!IsValidBusinessID(id)) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid business ID specified.");
- if (Businesses[id][bExtPos][0] == 0.0) return SendClientMessageEx(playerid, COLOR_GREY, "No exterior set for this business.");
- GameTextForPlayer(playerid, "~w~Teleporting", 5000, 1);
- SetPlayerInterior(playerid, 0);
- SetPlayerVirtualWorld(playerid, 0);
- PlayerInfo[playerid][pInt] = 0;
- PlayerInfo[playerid][pVW] = 0;
- SetPlayerPos(playerid,Businesses[id][bExtPos][0],Businesses[id][bExtPos][1],Businesses[id][bExtPos][2]);
- SetPlayerFacingAngle(playerid,Businesses[id][bExtPos][3]);
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
- }
- return 1;
- }
- CMD:goinbiz(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pBM] >= 1)
- {
- new id;
- if(sscanf(params, "d", id)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /goinbiz [businessid]");
- if(!IsValidBusinessID(id)) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid business ID specified.");
- if (Businesses[id][bExtPos][0] == 0.0) return SendClientMessageEx(playerid, COLOR_GREY, "No interior set for this business.");
- SetPlayerInterior(playerid,Businesses[id][bInt]);
- SetPlayerPos(playerid,Businesses[id][bIntPos][0],Businesses[id][bIntPos][1],Businesses[id][bIntPos][2]);
- SetPlayerFacingAngle(playerid,Businesses[id][bIntPos][3]);
- SetPVarInt(playerid, "BusinessesID", id);
- if(Businesses[id][bVW] == 0) SetPlayerVirtualWorld(playerid, BUSINESS_BASE_VW + id), PlayerInfo[playerid][pVW] = BUSINESS_BASE_VW + id;
- else SetPlayerVirtualWorld(playerid, Businesses[id][bVW]), PlayerInfo[playerid][pVW] = Businesses[id][bVW];
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
- }
- return 1;
- }
- CMD:asellbiz(playerid, params[])
- {
- if (PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pASM] < 1 && PlayerInfo[playerid][pBM] < 2) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use that command.");
- }
- new string[128], biz;
- if(sscanf(params, "d", biz)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /asellbiz [business id]");
- Businesses[biz][bOwner] = -1;
- SaveBusiness(biz);
- RefreshBusinessPickup(biz);
- new ip[16];
- GetPlayerIp(playerid,ip,sizeof(ip));
- 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]);
- Log("logs/business.log", string);
- PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
- format(string, sizeof(string), "~w~You have sold business %d.", biz);
- GameTextForPlayer(playerid, string, 10000, 3);
- foreach(new j: Player)
- {
- if(PlayerInfo[j][pBusiness] == biz)
- {
- PlayerInfo[j][pBusiness] = INVALID_BUSINESS_ID;
- PlayerInfo[j][pBusinessRank] = 0;
- SendClientMessageEx(playerid, COLOR_WHITE, "An admin has sold this business, your business stats have been reset.");
- }
- }
- mysql_format(MainPipeline, string, sizeof(string), "UPDATE `accounts` SET `Business` = "#INVALID_BUSINESS_ID", `BusinessRank` = 0 WHERE `Business` = '%d'", biz);
- mysql_tquery(MainPipeline, string, "OnQueryFinish", "i", SENDDATA_THREAD);
- return 1;
- }
- /*CMD:sellbiz(playerid, params[])
- {
- if(PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID )
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business!");
- }
- else if(PlayerInfo[playerid][pBusinessRank] < 5 && Businesses[PlayerInfo[playerid][pBusiness]][bOwner] != GetPlayerSQLId(playerid)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You aren't the owner of the business.");
- }
- else if (IsPlayerInRangeOfPoint(playerid, 2.0, Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][2]))
- {
- new i = PlayerInfo[playerid][pBusiness];
- PlayerInfo[playerid][pBusiness] = INVALID_BUSINESS_ID;
- PlayerInfo[playerid][pBusinessRank] = 0;
- GivePlayerCash(playerid,Businesses[i][bValue]);
- OnPlayerStatsUpdate(playerid);
- Businesses[i][bOwner] = -1;
- SaveBusiness(i);
- RefreshBusinessPickup(i);
- new string[128];
- format(string,sizeof(string),"%s (IP: %s) has sold business ID %d for $%d",GetPlayerNameEx(playerid),GetPlayerIpEx(playerid),i, Businesses[i][bValue]);
- Log("logs/business.log", string);
- PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
- format(string, sizeof(string), "~w~Congratulations~n~You have sold your business for ~n~~g~$%d", Businesses[i][bValue]);
- GameTextForPlayer(playerid, string, 10000, 3);
- foreach(new j: Player) {
- if(PlayerInfo[j][pBusiness] == i) {
- PlayerInfo[j][pBusiness] = INVALID_BUSINESS_ID;
- PlayerInfo[j][pBusinessRank] = 0;
- SendClientMessageEx(playerid, COLOR_WHITE, "The owner of the business you were a part of has sold his business.");
- }
- }
- format(string, sizeof(string), "UPDATE `accounts` SET `Business` = "#INVALID_BUSINESS_ID", `BusinessRank` = 0 WHERE `Business` = '%d'", i);
- mysql_tquery(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
- return 1;
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You need to be at your business in order to sell it.");
- return 1;
- }
- }
- CMD:buybiz(playerid, params[])
- {
- if(PlayerInfo[playerid][pBusiness] != INVALID_BUSINESS_ID) return SendClientMessageEx(playerid, COLOR_GREY, "You already own a business!");
- for(new i = 0; i < sizeof(Businesses); i++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, Businesses[i][bExtPos][0], Businesses[i][bExtPos][1], Businesses[i][bExtPos][2]))
- {
- if (Businesses[i][bOwner] >= 1)
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "This business is already owned!");
- }
- if (GetPlayerCash(playerid) < Businesses[i][bValue])
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "You don't have enough cash!");
- }
- GivePlayerCash(playerid, -Businesses[i][bValue]);
- Businesses[i][bOwner] = GetPlayerSQLId(playerid);
- strcpy(Businesses[i][bOwnerName], GetPlayerNameEx(playerid), MAX_PLAYER_NAME);
- PlayerInfo[playerid][pBusiness] = i;
- PlayerInfo[playerid][pBusinessRank] = 5;
- SendClientMessageEx(playerid, COLOR_WHITE, "Congratulations on your new purchase!");
- SendClientMessageEx(playerid, COLOR_WHITE, "Type /help to review the business help section!");
- SaveBusiness(i);
- OnPlayerStatsUpdate(playerid);
- RefreshBusinessPickup(i);
- new string[128];
- format(string,sizeof(string),"%s (IP: %s) has bought business ID %d for $%d.", GetPlayerNameEx(playerid), GetPlayerIpEx(playerid), i, Businesses[i][bValue]);
- Log("logs/business.log", string);
- return 1;
- }
- }
- return SendClientMessageEx(playerid, COLOR_WHITE, "You're not near a business!");
- }
- */
- CMD:creategaspump(playerid, params[])
- {
- new string[128], iBusinessID;
- if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pASM] >= 1 || PlayerInfo[playerid][pBM] >= 1) {
- if(sscanf(params, "d", iBusinessID)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /creategaspump [business id]");
- }
- else
- {
- if (GetFreeGasPumpID(iBusinessID) == INVALID_GAS_PUMP)
- return SendClientMessageEx(playerid, COLOR_GRAD1, "The maximum number of gas pumps has been reached for this business.");
- if (!(0 <= iBusinessID < MAX_BUSINESSES)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Invalid business specified.");
- }
- if (!Businesses[iBusinessID][bType]) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Type of this business must have been set before using this command.");
- }
- if(!IsBusinessGasAble(Businesses[iBusinessID][bType])) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can't create gas pumps for this type of business.");
- }
- if(!IsPlayerInRangeOfPoint(playerid, 150.0, Businesses[iBusinessID][bExtPos][0], Businesses[iBusinessID][bExtPos][1], Businesses[iBusinessID][bExtPos][2])) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are too far away from the business.");
- }
- new iPump = GetFreeGasPumpID(iBusinessID);
- Businesses[iBusinessID][GasPumpCapacity][iPump] = Businesses[iBusinessID][bLevel] * 100;
- CreateDynamicGasPump(playerid, iBusinessID, iPump);
- SaveBusiness(iBusinessID);
- format(string, sizeof(string), "%s has created a gas pump for %s (%d)", Businesses[iBusinessID][bName], iBusinessID);
- Log("logs/bedit.log", string);
- return 1;
- }
- } else return SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use this command.");
- }
- CMD:editgaspump(playerid, params[])
- {
- new iBusinessID, iPumpID, szLog[128], szName[9], Float: fValue;
- if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pASM] < 1 && PlayerInfo[playerid][pBM] < 1) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use this command.");
- }
- if(sscanf(params, "dds[9]F(0)", iBusinessID, iPumpID, szName, fValue)) {
- SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /editgaspump [business id] [pump id] [name] [value]");
- SendClientMessageEx(playerid, COLOR_GREY, "Available Names: Capacity, Gas, Position");
- }
- if (!(0 <= iBusinessID < MAX_BUSINESSES))
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "Invalid business specified.");
- }
- else if (!(0 <= iPumpID < MAX_BUSINESS_GAS_PUMPS))
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "Invalid gas pump specified.");
- }
- else if(Businesses[iBusinessID][GasPumpVehicleID][iPumpID])
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can't edit a gas pump while it is in use.");
- }
- if(!strcmp(szName, "position", true))
- {
- if(!IsPlayerInRangeOfPoint(playerid, 150.0, Businesses[iBusinessID][bExtPos][0], Businesses[iBusinessID][bExtPos][1], Businesses[iBusinessID][bExtPos][2])) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are far away from the business.");
- }
- format(szLog, sizeof(szLog), "%s has changed the position of pump %d for business %d", GetPlayerNameEx(playerid), iPumpID, iBusinessID);
- DestroyDynamicGasPump(iBusinessID, iPumpID);
- CreateDynamicGasPump(playerid, iBusinessID, iPumpID);
- SaveBusiness(iBusinessID);
- }
- else if(!strcmp(szName, "gas", true))
- {
- if (fValue > Businesses[iBusinessID][GasPumpCapacity][iPumpID])
- {
- SendClientMessageEx(playerid, COLOR_GREY, "The value cannot be higher than the capacity!");
- return 1;
- }
- Businesses[iBusinessID][GasPumpGallons][iPumpID] = fValue;
- SendClientMessageEx(playerid, COLOR_WHITE, "You have edited the gas pump gas amount!");
- 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);
- }
- else if(!strcmp(szName, "capacity", true))
- {
- Businesses[iBusinessID][GasPumpCapacity][iPumpID] = fValue;
- SendClientMessageEx(playerid, COLOR_WHITE, "You have edited the gas pump capacity!");
- 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);
- }
- SaveBusiness(iBusinessID);
- Log("logs/bedit.log", szLog);
- return 1;
- }
- CMD:deletegaspump(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] < 4 && PlayerInfo[playerid][pASM] < 1 && PlayerInfo[playerid][pBM] < 1) {
- return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use this command.");
- }
- new businessid, id, string[128];
- if(sscanf(params, "dd", businessid, id)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /deletegaspump [business id] [pump id]");
- }
- if(!IsValidBusinessID(businessid) || id < 0 || id >= MAX_BUSINESS_GAS_PUMPS || Businesses[businessid][GasPumpPosX][id] == 0) {
- return SendClientMessageEx(playerid, COLOR_GREY, "No gas pump found with that ID.");
- }
- if(Businesses[businessid][GasPumpVehicleID][id]) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can't delete a gas pump while it is in use.");
- }
- DestroyDynamicGasPump(businessid, id);
- Businesses[businessid][GasPumpPosX][id] = 0;
- Businesses[businessid][GasPumpPosY][id] = 0;
- Businesses[businessid][GasPumpPosZ][id] = 0;
- Businesses[businessid][GasPumpAngle][id] = 0;
- Businesses[businessid][GasPumpCapacity][id] = 0;
- Businesses[businessid][GasPumpGallons][id] = 0;
- Businesses[businessid][GasPumpSaleGallons][id] = 0;
- Businesses[businessid][GasPumpSalePrice][id] = 0;
- SaveBusiness(businessid);
- format(string, sizeof(string), "You have successfully deleted the gas pump %d for business %d.", id, businessid);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string, sizeof(string), "Admin %s deleted a gas pump for business %d", businessid);
- Log("logs/bedit.log", string);
- return 1;
- }
- CMD:addmats(playerid, params[]) {
- return cmd_addmaterials(playerid, params);
- }
- CMD:addmaterials(playerid, params[])
- {
- new string[128], amount;
- if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not in a business!");
- }
- if (Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_GUNSHOP) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Command not available for this type of business.");
- }
- if(sscanf(params, "d", amount) || amount < 0) {
- return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /addmaterials [amount]");
- }
- if (amount > PlayerInfo[playerid][pMats]) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You don't have that many materials.");
- }
- if (Businesses[PlayerInfo[playerid][pBusiness]][bInventory] + amount > Businesses[PlayerInfo[playerid][pBusiness]][bInventoryCapacity]) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Inventory capacity exceeded.");
- }
- if (InBusiness(playerid) != PlayerInfo[playerid][pBusiness]) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You must be inside the business.");
- }
- Businesses[PlayerInfo[playerid][pBusiness]][bInventory] += amount;
- PlayerInfo[playerid][pMats] -= amount;
- OnPlayerStatsUpdate(playerid);
- SaveBusiness(PlayerInfo[playerid][pBusiness]);
- SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "* You have successfully added materials to the business inventory!");
- format(string, sizeof(string), "INVENTORY: %d/%d materials", Businesses[PlayerInfo[playerid][pBusiness]][bInventory], Businesses[PlayerInfo[playerid][pBusiness]][bInventoryCapacity]);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- return 1;
- }
- /*CMD:offergun(playerid, params[])
- {
- if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_GUNSHOP) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not working for a gun store!");
- }
- new buyerid, weapon;
- if (sscanf(params, "uk<sweapon>", buyerid, weapon)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /offergun [player] [weapon name]");
- }
- if (!IsPlayerConnected(buyerid)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified!");
- }
- if (playerid == buyerid) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can't offer a gun to yourself!");
- }
- if(!ProxDetectorS(5.0, playerid, buyerid)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "The customer is not near you!");
- }
- if (InBusiness(playerid) != PlayerInfo[playerid][pBusiness]) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not inside the business!");
- }
- if(PlayerInfo[buyerid][pConnectHours] < 2 || PlayerInfo[buyerid][pWRestricted] > 0) {
- return SendClientMessageEx(playerid, COLOR_GREY, "That player is currently weapon restricted!");
- }
- new b = InBusiness(playerid);
- if (Businesses[b][bInventory] < GetWeaponParam(weapon, WeaponMats)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Business inventory does not have enough materials for that weapon.");
- }
- if (Businesses[b][bInventory] < GetWeaponParam(weapon, WeaponMinLevel)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Business level is not high enough to sell that type of gun.");
- }
- new price = GetWeaponPrice(PlayerInfo[playerid][pBusiness], weapon);
- new string[128];
- format(string, sizeof(string), "* You offered %s to buy a %s for $%s", GetPlayerNameEx(buyerid), Weapon_ReturnName(weapon), number_format(price));
- SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
- 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));
- SendClientMessageEx(buyerid, COLOR_LIGHTBLUE, string);
- SetPVarInt(buyerid, "Business_WeapType", weapon);
- SetPVarInt(buyerid, "Business_WeapOfferer", playerid);
- SetPVarInt(buyerid, "Business_WeapOffererSQLId", GetPlayerSQLId(playerid));
- SetPVarInt(buyerid, "Business_WeapPrice", price);
- return 1;
- }*/
- CMD:offermenu(playerid, params[])
- {
- new iBusiness = InBusiness(playerid);
- 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!");
- else if(Businesses[iBusiness][bInventory] < 1) return SendClientMessageEx(playerid, COLOR_GRAD2, " Business does not have enough inventory!");
- if(GetPlayerInterior(playerid) != Businesses[iBusiness][bInt]) return 1;
- new szDialog[512], pvar[25], line;
- if (Businesses[iBusiness][bType] == BUSINESS_TYPE_BAR || Businesses[iBusiness][bType] == BUSINESS_TYPE_CLUB)
- {
- for (new item; item < sizeof(Drinks); item++)
- {
- new cost = (PlayerInfo[playerid][pDonateRank] >= 1) ? (floatround(Businesses[iBusiness][bItemPrices][item] * 0.8)) : (Businesses[iBusiness][bItemPrices][item]);
- format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, Drinks[item], number_format(cost));
- format(pvar, sizeof(pvar), "Business_MenuItem%d", line);
- SetPVarInt(playerid, pvar, item);
- format(pvar, sizeof(pvar), "Business_MenuItemPrice%d", line);
- SetPVarInt(playerid, pvar, Businesses[iBusiness][bItemPrices][item]);
- line++;
- }
- }
- else if(Businesses[iBusiness][bType] == BUSINESS_TYPE_RESTAURANT)
- {
- for (new item; item < sizeof(RestaurantItems); ++item)
- {
- new cost = (PlayerInfo[playerid][pDonateRank] >= 1) ? (floatround(Businesses[iBusiness][bItemPrices][item] * 0.8)) : (Businesses[iBusiness][bItemPrices][item]);
- format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, RestaurantItems[item], number_format(cost));
- format(pvar, sizeof(pvar), "Business_MenuItem%d", line);
- SetPVarInt(playerid, pvar, item);
- format(pvar, sizeof(pvar), "Business_MenuItemPrice%d", line);
- SetPVarInt(playerid, pvar, Businesses[iBusiness][bItemPrices][item]);
- line++;
- }
- }
- if(strlen(szDialog) == 0) SendClientMessageEx(playerid, COLOR_GRAD2, " Store is not selling any items!");
- else ShowPlayerDialogEx(playerid, RESTAURANTMENU, DIALOG_STYLE_LIST, "Menu", szDialog, "Buy", "Cancel");
- return 1;
- }
- CMD:buyfood(playerid, params[])
- {
- if (!IsAtRestaurant(playerid))
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " You are not in a restaurant!");
- return 1;
- }
- new iBusiness = InBusiness(playerid);
- if (Businesses[iBusiness][bInventory] < 1) {
- SendClientMessageEx(playerid, COLOR_GRAD2, " Business does not have enough inventory!");
- return 1;
- }
- if (!Businesses[iBusiness][bStatus])
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "This restaurant is closed!");
- return 1;
- }
- if(Businesses[iBusiness][bMaxLevel] > 0 && PlayerInfo[playerid][pConnectHours] > Businesses[iBusiness][bMaxLevel])
- return SendClientMessageEx(playerid, COLOR_GRAD2, "The cashier has denied you service, this discount store is for new citizens only.");
- new szDialog[512], pvar[25], line;
- for (new item; item < sizeof(RestaurantItems); ++item)
- {
- format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, RestaurantItems[item], number_format(Businesses[iBusiness][bItemPrices][item]));
- format(pvar, sizeof(pvar), "Business_MenuItem%d", line);
- SetPVarInt(playerid, pvar, item);
- format(pvar, sizeof(pvar), "Business_MenuItemPrice%d", line);
- SetPVarInt(playerid, pvar, Businesses[iBusiness][bItemPrices][item]);
- line++;
- }
- if (strlen(szDialog) == 0)
- {
- SendClientMessageEx(playerid, COLOR_GRAD2, " Store is not selling any items!");
- }
- else
- {
- ShowPlayerDialogEx(playerid, RESTAURANTMENU, DIALOG_STYLE_LIST, "Menu", szDialog, "Buy", "Cancel");
- }
- return 1;
- }
- CMD:bpanic(playerid, params[])
- {
- if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not working for a business!");
- }
- if (PlayerInfo[playerid][pBusiness] != InBusiness(playerid)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not in the business interior!");
- }
- new string[128];
- if(GetPVarInt(playerid, "bizpanic") == 0)
- {
- format(string, sizeof(string), "** %s hits a small button.", GetPlayerNameEx(playerid));
- ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- 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));
- SendClientMessage(playerid, COLOR_GRAD2, "* The police have been notified that you require help. ");
- SetPVarInt(playerid, "bizpanic", 1);
- }
- else
- {
- format(string, sizeof(string), "** %s hits a small button.", GetPlayerNameEx(playerid));
- ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- format(string, sizeof(string), "* %s %s no longer requires help at %s.", GetBusinessRankName(PlayerInfo[playerid][pBusinessRank]), GetPlayerNameEx(playerid), Businesses[InBusiness(playerid)][bName]);
- SendClientMessage(playerid, COLOR_GRAD2, "* The police have been notified that you no longer require help. ");
- SetPVarInt(playerid, "bizpanic", 0);
- }
- foreach(new i: Player)
- {
- if(IsACop(i))
- {
- SetPlayerMarkerForPlayer(i, playerid, 0x2641FEAA);
- SendClientMessageEx(i, COLOR_LIGHTBLUE, string);
- }
- }
- return 1;
- }
- CMD:bizfind(playerid, params[])
- {
- if(IsACop(playerid))
- {
- new iBusinessID, string[128];
- if(sscanf(params, "d", iBusinessID))
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /bizfind [business id]");
- }
- if(IsValidBusinessID(iBusinessID))
- {
- if(Businesses[iBusinessID][bOwner])
- {
- SetPVarInt(playerid,"bpanic", 1);
- format(string, sizeof(string), "* Setting your GPS Waypoint to find %s", Businesses[iBusinessID][bName]);
- SetPlayerCheckpoint(playerid, Businesses[iBusinessID][bExtPos][0], Businesses[iBusinessID][bExtPos][1], Businesses[iBusinessID][bExtPos][2], 4.0);
- return 1;
- }
- return SendClientMessageEx(playerid, COLOR_GRAD2, " That business doesn't have an owner. ");
- }
- return SendClientMessageEx(playerid, COLOR_GRAD2, " Invalid Business ID.");
- }
- return SendClientMessageEx(playerid, COLOR_GRAD2, " You do not have access to the Business Directory. (Law Enforcement Only)");
- }
- CMD:binventory(playerid, params[])
- {
- new
- string[128],
- iBusiness = PlayerInfo[playerid][pBusiness];
- if(iBusiness != INVALID_BUSINESS_ID)
- {
- SendClientMessageEx(playerid, COLOR_GREEN, "|_________ Business Inventory_________|");
- format(string, sizeof(string), "Amount: %d / Capacity: %d / Type: %s", Businesses[iBusiness][bInventory], Businesses[iBusiness][bInventoryCapacity], GetInventoryType(iBusiness));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- for (new i; i < MAX_BUSINESS_GAS_PUMPS; i++) {
- if (Businesses[iBusiness][GasPumpPosX][i] != 0.0) {
- format(string, sizeof(string), "Gas Tank %d: %.2f gal / %.2f gal", i+1, Businesses[iBusiness][GasPumpGallons][i], Businesses[iBusiness][GasPumpCapacity][i]);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- }
- }
- }
- else SendClientMessage(playerid, COLOR_GRAD2, " You don't own or work for a business.");
- return 1;
- }
- CMD:offeritem(playerid, params[])
- {
- new buyerid, item;
- if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_STORE && Businesses[PlayerInfo[playerid][pBusiness]][bType] != BUSINESS_TYPE_GASSTATION) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not working for a 24/7 store!");
- }
- if (sscanf(params, "uk<storeitem>", buyerid, item)) {
- SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /offeritem [Player] [Item]");
- SendClientMessageEx(playerid, COLOR_GREY, "Items - cellphone, phonebook, dice, condom, musicplayer, rope, cigar, sprunk, lock, spraycan, radio, camera, lotteryticket,");
- return SendClientMessageEx(playerid, COLOR_GREY, "checkbook, paper, industriallock, elock, standardcaralarm, helmet");
- }
- if (PlayerInfo[playerid][pBusiness] != InBusiness(playerid)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not in the business interior!");
- }
- if (Businesses[PlayerInfo[playerid][pBusiness]][bInventory] < 1) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Business inventory has no items.");
- }
- if (!IsPlayerConnected(buyerid)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified!");
- }
- if (item == INVALID_STORE_ITEM) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Invalid item specified!");
- }
- if (!Businesses[PlayerInfo[playerid][pBusiness]][bItemPrices][item-1]) {
- SendClientMessageEx(playerid, COLOR_GRAD4, "This item is not for sale.");
- return 1;
- }
- if (playerid == buyerid) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You can't offer an item to yourself!");
- }
- if(!ProxDetectorS(5.0, playerid, buyerid)) {
- return SendClientMessageEx(playerid, COLOR_GREY, "The customer is not near you!");
- }
- new string[128];
- format(string, sizeof(string), "* You offered %s to buy a %s.", GetPlayerNameEx(buyerid), StoreItems[item-1]);
- SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
- 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]));
- SendClientMessageEx(buyerid, COLOR_LIGHTBLUE, string);
- SetPVarInt(buyerid, "Business_ItemType", item-1);
- SetPVarInt(buyerid, "Business_ItemPrice", Businesses[PlayerInfo[playerid][pBusiness]][bItemPrices][item-1]);
- SetPVarInt(buyerid, "Business_ItemOfferer", playerid);
- SetPVarInt(buyerid, "Business_ItemOffererSQLId", GetPlayerSQLId(playerid));
- return 1;
- }
- CMD:resupply(playerid, params[])
- {
- new iBusiness = PlayerInfo[playerid][pBusiness];
- new amount;
- new string[128];
- new year, month, day;
- if (sscanf(params, "d", amount))
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /resupply [amount]");
- }
- if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You don't own a business.");
- }
- if (PlayerInfo[playerid][pBusinessRank] < Businesses[iBusiness][bMinSupplyRank]) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Your rank is not high enough for placing resupply orders!");
- }
- if(amount < 1) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Resupply amount cannot be below 1.");
- }
- if (Businesses[iBusiness][bOrderState] == 1) {
- return SendClientMessageEx(playerid, COLOR_WHITE, "You already have a pending order. Either cancel it or wait for it to be delivered before placing orders.");
- }
- if (Businesses[iBusiness][bOrderState] == 2) {
- return SendClientMessageEx(playerid, COLOR_WHITE, "You already have an order which is being delivered.");
- }
- if (Businesses[iBusiness][bSupplyPos][0] == 0.0) {
- return SendClientMessageEx(playerid, COLOR_GREY, "This business does not have a delivery point for Shipment Contractors.");
- }
- if (Businesses[iBusiness][bInventory] >= Businesses[iBusiness][bInventoryCapacity]) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Inventory is already at full capacity.");
- }
- if(Businesses[iBusiness][bInventory] + amount > Businesses[iBusiness][bInventoryCapacity])
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "Your inventory does not have the capacity.");
- }
- new rSupCost = floatround(amount * BUSINESS_ITEMS_COST);
- if (!Businesses[iBusiness][bSafeBalance] || Businesses[iBusiness][bSafeBalance] < rSupCost || rSupCost < 0) {
- 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);
- format(string, sizeof(string), "Safe balance is not enough for this. ($%s)", number_format(floatround(amount * BUSINESS_ITEMS_COST)));
- return SendClientMessageEx(playerid, COLOR_GREY, string);
- }
- format(Businesses[iBusiness][bOrderBy], MAX_PLAYER_NAME, "%s", GetPlayerNameEx(playerid));
- getdate(year, month, day);
- format(Businesses[iBusiness][bOrderDate], 30, "%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minuite, second);
- Businesses[iBusiness][bSafeBalance] -= floatround(amount * BUSINESS_ITEMS_COST);
- Businesses[iBusiness][bOrderAmount] = amount;
- Businesses[iBusiness][bOrderState] = 1;
- SaveBusiness(iBusiness);
- 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);
- Log("logs/business.log", string);
- format(string, sizeof(string), "* You have placed a resupply order for %s", Businesses[PlayerInfo[playerid][pBusiness]][bName]);
- SendClientMessage(playerid, COLOR_GRAD2, string);
- return 1;
- }
- CMD:checkresupply(playerid, params[])
- {
- new iBusinessID = PlayerInfo[playerid][pBusiness];
- if((0 <= iBusinessID < MAX_BUSINESSES) && PlayerInfo[playerid][pBusinessRank] >= Businesses[iBusinessID][bMinSupplyRank])
- {
- new iOrderState = Businesses[iBusinessID][bOrderState];
- if (!iOrderState)
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "Your business has never placed a resupply order.");
- return 1;
- }
- else
- {
- new string[128];
- SendClientMessageEx(playerid, COLOR_GREEN, "|___________ Latest Resupply Order ___________|");
- format(string,sizeof(string), "Date/Time: %s -- Amount: %s -- Status: %s", Businesses[iBusinessID][bOrderDate], number_format(Businesses[iBusinessID][bOrderAmount]), GetSupplyState(iOrderState));
- //if (iOrderState == 2) format(string,sizeof(string), "%s {DDDDDD}(Truck Distance: %d)");
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- format(string,sizeof(string), "This order was submitted by %s", Businesses[iBusinessID][bOrderBy]);
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- if (iOrderState == 1) SendClientMessageEx(playerid, COLOR_YELLOW, "You can use /cancelresupply to cancel this order.");
- }
- }
- else SendClientMessageEx(playerid, COLOR_GRAD1, "Only authorized business employees may use this command.");
- return 1;
- }
- CMD:cancelresupply(playerid, params[])
- {
- if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID) {
- return SendClientMessageEx(playerid, COLOR_GREY, "You are not in a business!");
- }
- else if (PlayerInfo[playerid][pBusinessRank] < Businesses[PlayerInfo[playerid][pBusiness]][bMinSupplyRank]) {
- return SendClientMessageEx(playerid, COLOR_GREY, "Your rank is not high enough for cancelling resupply orders!");
- }
- else {
- new orderstate = Businesses[PlayerInfo[playerid][pBusiness]][bOrderState];
- if (orderstate == 0) {
- return SendClientMessageEx(playerid, COLOR_WHITE, "Your business has never placed a resupply order.");
- }
- else if (orderstate == 2) {
- foreach(new i : Player)
- {
- if(TruckDeliveringTo[GetPlayerVehicleID(i)] == PlayerInfo[playerid][pBusiness])
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You can't cancel an order while it is being shipped!");
- return 1;
- }
- }
- Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] += floatround(Businesses[PlayerInfo[playerid][pBusiness]][bOrderAmount] * BUSINESS_ITEMS_COST);
- Businesses[PlayerInfo[playerid][pBusiness]][bOrderState] = 4;
- SaveBusiness(PlayerInfo[playerid][pBusiness]);
- new string[128];
- 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]);
- Log("logs/business.log", string);
- 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))));
- return SendClientMessageEx(playerid, COLOR_WHITE, string);
- }
- else if (orderstate == 1) {
- Businesses[PlayerInfo[playerid][pBusiness]][bSafeBalance] += floatround(Businesses[PlayerInfo[playerid][pBusiness]][bOrderAmount] * BUSINESS_ITEMS_COST);
- Businesses[PlayerInfo[playerid][pBusiness]][bOrderState] = 4;
- SaveBusiness(PlayerInfo[playerid][pBusiness]);
- new string[128];
- 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]);
- Log("logs/business.log", string);
- 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))));
- return SendClientMessageEx(playerid, COLOR_WHITE, string);
- }
- }
- return 1;
- }
- CMD:minrank(playerid, params[])
- {
- new rank, command[32];
- if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || PlayerInfo[playerid][pBusinessRank] < 5)
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "Only business owners can use this command.");
- }
- if (sscanf(params, "ds[32]", rank, command))
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /minrank [rank] [invite/giverank/supply]");
- }
- if(rank < 0 || rank > 5)
- {
- SendClientMessageEx(playerid, COLOR_GREY, "Don't go below number 0 or above number 5!");
- }
- if (strcmp(command, "invite", true) == 0) Businesses[PlayerInfo[playerid][pBusiness]][bMinInviteRank] = rank, SaveBusiness(PlayerInfo[playerid][pBusiness]);
- else if (strcmp(command, "giverank", true) == 0) Businesses[PlayerInfo[playerid][pBusiness]][bMinGiveRankRank] = rank, SaveBusiness(PlayerInfo[playerid][pBusiness]);
- else if (strcmp(command, "supply", true) == 0) Businesses[PlayerInfo[playerid][pBusiness]][bMinSupplyRank] = rank, SaveBusiness(PlayerInfo[playerid][pBusiness]);
- else return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid Permission Name");
- new string[128];
- format(string, sizeof(string), "You have set the minimum rank for %s to %d (%s)", command, rank, GetBusinessRankName(rank));
- SendClientMessageEx(playerid, COLOR_GREY, string);
- return 1;
- }
- CMD:br(playerid, params[])
- {
- return cmd_bizradio(playerid, params);
- }
- CMD:bizradio(playerid, params[])
- {
- 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");
- new
- string[128],
- iBusinessID = PlayerInfo[playerid][pBusiness],
- iRank = PlayerInfo[playerid][pBusinessRank];
- if (!IsValidBusinessID(iBusinessID)) return SendClientMessageEx(playerid, COLOR_GRAD2, "You're not an employee of a business!");
- else if(iBusinessID == INVALID_BUSINESS_ID) return SendClientMessageEx(playerid, COLOR_GRAD2, "You're not an employee of a business!");
- if(PlayerTied[playerid] != 0 || PlayerCuffed[playerid] != 0 || PlayerInfo[playerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot do this at this time.");
- if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /b(iz)r(radio) [biz chat]");
- format(string, sizeof(string), "(radio) %s", params);
- SetPlayerChatBubble(playerid,string,COLOR_WHITE,15.0,5000);
- format(string, sizeof(string), "** (%d) %s %s: %s **", iRank, GetBusinessRankName(iRank), GetPlayerNameEx(playerid), params);
- foreach(new i: Player)
- {
- if (PlayerInfo[i][pBusiness] == iBusinessID && GetPVarInt(i, "BusinessRadio") != 1) {
- ChatTrafficProcess(i, COLOR_BR, string, 14);
- }
- }
- return 1;
- }
- CMD:employeepayset(playerid, params[])
- {
- if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || PlayerInfo[playerid][pBusinessRank] != 5)
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "Not authorized to use this command!");
- }
- new rank, amount;
- if (sscanf(params, "dd", rank, amount))
- {
- SendClientMessageEx(playerid, COLOR_RED, "Listing current paycheck amounts...");
- for (new i, string[64]; i < 5; i++) {
- format(string,sizeof(string), "Rank %d (%s): $%s", i, GetBusinessRankName(i), number_format(Businesses[PlayerInfo[playerid][pBusiness]][bRankPay][i]));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- }
- return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /employeepayset [rank] [amount]");
- }
- if (rank < 0 || rank > 4)
- {
- return SendClientMessageEx(playerid, COLOR_WHITE, "Invalid rank entered!");
- }
- if (amount < 1 || amount > 100000)
- {
- return SendClientMessageEx(playerid, COLOR_WHITE, "Amount can't be lower than $1 or higher than $100,000!");
- }
- Businesses[PlayerInfo[playerid][pBusiness]][bRankPay][rank] = amount;
- SaveBusiness(PlayerInfo[playerid][pBusiness]);
- new string[128];
- format(string, sizeof(string), "You have set paycheck amount for rank %d (%s) to $%s", rank, GetBusinessRankName(rank), number_format(amount));
- SendClientMessageEx(playerid, COLOR_WHITE, string);
- 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]);
- Log("logs/business.log", string);
- return 1;
- }
- CMD:employeeautopay(playerid, params[])
- {
- if (PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || PlayerInfo[playerid][pBusinessRank] != 5)
- {
- return SendClientMessageEx(playerid, COLOR_GREY, "Not authorized to use this command!");
- }
- if (Businesses[PlayerInfo[playerid][pBusiness]][bAutoPay])
- {
- Businesses[PlayerInfo[playerid][pBusiness]][bAutoPay] = 0;
- SendClientMessageEx(playerid, COLOR_WHITE, "You have disabled paychecks for the business.");
- SaveBusiness(PlayerInfo[playerid][pBusiness]);
- return 1;
- }
- else
- {
- Businesses[PlayerInfo[playerid][pBusiness]][bAutoPay] = 1;
- SendClientMessageEx(playerid, COLOR_WHITE, "You have enabled paychecks for the business.");
- SaveBusiness(PlayerInfo[playerid][pBusiness]);
- return 1;
- }
- }
- CMD:editgasprice(playerid, params[])
- {
- if (PlayerInfo[playerid][pBusiness] != INVALID_BUSINESS_ID && PlayerInfo[playerid][pBusinessRank] >= 5 && IsBusinessGasAble(Businesses[PlayerInfo[playerid][pBusiness]][bType]))
- {
- ShowPlayerDialogEx(playerid, DIALOG_GASPRICE, DIALOG_STYLE_INPUT, "Edit Gas Price", "Enter the new price per 1 gallon (e.g. 4.52)", "OK", "Cancel");
- SetPVarInt(playerid, "EditingBusiness", PlayerInfo[playerid][pBusiness]);
- }
- else SendClientMessageEx(playerid, COLOR_GREY, "Your are not the owner of a gas station!");
- return 1;
- }
- CMD:editprices(playerid, params[])
- {
- new
- iBusiness = PlayerInfo[playerid][pBusiness];
- if (iBusiness != INVALID_BUSINESS_ID)
- {
- if(PlayerInfo[playerid][pBusinessRank] >= 5)
- {
- if(Businesses[iBusiness][bType] == BUSINESS_TYPE_STORE || Businesses[iBusiness][bType] == BUSINESS_TYPE_GASSTATION) {
- new szDialog[912];
- 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)) );
- ShowPlayerDialogEx(playerid, DIALOG_STOREPRICES, DIALOG_STYLE_LIST, "Edit 24/7 Prices", szDialog, "Edit", "Cancel");
- SetPVarInt(playerid, "EditingBusiness", iBusiness);
- }
- else if(Businesses[iBusiness][bType] == BUSINESS_TYPE_CLOTHING) {
- 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");
- SetPVarInt(playerid, "EditingBusiness", iBusiness);
- }
- else if(Businesses[iBusiness][bType] == BUSINESS_TYPE_GUNSHOP) {
- new szDialog[512];
- 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]));
- ShowPlayerDialogEx(playerid, DIALOG_GUNPRICES, DIALOG_STYLE_LIST, "Edit Weapon Prices", szDialog, "Edit", "Cancel");
- SetPVarInt(playerid, "EditingBusiness", iBusiness);
- }
- else if(Businesses[iBusiness][bType] == BUSINESS_TYPE_BAR || Businesses[iBusiness][bType] == BUSINESS_TYPE_CLUB /*|| Businesses[iBusiness][bType] == BUSINESS_TYPE_RESTAURANT*/)
- {
- new szDialog[512];
- for (new i; i < sizeof(Drinks); i++) format(szDialog, sizeof(szDialog), "%s%s ($%s)\n", szDialog, Drinks[i], number_format(Businesses[iBusiness][bItemPrices][i]));
- ShowPlayerDialogEx(playerid, DIALOG_BARPRICE, DIALOG_STYLE_LIST, "Edit Business Prices", szDialog, "Edit", "Cancel");
- SetPVarInt(playerid, "EditingBusiness", iBusiness);
- }
- else if(Businesses[iBusiness][bType] == BUSINESS_TYPE_SEXSHOP)
- {
- new szDialog[512];
- 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]));
- ShowPlayerDialogEx(playerid, DIALOG_SEXSHOP, DIALOG_STYLE_LIST, "Edit Business Prices", szDialog, "Edit", "Cancel");
- SetPVarInt(playerid, "EditingBusiness", iBusiness);
- }
- else if (Businesses[iBusiness][bType] == BUSINESS_TYPE_RESTAURANT)
- {
- new buf[512];
- for (new i = 0; i < sizeof(RestaurantItems); ++i)
- {
- format(buf, sizeof(buf), "%s%s ($%s)\n", buf, RestaurantItems[i], number_format(Businesses[iBusiness][bItemPrices][i]));
- }
- ShowPlayerDialogEx(playerid, DIALOG_RESTAURANT, DIALOG_STYLE_LIST, "Edit Business Prices", buf, "Edit", "Cancel");
- SetPVarInt(playerid, "EditingBusiness", iBusiness);
- }
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_GREY, "You aren't a store owner.");
- return 1;
- }
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You are not a store owner.");
- }
- return 1;
- }
- CMD:bizlock(playerid, params[])
- {
- if(PlayerInfo[playerid][pBusiness] != INVALID_BUSINESS_ID && PlayerInfo[playerid][pBusinessRank] >= Businesses[PlayerInfo[playerid][pBusiness]][bMinDoorRank] &&
- IsPlayerInRangeOfPoint(playerid, 2.0, Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][2]))
- {
- if(Businesses[PlayerInfo[playerid][pBusiness]][bStatus] == 1)
- {
- Businesses[PlayerInfo[playerid][pBusiness]][bStatus] = 0;
- new string[MAX_PLAYER_NAME + 28];
- format(string, sizeof(string), "* %s has locked the door.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else
- {
- Businesses[PlayerInfo[playerid][pBusiness]][bStatus] = 1;
- new string[MAX_PLAYER_NAME + 28];
- format(string, sizeof(string), "* %s has unlocked the door.", GetPlayerNameEx(playerid));
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- RefreshBusinessPickup(PlayerInfo[playerid][pBusiness]);
- Streamer_UpdateEx(playerid, Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][0], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][1], Businesses[PlayerInfo[playerid][pBusiness]][bExtPos][2]);
- }
- else
- {
- SendClientMessageEx(playerid, COLOR_WHITE, "You are not near your business or not authorized.");
- return 1;
- }
- return 1;
- }
- stock LoadBusinesses() {
- printf("[LoadBusinesses] Loading data from database...");
- mysql_tquery(MainPipeline, "SELECT OwnerName.Username, b.* FROM businesses b LEFT JOIN accounts OwnerName ON b.OwnerID = OwnerName.id", "BusinessesLoadQueryFinish", "");
- }
- forward BusinessesLoadQueryFinish();
- public BusinessesLoadQueryFinish()
- {
- new i, rows;
- cache_get_row_count(rows);
- while(i < rows)
- {
- cache_get_value_name(i, "Name", Businesses[i][bName], MAX_BUSINESS_NAME);
- cache_get_value_name_int(i, "OwnerID", Businesses[i][bOwner]);
- cache_get_value_name(i, "Username", Businesses[i][bOwnerName], MAX_PLAYER_NAME);
- cache_get_value_name_int(i, "Type", Businesses[i][bType]);
- cache_get_value_name_int(i, "Value", Businesses[i][bValue]);
- cache_get_value_name_int(i, "Status", Businesses[i][bStatus]);
- cache_get_value_name_int(i, "Level", Businesses[i][bLevel]);
- cache_get_value_name_int(i, "LevelProgress", Businesses[i][bLevelProgress]);
- cache_get_value_name_int(i, "SafeBalance", Businesses[i][bSafeBalance]);
- cache_get_value_name_int(i, "Inventory", Businesses[i][bInventory]);
- cache_get_value_name_int(i, "InventoryCapacity", Businesses[i][bInventoryCapacity]);
- cache_get_value_name_int(i, "AutoSale", Businesses[i][bAutoSale]);
- cache_get_value_name_int(i, "TotalSales", Businesses[i][bTotalSales]);
- cache_get_value_name_float(i, "ExteriorX", Businesses[i][bExtPos][0]);
- cache_get_value_name_float(i, "ExteriorY", Businesses[i][bExtPos][1]);
- cache_get_value_name_float(i, "ExteriorZ", Businesses[i][bExtPos][2]);
- cache_get_value_name_float(i, "ExteriorA", Businesses[i][bExtPos][3]);
- cache_get_value_name_float(i, "InteriorX", Businesses[i][bIntPos][0]);
- cache_get_value_name_float(i, "InteriorY", Businesses[i][bIntPos][1]);
- cache_get_value_name_float(i, "InteriorZ", Businesses[i][bIntPos][2]);
- cache_get_value_name_float(i, "InteriorA", Businesses[i][bIntPos][3]);
- cache_get_value_name_int(i, "Interior", Businesses[i][bInt]);
- cache_get_value_name_float(i, "SupplyPointX", Businesses[i][bSupplyPos][0]);
- cache_get_value_name_float(i, "SupplyPointY", Businesses[i][bSupplyPos][1]);
- cache_get_value_name_float(i, "SupplyPointZ", Businesses[i][bSupplyPos][2]);
- cache_get_value_name_float(i, "GasPrice", Businesses[i][bGasPrice]);
- cache_get_value_name(i, "OrderBy", Businesses[i][bOrderBy], MAX_PLAYER_NAME);
- cache_get_value_name_int(i, "OrderState", Businesses[i][bOrderState]);
- cache_get_value_name_int(i, "OrderAmount", Businesses[i][bOrderAmount]);
- cache_get_value_name(i, "OrderDate", Businesses[i][bOrderDate], 30);
- cache_get_value_name_int(i, "CustomExterior", Businesses[i][bCustomExterior]);
- cache_get_value_name_int(i, "CustomInterior", Businesses[i][bCustomInterior]);
- cache_get_value_name_int(i, "Grade", Businesses[i][bGrade]);
- cache_get_value_name_int(i, "CustomVW", Businesses[i][bVW]);
- cache_get_value_name_int(i, "Pay", Businesses[i][bAutoPay]);
- cache_get_value_name_int(i, "MinInviteRank", Businesses[i][bMinInviteRank]);
- cache_get_value_name_int(i, "MinSupplyRank", Businesses[i][bMinSupplyRank]);
- cache_get_value_name_int(i, "MinGiveRankRank", Businesses[i][bMinGiveRankRank]);
- cache_get_value_name_int(i, "MinSafeRank", Businesses[i][bMinSafeRank]);
- cache_get_value_name_int(i, "Months", Businesses[i][bMonths]);
- cache_get_value_name_int(i, "GymEntryFee", Businesses[i][bGymEntryFee]);
- cache_get_value_name_int(i, "GymType", Businesses[i][bGymType]);
- if (Businesses[i][bOrderState] == 2) {
- Businesses[i][bOrderState] = 1;
- }
- if(Businesses[i][bExtPos][0] != 0.0) RefreshBusinessPickup(i); // If the business is at blueberry, do not spawn it
- for (new j; j <= 5; j++)
- {
- new col[9];
- format(col, sizeof(col), "Rank%dPay", j);
- cache_get_value_name_int(i, col, Businesses[i][bRankPay][j]);
- }
- if (Businesses[i][bType] == BUSINESS_TYPE_GASSTATION)
- {
- for (new j, column[17]; j < MAX_BUSINESS_GAS_PUMPS; j++)
- {
- format(column, sizeof(column), "GasPump%dPosX", j + 1);
- cache_get_value_name_float(i, column, Businesses[i][GasPumpPosX][j]);
- format(column, sizeof(column), "GasPump%dPosY", j + 1);
- cache_get_value_name_float(i, column, Businesses[i][GasPumpPosY][j]);
- format(column, sizeof(column), "GasPump%dPosZ", j + 1);
- cache_get_value_name_float(i, column, Businesses[i][GasPumpPosZ][j]);
- format(column, sizeof(column), "GasPump%dAngle", j + 1);
- cache_get_value_name_float(i, column, Businesses[i][GasPumpAngle][j]);
- format(column, sizeof(column), "GasPump%dCapacity", j + 1);
- cache_get_value_name_float(i, column, Businesses[i][GasPumpCapacity][j]);
- format(column, sizeof(column), "GasPump%dGas", j + 1);
- cache_get_value_name_float(i, column, Businesses[i][GasPumpGallons][j]);
-
- if(Businesses[i][GasPumpPosX][j] != 0.0) CreateDynamicGasPump(_, i, j);
- for (new z; z < sizeof(StoreItems); z++)
- {
- new col[12];
- format(col, sizeof(col), "Item%dPrice", z + 1);
- cache_get_value_name_int(i, col, Businesses[i][bItemPrices][z]);
- }
- }
- }
- else if (Businesses[i][bType] == BUSINESS_TYPE_NEWCARDEALERSHIP || Businesses[i][bType] == BUSINESS_TYPE_OLDCARDEALERSHIP)
- {
- for (new j, column[16], label[50]; j < MAX_BUSINESS_DEALERSHIP_VEHICLES; j++)
- {
- format(column, sizeof(column), "Car%dModelId", j);
- cache_get_value_name_int(i, column, Businesses[i][bModel][j]);
- format(column, sizeof(column), "Car%dPosX", j);
- cache_get_value_name_float(i, column, Businesses[i][bParkPosX][j]);
- format(column, sizeof(column), "Car%dPosY", j);
- cache_get_value_name_float(i, column, Businesses[i][bParkPosY][j]);
- format(column, sizeof(column), "Car%dPosZ", j);
- cache_get_value_name_float(i, column, Businesses[i][bParkPosZ][j]);
- format(column, sizeof(column), "Car%dPosAngle", j);
- cache_get_value_name_float(i, column, Businesses[i][bParkAngle][j]);
- format(column, sizeof(column), "Car%dPrice", j);
- cache_get_value_name_int(i, column, Businesses[i][bPrice][j]);
- cache_get_value_name_float(i, "PurchaseX", Businesses[i][bPurchaseX][j]);
- cache_get_value_name_float(i, "PurchaseY", Businesses[i][bPurchaseY][j]);
- cache_get_value_name_float(i, "PurchaseZ", Businesses[i][bPurchaseZ][j]);
- cache_get_value_name_float(i, "PurchaseAngle", Businesses[i][bPurchaseAngle][j]);
- if(400 < Businesses[i][bModel][j] < 612 || Businesses[i][bParkPosX][j] != 0.0)
- {
- 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);
- format(label, sizeof(label), "%s For Sale | Price: $%s", GetVehicleName(Businesses[i][bVehID][j]), number_format(Businesses[i][bPrice][j]));
- 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]);
- }
- }
- }
- else
- {
- for (new j; j < sizeof(StoreItems); j++)
- {
- new col[12];
- format(col, sizeof(col), "Item%dPrice", j + 1);
- cache_get_value_name_int(i, col, Businesses[i][bItemPrices][j]);
- }
- }
- Businesses[i][bGymBoxingArena1][0] = INVALID_PLAYER_ID;
- Businesses[i][bGymBoxingArena1][1] = INVALID_PLAYER_ID;
- Businesses[i][bGymBoxingArena2][0] = INVALID_PLAYER_ID;
- Businesses[i][bGymBoxingArena2][1] = INVALID_PLAYER_ID;
- for (new it = 0; it < 10; ++it)
- {
- Businesses[i][bGymBikePlayers][it] = INVALID_PLAYER_ID;
- Businesses[i][bGymBikeVehicles][it] = INVALID_VEHICLE_ID;
- }
- cache_get_value_name_int(i, "MaxLevel", Businesses[i][bMaxLevel]);
- i++;
- }
- if(i > 0) printf("[LoadBusinesses] %d businesses rehashed/loaded.", i);
- else printf("[LoadBusinesses] Failed to load any businesses.");
- }
- stock SaveBusiness(id)
- {
- new query[4019];
- mysql_format(MainPipeline, query, sizeof(query), "UPDATE `businesses` SET ");
- mysql_format(MainPipeline, query, sizeof(query), "%s \
- `Name` = '%e', `Type` = %d, `Value` = %d, `OwnerID` = %d, `Months` = %d, `SafeBalance` = %d, `Inventory` = %d, `InventoryCapacity` = %d, `Status` = %d, `Level` = %d, \
- `LevelProgress` = %d, `AutoSale` = %d, `OrderDate` = '%s', `OrderAmount` = %d, `OrderBy` = '%e', `OrderState` = %d, `TotalSales` = %d, ",
- query,
- 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],
- Businesses[id][bLevelProgress], Businesses[id][bAutoSale], Businesses[id][bOrderDate], Businesses[id][bOrderAmount], Businesses[id][bOrderBy], Businesses[id][bOrderState], Businesses[id][bTotalSales]);
- mysql_format(MainPipeline, query, sizeof(query), "%s \
- `ExteriorX` = %f, `ExteriorY` = %f, `ExteriorZ` = %f, `ExteriorA` = %f, \
- `InteriorX` = %f, `InteriorY` = %f, `InteriorZ` = %f, `InteriorA` = %f, \
- `Interior` = %d, `CustomExterior` = %d, `CustomInterior` = %d, `Grade` = %d, `CustomVW` = %d, `SupplyPointX` = %f, `SupplyPointY` = %f, `SupplyPointZ` = %f, ",
- query,
- Businesses[id][bExtPos][0], Businesses[id][bExtPos][1], Businesses[id][bExtPos][2], Businesses[id][bExtPos][3],
- Businesses[id][bIntPos][0], Businesses[id][bIntPos][1], Businesses[id][bIntPos][2], Businesses[id][bIntPos][3],
- 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]);
- for (new i; i < sizeof(StoreItems); i++) mysql_format(MainPipeline, query, sizeof(query), "%s`Item%dPrice` = %d, ", query, i+1, Businesses[id][bItemPrices][i]);
- for (new i; i < 5; i++) mysql_format(MainPipeline, query, sizeof(query), "%s`Rank%dPay` = %d, ", query, i, Businesses[id][bRankPay][i], id);
- 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]);
- mysql_format(MainPipeline, query, sizeof(query), "%s \
- `Pay` = %d, `GasPrice` = %f, `MinInviteRank` = %d, `MinSupplyRank` = %d, `MinGiveRankRank` = %d, `MinSafeRank` = %d, `GymEntryFee` = %d, `GymType` = %d, `TotalProfits` = %d, `MaxLevel` = %d WHERE `Id` = %d",
- query,
- 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);
- mysql_tquery(MainPipeline, query, "OnQueryFinish", "i", SENDDATA_THREAD);
- //printf("Len :%d", strlen(query));
- printf("[business] saved %i", id);
- return 1;
- }
- stock LoadBusinessSales() {
- print("[LoadBusinessSales] Loading data from database...");
- mysql_tquery(MainPipeline, "SELECT * FROM `businesssales`", "LoadBusinessesSaless", "");
- }
- forward LoadBusinessesSaless();
- public LoadBusinessesSaless() {
- new
- iRows,
- iIndex;
- cache_get_row_count(iRows);
- while((iIndex < iRows)) {
- cache_get_value_name_int(iIndex, "bID", BusinessSales[iIndex][bID]);
- cache_get_value_name_int(iIndex, "BusinessID", BusinessSales[iIndex][bBusinessID]);
- cache_get_value_name(iIndex, "Text", BusinessSales[iIndex][bText], 128);
- cache_get_value_name_int(iIndex, "Price", BusinessSales[iIndex][bPrice]);
- cache_get_value_name_int(iIndex, "Available", BusinessSales[iIndex][bAvailable]);
- cache_get_value_name_int(iIndex, "Purchased", BusinessSales[iIndex][bPurchased]);
- cache_get_value_name_int(iIndex, "Type", BusinessSales[iIndex][bType]);
- iIndex++;
- }
- return 1;
- }
- stock SaveBusinessSale(id)
- {
- new query[200];
- 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],
- BusinessSales[id][bPrice], BusinessSales[id][bAvailable], BusinessSales[id][bPurchased], BusinessSales[id][bType], BusinessSales[id][bID]);
- mysql_tquery(MainPipeline, query, "OnQueryFinish", "i", SENDDATA_THREAD);
- printf("[BusinessSale] saved %i", id);
- return 1;
- }
- stock SaveDealershipSpawn(businessid) {
- new query[200];
- mysql_format(MainPipeline, query, sizeof(query), "UPDATE `businesses` SET");
- 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]);
- mysql_format(MainPipeline, query, sizeof(query), "%s WHERE `Id` = %d", query, businessid+1);
- mysql_tquery(MainPipeline, query, "OnQueryFinish", "ii", SENDDATA_THREAD, INVALID_PLAYER_ID);
- }
- stock SaveDealershipVehicle(businessid, slotid)
- {
- new query[256];
- //slotid++;
- mysql_format(MainPipeline, query, sizeof(query), "UPDATE `businesses` SET");
- mysql_format(MainPipeline, query, sizeof(query), "%s `Car%dPosX` = %0.5f,", query, slotid, Businesses[businessid][bParkPosX][slotid]);
- mysql_format(MainPipeline, query, sizeof(query), "%s `Car%dPosY` = %0.5f,", query, slotid, Businesses[businessid][bParkPosY][slotid]);
- mysql_format(MainPipeline, query, sizeof(query), "%s `Car%dPosZ` = %0.5f,", query, slotid, Businesses[businessid][bParkPosZ][slotid]);
- mysql_format(MainPipeline, query, sizeof(query), "%s `Car%dPosAngle` = %0.5f,", query, slotid, Businesses[businessid][bParkAngle][slotid]);
- mysql_format(MainPipeline, query, sizeof(query), "%s `Car%dModelId` = %d,", query, slotid, Businesses[businessid][bModel][slotid]);
- mysql_format(MainPipeline, query, sizeof(query), "%s `Car%dPrice` = %d", query, slotid, Businesses[businessid][bPrice][slotid]);
- mysql_format(MainPipeline, query, sizeof(query), "%s WHERE `Id` = %d", query, businessid+1);
- mysql_tquery(MainPipeline, query, "OnQueryFinish", "ii", SENDDATA_THREAD, INVALID_PLAYER_ID);
- }
- CMD:dealershiprespawn(playerid, params[])
- {
- if(!PlayerInfo[playerid][pBM]) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command.");
- new business = PlayerInfo[playerid][pBusiness];
- if(business == INVALID_BUSINESS_ID) return SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in a business, use /switchbiz first.");
- SendClientMessageEx(playerid, COLOR_GREY, "** Respawning dealership vehicles..");
- for (new i; i < MAX_BUSINESS_DEALERSHIP_VEHICLES; i++)
- {
- if(Businesses[business][bVehID][i] != 0) SetVehicleToRespawn(Businesses[business][bVehID][i]);
- }
- return 1;
- }
|