| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510 |
- // Developers notes
- /* # Coding guideline
- * Add +1 at the end of array declarations to visually account for null bit.
- * Always log first.
- * Always notify discord last.
- * Always wait for other queries to finish before initiating one: "sql_wait(sqlHandle); // Wait for other queries to finish"
- * Delete GVar strings as soon as possible, but at least before the player quits or the gamemode exits, as per: https://forum.sa-mp.com/showthread.php?t=151076
- * Read all the function before the OnGameModeInit(), to be able to follow the DRY principle. Repeating code will NOT BE ACCEPTED!
- */
- /* # Style guide
- * GLOBAL_CONSTANT
- * local_variable
- * someFunction
- * SomeClass
- * playerid // Variable storing in-game player ID
- * player_id // Variable storing database player ID
- */
- /* # Adding a discord bot to your guild.
- https://discordapp.com/oauth2/authorize?client_id=%CLIENT_ID%&scope=bot&permissions=3072
- Where %CLEINT_ID% is the client id.
- */
- /* # Todo:
- * Add geoiplib, to make connect messages fancier, and add a locate command.
- * Show underscores as spaces and convert spaces in changename input to undescores before regex check.
- * Vip limit on characters.
- * See why sql_insert_id wont work. (Try it via a callback)
- * Check if timestamps work (implemented on temp ban), before implementing it more.
- * Normalise database column names.
- * Some SMALLINT fields are using SQL_INTERGER_LEGNTH for size and could be smaller.
- */
- /// Global definitions
- // Colours
- /*
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_BLUE 0x0000BBAA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_LIME 0x10F441AA
- #define COLOR_NAVY 0x000080AA
- #define COLOR_AQUA 0xF0F8FFAA
- #define COLOR_CRIMSON 0xDC143CAA
- #define COLOR_BISQUE 0xFFE4C4AA
- #define COLOR_BLACK 0x000000AA
- #define COLOR_CHARTREUSE 0x7FFF00AA
- #define COLOR_BROWN 0XA52A2AAA
- #define COLOR_CORAL 0xFF7F50AA
- #define COLOR_GOLD 0xB8860BAA
- #define COLOR_GREENYELLOW 0xADFF2FAA
- #define COLOR_INDIGO 0x4B00B0AA
- #define COLOR_IVORY 0xFFFF82AA
- #define COLOR_LAWNGREEN 0x7CFC00AA
- #define COLOR_SEAGREEN 0x20B2AAAA
- #define COLOR_SEAGREEN 0x2E8B57AA
- #define COLOR_LIMEGREEN 0x32CD32AA //<--- Dark lime
- #define COLOR_MIDNIGHTBLUE 0X191970AA
- #define COLOR_MAROON 0x800000AA
- #define COLOR_OLIVE 0x808000AA
- #define COLOR_ORANGERED 0xFF4500AA
- #define COLOR_PINK 0xFFC0CBAA // - Light light pink
- #define COLOR_SPRINGGREEN 0x00FF7FAA
- #define COLOR_TOMATO 0xFF6347AA // - Tomato >:/ sounds wrong lol... well... :P
- #define COLOR_YELLOWGREEN 0x9ACD32AA //- like military green
- #define COLOR_MEDIUMAQUA 0x83BFBFAA
- #define COLOR_MEDIUMMAGENTA 0x8B008BAA // dark magenta ^^
- */
- #define COLOR_ACTIVEBORDER 0xB4B4B4FF
- #define COLOR_ACTIVECAPTION 0x99B4D1FF
- #define COLOR_ACTIVECAPTIONTEXT 0x000000FF
- #define COLOR_ALICEBLUE 0xF0F8FFFF
- #define COLOR_ANTIQUEWHITE 0xFAEBD7FF
- #define COLOR_APPWORKSPACE 0xABABABFF
- #define COLOR_AQUA 0x00FFFFFF
- #define COLOR_AQUAMARINE 0x7FFFD4FF
- #define COLOR_AZURE 0xF0FFFFFF
- #define COLOR_BEIGE 0xF5F5DCFF
- #define COLOR_BISQUE 0xFFE4C4FF
- #define COLOR_BLACK 0x000000FF
- #define COLOR_BLANCHEDALMOND 0xFFEBCDFF
- #define COLOR_BLUE 0x0000FFFF
- #define COLOR_BLUEVIOLET 0x8A2BE2FF
- #define COLOR_BROWN 0xA52A2AFF
- #define COLOR_BURLYWOOD 0xDEB887FF
- #define COLOR_BUTTONFACE 0xF0F0F0FF
- #define COLOR_BUTTONHIGHLIGHT 0xFFFFFFFF
- #define COLOR_BUTTONSHADOW 0xA0A0A0FF
- #define COLOR_CADETBLUE 0x5F9EA0FF
- #define COLOR_CHARTREUSE 0x7FFF00FF
- #define COLOR_CHOCOLATE 0xD2691EFF
- #define COLOR_CONTROL 0xF0F0F0FF
- #define COLOR_CONTROLDARK 0xA0A0A0FF
- #define COLOR_CONTROLDARKDARK 0x696969FF
- #define COLOR_CONTROLLIGHT 0xE3E3E3FF
- #define COLOR_CONTROLLIGHTLIGHT 0xFFFFFFFF
- #define COLOR_CONTROLTEXT 0x000000FF
- #define COLOR_CORAL 0xFF7F50FF
- #define COLOR_CORNFLOWERBLUE 0x6495EDFF
- #define COLOR_CORNSILK 0xFFF8DCFF
- #define COLOR_CRIMSON 0xDC143CFF
- #define COLOR_CYAN 0x00FFFFFF
- #define COLOR_DARKBLUE 0x00008BFF
- #define COLOR_DARKCYAN 0x008B8BFF
- #define COLOR_DARKGOLDENROD 0xB8860BFF
- #define COLOR_DARKGRAY 0xA9A9A9FF
- #define COLOR_DARKGREEN 0x006400FF
- #define COLOR_DARKKHAKI 0xBDB76BFF
- #define COLOR_DARKMAGENTA 0x8B008BFF
- #define COLOR_DARKOLIVEGREEN 0x556B2FFF
- #define COLOR_DARKORANGE 0xFF8C00FF
- #define COLOR_DARKORCHID 0x9932CCFF
- #define COLOR_DARKRED 0x8B0000FF
- #define COLOR_DARKSALMON 0xE9967AFF
- #define COLOR_DARKSEAGREEN 0x8FBC8BFF
- #define COLOR_DARKSLATEBLUE 0x483D8BFF
- #define COLOR_DARKSLATEGRAY 0x2F4F4FFF
- #define COLOR_DARKTURQUOISE 0x00CED1FF
- #define COLOR_DARKVIOLET 0x9400D3FF
- #define COLOR_DEEPPINK 0xFF1493FF
- #define COLOR_DEEPSKYBLUE 0x00BFFFFF
- #define COLOR_DEFAULT_CHAT 0xFFFFFFFF
- #define COLOR_DESKTOP 0x000000FF
- #define COLOR_DIMGRAY 0x696969FF
- #define COLOR_DODGERBLUE 0x1E90FFFF
- #define COLOR_FIREBRICK 0xB22222FF
- #define COLOR_FLBLUE 0x6495EDAA
- #define COLOR_FLORALWHITE 0xFFFAF0FF
- #define COLOR_FORESTGREEN 0x228B22FF
- #define COLOR_GAINSBORO 0xDCDCDCFF
- #define COLOR_GHOSTWHITE 0xF8F8FFFF
- #define COLOR_GOLD 0xFFD700FF
- #define COLOR_GOLDENROD 0xDAA520FF
- #define COLOR_GRADIENTACTIVECAPTION 0xB9D1EAFF
- #define COLOR_GRADIENTINACTIVECAPTION 0xD7E4F2FF
- #define COLOR_GRAY 0x808080FF
- #define COLOR_GRAYTEXT 0x808080FF
- #define COLOR_GREEN 0x008000FF
- #define COLOR_GREENYELLOW 0xADFF2FFF
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_HIGHLIGHT 0x3399FFFF
- #define COLOR_HIGHLIGHTTEXT 0xFFFFFFFF
- #define COLOR_HONEYDEW 0xF0FFF0FF
- #define COLOR_HOTPINK 0xFF69B4FF
- #define COLOR_HOTTRACK 0x0066CCFF
- #define COLOR_INACTIVEBORDER 0xF4F7FCFF
- #define COLOR_INACTIVECAPTION 0xBFCDDBFF
- #define COLOR_INACTIVECAPTIONTEXT 0x434E54FF
- #define COLOR_INDIANRED 0xCD5C5CFF
- #define COLOR_INDIGO 0x4B0082FF
- #define COLOR_INFO 0xFFFFE1FF
- #define COLOR_INFOTEXT 0x000000FF
- #define COLOR_IVORY 0xFFFFF0FF
- #define COLOR_KHAKI 0xF0E68CFF
- #define COLOR_LAVENDER 0xE6E6FAFF
- #define COLOR_LAVENDERBLUSH 0xFFF0F5FF
- #define COLOR_LAWNGREEN 0x7CFC00FF
- #define COLOR_LEMONCHIFFON 0xFFFACDFF
- #define COLOR_LIGHTBLUE 0xADD8E6FF
- #define COLOR_LIGHTCORAL 0xF08080FF
- #define COLOR_LIGHTCYAN 0xE0FFFFFF
- #define COLOR_LIGHTGOLDENRODYELLOW 0xFAFAD2FF
- #define COLOR_LIGHTGRAY 0xD3D3D3FF
- #define COLOR_LIGHTGREEN 0x90EE90FF
- #define COLOR_LIGHTPINK 0xFFB6C1FF
- #define COLOR_LIGHTSALMON 0xFFA07AFF
- #define COLOR_LIGHTSEAGREEN 0x20B2AAFF
- #define COLOR_LIGHTSKYBLUE 0x87CEFAFF
- #define COLOR_LIGHTSLATEGRAY 0x778899FF
- #define COLOR_LIGHTSTEELBLUE 0xB0C4DEFF
- #define COLOR_LIGHTYELLOW 0xFFFFE0FF
- #define COLOR_LIME 0x00FF00FF
- #define COLOR_LIMEGREEN 0x32CD32FF
- #define COLOR_LINEN 0xFAF0E6FF
- #define COLOR_MAGENTA 0xFF00FFFF
- #define COLOR_MAROON 0x800000FF
- #define COLOR_MEDIUMAQUAMARINE 0x66CDAAFF
- #define COLOR_MEDIUMBLUE 0x0000CDFF
- #define COLOR_MEDIUMORCHID 0xBA55D3FF
- #define COLOR_MEDIUMPURPLE 0x9370DBFF
- #define COLOR_MEDIUMSEAGREEN 0x3CB371FF
- #define COLOR_MEDIUMSLATEBLUE 0x7B68EEFF
- #define COLOR_MEDIUMSPRINGGREEN 0x00FA9AFF
- #define COLOR_MEDIUMTURQUOISE 0x48D1CCFF
- #define COLOR_MEDIUMVIOLETRED 0xC71585FF
- #define COLOR_MENU 0xF0F0F0FF
- #define COLOR_MENUBAR 0xF0F0F0FF
- #define COLOR_MENUHIGHLIGHT 0x3399FFFF
- #define COLOR_MENUTEXT 0x000000FF
- #define COLOR_MIDNIGHTBLUE 0x191970FF
- #define COLOR_MINTCREAM 0xF5FFFAFF
- #define COLOR_MISTYROSE 0xFFE4E1FF
- #define COLOR_MOCCASIN 0xFFE4B5FF
- #define COLOR_NAVAJOWHITE 0xFFDEADFF
- #define COLOR_NAVY 0x000080FF
- #define COLOR_OLDLACE 0xFDF5E6FF
- #define COLOR_OLIVE 0x808000FF
- #define COLOR_OLIVEDRAB 0x6B8E23FF
- #define COLOR_ORANGE 0xFFA500FF
- #define COLOR_ORANGERED 0xFF4500FF
- #define COLOR_ORCHID 0xDA70D6FF
- #define COLOR_PALEGOLDENROD 0xEEE8AAFF
- #define COLOR_PALEGREEN 0x98FB98FF
- #define COLOR_PALETURQUOISE 0xAFEEEEFF
- #define COLOR_PALEVIOLETRED 0xDB7093FF
- #define COLOR_PAPAYAWHIP 0xFFEFD5FF
- #define COLOR_PEACHPUFF 0xFFDAB9FF
- #define COLOR_PERU 0xCD853FFF
- #define COLOR_PINK 0xFFC0CBFF
- #define COLOR_PLUM 0xDDA0DDFF
- #define COLOR_POWDERBLUE 0xB0E0E6FF
- #define COLOR_PURPLE 0x800080FF
- #define COLOR_RED 0xFF0000FF
- #define COLOR_ROSYBROWN 0xBC8F8FFF
- #define COLOR_ROYALBLUE 0x4169E1FF
- #define COLOR_SADDLEBROWN 0x8B4513FF
- #define COLOR_SALMON 0xFA8072FF
- #define COLOR_SANDYBROWN 0xF4A460FF
- #define COLOR_SCROLLBAR 0xC8C8C8FF
- #define COLOR_SEAGREEN 0x2E8B57FF
- #define COLOR_SEASHELL 0xFFF5EEFF
- #define COLOR_SIENNA 0xA0522DFF
- #define COLOR_SILVER 0xC0C0C0FF
- #define COLOR_SKYBLUE 0x87CEEBFF
- #define COLOR_SLATEBLUE 0x6A5ACDFF
- #define COLOR_SLATEGRAY 0x708090FF
- #define COLOR_SNOW 0xFFFAFAFF
- #define COLOR_SPRINGGREEN 0x00FF7FFF
- #define COLOR_STEELBLUE 0x4682B4FF
- #define COLOR_TAN 0xD2B48CFF
- #define COLOR_TEAL 0x008080FF
- #define COLOR_THISTLE 0xD8BFD8FF
- #define COLOR_TOMATO 0xFF6347FF
- #define COLOR_TRANSPARENT 0xFFFFFF00
- #define COLOR_TURQUOISE 0x40E0D0FF
- #define COLOR_VIOLET 0xEE82EEFF
- #define COLOR_WHEAT 0xF5DEB3FF
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_WHITESMOKE 0xF5F5F5FF
- #define COLOR_WINDOW 0xFFFFFFFF
- #define COLOR_WINDOWFRAME 0x646464FF
- #define COLOR_WINDOWTEXT 0x000000FF
- #define COLOR_YELLOW 0xFFFF00FF
- #define COLOR_YELLOWGREEN 0x9ACD32FF
- #define COLOR_STEALTH_ORANGE 0xFF880000
- #define COLOR_STEALTH_OLIVE 0x66660000
- #define COLOR_STEALTH_GREEN 0x33DD1100
- #define COLOR_STEALTH_PINK 0xFF22EE00
- #define COLOR_STEALTH_BLUE 0x0077BB00
- // Color groups
- #define COLOR_COMMAND_OUTPUT 0xFFFFFFFF // White
- #define COLOR_NOTICE 0xAFAFAFAA // Grey
- #define COLOR_WARNING 0xFFA500FF // Orange? (Looks more yellow to me)
- #define COLOR_ERROR 0xFF0000FF // Red
- #define COLOR_GLOBAL_CHAT 0xFFFFFFFF // White
- #define COLOR_PM_CHAT 0xFFFF00FF // Yellow
- #define COLOR_VIP_CHAT 0x800080FF // Purple
- #define COLOR_CREW_CHAT 0xFF9900AA // Orange
- #define COLOR_ADMIN_CHAT 0xB8860BAA // Gold
- #define COLOR_POLICE 0x00008BFF //
- #define COLOR_MEDIC 0xFFC0CBAA // Light pink
- #define COLOR_FIRE 0xAA3333AA // Red
- #define COLOR_SHERIFF 0xF5F5DCFF // Beige
- #define COLOR_FBI 0x000080AA // Navy
- #define COLOR_DMV 0xF0F8FFAA // Aqua
- #define COLOR_NEWS 0x808000FF // Olive
- #define EMBED_COLOR_GREY "{838383}"
- #define EMBED_COLOR_RED "{FF0000}"
- #define EMBED_COLOR_WHITE "{FFFFFF}"
- // SQL datatypes
- #define MAX_SQL_INTEGER 10
- #define MAX_SQL_TIMESTAMP 19 // 1999-01-08 04:05:06 [5 + 4 + 2 + 2 +2 + 2 + 2]
- #define MAX_SQL_FLOAT 16
- #define MAX_SQL_HASH 128
- #define MAX_SQL_IP 45
- #define MAX_SQL_REASON 121
- // Log levels
- #define LOGLEVEL_CHAT -2
- #define LOGLEVEL_COMMAND -1
- #define LOGLEVEL_DEBUG 0
- #define LOGLEVEL_INFO 1
- #define LOGLEVEL_NOTICE 2
- #define LOGLEVEL_WARNING 3
- #define LOGLEVEL_ERROR 4
- #define LOGLEVEL_CRITICAL 5
- #define LOGLEVEL_PANIC 6
- // Userlevels
- enum{ // Noted values as comments, for database reference.
- UNREGISTERED_PLAYER, // 0
- REGISTERED_PLAYER, // 1
- REGULAR_PLAYER, // 2 Spent many hours in and around the comunity.
- VIP_PLAYER, // 3 Donated.
- MODERATOR_CREW, // 4
- VETERAN_CREW, // 5 Inactive admins and management that are allowed to keep their rights.
- ADMIN_CREW, // 6
- UNDERCOVER_ADMIN_CREW, // 7
- MANAGEMENT_CREW, // 8
- UNDRECOVER_MANAGEMENT_CREW, // 9
- FOUNDER_PLAYER, // 10
- UNDERCOVER_FOUNDER_PLAYER, // 11
- }
- // Discord channels
- enum{
- ECHO_CHANNEL,
- MAIN_CHANNEL,
- ADMIN_ECHO_CHANNEL,
- ADMIN_CHANNEL,
- MANAGEMENT_CHANNEL,
- }
- // Chats
- enum{
- CHAT_LOCAL, // Has to be 0, else a gVar would have to be created OnJoin, this conserves memory when no chatmode is set (which will be the case most likely)
- CHAT_WHISPER,
- CHAT_LOW,
- CHAT_ACTION,
- CHAT_SHOUT,
- CHAT_OC,
- CHAT_GLOBAL,
- CHAT_CALL,
- CHAT_SMS,
- CHAT_RADIO,
- CHAT_PM,
- CHAT_GANG,
- CHAT_GANG_OC,
- CHAT_FACTION,
- CHAT_FACTION_OC,
- CHAT_VIP,
- CHAT_CREW,
- CHAT_ADMIN,
- CHAT_MANAGEMENT,
- CHAT_UNDERCOVER,
- }
- // Dialogs
- enum{
- DIALOG_CHANGENAME,
- DIALOG_REGISTER,
- DIALOG_ACCOUNT_CREATED,
- DIALOG_LOGIN,
- DIALOG_CHANGE_USERNAME,
- DIALOG_CHARACTERS,
- DIALOG_LOGIN_FAILED,
- DIALOG_DELETE_CHARACTER,
- DIALOG_GOTO,
- DIALOG_GOTO_INTERIOR,
- DIALOG_GOTO_PLAYER,
- DIALOG_GOTO_247,
- DIALOG_GOTO_AVIATION,
- DIALOG_GOTO_AMMUNATION,
- DIALOG_GOTO_BURGLARYHOUSE,
- DIALOG_GOTO_CASINO,
- DIALOG_GOTO_MISSION,
- DIALOG_GOTO_MISSIONEXT,
- DIALOG_GOTO_MISSIONHOUSE,
- DIALOG_GOTO_MODDING,
- DIALOG_GOTO_POLICE,
- DIALOG_GOTO_HOUSES,
- DIALOG_GOTO_SAFEHOUSE,
- DIALOG_GOTO_SHOPS,
- DIALOG_GOTO_SHOP,
- DIALOG_GOTO_STADIA,
- DIALOG_GOTO_UHOUSE,
- DIALOG_GOTO_SEXWORK,
- DIALOG_GOTO_UNCATAGORIZED,
- DIALOG_CREATE_PICKUP,
- DIALOG_CREATE_FACTION_PICKUP,
- DIALOG_DUTY_PD,
- DIALOG_POLICE_SKIN,
- DIALOG_DUTY_MD,
- DIALOG_MEDIC_SKIN,
- DIALOG_DUTY_FD,
- DIALOG_FIRE_SKIN,
- DIALOG_DUTY_SD,
- DIALOG_SHERIFF_SKIN,
- DIALOG_DUTY_FBI,
- DIALOG_FBI_SKIN,
- DIALOG_DUTY_DMV,
- DIALOG_DMV_SKIN,
- DIALOG_DUTY_NEWS,
- DIALOG_NEWS_SKIN,
- }
- // Pickups
- enum{
- PICKUP_FACTION_PD,
- PICKUP_FACTION_MD,
- PICKUP_FACTION_FD,
- PICKUP_FACTION_SD,
- PICKUP_FACTION_FBI,
- PICKUP_FACTION_DMV,
- PICKUP_FACTION_NEWS,
- PICKUP_PORTAL, // MUST be last as it's not in the pickup create dialog
- }
- // Location categories
- enum{
- GOTO_CATEGORY_INTERIOR,
- }
- enum{
- INTERIOR_CATEGORY_AVIATION,
- INTERIOR_CATEGORY_HOUSES,
- INTERIOR_CATEGORY_MISSION,
- INTERIOR_CATEGORY_MISSIONEXT,
- INTERIOR_CATEGORY_POLICE,
- INTERIOR_CATEGORY_SEXWORK,
- INTERIOR_CATEGORY_SHOPS,
- INTERIOR_CATEGORY_STADIA,
- }
- enum{
- INTERIOR_HOUSE_CAT_BURGLARY,
- INTERIOR_HOUSE_CAT_MISSION,
- INTERIOR_HOUSE_CAT_SAFE,
- INTERIOR_HOUSE_CAT_U,
- }
- enum{
- INTERIOR_SHOP_CAT_247,
- INTERIOR_SHOP_CAT_AMMUNATION,
- INTERIOR_SHOP_CAT_CASINO,
- INTERIOR_SHOP_CAT_MODSHOP,
- INTERIOR_SHOP_CAT_SHOP,
- }
- enum{INTERIOR_247_LSHAPED, INTERIOR_247_OBLONG, INTERIOR_247_MEDIUM, INTERIOR_247_MEDIUM_NOEXIT, INTERIOR_247_LONG, INTERIOR_247_SQAURE}
- enum{
- INTERIOR_AVIATION_TICKET,
- INTERIOR_AVIATION_BAGGAGE,
- INTERIOR_AVIATION_SHAMAL,
- INTERIOR_AVIATION_ANDROMADA,
- INTERIOR_AVIATION_LSAIRPORT
- }
- enum{INTERIOR_AMMU_OCEAN, INTERIOR_AMMU_PALOMINO, INTERIOR_AMMU_ANGEL, INTERIOR_AMMU_QUEBRADOS, INTERIOR_AMMU_2STORIES, INTERIOR_AMMU_BOOTH, INTERIOR_AMMU_RANGE}
- enum{
- INTERIOR_BURGRLARY_LARGE,
- INTERIOR_BURGRLARY_MEDIUM,
- INTERIOR_BURGRLARY_SMALL,
- INTERIOR_BURGRLARY_VERYLARGE,
- INTERIOR_BURGRLARY_5,
- INTERIOR_BURGRLARY_6,
- INTERIOR_BURGRLARY_NOBATH,
- }
- enum{
- INTERIOR_CASINO_CALIGULAS,
- INTERIOR_CASINO_REDLAND,
- INTERIOR_CASINO_4DRAGONS,
- INTERIOR_CASINO_4DRAGONSUITE,
- }
- enum{
- INTERIOR_MISSION_ATRIUM,
- INTERIOR_MISSION_BIGSMOKE,
- INTERIOR_MISSION_JEFFERSON,
- INTERIOR_MISSION_JIZZY,
- INTERIOR_MISSION_RC,
- INTERIOR_MISSION_WUZI,
- }
- enum{
- INTERIOR_MISSIONEXT_GAS,
- INTERIOR_MISSIONEXT_LIBERTY,
- INTERIOR_MISSIONEXT_SFGARAGE,
- }
- enum{
- INTERIOR_MISSIONHOUSE_DESIRE,
- INTERIOR_MISSIONHOUSE_COLONEL,
- INTERIOR_MISSIONHOUSE_RYDER,
- INTERIOR_MISSIONHOUSE_SWEET,
- INTERIOR_MISSIONHOUSE_CRACK,
- }
- enum{INTERIOR_MOD_LOCO, INTERIOR_MOD_WHEEL, INTERIOR_MOD_TRANSFENDER}
- enum{INTERIOR_PD_LV, INTERIOR_PD_LS, INTERIOR_PD_SF, INTERIOR_PD_BARBARA}
- enum{
- INTERIOR_HOUSE_GOLDEN,
- INTERIOR_HOUSE_HASHBURY,
- INTERIOR_HOUSE_JOHNSON,
- INTERIOR_HOUSE_MADDDOGG,
- INTERIOR_HOUSE_RED,
- INTERIOR_HOUSE_VERDANT,
- INTERIOR_HOUSE_UNUSED,
- }
- enum{
- INTERIOR_SEXWORK_BROTHEL,
- INTERIOR_SEXWORK_BROTHEL2,
- INTERIOR_SEXWORK_BIGSPREAD,
- }
- enum{
- INTERIOR_SHOP_TATTOO,
- INTERIOR_SHOP_BURGER,
- INTERIOR_SHOP_PIZZA,
- INTERIOR_SHOP_CLUCKIN,
- INTERIOR_SHOP_CALIGULAS,
- INTERIOR_SHOP_CASINO,
- INTERIOR_SHOP_4DRAGONS,
- INTERIOR_SHOP_4DRAGONSUITE,
- INTERIOR_SHOP_DONUTS,
- INTERIOR_SHOP_RC,
- INTERIOR_SHOP_PUMP,
- INTERIOR_SHOP_GYM,
- INTERIOR_SHOP_BETTING,
- INTERIOR_SHOP_RECORDS,
- }
- enum{
- INTERIOR_STADIUM_BLOODBOWL,
- INTERIOR_STADIUM_KICKSTART,
- INTERIOR_STADIUM_8TRACK,
- INTERIOR_STADIUM_DIRTBIKE,
- }
- enum{
- INTERIOR_
- }
- // Factions
- enum{
- FACTION_NONE,
- FACTION_POLICE,
- FACTION_MEDIC,
- FACTION_FIRE,
- FACTION_SHERIFF,
- FACTION_FBI,
- FACTION_DMV,
- FACTION_NEWS,
- }
- // Jobs
- enum{
- JOB_NONE,
- JOB_POLICE,
- JOB_MEDIC,
- JOB_FIRE,
- JOB_SHERIFF,
- JOB_FBI,
- JOB_DMV,
- JOB_NEWS,
- }
- // Vehicles
- enum{
- EDITVEHICLE_PARK,
- EDITVEHICLE_COLOR,
- EDITVEHICLE_RESPAWN,
- EDITVEHICLE_SIREN,
- }
- new vehicleNameArray[212][] = {
- {"Landstalker"},
- {"Bravura"},
- {"Buffalo"},
- {"Linerunner"},
- {"Perrenial"},
- {"Sentinel"},
- {"Dumper"},
- {"Firetruck"},
- {"Trashmaster"},
- {"Stretch"},
- {"Manana"},
- {"Infernus"},
- {"Voodoo"},
- {"Pony"},
- {"Mule"},
- {"Cheetah"},
- {"Ambulance"},
- {"Leviathan"},
- {"Moonbeam"},
- {"Esperanto"},
- {"Taxi"},
- {"Washington"},
- {"Bobcat"},
- {"Mr Whoopee"},
- {"BF Injection"},
- {"Hunter"},
- {"Premier"},
- {"Enforcer"},
- {"Securicar"},
- {"Banshee"},
- {"Predator"},
- {"Bus"},
- {"Rhino"},
- {"Barracks"},
- {"Hotknife"},
- {"Trailer 1"},
- {"Previon"},
- {"Coach"},
- {"Cabbie"},
- {"Stallion"},
- {"Rumpo"},
- {"RC Bandit"},
- {"Romero"},
- {"Packer"},
- {"Monster"},
- {"Admiral"},
- {"Squalo"},
- {"Seasparrow"},
- {"Pizzaboy"},
- {"Tram"},
- {"Trailer 2"},
- {"Turismo"},
- {"Speeder"},
- {"Reefer"},
- {"Tropic"},
- {"Flatbed"},
- {"Yankee"},
- {"Caddy"},
- {"Solair"},
- {"Berkley's RC Van"},
- {"Skimmer"},
- {"PCJ-600"},
- {"Faggio"},
- {"Freeway"},
- {"RC Baron"},
- {"RC Raider"},
- {"Glendale"},
- {"Oceanic"},
- {"Sanchez"},
- {"Sparrow"},
- {"Patriot"},
- {"Quad"},
- {"Coastguard"},
- {"Dinghy"},
- {"Hermes"},
- {"Sabre"},
- {"Rustler"},
- {"ZR-350"},
- {"Walton"},
- {"Regina"},
- {"Comet"},
- {"BMX"},
- {"Burrito"},
- {"Camper"},
- {"Marquis"},
- {"Baggage"},
- {"Dozer"},
- {"Maverick"},
- {"News Chopper"},
- {"Rancher"},
- {"FBI Rancher"},
- {"Virgo"},
- {"Greenwood"},
- {"Jetmax"},
- {"Hotring"},
- {"Sandking"},
- {"Blista Compact"},
- {"Police Maverick"},
- {"Boxville"},
- {"Benson"},
- {"Mesa"},
- {"RC Goblin"},
- {"Hotring Racer A"},
- {"Hotring Racer B"},
- {"Bloodring Banger"},
- {"Rancher"},
- {"Super GT"},
- {"Elegant"},
- {"Journey"},
- {"Bike"},
- {"Mountain Bike"},
- {"Beagle"},
- {"Cropdust"},
- {"Stunt"},
- {"Tanker"},
- {"Roadtrain"},
- {"Nebula"},
- {"Majestic"},
- {"Buccaneer"},
- {"Shamal"},
- {"Hydra"},
- {"FCR-900"},
- {"NRG-500"},
- {"HPV1000"},
- {"Cement Truck"},
- {"Tow Truck"},
- {"Fortune"},
- {"Cadrona"},
- {"FBI Truck"},
- {"Willard"},
- {"Forklift"},
- {"Tractor"},
- {"Combine"},
- {"Feltzer"},
- {"Remington"},
- {"Slamvan"},
- {"Blade"},
- {"Freight"},
- {"Streak"},
- {"Vortex"},
- {"Vincent"},
- {"Bullet"},
- {"Clover"},
- {"Sadler"},
- {"Firetruck LA"},
- {"Hustler"},
- {"Intruder"},
- {"Primo"},
- {"Cargobob"},
- {"Tampa"},
- {"Sunrise"},
- {"Merit"},
- {"Utility"},
- {"Nevada"},
- {"Yosemite"},
- {"Windsor"},
- {"Monster A"},
- {"Monster B"},
- {"Uranus"},
- {"Jester"},
- {"Sultan"},
- {"Stratum"},
- {"Elegy"},
- {"Raindance"},
- {"RC Tiger"},
- {"Flash"},
- {"Tahoma"},
- {"Savanna"},
- {"Bandito"},
- {"Freight Flat"},
- {"Streak Carriage"},
- {"Kart"},
- {"Mower"},
- {"Duneride"},
- {"Sweeper"},
- {"Broadway"},
- {"Tornado"},
- {"AT-400"},
- {"DFT-30"},
- {"Huntley"},
- {"Stafford"},
- {"BF-400"},
- {"Newsvan"},
- {"Tug"},
- {"Trailer 3"},
- {"Emperor"},
- {"Wayfarer"},
- {"Euros"},
- {"Hotdog"},
- {"Club"},
- {"Freight Carriage"},
- {"Trailer 3"},
- {"Andromada"},
- {"Dodo"},
- {"RC Cam"},
- {"Launch"},
- {"Police Car (LSPD)"},
- {"Police Car (SFPD)"},
- {"Police Car (LVPD)"},
- {"Police Ranger"},
- {"Picador"},
- {"S.W.A.T. Van"},
- {"Alpha"},
- {"Phoenix"},
- {"Glendale"},
- {"Sadler"},
- {"Luggage Trailer A"},
- {"Luggage Trailer B"},
- {"Stair Trailer"},
- {"Boxville"},
- {"Farm Plow"},
- {"Utility Trailer"}
- };
- // Environment settings TODO: THESE SHOULD ALL BE READ FROM A CONFIG FILE!
- static bool:scriptDebug = true; // Debug setting
- #define MODE_NAME "0.0a Build 10"
- #define SERVER_NAME "Bone County RPG"
- #define PG_HOST "127.0.0.1"
- #define PG_ROLE "rpfw-dev"
- #define PG_PASS "nJd&1k$0fs"
- #define PG_DB "rpfw-dev"
- #define PG_PORT 5432
- #define DISCORD_HOME_GUILD_ID "666077037470941184" // Emerald City Roleplay
- #define DISCORD_ECHO_CHANNEL_ID "677855051166777344" // #bcrp-echo
- //#define DISCORD_ECHO_CHANNEL_ID "666078187079598080" // #ecrp-echo
- #define DISCORD_MAIN_CHANNEL_ID "677855315898793984" // #bcrp
- //#define DISCORD_MAIN_CHANNEL_ID "667396220402270228" // #development
- #define DISCORD_ADMIN_ECHO_CHANNEL_ID "672841892169383936" // #admin-echo
- #define DISCORD_ADMIN_CHANNEL_ID "667396026058932236" // #admins
- #define DISCORD_MANAGEMENT_CHANNEL_ID "666091376240361492" // #management
- // Game-mode limits
- #define MAX_CHARACTERS_PER_USER 20 // Maximum of MAX_CHARACTERS_PER_USER_DIGITS digits (Due to SQL query string length)
- #define MAX_CHARACTERS_PER_USER_DIGITS 3
- // SQL plugin
- new SQL:sqlHandle;
- // discord-connector
- //static DCC_Guild:homeGuild; // Discord guild controlled by game community.
- static DCC_Channel:echoChannel; // Public echo channel.
- static DCC_Channel:mainChannel; // Channel for communirty notifications.
- static DCC_Channel:adminEchoChannel; // Admin echo channel.
- static DCC_Channel:adminChannel; // Channel for admin notifications.
- static DCC_Channel:managementChannel; // Channel for management notifications.
- DiscordEcho(const message[], messageLevel){ // Write to echo channels.
- switch(messageLevel) // Output facilities.
- {
- case ECHO_CHANNEL: { // Public echo message
- DiscordSendChannelMessage(echoChannel, message);
- DiscordSendChannelMessage(adminEchoChannel, message); // Also send to admin echo channel, so admin can see everything in one channel without needing to constantly switch. Also handy as log on conflicts/complaints.
- }
- case MAIN_CHANNEL: {DiscordSendChannelMessage(mainChannel, message);} // Public notification
- case ADMIN_ECHO_CHANNEL: {DiscordSendChannelMessage(adminEchoChannel, message);} // Admin echo message
- case ADMIN_CHANNEL: {DiscordSendChannelMessage(adminChannel, message);} // Admin notification
- case MANAGEMENT_CHANNEL: {DiscordSendChannelMessage(managementChannel, message);} // Management notification
- }
- return 0;
- }
- // Natives
- native WP_Hash(buffer[], len, const str[]); // https://forum.sa-mp.com/showthread.php?t=570945
- //native Float:loadavg(); // https://forum.sa-mp.com/showthread.php?t=260206 LINUX ONLY
- // Includes
- #include <a_samp> // https://sa-mp.com
- #include <sql> // https://github.com/udan11/samp-plugin-sql (Fastest player in town and only one supporting postgreSQL) | Examples: https://pastebin.com/67y2nq2n https://github.com/udan11/samp-plugin-sql/issues/10
- #include <sscanf2> // Newest version: https://github.com/maddinat0r/sscanf/releases | Better readme: https://github.com/Y-Less/sscanf
- #include <strlib> // https://github.com/oscar-broman/strlib
- #include <Pawn.Regex> // https://github.com/urShadow/Pawn.Regex
- #include <Pawn.CMD> // https://github.com/urShadow/Pawn.CMD (Fastest player in town)
- #include <gvar> // https://github.com/samp-incognito/samp-gvar-plugin
- #include <discord-connector> // https://github.com/maddinat0r/samp-discord-connector (Only player in town)
- #include <streamer> // https://github.com/samp-incognisto/samp-streamer-plugin
- /// Middle-ware
- // Logging
- logger(const log_level, const message[]){ // Write to logging facility
- // Do not log commands or debug when script debugging is turned off.
- if(scriptDebug == false){ // Debug is off
- if(log_level == LOGLEVEL_COMMAND || log_level == LOGLEVEL_DEBUG){ // Command or debug message
- return 0; // Stop and do not log
- }
- }
-
- // Messagelevel tag
- new human_readable_log_level[8 + 1];
- switch(log_level){ // Assign log level.
- case LOGLEVEL_CHAT: human_readable_log_level = "chat";
- case LOGLEVEL_COMMAND: human_readable_log_level = "command";
- case LOGLEVEL_DEBUG: human_readable_log_level = "debug";
- case LOGLEVEL_INFO: human_readable_log_level = "info";
- case LOGLEVEL_NOTICE: human_readable_log_level = "notice";
- case LOGLEVEL_WARNING: human_readable_log_level = "warning";
- case LOGLEVEL_ERROR: human_readable_log_level = "error";
- case LOGLEVEL_CRITICAL: human_readable_log_level = "critical";
- case LOGLEVEL_PANIC: human_readable_log_level = "panic";
- }
-
- printf("[%s] %s", human_readable_log_level, message); // Print to STDOUT.
- return 0;
- }
- /*// SQL plugin (BROKEN, look at it again after I have more then a week of experience)
- //forward sqlQuery(SQL:handle, query[]);
- //public sqlQuery(SQL:handle, query[]){
- sqlQuery(SQL:handle, query[]){
- //sql_wait(handle); // Wait for all queries to finish.
- new Result:result = sql_query(handle, query);
- if(sql_error(result)){printf("SQL error");} // Did not work during a test with a faulty statement.
- return result;
- }*/
- // discord-connector
- DiscordSendChannelMessage(DCC_Channel:channel, const message[]){
- if(scriptDebug){ // Log middle-ware event in debugging mode only
- new channel_name[100 + 1]; // Default value from tutorial
- DCC_GetChannelName(channel, channel_name);
- new logMessage[26 + 100 + 2000 + 1]; // Discord max message length = 2000
- format(logMessage, sizeof(logMessage), "Send to discord channel %s: %s", channel_name, message);
- logger(LOGLEVEL_DEBUG, logMessage); // Actually log the message
- }
- DCC_SendChannelMessage(channel, message); // Call discord-connector DISABLE THIS TO STOP ALL OUTGOING DISCORD MESSAGES
- }
- /// Game-mode
- // Account functions
- forward changeName(playerid, const name[]);
- public changeName(playerid, const name[]){ // Check if name is valid and force change if needed.
- // Prevent regex error when comparing against null
- if(isempty(name)){ // No name entered
- ShowPlayerDialog(playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT, "Character name", "You must enter a name.\n\nExamples:\n Jo_Bo\n Dingle_P._J._Berry\n Jackson_DeForest_Kelley\n MaryJo_Ann_LaFluer", "Change", ""); // Force RP name.
-
- return 0;
- }
-
- // Check name
- new Regex:r = Regex_New("^[A-Z][a-z]{1,}([A-Z][a-z]{1,})?(_([A-Z][a-z]{1,}([A-Z][a-z]{1,})?|[A-Z]\\.(_[A-Z]\\.)?))?_[A-Z][a-z]{1,}([A-Z][a-z]{1,})?$"); // Regex name filter
- new isValidName = Regex_Check(name, r); // Validate name to filter
- Regex_Delete(r);
- if(!isValidName){ // Invalid role-play name
- ShowPlayerDialog(playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT, "Character name", "Please pick a realistic name, separate first and last name with an underscore.\n\nExamples:\n Jo_Bo\n Dingle_P._J._Berry\n Jackson_DeForest_Kelley\n MaryJo_Ann_LaFluer", "Change", ""); // Force RP name.
- }
- else { // Valid role-play name
- print("Valid name");
- // Check for name in use
- /*new escaped_name[MAX_PLAYER_NAME + 1]; // TODO should be more, to account for escape characters.
- sql_escape_string(sqlHandle, name, escaped_name, sizeof(escaped_name)); // Escape player name BROKEN argument type mismatch on argument 2, but name is a sting...*/
- new character_query[40 + MAX_PLAYER_NAME + 1], Result:character_result = sql_query(sqlHandle, character_query);
- format(character_query, sizeof(character_query), "SELECT id FROM character WHERE name = '%s'", name);
-
- if(sql_num_rows(character_result) > 0){ // Name taken
- ShowPlayerDialog(playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT, "Character name", "Name already taken. Please pick an original name.", "Change", ""); // Force RP name.
- }
- else{ // Name free
- // Notify all players
- new message[11 + 4 + MAX_PLAYER_NAME + 1];
- format(message, sizeof(message), "* [%i] %s joined.", playerid, getCharacterName(playerid));
- SendClientMessageToAll(COLOR_NOTICE, message); // Notify all players
- DiscordEcho(message, ECHO_CHANNEL); // Notify discord public echo
-
- new client_connect_username[MAX_PLAYER_NAME + 1], admin_message[38 + 4 + MAX_PLAYER_NAME + MAX_PLAYER_NAME + 1];
- GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid); // Get client connect name
- if(GetPlayerState(playerid) == PLAYER_STATE_NONE){ // Not spawned: character creation (Creating a character without registering)
- // Notify admins
-
- format(admin_message, sizeof(admin_message), "* [%i] %s temporary charcter, created by: %s", playerid, getCharacterName(playerid), client_connect_username);
- sendToAdmins(COLOR_NOTICE, admin_message);
- // Do nothing let continue to spawn, after spawn character will be saved to database.
- }
- else{ // Spawnedplayer: Creating permanent or renaming an existing permanent character
- // Notify admins
- format(admin_message, sizeof(admin_message), "* [%i] %s created by: %s", playerid, getCharacterName(playerid), client_connect_username);
- sendToAdmins(COLOR_NOTICE, admin_message);
-
- // Send to skin selection
- ForceClassSelection(playerid);
- TogglePlayerSpectating(playerid, true);
- TogglePlayerSpectating(playerid, false);
- }
-
- // Change name (No way yet to change name ingame)
- /*if(GetGVarInt("userlevel", playerid) > 1){ // Registered player.
- // Get username
- new username[MAX_PLAYER_NAME + 1], message[75 + MAX_PLAYER_NAME + 1];
- GetGVarString("username", username, sizeof(username), playerid);
- // Update or create character name in database
- new callback[1];
- new Result:result;
- new query[51 + MAX_PLAYER_NAME + MAX_PLAYER_NAME + 1];
- format(query, sizeof(query), "UPDATE \"user\"(name) VALUES('%s') WHERE username == '%s'", name, username);
- sql_wait(sqlHandle); // Wait for other queries to finish
- result = sql_query(sqlHandle, query, callback = "", "r");
-
- // Inform user
- format(message, sizeof(message), "SERVER: Your username remains unchanged, next time connect as: %s", client_connect_username);
- SendClientMessage(playerid, COLOR_WHITE, message);
- }*/
- SetPlayerName(playerid, name); // Change name in-game
- }
- }
-
- return 0;
- }
- forward register(playerid);
- public register(playerid){ // Register player in database
- if(GetPlayerState(playerid) == PLAYER_STATE_NONE){ // Not spawned
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "ERROR: You need to have spawned to register.");
- }
- else{ // Spawned player
- if(GetGVarInt("userlevel", playerid) != UNREGISTERED_PLAYER){ // Registered player.
- new message[35 + MAX_PLAYER_NAME + 1];
- format(message, sizeof(message), "ERROR: You are already registered"); //, %s.",
- SendClientMessage(playerid, COLOR_WHITE, message);
- }
- else{ // Unregistered player.
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Password", "Please pick a strong and safe password, that you are able to remember.", "Continue", "Cancel"); // Password prompt
- }
- }
- }
- forward createCharacterRecord(playerid, id);
- public createCharacterRecord(playerid, id){
- new character_query[94 + MAX_SQL_INTEGER + MAX_PLAYER_NAME + 3 + 1];
- format(character_query, sizeof(character_query), "INSERT INTO character(user_id, name, skin_id) VALUES(%i, '%s', %i)", id, getPlayerName(playerid), GetPlayerSkin(playerid));
- sql_query(sqlHandle, character_query);
- }
- forward authenticate(playerid);
- public authenticate(playerid){
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Sign in", "Enter your password to log on", "Log in", "Cancel"); // Show password confirmation dialog
- }
- forward characterSelection(playerid);
- public characterSelection(playerid){
- if(GetGVarInt("userlevel", playerid) < REGISTERED_PLAYER){ // Unregistered player (Or worse?)
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: Register first with: /my account register");
- }
- else{ // Registered player
- // If spawned, save current character
- if(GetPlayerState(playerid) != PLAYER_STATE_NONE){
- savePlayerState(playerid);
- }
- new id = getUserID(playerid);
- new character_query[75 + MAX_SQL_INTEGER + MAX_CHARACTERS_PER_USER_DIGITS + 1];
- format(character_query, sizeof(character_query), "SELECT id, name FROM character WHERE user_id = %i LIMIT %i", id, MAX_CHARACTERS_PER_USER);
- new Result:character_result = sql_query(sqlHandle, character_query);
- new character_string[(MAX_PLAYER_NAME * MAX_CHARACTERS_PER_USER) + 1], character_array[MAX_CHARACTERS_PER_USER + 1];
- for(new i = 0; i < sql_num_rows(character_result); i++){
- new name[MAX_PLAYER_NAME + 1];
- sql_get_field_assoc_ex(character_result, i, "name", name, sizeof(name));
- format(character_string, sizeof(character_string), "%s%s\n", character_string, name);
- character_array[i] = sql_get_field_assoc_int_ex(character_result, i, "id");
- printf("Character ID from array: %i", character_array[i]);
- }
- new character_array_string[MAX_CHARACTERS_PER_USER * MAX_SQL_INTEGER + 1];
- strfrombin(character_array_string, character_array); // Convert array to string for use with GVar
- SetGVarString("character_array_string", character_array_string, playerid);
- ShowPlayerDialog(playerid, DIALOG_CHARACTERS, DIALOG_STYLE_LIST, "Characters", character_string, "Spawn", "New");
- }
- }
- forward savePlayerState(playerid);
- public savePlayerState(playerid){
- new escaped_playername[MAX_PLAYER_NAME + 1], character_query[156 + MAX_SQL_INTEGER + (MAX_SQL_FLOAT * 3) + MAX_SQL_INTEGER + (MAX_SQL_FLOAT * 4) + (MAX_SQL_INTEGER * 2) + 1]; // Should be longer to allow for escaped characters
- sql_escape_string(sqlHandle, getPlayerName(playerid), escaped_playername, sizeof(escaped_playername)); // Escape player name
- new Float:health, Float:armour, Float:x, Float:y, Float:z, Float:angle;
- // Unrealiable TODO change to gvars
- GetPlayerHealth(playerid, health);
- GetPlayerArmour(playerid, armour);
- new world_id, interior_id;
- getPlayerLocation(playerid, x, y, z, angle, world_id, interior_id);
- format(character_query, sizeof(character_query), "UPDATE character SET (cash, health, armour, jailed, pos_x, pos_y, pos_z, rotation, world_id, interior_id) = (%i, '%f', '%f', %i, '%f', '%f', '%f', '%f', %i, %i) WHERE name = '%s'", GetPlayerMoney(playerid), health, armour, 0, x, y, z, angle, world_id, interior_id, escaped_playername);
- sql_query(sqlHandle, character_query);
- }
- forward kickPlayerDelay(playerid);
- public kickPlayerDelay(playerid){
- Kick(playerid);
- }
- forward kickPlayer(playerid, kickerid, const reason[], banned);
- public kickPlayer(playerid, kickerid, const reason[], banned){ // Kick a player
- // Issuer of kick
- new kickername[MAX_PLAYER_NAME + 1], kicker_id[MAX_SQL_INTEGER + 1];
- if(kickerid == -1){ // Not kicked by in-game player
- kickername = "SERVER";
- kicker_id = "NULL";
- }
- else{ // Kicked by in-game player
- kickername = getPlayerName(playerid);
- kicker_id = "%s", getUserID(kickerid);
- }
- strreplace(kickername, "_", " ");
- // Action
- new action[16 + MAX_SQL_INTEGER + 1];
- if(banned){
- if(banned < 1){ // Permanent ban
- action = "banned permanently";
- }
- else{ // Temporary ban
- format(action, sizeof(action), "banned for %i days", banned);
- }
- }
- else{
- action = "kicked";
- }
- // Notify all players
- new playername[MAX_PLAYER_NAME + 1], message[16 + 4 + MAX_PLAYER_NAME + MAX_PLAYER_NAME + 16 + MAX_SQL_REASON + 1], admin_message[23 + 4 + MAX_PLAYER_NAME + 16 + MAX_PLAYER_NAME + MAX_SQL_REASON + 1]; // Max samp chat message length 128 - 8 for "/kick ? ".
- GetPlayerName(playerid, playername, sizeof(playername));
- format(message, sizeof(message), "* [%i] %s %s, reason: %s", playerid, getCharacterName(playerid), action, reason);
- format(admin_message, sizeof(admin_message), "* [%i] %s kicked %s, reason: %s", kickerid, kickername, getCharacterName(playerid), action, reason);
- logger(LOGLEVEL_INFO, message); // Log event
- SendClientMessageToAll(COLOR_NOTICE, message);
- DiscordEcho(message, ECHO_CHANNEL);
- sendToAdmins(COLOR_NOTICE, admin_message);
- // Inform player (Redundant, but some people are blind or stupid)
- new player_message[30 + 6 + MAX_PLAYER_NAME + MAX_SQL_REASON + 1]; // Max samp chat message length 128 - 8 for "/kick ? ".
- format(player_message, sizeof(player_message), "SERVER: You have been %s, reason: %s", action, reason);
- SendClientMessage(playerid, COLOR_ERROR, player_message); // Notify player
- if(banned){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "You may appeal this ban via the forum or Discord.");
- }
- new ip_id = getIPID(playerid);
- // Crearte IP kick record
- new ip_query[61 + 4 + MAX_SQL_REASON + 4 + 1];
- format(ip_query, sizeof(ip_query), "INSERT INTO ip_kick(ip_id, reason, kicker_id) VALUES(%i, '%s', %s)", ip_id, reason, kicker_id);
- sql_query(sqlHandle, ip_query);
- // Get IP kick record
- new ip_id_query[64 + 4 + MAX_SQL_REASON + 4 + 1];
- format(ip_id_query, sizeof(ip_id_query), "SELECT id FROM ip_kick WHERE ip_id = %i ORDER BY id DESC LIMIT 1", ip_id);
- new Result:ip_id_result = sql_query(sqlHandle, ip_id_query);
- new ip_kick_id = sql_get_field_assoc_int(Result:ip_id_result, "id");
- // User kick record
- printf("Userlevel: %i", GetGVarInt("userlevel", playerid));
- if(GetGVarInt("userlevel", playerid) > UNREGISTERED_PLAYER){ // Not logged in to a user account
- new user_query[79 + 4 + MAX_SQL_REASON + 4 + 1];
- format(user_query, sizeof(user_query), "INSERT INTO user_kick(user_id, reason, kicker_id, ip_kick_id) VALUES(%i, '%s', %s, %i)", getUserID(playerid), reason, kicker_id, ip_kick_id);
- sql_query(sqlHandle, user_query);
- }
- SetTimerEx("kickPlayerDelay", 50, false, "i", playerid); // Give the message 50 milliseconds to reach the player before kicking.
- }
- banExpiration(days);
- banExpiration(days){
- if(days < 1){ // Permanent ban
- new foo[MAX_SQL_TIMESTAMP + 1] = "0";
- return foo;
- }
- else{ // Temporary ban
- new year, month, day, hour, minute, second, expires[MAX_SQL_TIMESTAMP + 1];
- getdate(year, month, day);
- gettime(hour, minute, second);
- day = day + days;
- format(expires, sizeof(expires), "%i-%i-%i %i:%i:%i", year, month, day, hour, minute, second);
-
- return expires;
- //return year, month, day, hour, minute, second;
- //return 0;
- }
- }
- forward banPlayer(playerid, bannerid, const reason[], days);
- public banPlayer(playerid, bannerid, const reason[], days){ // Ban & kick a player
- new ip_id = getIPID(playerid);
- // Create IP ban record
- new banner_id, ip_query[72 + MAX_SQL_INTEGER + MAX_SQL_TIMESTAMP + MAX_SQL_REASON + MAX_SQL_INTEGER + 1];
- if(bannerid < 0){ // Not banned by in-game player
- format(ip_query, sizeof(ip_query), "INSERT INTO ip_ban(ip_id, expires, reason) VALUES(%i, '%s', '%s')", ip_id, banExpiration(days), reason);
- }
- else{ // Banned by in-game player
- banner_id = getUserID(bannerid);
- format(ip_query, sizeof(ip_query), "INSERT INTO ip_ban(ip_id, expires, reason, banner_id) VALUES(%i, '%s', '%s', %i)", ip_id, banExpiration(days), reason, banner_id);
- }
- sql_query(sqlHandle, ip_query);
- // Get IP ban record ID
- new ban_id_query[61 + MAX_PLAYER_NAME + 1];
- format(ban_id_query, sizeof(ban_id_query), "SELECT id FROM ip_ban WHERE ip_id = %i ORDER BY id DESC LIMIT 1", ip_id);
- new Result:ban_id_result = sql_query(sqlHandle, ban_id_query);
- new ip_ban_id = sql_get_field_assoc_int(ban_id_result, "id");
- // User ban record (As banned players get only kicked, noneed to check for active ban)
- if(GetGVarInt("userlevel", playerid) > 1){ // Registered player
- new user_query[97 + MAX_SQL_INTEGER + MAX_SQL_TIMESTAMP + MAX_SQL_REASON + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
- format(user_query, sizeof(user_query), "INSERT INTO user_ban(user_id, expires, reason, banner_id, ip_ban_id) VALUES(%i, %s, %s, %i, %i) WHERE id = %i", ip_id, banExpiration(days), reason, banner_id, ip_ban_id);
- sql_query(sqlHandle, user_query);
- }
- // Kick player
- kickPlayer(playerid, bannerid, reason, days);
- }
- // Database functions
- forward getIPID(playerid);
- public getIPID(playerid){
- new player_ip[MAX_SQL_IP + 1], query[37 + MAX_SQL_IP + 1]; // Create varaibles
- GetPlayerIp(playerid, player_ip, sizeof(player_ip)); // Polulate player_ip variable
- format(query, sizeof(query), "SELECT id FROM ip WHERE address = '%s'", player_ip); // Format query string
- new Result:result = sql_query(sqlHandle, query); // Execute query
-
- return sql_get_field_assoc_int(result, "id"); // Get id from result
- }
- forward getUserID(playerid);
- public getUserID(playerid){
- // SQL escape username
- new client_connect_username[MAX_PLAYER_NAME + 1], escaped_username[MAX_PLAYER_NAME + 1]; // TODO escaped_username should be longer to account for escape characters (Also increate database column size!)
- GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid); // Get client connect name
- sql_escape_string(sqlHandle, client_connect_username, escaped_username, sizeof(escaped_username)); // Escape player name
- // Get user ID
- new userid_query[47 + MAX_PLAYER_NAME + 1];
- format(userid_query, sizeof(userid_query), "SELECT id FROM \"user\" WHERE name = '%s'", escaped_username);
- new Result:result = sql_query(sqlHandle, userid_query);
- return sql_get_field_assoc_int(result, "id");
- }
- // Player functions
- forward deleteAllGVars(playerid);
- public deleteAllGVars(playerid){ // Delete GVars as per https://forum.sa-mp.com/showthread.php?t=151076
- DeleteGVar("client_connect_username", playerid); // From OnPlayerConnect()
- DeleteGVar("userlevel", playerid); // From OnPlayerConnect()
- DeleteGVar("hash", playerid); // From DIALOG_REGISTER
- DeleteGVar("character_array_string", playerid); // From OnDialogResponse()
- DeleteGVar("authentication_count", playerid); // From DIALOG_LOGIN
- DeleteGVar("character_id", playerid); // From DIALOG_CHARACTERS
- DeleteGVar("chatmode", playerid); // From cmd:my()
- DeleteGVar("disable_pickups", playerid); // From OnPlayerPickUpDynamicPickup()
- DeleteGVar("goto_target", playerid); // From cmd:my() & cmd:p()
- DeleteGVar("job", playerid); // From OnDialogResponse()
- }
- //getPlayerName(playerid);
- getPlayerName(playerid){
- // new playername[MAX_PLAYER_NAME + 1];
- new const playername[MAX_PLAYER_NAME + 1];
- GetPlayerName(playerid, playername, sizeof(playername));
- // new output[MAX_PLAYER_NAME + 1];
- // strfromliteral(output, playername);
-
- return playername;
- }
- forward gotoCallback(Float:x, Float:y, Float:z, world, interior, Float:angle, const name[], playerid = -1);
- stock gotoCallback(Float:x, Float:y, Float:z, world, interior, Float:angle, const name[], playerid = -1){
- if(playerid== -1){
- playerid = GetGVarInt("goto_target", playerid);
- DeleteGVar("goto_target", playerid);
- }
- teleportPlayer(playerid, x, y, z, angle, world, interior);
-
- // Inform admins
- new admin_message[21 + 4 + MAX_PLAYER_NAME + 5 + 4 + MAX_PLAYER_NAME + 1 + 1]; // 5 + 4 + MAX_PLAYER_NAME + 1 = name
- format(admin_message, sizeof(admin_message), "* [%i] %s teleported to: %s", playerid, getCharacterName(playerid), name);
- sendToAdmins(COLOR_NOTICE, admin_message);
- }
- forward setPlayerSkin(playerid, skinid);
- public setPlayerSkin(playerid, skinid){
- print("Called setPlayerSkin()");
- new
- Float:tmpPos[4],
- vehicleid = GetPlayerVehicleID(playerid),
- seatid = GetPlayerVehicleSeat(playerid);
- GetPlayerPos(playerid, tmpPos[0], tmpPos[1], tmpPos[2]);
- GetPlayerFacingAngle(playerid, tmpPos[3]);
- if(skinid < 0 || skinid > 299) return 0;
- if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK)
- {
- SetPlayerPos(playerid, tmpPos[0], tmpPos[1], tmpPos[2]);
- SetPlayerFacingAngle(playerid, tmpPos[3]);
- TogglePlayerControllable(playerid, 1); // preventing any freeze - optional
- return SetPlayerSkin(playerid, skinid);
- }
- else if(IsPlayerInAnyVehicle(playerid))
- {
- new
- tmp;
- RemovePlayerFromVehicle(playerid);
- SetPlayerPos(playerid, tmpPos[0], tmpPos[1], tmpPos[2]);
- SetPlayerFacingAngle(playerid, tmpPos[3]);
- TogglePlayerControllable(playerid, 1); // preventing any freeze - important - because of doing animations of exiting vehicle
- tmp = SetPlayerSkin(playerid, skinid);
- PutPlayerInVehicle(playerid, vehicleid, (seatid == 128) ? 0 : seatid);
- return tmp;
- }
- else
- {
- return SetPlayerSkin(playerid, skinid);
- }
- }
- forward getPlayerLocation(playerid, &Float:x, &Float:y, &Float:z, &Float:angle, &world, &interior);
- public getPlayerLocation(playerid, &Float:x, &Float:y, &Float:z, &Float:angle, &world, &interior){
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, angle);
- world = GetPlayerVirtualWorld(playerid);
- interior = GetPlayerInterior(playerid);
- printf("Angle: %f", angle);
- }
- forward teleportPlayer(playerid, Float:x, Float:y, Float:z, Float:angle, world, interior);
- public teleportPlayer(playerid, Float:x, Float:y, Float:z, Float:angle, world, interior){
- SetPlayerPos(playerid, x, y, z);
- SetPlayerVirtualWorld(playerid, world);
- SetPlayerInterior(playerid, interior);
- SetPlayerFacingAngle(playerid, angle);
- }
- //forward setPlayerJob(playerid, job, skin_id = 0, color = COLOR_WHITE);
- stock setPlayerJob(playerid, job, skin_id = 0, color = COLOR_WHITE){
- switch(job){
- case JOB_NONE:{
- // Get skin from character record
- new character_query[42 + MAX_SQL_INTEGER + 1];
- format(character_query, sizeof(character_query), "SELECT skin_id FROM character WHERE id = %i", GetGVarInt("character_id", playerid));
- new Result:id_result = sql_query(sqlHandle, character_query);
- skin_id = sql_get_field_assoc_int(id_result, "skin_id");
-
- color = COLOR_WHITE;
- ResetPlayerWeapons(playerid);
- // TODO: get weaponskill fromddatabase and set it to player.
- // TODO: Set player weapons from database
- }
- case JOB_POLICE:{
- SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
- GivePlayerWeapon(playerid, 3, 1); // Baton
- GivePlayerWeapon(playerid, 17, 10); // Teargas
- GivePlayerWeapon(playerid, 22, 170); // 10 clips and a 9mm
- }
- // case JOB_MEDIC:
- case JOB_FIRE:{
- GivePlayerWeapon(playerid, 42, 1); // Fire extinguisher
- }
- case JOB_SHERIFF:{
- SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
- GivePlayerWeapon(playerid, 3, 1); // Baton
- GivePlayerWeapon(playerid, 17, 10); // Teargas
- GivePlayerWeapon(playerid, 22, 170); // 10 clips and a 9mm
- }
- case JOB_FBI:{
- GivePlayerWeapon(playerid, 42, 1); // Fire extinguisher
- }
- case JOB_DMV:{
- GivePlayerWeapon(playerid, 17, 10); // Teargas
- }
- case JOB_NEWS:{
- GivePlayerWeapon(playerid, 43, 1); // Camera
- }
- }
- printf("setPlayerSkin(%i, %i);", playerid, skin_id);
- setPlayerSkin(playerid, skin_id);
- SetGVarInt("job", job, playerid);
- SetPlayerColor(playerid, color);
- }
- // Chat functions
- //forward getCharacterName(playerid);
- stock getCharacterName(playerid){ // Convert name from player name
- new playername[MAX_PLAYER_NAME + 1];
- GetPlayerName(playerid, playername, sizeof(playername));
- strreplace(playername, "_", " ");
- return playername;
- }
- forward sendToChat(playerid, target, text[128 + 1], receiver_id, DCC_User:author);
- public sendToChat(playerid, target, text[128 + 1], receiver_id, DCC_User:author){
- strtrim(text); // Trim edge whitespaces
- if(isempty(text)){
- return 0; // Fail if text is empty
- }
- new playername[MAX_PLAYER_NAME + 1];
- if(playerid < 0){
- DCC_GetUserName(author, playername, sizeof(playername));
- } // Discord messagge
- else{playername = getCharacterName(playerid);}
-
- new chat_format, chat_color, chat_range, chat_userlevel, chat_character[1 + 1], chat_name[13 + 1], discord_channel;
- switch(target){
- case CHAT_WHISPER:{
- chat_format = 2;
- chat_range = 3;
- chat_name = "whispers";
- chat_color = COLOR_COMMAND_OUTPUT;
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_LOW:{
- chat_format = 2;
- chat_range = 10;
- chat_name = "speaks softly";
- chat_color = COLOR_COMMAND_OUTPUT;
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_LOCAL:{
- chat_format = 1;
- chat_range = 20;
- chat_color = COLOR_COMMAND_OUTPUT;
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_SHOUT:{
- chat_format = 2;
- chat_range = 50;
- chat_name = "shouts";
- chat_color = COLOR_COMMAND_OUTPUT;
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_ACTION:{
- chat_format = 0;
- chat_range = 20;
- chat_color = COLOR_COMMAND_OUTPUT;
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_OC:{
- chat_format = 3;
- chat_range = 20;
- chat_character = "'";
- chat_name = "OOC";
- chat_color = COLOR_COMMAND_OUTPUT;
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_GLOBAL:{
- chat_format = 3;
- chat_character = "`";
- chat_name = "Global";
- chat_color = COLOR_COMMAND_OUTPUT;
- discord_channel = ECHO_CHANNEL;
- }
- case CHAT_GANG:{
- chat_format = 3;
- chat_character = "~";
- chat_name = "Gang";
- chat_color = COLOR_CREW_CHAT;
- // TODO: Output to gang Discord channel
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_GANG_OC:{
- chat_format = 3;
- chat_character = "#";
- chat_name = "Gang OC";
- chat_color = COLOR_CREW_CHAT;
- // TODO: Output to gang Discord channel
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_FACTION:{
- chat_format = 3;
- chat_character = "!";
- chat_name = "Faction";
- chat_color = COLOR_CREW_CHAT;
- // TODO: Output to faction Discord channel
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_FACTION_OC:{
- chat_format = 3;
- chat_character = "$";
- chat_name = "Faction OC";
- chat_color = COLOR_CREW_CHAT;
- // TODO: Output to faction Discord channel
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_CREW:{
- chat_format = 3;
- chat_character = "@";
- chat_name = "Crew";
- chat_color = COLOR_CREW_CHAT;
- chat_userlevel = MODERATOR_CREW;
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_ADMIN:{
- chat_format = 3;
- chat_character = "%";
- chat_name = "Admin";
- chat_color = COLOR_ADMIN_CHAT;
- chat_userlevel = ADMIN_CREW;
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_MANAGEMENT:{
- chat_format = 3;
- chat_character = "&";
- chat_name = "Management";
- chat_color = COLOR_ADMIN_CHAT;
- chat_userlevel = MANAGEMENT_CREW;
- discord_channel = MANAGEMENT_CHANNEL;
- }
- case CHAT_VIP:{
- chat_format = 3;
- chat_character = "^";
- chat_name = "VIP";
- chat_color = COLOR_VIP_CHAT;
- chat_userlevel = VIP_PLAYER;
- discord_channel = ADMIN_ECHO_CHANNEL;
- //TODO: Add VIP discord channel.
- }
- case CHAT_UNDERCOVER:{
- chat_format = -1;
- chat_character = "*";
- chat_color = COLOR_COMMAND_OUTPUT;
- chat_userlevel = ADMIN_CREW;
- discord_channel = ECHO_CHANNEL;
- }
- case CHAT_PM:{
- chat_format = 3;
- chat_character = ">";
- chat_name = "PM";
- chat_color = COLOR_PM_CHAT;
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_CALL:{
- chat_format = 3;
- chat_character = "+";
- chat_name = "Call";
- chat_color = COLOR_PM_CHAT;
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_SMS:{
- chat_format = 3;
- chat_character = "-";
- chat_name = "SMS";
- chat_color = COLOR_PM_CHAT;
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- case CHAT_RADIO:{
- chat_format = 3;
- chat_character = "=";
- chat_name = "Radio";
- chat_color = COLOR_PM_CHAT;
- discord_channel = ADMIN_ECHO_CHANNEL;
- }
- }
-
- // Format chat message
- new message[9 + sizeof(chat_character) + (6 * 8) + sizeof(chat_name) + 4 + MAX_PLAYER_NAME + 128 + 1];
- new discord_message[23 + sizeof(chat_character) + sizeof(chat_name) + sizeof(playerid) + MAX_PLAYER_NAME + 128 + 1];
- switch(chat_format){
- case -1:{
- format(message, sizeof(message), "%s %s", chat_character, text);
- format(discord_message, sizeof(discord_message), "```css\n%s %s\n```", chat_character, text);
- }
- case 0:{
- format(message, sizeof(message), EMBED_COLOR_GREY"[{%06x}%i"EMBED_COLOR_GREY"] {%06x}%s{%06x} %s", GetPlayerColor(playerid) >>> 8, playerid, GetPlayerColor(playerid) >>> 8, playername, chat_color >>> 8, text);
- format(discord_message, sizeof(discord_message), "```css\n[%i] %s %s\n```", playerid, playername, text);
- }
- case 1:{
- format(message, sizeof(message), EMBED_COLOR_GREY"[{%06x}%i"EMBED_COLOR_GREY"] {%06x}%s"EMBED_COLOR_GREY":{%06x} %s", GetPlayerColor(playerid) >>> 8, playerid, GetPlayerColor(playerid) >>> 8, playername, chat_color >>> 8, text);
- format(discord_message, sizeof(discord_message), "```css\n[%i] %s: %s\n```", playerid, playername, text);
- }
- case 2:{
- format(message, sizeof(message), EMBED_COLOR_GREY"[{%06x}%i"EMBED_COLOR_GREY"] {%06x}%s %s"EMBED_COLOR_GREY":{%06x} %s", GetPlayerColor(playerid) >>> 8, playerid, GetPlayerColor(playerid) >>> 8, playername, chat_name, chat_color >>> 8, text);
- format(discord_message, sizeof(discord_message), "```css\n[%i] %s %s: %s\n```", playerid, playername, chat_name, text);
- }
- case 3:{
- format(message, sizeof(message), "%s "EMBED_COLOR_GREY"({%06x}%s"EMBED_COLOR_GREY") [{%06x}%i"EMBED_COLOR_GREY"] {%06x}%s"EMBED_COLOR_GREY":{%06x} %s", chat_character, chat_color >>> 8, chat_name, GetPlayerColor(playerid) >>> 8, playerid, GetPlayerColor(playerid) >>> 8, playername, chat_color >>> 8, text);
- format(discord_message, sizeof(discord_message), "```css\n%s (%s) [%i] %s: %s\n```", chat_character, chat_name, playerid, playername, text);
- }// Good discord tag options for color effects: yaml, css, moon, elixir, haxe, groovy, brainfuck, accesslog,inform7, c,
- }
-
- // Authorisation
- if(chat_userlevel && chat_userlevel > GetGVarInt("userlevel", playerid)){ // User not privilged to read chat
- if(target == CHAT_CREW){ // Show the user the message was sent to crew chat.
- SendClientMessage(playerid, chat_color, message);
- }
- else{
- SendClientMessage(playerid, COLOR_CREW_CHAT, "ERROR: You are not authorized to speak in this chat.");
- return 0; // Fail to send the message
- }
- }
-
- // Send TODO: Add checks for muted.
- if(chat_range){ // Ranged chats
- logger(LOGLEVEL_CHAT, message); // Log event
-
- // Show message to players in range
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- for(new recipient_id, a = GetMaxPlayers(); recipient_id < a; recipient_id++){
- if(IsPlayerConnected(receiver_id)){
- new Float:distance = GetPlayerDistanceFromPoint(recipient_id, x, y, z);
- if(distance <= chat_range){ // Player nearby
- sendClientMultiMessage(recipient_id, chat_color, message, Bool:false);
- }
- }
- }
- DiscordEcho(discord_message, discord_channel);
- }
- else{ // Global chats
- if(target == CHAT_GLOBAL){ // Public chat
- logger(LOGLEVEL_CHAT, message); // Log event
- sendClientMultiMessage(0, chat_color, message, Bool:true);
- DiscordEcho(discord_message, discord_channel);
- }
- else if(target == CHAT_GANG || target == CHAT_GANG_OC || target == CHAT_FACTION || target == CHAT_FACTION_OC || target == CHAT_CALL || target == CHAT_SMS || target == CHAT_RADIO ){ // Entity chat
- // TODO
- // TODO sendToAdmins();
- // TODO send to specific discord channel
- SendClientMessage(playerid, chat_color, "You are not a member of the required entity.");
- }
- else if(target == CHAT_PM){
- new output[sizeof(message)];
- strdel(message, 0, 1);
- format(output, sizeof(output), "<%s", message);
- sendClientMultiMessage(receiver_id, chat_color, output, Bool:false);
-
- new receipt[12 + 1 + sizeof(chat_name) + 4 + MAX_PLAYER_NAME + 128 + 1];
- format(receipt, sizeof(receipt), "%s (%s) to [%i] %s: %s", chat_character, chat_name, receiver_id, playername, text);
- sendClientMultiMessage(playerid, chat_color, receipt, Bool:false);
- new admin_message[15 + 1 + sizeof(chat_name) + 4 + MAX_PLAYER_NAME + 4 + 128 + 1];
- format(admin_message, sizeof(admin_message), "%s (%s) [%i] %s to [%i]: %s", chat_character, chat_name, playerid, playername, receiver_id, text);
- logger(LOGLEVEL_CHAT, admin_message); // Log event
-
- sendToAdmins(chat_color, admin_message);
- }
-
- else{ // Chat with privileged users
- for(new recipient_id, a = GetMaxPlayers(); recipient_id < a; recipient_id++){
- if(IsPlayerConnected(recipient_id)){
- if(GetGVarInt("userlevel", recipient_id) >= chat_userlevel){ // Privileged
- logger(LOGLEVEL_CHAT, message); // Log event
- sendClientMultiMessage(recipient_id, chat_color, message, Bool:false);
- DiscordEcho(discord_message, discord_channel);
- }
- }
- }
- }
- }
- return 1;
- }
- forward sendToAdmins(chat_color, const message[]);
- public sendToAdmins(chat_color, const message[]){
- for(new recipient_id, a = GetMaxPlayers(); recipient_id < a; recipient_id++){
- if(IsPlayerConnected(recipient_id)){
- if(GetGVarInt("userlevel", recipient_id) >= ADMIN_CREW){ // Privileged
- SendClientMessage(recipient_id, chat_color, message);
- }
- }
- }
- DiscordEcho(message, ADMIN_ECHO_CHANNEL);
- }
- forward sendPM(playerid, text[128 + 1], recipient_id);
- public sendPM(playerid, text[128 + 1], recipient_id){
- if (recipient_id == INVALID_PLAYER_ID){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "ERROR: Player not found.");
- }
- else{
- sendToChat(playerid, CHAT_PM, text, recipient_id, DCC_INVALID_USER);
- }
- }
- forward sendClientMultiMessage(recipient_id, chat_color, const message[], Bool:toall);
- public sendClientMultiMessage(recipient_id, chat_color, const message[], Bool:toall){
- if(strlen(message) > 144){ // SAMP does not send messages longer than 144 characters
- new part_1[144 + 1], part_2[144 + 1];
- strmid(part_1, message, 0, 143); // TODO see if this can be moved 1 bit
- strmid(part_2, message, 143, 286);
- if(toall){
- SendClientMessageToAll(chat_color, part_1);
- SendClientMessageToAll(chat_color, part_2);
- }
- else{
- SendClientMessage(recipient_id, chat_color, part_1);
- SendClientMessage(recipient_id, chat_color, part_2);
- }
- }
- else{
- if(toall){SendClientMessageToAll(chat_color, message);}
- else{SendClientMessage(recipient_id, chat_color, message);}
- }
- }
- // Pickup functions
- forward createDynamicPickup(object, Float:x, Float:y, Float:z, world, interior, pickup_type);
- public createDynamicPickup(object, Float:x, Float:y, Float:z, world, interior, pickup_type){
- // Object position corrections
- if(object == 19902){
- z = z - 0.5;
- }
- else if(object == 19607){
- z = z - 0.5;
- }
-
- // Pickup types
- new type;
- switch(pickup_type){
- case 99999: type = 2;
- default: type = 1;
- }
- new pickupid = CreateDynamicPickup(object, type, x, y, z, world, interior);
- SetGVarInt("pickup_type", pickup_type, pickupid);
- printf("new pickupid = CreateDynamicPickup(%i, %i, %f, %f, %f, %i, %i);", pickupid, object, type, x, y, z, world, interior);
- return pickupid;
- }
- forward spawnPortal(id, object, Float:pos_x, Float:pos_y, Float:pos_z, world, interior, exit_object, Float:exit_pos_x, Float:exit_pos_y, Float:exit_pos_z, exit_world, exit_interior);
- public spawnPortal(id, object, Float:pos_x, Float:pos_y, Float:pos_z, world, interior, exit_object, Float:exit_pos_x, Float:exit_pos_y, Float:exit_pos_z, exit_world, exit_interior){
- new pickup_id = createDynamicPickup(object, pos_x, pos_y, pos_z, world, interior, PICKUP_PORTAL);
- SetGVarFloat("pickup_x", exit_pos_x, pickup_id);
- SetGVarFloat("pickup_y", exit_pos_y, pickup_id);
- SetGVarFloat("pickup_z", exit_pos_z, pickup_id);
- SetGVarInt("pickup_world", exit_world, pickup_id);
- SetGVarInt("pickup_interior", exit_interior, pickup_id);
- new exit_pickup_id = createDynamicPickup(exit_object, exit_pos_x, exit_pos_y, exit_pos_z, exit_world, exit_interior, PICKUP_PORTAL);
- SetGVarFloat("pickup_x", pos_x, exit_pickup_id);
- SetGVarFloat("pickup_y", pos_y, exit_pickup_id);
- SetGVarFloat("pickup_z", pos_z, exit_pickup_id);
- SetGVarInt("pickup_world", world, exit_pickup_id);
- SetGVarInt("pickup_interior", interior, exit_pickup_id);
- new portal_query[64 + MAX_SQL_INTEGER + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
- format(portal_query, sizeof(portal_query), "UPDATE portal SET (pickup_id, exit_pickup_id) = (%i, %i) WHERE id = %i", pickup_id, exit_pickup_id, id);
- sql_query(sqlHandle, portal_query);
- }
- forward destroyPortal(id);
- public destroyPortal(id){
- DestroyDynamicPickup(id);
- DeleteGVar("pickup_type", id);
- DeleteGVar("pickup_x", id);
- DeleteGVar("pickup_y", id);
- DeleteGVar("pickup_z", id);
- DeleteGVar("pickup_world", id);
- DeleteGVar("pickup_interior", id);
- }
- // Vehicle functions
- getVehicleModelFromName(name[])
- {
- for(new i = 0; i < 211; i++)
- {
- if(strfind(vehicleNameArray[i], name, true) != -1)
- return i + 400;
- }
- return -1;
- }
- stock editVehicle(playerid, target, option, color1 = -1, color2 = -1, respawn = -1){
- new vehicleid = GetPlayerVehicleID(target);
- if(vehicleid == 0){
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Target player does not occupy a vehicle.");
- }
-
- // Get vehicle record
- new vehicle_query[54 + sizeof(vehicleid) + 1], admin_message[23 + (4 * 2) + (MAX_PLAYER_NAME * 2) + 1];
- format(vehicle_query, sizeof(vehicle_query), "SELECT id, addsiren FROM vehicle WHERE vehicle_id = %i", vehicleid);
- new Result:vehicle_result = sql_query(sqlHandle, vehicle_query), record_id;
- if(sql_num_rows(vehicle_result) > 0){ // Record exists
- record_id = sql_get_field_assoc_int(vehicle_result, "id");
- }
-
- new save_query[88 + (MAX_SQL_INTEGER *2) + (MAX_SQL_FLOAT * 4) + 1];
- switch(option){
- case EDITVEHICLE_PARK:{
- new Float:x, Float:y, Float:z, Float:angle;
- GetVehiclePos(vehicleid, x, y, z);
- GetVehicleZAngle(vehicleid, angle);
-
- if(sql_num_rows(vehicle_result) < 1){ // New vehicle
- format(save_query, sizeof(save_query), "INSERT INTO vehicle(model_id, pos_x, pos_y, pos_z, angle, vehicle_id) VALUES(%i, %f, %f, %f, %f, %i)", GetVehicleModel(vehicleid), x, y, z, angle, vehicleid);
- format(admin_message, sizeof(admin_message), "* [%i] %s has saved a vehicle for [%i] %s", playerid, getPlayerName(playerid), target, getPlayerName(target));
- }
- else{ // Existing vehicle
- format(save_query, sizeof(save_query), "UPDATE vehicle(pos_x, pos_y, pos_z, angle) VALUES(%f, %f, %f, %f) WHERE id = %i", x, y, z, angle, record_id);
- format(admin_message, sizeof(admin_message), "* [%i] %s has parked vehicle %i, for [%i] %s", record_id, getPlayerName(playerid), record_id, target, getPlayerName(target));
- }
- sql_query(sqlHandle, save_query);
- sendToAdmins(COLOR_NOTICE, admin_message);
- }
- case EDITVEHICLE_COLOR:{
- if(sql_num_rows(vehicle_result) < 1){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "To be able to permanently save colours, the vehicle needs to be parked first.");
- }
- else{
- format(save_query, sizeof(save_query), "UPDATE vehicle(color1, color2) VALUES(%i, %i) WHERE id = %i", color1, color2, record_id);
- format(admin_message, sizeof(admin_message), "* [%i] %s has updated the colours of vehicle %i, for [%i] %s", playerid, getPlayerName(playerid), record_id, target, getPlayerName(target));
- sql_query(sqlHandle, save_query);
- }
- ChangeVehicleColor(vehicleid, color1, color2);
- }
- case EDITVEHICLE_RESPAWN:{
- if(sql_num_rows(vehicle_result) < 1){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "To be able to save the respawn delay, the vehicle needs to be parked first.");
- }
- else{
- DestroyVehicle(vehicleid);
- format(save_query, sizeof(save_query), "UPDATE vehicle SET respawn_delay = %i WHERE id = %i", respawn, record_id);
- format(admin_message, sizeof(admin_message), "* [%i] %s has updated the respawn delay of vehicle %i, for [%i] %s", playerid, getPlayerName(playerid), record_id, target, getPlayerName(target));
- sql_query(sqlHandle, save_query);
- vehicleid = addvehicle(record_id);
- PutPlayerInVehicle(target, vehicleid, 0);
- }
-
- }
- case EDITVEHICLE_SIREN:{
- printf("num rows: %i", sql_num_rows(vehicle_result));
- if(sql_num_rows(vehicle_result) < 1){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "To be able to save the siren, the vehicle needs to be parked first.");
- }
- else{
- DestroyVehicle(vehicleid);
- new siren = sql_get_field_assoc_int(vehicle_result, "addsiren");
- if(siren){
- format(save_query, sizeof(save_query), "UPDATE vehicle(siren) VALUES(0) WHERE id = %i", record_id);
- format(admin_message, sizeof(admin_message), "* [%i] %s has removed the siren of vehicle %i, for [%i] %s", playerid, getPlayerName(playerid), record_id, target, getPlayerName(target));
- vehicleid = addvehicle(record_id);
- PutPlayerInVehicle(target, vehicleid, 0);
- }
- else{
- format(save_query, sizeof(save_query), "UPDATE vehicle(siren) VALUES(1) WHERE id = %i", record_id);
- format(admin_message, sizeof(admin_message), "* [%i] %s has added a siren to vehicle %i, for [%i] %s", playerid, getPlayerName(playerid), record_id, target, getPlayerName(target));
- sql_query(sqlHandle, save_query);
- vehicleid = addvehicle(record_id);
- PutPlayerInVehicle(target, vehicleid, 0);
- }
- }
- }
- }
-
- return 0;
- }
- addvehicle(vehicle_id){
- // Get vehicle record
- new vehicle_query[109 + (MAX_SQL_INTEGER * 6) + (MAX_SQL_FLOAT * 4) + 1];
- format(vehicle_query, sizeof(vehicle_query), "SELECT model_id, pos_x, pos_y, pos_z, angle, color1, color2, respawn_delay, addsiren FROM vehicle WHERE id = %i", vehicle_id);
- new Result:vehicle_result = sql_query(sqlHandle, vehicle_query);
- if(sql_num_rows(vehicle_result) > 0){ // Record exists
-
- new model_id = sql_get_field_assoc_int(vehicle_result, "model_id"); // Work around for next line will be deemed to long with this included.
- new vehicleid = AddStaticVehicleEx(model_id, sql_get_field_assoc_float(vehicle_result, "pos_x"), sql_get_field_assoc_float(vehicle_result, "pos_y"), sql_get_field_assoc_float(vehicle_result, "pos_z"), sql_get_field_assoc_float(vehicle_result, "angle"), sql_get_field_assoc_int(vehicle_result, "color1"), sql_get_field_assoc_int(vehicle_result, "color2"), sql_get_field_assoc_int(vehicle_result, "respawn_delay"), sql_get_field_assoc_int(vehicle_result, "addsiren"));
- printf("Added ingame vehicle: %i", vehicleid);
- new update_query[44 + (MAX_SQL_INTEGER * 2) + 1];
- format(update_query, sizeof(update_query), "UPDATE vehicle SET vehicle_id = %i WHERE id = %i", vehicleid, vehicle_id);
- sql_query(sqlHandle, update_query);
- return vehicleid;
- }
- return 0;
- }
-
- // Command functions
- public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags){
- if(result == -1){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: Unknown command.");
- return 0;
- }
- return 1;
- }
- public OnPlayerCommandReceived(playerid, cmd[], params[], flags){
- new userlevel = GetGVarInt("userlevel", playerid);
- if(flags){
- if(flags > userlevel){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: Access denied.");
- printf("player %d doesn�t have access to command '%s'", playerid, cmd); // TODO make a list of unique commands we dont have but people try to use
-
- return 0;
- }
- }
- return 1;
- }
- public PC_OnInit(){ // TODO
- return 1; // Remove this once stuff is in place.
- }
- flags:test(ADMIN_CREW);
- cmd:test(playerid, params[]){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Executed");
- return 1;
- }
- // Command commands
- cmd:help(playerid, params[]){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: Ask questions in the chat, on Discord or the forum.\nTo list all commands: /cmds");
- return 1;
- }
- alias:help("h");
- cmd:cmds(playerid, params[]){
- SendClientMessage(playerid, COLOR_NOTICE, "Command help syntax: \"/\" = start of cmd, \"()\" = group, \"|\" = or, \"<>\" = required parameter, \"[]\" = optional parameter, \",\" = next item.");
- SendClientMessage(playerid, COLOR_NOTICE, "Command help syntax example: /command <parameter> [optional_parameter], /next_command (option | option | option <parameter> <parameter>)");
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "General commands: (/help, /h), (/cmds, /cmd, /commands), (/my, /myself, /mine), (/v, /vehivle, /veh), (/p, /player)");
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Chat commands: (/me, /emote, /action) <msg>, (/w, /whisper) <msg>, (/low, /soft) <msg>, (/l, /local) <msg>, (/s, /shout, /scream) <msg>, (/o, ', /oc, /ooc) <msg>");
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Chat commands: (/g, `, /global, /public) <msg>, (/gc, ~) <msg>, (/fc, !) <msg>, (/vc, &) <msg>, (/cc, @) <msg>, /my chatmode <chat_name>");
- if(GetGVarInt("userlevel", playerid) >= ADMIN_CREW){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Admin commands: /property (pickup | portal)");
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Admin commands extend the options for commands like /my, /p & /v");
- }
- return 0;
- }
- alias:cmds("commands", "cmd");
- // User commands
- cmd:register(playerid, params[]){
- register(playerid);
- }
- cmd:my(playerid, params[]){
- // No option specified
- if(strlen(params) < 1){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /my <option> <value>");
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Options: account, chatmode");
- if(GetGVarInt("userlevel", playerid) >= ADMIN_CREW){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Admin options: goto");
- }
- return 0;
- }
-
- // Options
- if(!strcmp(params, "account", true, 7)){ // /my account
- strdel(params, 0, 8); // Remove first 8 characters, "account ", from the string.
- // Values
- if (isequal(params, "register", .ignorecase = true)){ // /my account register
- register(playerid); // Call public register function
- }
- else if (isequal(params, "characters", .ignorecase = true)){ // /my account characters
- characterSelection(playerid);
- }
- else if (isequal(params, "deletecharacter", .ignorecase = true)){ // /my account characters
- ShowPlayerDialog(playerid, DIALOG_DELETE_CHARACTER, DIALOG_STYLE_MSGBOX, "Charater deletion", "You are about to permanently delete this charater and all it's assets.\n This can NOT be undone.", "Destroy", "Abort");
- }
- else{ // Invalid value
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /my account ( register | characters | deletecharacter)");
- }
- }
- else if(!strcmp(params, "chatmode", true, 8)){ // /my chatmode
- strdel(params, 0, 9); // Remove first 9 characters, "account ", from the string.
- // Values
- if (isequal(params, "whisper", .ignorecase = true)){
- SetGVarInt("chatmode", CHAT_WHISPER, playerid);
- }
- else if (isequal(params, "low", .ignorecase = true)){
- SetGVarInt("chatmode", CHAT_LOW, playerid);
- }
- else if (isequal(params, "local", .ignorecase = true)){
- SetGVarInt("chatmode", CHAT_LOCAL, playerid);
- }
- else if (isequal(params, "shout", .ignorecase = true)){
- SetGVarInt("chatmode", CHAT_SHOUT, playerid);
- }
- else if (isequal(params, "oc", .ignorecase = true)){
- SetGVarInt("chatmode", CHAT_OC, playerid);
- }
- else if (isequal(params, "global", .ignorecase = true)){
- SetGVarInt("chatmode", CHAT_GLOBAL, playerid);
- }
- else if (isequal(params, "gang", .ignorecase = true)){
- SetGVarInt("chatmode", CHAT_GANG, playerid);
- }
- else if (isequal(params, "faction", .ignorecase = true)){
- SetGVarInt("chatmode", CHAT_FACTION, playerid);
- }
- else if (isequal(params, "vip", .ignorecase = true)){
- SetGVarInt("chatmode", CHAT_VIP, playerid);
- }
- else if (isequal(params, "crew", .ignorecase = true)){
- SetGVarInt("chatmode", CHAT_CREW, playerid);
- }
- else if (isequal(params, "admin", .ignorecase = true)){
- SetGVarInt("chatmode", CHAT_ADMIN, playerid);
- }
- else if (isequal(params, "management", .ignorecase = true)){
- SetGVarInt("chatmode", CHAT_MANAGEMENT, playerid);
- }
- else{ // Invalid value
- printf("else isequals register");
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /my chatmode <value>");
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Values: whisper low local shout oc global gang faction vip crew admin management");
- }
- }
- else if(!strcmp(params, "goto", true, 4) || !strcmp(params, "sendto", true, 6) || !strcmp(params, "teleport", true, 8)){
- if(GetGVarInt("userlevel", playerid) < ADMIN_CREW){
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: Access denied.");
- }
-
- SetGVarInt("goto_target", playerid, playerid);
- ShowPlayerDialog(playerid, DIALOG_GOTO, DIALOG_STYLE_LIST, "Categories", "Interiors\nPlayers", "Select", "Cancel");
- }
- else{ // Invalid option
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/my options: account chatmode");
- if(GetGVarInt("userlevel", playerid) >= ADMIN_CREW){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Admin options: goto");
- }
- }
- return 0;
- }
- alias:my("myself", "mine");
- // Chat commands
- cmd:w(playerid, params[128 + 1]){
- sendToChat(playerid, CHAT_WHISPER, params, 0, DCC_INVALID_USER);
-
- return 1;
- }
- alias:w("whisper");
- cmd:low(playerid, params[128 + 1]){
- sendToChat(playerid, CHAT_LOW, params, 0, DCC_INVALID_USER);
- return 1;
- }
- alias:low("soft");
- cmd:l(playerid, params[128 + 1]){
- sendToChat(playerid, CHAT_LOCAL, params, 0, DCC_INVALID_USER);
- return 1;
- }
- alias:l("local");
- cmd:me(playerid, params[128 + 1]){
- sendToChat(playerid, CHAT_ACTION, params, 0, DCC_INVALID_USER);
- return 1;
- }
- alias:me("emote", "action");
- cmd:s(playerid, params[128 + 1]){
- sendToChat(playerid, CHAT_SHOUT, params, 0, DCC_INVALID_USER);
- return 1;
- }
- alias:s("shout", "scream");
- cmd:o(playerid, params[128 + 1]){
- sendToChat(playerid, CHAT_OC, params, 0, DCC_INVALID_USER);
- return 1;
- }
- alias:o("oc", "ooc");
- cmd:g(playerid, params[128 + 1]){
- sendToChat(playerid, CHAT_GLOBAL, params, 0, DCC_INVALID_USER);
- return 1;
- }
- alias:g("global", "public");
- cmd:gc(playerid, params[128 + 1]){
- sendToChat(playerid, CHAT_GANG, params, 0, DCC_INVALID_USER);
- return 1;
- }
- cmd:fc(playerid, params[128 + 1]){
- sendToChat(playerid, CHAT_FACTION, params, 0, DCC_INVALID_USER);
- return 1;
- }
- cmd:vc(playerid, params[128 + 1]){
- sendToChat(playerid, CHAT_VIP, params, 0, DCC_INVALID_USER);
- return 1;
- }
- cmd:cc(playerid, params[128 + 1]){
- sendToChat(playerid, CHAT_CREW, params, 0, DCC_INVALID_USER);
- return 1;
- }
- cmd:pm(playerid, params[128 + 1]){
- new recipient_id, message[128 + 1];
- if (sscanf(params, "u s", recipient_id, message)){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /pm <playerid> <message>");
- }
- else{
- sendPM(playerid, message, recipient_id);
- }
- return 1;
- }
- alias:pm("msg", "dm");
- // Vehicle commands
- flags:v(ADMIN_CREW);
- cmd:v(playerid, params[]){
- //new vehicle_id;
- if(strlen(params) < 1){
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /v [playerID] <model> | park | respawn <seconds> | siren");
- }
- //new option[125 + 1];
-
- new target;
- if(!sscanf(params, "i s", target, params)){ // This should overwrite the params to excluse the player id, or cause problems.
- if(!IsPlayerConnected(target)){
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "That player is not ingame.");
- }
- }
- else{
- target = playerid;
- }
-
-
-
- if(!strcmp(params, "park", true, 4)){
- editVehicle(playerid, target, EDITVEHICLE_PARK);
- /*new vehicleid = GetPlayerVehicleID(target);
- if(vehicleid == 0){
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Player not in a vehicle.");
- }
- new Float:x, Float:y, Float:z, Float:angle;
- GetVehiclePos(vehicleid, x, y, z);
- GetVehicleZAngle(vehicleid, angle);
-
- // Get vehicle record
- new vehicle_query[75 + 1], admin_message[23 + 4 + MAX_PLAYER_NAME + 1];
- format(vehicle_query, sizeof(vehicle_query), "SELECT id FROM vehicle WHERE vehicle_id = %i", vehicleid);
- new Result:vehicle_result = sql_query(sqlHandle, vehicle_query);
-
- new save_query[75 + 1];
- if(sql_num_rows(vehicle_result) < 1){ // New vehicle
- format(save_query, sizeof(save_query), "INSERT INTO vehicle SET (model_id, pos_x, pos_y, pos_z, angle) = (%i, %f, %f, %f, %f)", GetVehicleModel(vehicleid), x, y, z, angle);
- format(admin_message, sizeof(admin_message), "[%i] %s has saved a vehicle.", playerid, getPlayerName(playerid));
- }
- else{ // Existing vehicle
- new id = sql_get_field_assoc_int(vehicle_result, "id");
- format(save_query, sizeof(save_query), "UPDATE vehicle(pos_x, pos_y, pos_z, angle) VALUES(%f, %f, %f, %f) WHERE id = %i", x, y, z, angle, id);
- format(admin_message, sizeof(admin_message), "[%i] %s has updated vehicle: %i", playerid, getPlayerName(playerid), id);
- }
- sql_query(sqlHandle, save_query);
- sendToAdmins(COLOR_NOTICE, admin_message);*/
- }
- else if(!strcmp(params, "respawn", true, 7)){
- strdel(params, 0, 8); // Remove first 8 characters from the string.
- new respawn;
- if(!sscanf(params, "i", respawn)){
- editVehicle(playerid, target, EDITVEHICLE_RESPAWN, -1, -1, respawn);
- }
- else{
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/v [ID] respawn usage: <seconds>");
- }
-
- }
- else if(!strcmp(params, "siren", true, 5)){
- editVehicle(playerid, target, EDITVEHICLE_SIREN);
- }
- else if(!sscanf(params, "s")){
- // Get model ID
- new modelid = getVehicleModelFromName(params);
- if(modelid == -1){
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Unkown parameter or model name.");
- }
- new Float:x, Float:y, Float:z, Float:angle, worldid, interiorid;
- getPlayerLocation(target, x, y, z, angle, worldid, interiorid);
- // To prevent crashses in certain situations.
- if(IsPlayerInAnyVehicle(target)){
- GetVehicleZAngle(GetPlayerVehicleID(target), angle);
- RemovePlayerFromVehicle(target);
- }
- new vehicleid = AddStaticVehicleEx(modelid, x, y, z, angle, -1, -1, -1);
- SetVehicleVirtualWorld(vehicleid, worldid);
- PutPlayerInVehicle(target, vehicleid, 0);
- new admin_message[33 + 4 + MAX_PLAYER_NAME + 1];
- format(admin_message, sizeof(admin_message), "[%i] %s has created a temporary vehicle.", playerid, getPlayerName(playerid));
- sendToAdmins(COLOR_NOTICE, admin_message);
- }
- else{
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /v (model_name_part | park | respawn <seconds>| siren");
- }
-
-
- return 1;
- }
- alias:v("vehicle", "veh");
- // Player commands
- cmd:p(playerid, params[]){
- // No parameters
- if(strlen(params) < 1){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /p <ID> option");
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/p options: admin, goto");
- }
- // Syntax
- new player_id, option[123 + 1];
- if(sscanf(params, "i s", player_id, option)){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /p <ID> <option>");
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/p options: admin, goto");
- }
-
- if(!strcmp(option, "admin", true, 5)){
- SetGVarInt("userlevel", ADMIN_CREW, player_id);
- // TODO take admin if already admin
- // TODO notify admins
- }
- else if(!strcmp(option, "goto", true, 4) && !strcmp(option, "sendto", true, 6 && !strcmp(option, "teleport", true, 8)) ){
- if(GetGVarInt("userlevel", playerid) < ADMIN_CREW){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: Access denied.");
-
- SetGVarInt("goto_target", player_id);
- }
- }
- else{
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/p <ID> options: admin, goto");
- }
-
- return 1;
- }
- alias:p("player");
- // Admin commands
- flags:property(ADMIN_CREW);
- cmd:property(playerid, params[]){
- // No option specified
- if(strlen(params) < 1){
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/property options: pickup, portal");
- }
- // Options
- if(!strcmp(params, "pickup", true, 6)){ // /property pickup
- strdel(params, 0, 7); // Remove first 7 characters, "pickup ", from the string.
-
- // No parameters
- if(strlen(params) < 1){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /property pickup <create | ID <goto | move | delete>>");
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/p options: admin, goto");
- }
-
- // Values
- new pickup_id, option[110 + 1];
- if(!strcmp(params, "create", true)){ // /property pickup create
- ShowPlayerDialog(playerid, DIALOG_CREATE_PICKUP, DIALOG_STYLE_LIST, "Pickup caterogy", "Faction", "Select", "Cancel");
- }
- else if (!sscanf(params, "i s", pickup_id, option)){
- new pickup_query[69 + MAX_SQL_INTEGER + 1];
- format(pickup_query, sizeof(pickup_query), "SELECT object_id, type_id, pickup_id, pos_x, pos_y, pos_z, world_id, pickup_id, angle FROM pickup WHERE id = %i", pickup_id);
- new Result:pickup_result = sql_query(sqlHandle, pickup_query);
- if(sql_num_rows(pickup_result) < 1){ // Invalid pickup ID
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Invalid pickup ID");
- }
-
- new pickupid = sql_get_field_assoc_int(pickup_result, "pickup_id");
- if(!strcmp(option, "move", true)){
- // Destroy old pickup
- DestroyDynamicPickup(pickupid);
-
- // Create new pickup
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- new interior = GetPlayerInterior(playerid);
- new world = GetPlayerVirtualWorld(playerid);
-
- new Float:angle;
- new object_id = sql_get_field_assoc_int(pickup_result, "object_id");
- new type_id = sql_get_field_assoc_int(pickup_result, "type_id");
- new new_pickupid = createDynamicPickup(object_id, x, y, z, world, interior, type_id);
- angle = GetPlayerFacingAngle(playerid, angle);
- // Update pickup record
- new update_query[118 + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_INTEGER + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
- format(update_query, sizeof(update_query), "UPDATE pickup SET pos_x = '%f', pos_y = '%f', pos_z = '%f', world_id = %i, interior_id = %i, pickup_id = %i, angle = %f WHERE id = %i", x, y, z, world, interior, new_pickupid, pickup_id, angle);
- sql_query(sqlHandle, update_query);
-
- // Inform admins
- new admin_message[39 + 4 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
- format(admin_message, sizeof(admin_message), "* [%i] %s modified the location of pickup: %i", playerid, getPlayerName(playerid), pickup_id);
- sendToAdmins(COLOR_NOTICE, admin_message);
- }
- else if(!strcmp(option, "delete", true)){
- // Destroy pickup
- DestroyDynamicPickup(pickupid);
-
- // Delete pickup record
- new update_query[95 + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_INTEGER + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
- format(update_query, sizeof(update_query), "DELETE FROM pickup WHERE id = %i", pickup_id);
- sql_query(sqlHandle, update_query);
- // Inform admins
- new admin_message[39 + 4 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
- format(admin_message, sizeof(admin_message), "* [%i] %s deleted pickup: %i", playerid, getPlayerName(playerid), pickup_id);
- sendToAdmins(COLOR_NOTICE, admin_message);
- }
- else if(!strcmp(option, "goto", true)){
- new name[7 + MAX_SQL_INTEGER];
- format(name, sizeof(name), "pickup %i", pickupid);
- gotoCallback(sql_get_field_assoc_float(pickup_result, "pos_x"), sql_get_field_assoc_float(pickup_result, "pos_y"), sql_get_field_assoc_float(pickup_result, "pos_z"), sql_get_field_assoc_int(pickup_result, "world_id"), sql_get_field_assoc_int(pickup_result, "interior_id"), sql_get_field_assoc_float(pickup_result, "angle"), name, playerid); // TODO check if this informs admins
- }
- else{ // Invalid option.
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/property pickup <ID> usage: goto, move, delete");
- }
- }
- else{ // Invalid value
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/property pickup usage: create, <ID> <goto | move | delete>");
- }
- }
- else if(!strcmp(params, "portal", true, 6)){ // /property portal
- strdel(params, 0, 7); // Remove first 7 characters, "portal ", from the string.
- // No parameters
- if(strlen(params) < 1){
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /property portal <create | ID <goto | exit | entrance | object | delete>>");
- }
-
- // Values
- new portal_id, option[116 + 1];
- if (!strcmp(params, "create", true, 6)){ // /property portal create
- strdel(params, 0, 7); // Remove first 7 characters, "create ", from the string.
- // Worlds
- new value[105 + 1], world_id;
- if (sscanf(params, "s", value)){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "For a portal that works in all worlds use: /property portal create all");
- }
- if(!strcmp(value, "all", true)){
- world_id = -1;
- }
- else{
- world_id = GetPlayerVirtualWorld(playerid);
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Invalid world option, creating default portal.");
- }
- new Float:x, Float:y, Float:z, Float:angle, world, interior;
- getPlayerLocation(playerid, x, y, z, angle, world, interior);
-
- new pickup_id = createDynamicPickup(19902, x, y, z, world_id, interior, PICKUP_PORTAL);
- // Create portal database record
- new portal_query[120 + (MAX_SQL_FLOAT * 3) + (MAX_SQL_INTEGER * 3) + MAX_SQL_FLOAT + 1];
- format(portal_query, sizeof(portal_query), "INSERT INTO portal(object, pos_x, pos_y, pos_z, world, pickup_id, interior_id, angle) VALUES (19902, '%f', '%f', '%f', %i, %i, %i, %f)", x, y, z, world_id, pickup_id, interior, 360 - angle);
- sql_query(sqlHandle, portal_query);
-
- // Inform user(s)
- new portal_id_query[91 + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_INTEGER + 1];
- format(portal_id_query, sizeof(portal_id_query), "SELECT id FROM portal WHERE pos_x = '%f' AND pos_y = '%f' AND pos_z = '%f' AND world = %i AND interior_id = %i", x, y, z, world_id, interior);
- new Result:portal_id_result = sql_query(sqlHandle, portal_id_query);
- portal_id = sql_get_field_assoc_int(Result:portal_id_result, "id");
- new message[69 + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1], admin_message[21 + 4 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
- format(message, sizeof(message), "Portal %i created. Create the other side with: /property portal %i exit", portal_id, portal_id);
- format(admin_message, sizeof(admin_message), "* [%i] %s created portal: %i", playerid, getPlayerName(playerid), portal_id);
- sendToAdmins(COLOR_NOTICE , admin_message);
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, message);
- }
- else if (!sscanf(params, "i s", portal_id, option)){
- // Get portal record
- new portal_query[189 + MAX_SQL_INTEGER + 1];
- format(portal_query, sizeof(portal_query), "SELECT object, pos_x, pos_y, pos_z, world, interior_id, pickup_id, exit_pos_x, exit_pos_y, exit_pos_z, exit_world, exit_interior_id, exit_pickup_id, angle, exit_angle FROM portal WHERE id = %i", portal_id);
- new Result:portal_result = sql_query(sqlHandle, portal_query);
-
- // Invalid portal ID
- if(sql_num_rows(portal_result) < 1){ // Invalid portal ID
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Invalid portal ID");
- }
-
- if (!strcmp(option, "exit", true, 4)){
- new Float:pos_x = sql_get_field_assoc_float(portal_result, "pos_x");
- new Float:pos_y = sql_get_field_assoc_float(portal_result, "pos_y");
- new Float:pos_z = sql_get_field_assoc_float(portal_result, "pos_z");
- new world_id = sql_get_field_assoc_int(portal_result, "world");
- new interior_id = sql_get_field_assoc_int(portal_result, "interior_id");
- new session_id = sql_get_field_assoc_int(portal_result, "pickup_id");
- new exit_pickup_id = sql_get_field_assoc_int(portal_result, "exit_pickup_id");
- new Float:angle = sql_get_field_assoc_float(portal_result, "angle");
-
- // Location
- new Float:x, Float:y, Float:z, Float:player_angle, world, interior;
- getPlayerLocation(playerid, x, y, z, player_angle, world, interior);
- // World
- if(world_id != -1){ // Not an all-world portal
- world = GetPlayerVirtualWorld(playerid);
- }
- else{
- world = world_id;
- }
- // Delete old exit if exists
- if(exit_pickup_id){
- destroyPortal(exit_pickup_id);
- }
- new pickup_id = createDynamicPickup(19607, x, y, z, world, interior, PICKUP_PORTAL);
- SetGVarFloat("pickup_x", pos_x, pickup_id);
- SetGVarFloat("pickup_y", pos_y, pickup_id);
- SetGVarFloat("pickup_z", pos_z, pickup_id);
- SetGVarInt("pickup_world", world_id, pickup_id);
- SetGVarFloat("pickup_angle", angle, pickup_id);
- SetGVarInt("pickup_interior", interior_id, pickup_id);
- SetGVarFloat("pickup_x", x, session_id);
- SetGVarFloat("pickup_y", y, session_id);
- SetGVarFloat("pickup_z", z, session_id);
- SetGVarInt("pickup_world", world, session_id);
- SetGVarFloat("pickup_angle", player_angle, session_id);
- SetGVarInt("pickup_interior", interior, session_id);
- // Update portal record
- new update_query[172 + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_INTEGER + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
- format(update_query, sizeof(update_query), "UPDATE portal SET exit_object = 19607, exit_pos_x = '%f', exit_pos_y = '%f', exit_pos_z = '%f', exit_world = %i, exit_interior_id = %i, exit_pickup_id = %i, exit_angle = %i WHERE id = %i", x, y, z, world, interior, pickup_id, 360 - player_angle, portal_id);
- sql_query(sqlHandle, update_query);
- // Inform admins and Discord
- new admin_message[61 + 4 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
- format(admin_message, sizeof(admin_message), "* [%i] %s modified the exit location of portal: %i", playerid, getPlayerName(playerid), portal_id);
- sendToAdmins(COLOR_NOTICE , admin_message);
- }
- else if(!strcmp(option, "object", true, 6)){
- strdel(option, 0, 7); // Remove first 7 characters, from the string.
- new object, exit_object;
- print(option);
- if (sscanf(option, "i i", object, exit_object)){
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Invalid syntax, specify two object ID's: /property portal <ID> object <ID> <ID>");
- }
- new Float:pos_x = sql_get_field_assoc_float(portal_result, "pos_x");
- new Float:pos_y = sql_get_field_assoc_float(portal_result, "pos_y");
- new Float:pos_z = sql_get_field_assoc_float(portal_result, "pos_z");
- new world_id = sql_get_field_assoc_int(portal_result, "world");
- new interior_id = sql_get_field_assoc_int(portal_result, "interior_id");
- new pickup_id = sql_get_field_assoc_int(portal_result, "pickup_id");
- new Float:exit_pos_x = sql_get_field_assoc_float(portal_result, "exit_pos_x");
- new Float:exit_pos_y = sql_get_field_assoc_float(portal_result, "exit_pos_y");
- new Float:exit_pos_z = sql_get_field_assoc_float(portal_result, "exit_pos_z");
- new exit_world_id = sql_get_field_assoc_int(portal_result, "exit_world");
- new exit_interior_id = sql_get_field_assoc_int(portal_result, "exit_interior_id");
- new exit_pickup_id = sql_get_field_assoc_int(portal_result, "exit_pickup_id");
- destroyPortal(exit_pickup_id);
- destroyPortal(pickup_id);
- spawnPortal(portal_id, object, pos_x, pos_y, pos_z, world_id, interior_id, exit_object, exit_pos_x, exit_pos_y, exit_pos_z, exit_world_id, exit_interior_id);
- new update_query[57 + MAX_SQL_INTEGER + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
- format(update_query, sizeof(update_query), "UPDATE portal SET (object, exit_object) = (%i, %i) WHERE id = %i", object, exit_object, portal_id);
- sql_query(sqlHandle, update_query);
- }
- else if(!strcmp(option, "delete", true, 6)){
- new pickup_id = sql_get_field_assoc_int(portal_result, "pickup_id");
- new exit_pickup_id = sql_get_field_assoc_int(portal_result, "exit_pickup_id");
- // TODO: Confirmation, by spectating the pickup or having to be near.
- destroyPortal(exit_pickup_id);
- destroyPortal(pickup_id);
- // Delete portal record
- new delete_query[31 + MAX_SQL_INTEGER + 1];
- format(delete_query, sizeof(delete_query), "DELETE FROM portal WHERE id = %i", portal_id);
- sql_query(sqlHandle, delete_query);
- }
- else if(!strcmp(option, "entrance", true, 8)){
- new object = sql_get_field_assoc_int(portal_result, "object");
- //new Float:x = sql_get_field_assoc_float(portal_result, "pos_x");
- //new Float:y = sql_get_field_assoc_float(portal_result, "pos_y");
- //new Float:z = sql_get_field_assoc_float(portal_result, "pos_z"); todo shorten qeury
- new world = sql_get_field_assoc_int(portal_result, "world");
- new pickup_id = sql_get_field_assoc_int(portal_result, "pickup_id");
- new Float:pos_x = sql_get_field_assoc_float(portal_result, "exit_pos_x");
- new Float:pos_y = sql_get_field_assoc_float(portal_result, "exit_pos_y");
- new Float:pos_z = sql_get_field_assoc_float(portal_result, "exit_pos_z");
- new world_id = sql_get_field_assoc_int(portal_result, "exit_world");
- new interior_id = sql_get_field_assoc_int(portal_result, "exit_interior");
- new Float:angle = sql_get_field_assoc_float(portal_result, "exit_angle");
- if(sql_num_rows(portal_result) < 1){ // Invalid portal ID
- return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Invalid portal ID");
- }
- // Location
- new Float:x, Float:y, Float:z, Float:player_angle, player_world, interior;
- getPlayerLocation(playerid, x, y, z, player_angle, player_world, interior);
-
- // World
- if(world_id == -1){ // All-world portal
- world = world_id;
- }
- destroyPortal(pickup_id); // Despawn old pickups and remove GVars
- new pickupid = createDynamicPickup(object, x, y, z, world, interior, PICKUP_PORTAL);
- SetGVarFloat("pickup_x", pos_x, pickupid);
- SetGVarFloat("pickup_y", pos_y, pickupid);
- SetGVarFloat("pickup_z", pos_z, pickupid);
- SetGVarInt("pickup_world", world_id, pickupid);
- SetGVarInt("pickup_interior", interior_id, pickupid);
- SetGVarFloat("pickup_angle", angle, pickupid);
- // Inform admins and Discord
- new admin_message[65 + 4 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
- format(admin_message, sizeof(admin_message), "* [%i] %s modified the entrance location of portal: %i", playerid, getPlayerName(playerid), portal_id);
- sendToAdmins(COLOR_NOTICE, admin_message);
- }
- else if(!strcmp(option, "goto", true)){
- teleportPlayer(playerid, sql_get_field_assoc_float(Result:portal_result, "exit_pos_x"), sql_get_field_assoc_float(Result:portal_result, "exit_pos_y"), sql_get_field_assoc_float(Result:portal_result, "exit_pos_z"), sql_get_field_assoc_float(Result:portal_result, "angle"), sql_get_field_assoc_int(Result:portal_result, "exit_world_id"), sql_get_field_assoc_int(Result:portal_result, "exit_interior_id"));
- }
- else{ // Invalid option
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/property portal <ID> options: goto, exit, entrance, object, delete");
- }
- }
- else{ // Invalid value
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /property portal <create | ID <goto | exit | entrance | object | delete>>");
- }
- }
- else{ // Invalid option
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/property options: pickup, portal");
- }
-
- return 1;
- }
- // Dialog functions
- forward dialogGotoInterior(playerid);
- public dialogGotoInterior(playerid){
- ShowPlayerDialog(playerid, DIALOG_GOTO_INTERIOR, DIALOG_STYLE_LIST, "Categories", "Avaition\nHouses\nMissions\nMission exteriors\nPolice departments\nSex work\nShops\nStadia", "Select", "Back");
- }
- forward dialogGotoPlayer(playerid);
- public dialogGotoPlayer(playerid){
- for(new targetid, a = GetMaxPlayers(); targetid < a; targetid++){
- if(IsPlayerConnected(targetid)){
- // TODO: Decide to use this or TABplayer list.
- }
- }
- ShowPlayerDialog(playerid, DIALOG_GOTO_PLAYER, DIALOG_STYLE_LIST, "Players", "", "Goto", "Back");
- }
- dialogGotoHouses(playerid){
- ShowPlayerDialog(playerid, DIALOG_GOTO_HOUSES, DIALOG_STYLE_TABLIST, "Houses", "Burglary houses\nMission houses\nSafe houses\nUncategorized", "Select", "Cancel");
- }
- dialogGotoShops(playerid){
- ShowPlayerDialog(playerid, DIALOG_GOTO_SHOPS, DIALOG_STYLE_TABLIST, "Shops", "24/7's\nAmmunation's\nCasino's\nModding shops\nUncatagorized", "Select", "Cancel");
- }
- // a_samp events
- public OnGameModeInit(){
- new message[36 + 22 + 1];
- format(message, sizeof(message), "* Global game-mode initialization: v%s", MODE_NAME);
- logger(LOGLEVEL_NOTICE, "* Global game-mode initialization."); // Log event.
- // Player radar blip markers only visible to nearby players.
- ShowPlayerMarkers(PLAYER_MARKERS_MODE_STREAMED);
- LimitPlayerMarkerRadius(15);
-
- // Set mode name
- SetGameModeText(MODE_NAME);
- // SQL log level
- if(scriptDebug){
- sql_debug(LOG_ALL, LOG_ALL); // Log everything everywhere.
- }
- else{
- sql_debug(LOG_INFO, LOG_WARNING); // Loglevel info for file and worning for console.
- }
- // Connect to database
- sqlHandle = SQL:sql_connect(SQL_HANDLER_POSTGRESQL, PG_HOST, PG_ROLE, PG_PASS, PG_DB, PG_PORT);
- printf("sqlconnection = %d", _:sqlHandle);
- if(!sql_ping(sqlHandle)){
- print( " + Database connection" );
- }
- else{
- print( "Database connection failed" );
- }
- // Initialize Discord
- //homeGuild = DCC_GetGuildId(DISCORD_HOME_GUILD_ID); // Set home guild ID. NOT NEEDED FOR NOW AND BROKEN
- echoChannel = DCC_FindChannelById(DISCORD_ECHO_CHANNEL_ID); // Set main echo channel ID.
- mainChannel = DCC_FindChannelById(DISCORD_MAIN_CHANNEL_ID); // Set main notification channel ID.
- adminEchoChannel = DCC_FindChannelById(DISCORD_ADMIN_ECHO_CHANNEL_ID); // Set admin echo channel ID.
- adminChannel = DCC_FindChannelById(DISCORD_ADMIN_CHANNEL_ID); // Set admin notification channel ID.
- managementChannel = DCC_FindChannelById(DISCORD_MANAGEMENT_CHANNEL_ID); // Set management notification channel ID.
-
- DiscordEcho(message, ECHO_CHANNEL); // Notify Discord
- //DiscordEcho(message, MAIN_CHANNEL); // TODO Enable after we are stable
-
- // Portals
- new Result:portal_result = sql_query(sqlHandle, "SELECT id, object, pos_x, pos_y, pos_z, world, interior_id, exit_object, exit_pos_x, exit_pos_y, exit_pos_z, exit_world, exit_interior_id FROM portal");
- for(new i = 0; i < sql_num_rows(portal_result); i++){
- new id = sql_get_field_assoc_int_ex(portal_result, i, "id");
- new object = sql_get_field_assoc_int_ex(portal_result, i, "object");
- new Float:pos_x = sql_get_field_assoc_float_ex(portal_result, i, "pos_x");
- new Float:pos_y = sql_get_field_assoc_float_ex(portal_result, i, "pos_y");
- new Float:pos_z = sql_get_field_assoc_float_ex(portal_result, i, "pos_z");
- new world = sql_get_field_assoc_int_ex(portal_result, i, "world");
- new interior = sql_get_field_assoc_int_ex(portal_result, i, "interior_id");
- new exit_object = sql_get_field_assoc_int_ex(portal_result, i, "exit_object");
- new Float:exit_pos_x = sql_get_field_assoc_float_ex(portal_result, i, "exit_pos_x");
- new Float:exit_pos_y = sql_get_field_assoc_float_ex(portal_result, i, "exit_pos_y");
- new Float:exit_pos_z = sql_get_field_assoc_float_ex(portal_result, i, "exit_pos_z");
- new exit_world = sql_get_field_assoc_int_ex(portal_result, i, "exit_world");
- new exit_interior = sql_get_field_assoc_int_ex(portal_result, i, "exit_interior_id");
-
- spawnPortal(id, object, pos_x, pos_y, pos_z, world, interior, exit_object, exit_pos_x, exit_pos_y, exit_pos_z, exit_world, exit_interior);
- }
-
- // Pickups
- new Result:pickup_result = sql_query(sqlHandle, "SELECT id, object_id, pos_x, pos_y, pos_z, world_id, interior_id, type_id FROM pickup");
- for(new i = 0; i < sql_num_rows(pickup_result); i++){
- new id = sql_get_field_assoc_int_ex(pickup_result, i, "id");
- new object_id = sql_get_field_assoc_int_ex(pickup_result, i, "object_id");
- new Float:pos_x = sql_get_field_assoc_float_ex(pickup_result, i, "pos_x");
- new Float:pos_y = sql_get_field_assoc_float_ex(pickup_result, i, "pos_y");
- new Float:pos_z = sql_get_field_assoc_float_ex(pickup_result, i, "pos_z");
- new world_id = sql_get_field_assoc_int_ex(pickup_result, i, "world_id");
- new interior_id = sql_get_field_assoc_int_ex(pickup_result, i, "interior_id");
- new type_id = sql_get_field_assoc_int_ex(pickup_result, i, "type_id");
-
- new pickupid = createDynamicPickup(object_id, pos_x, pos_y, pos_z, world_id, interior_id, type_id);
- // Update pickup record
- new pickup_query[44 + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
- format(pickup_query, sizeof(pickup_query), "UPDATE pickup SET pickup_id = %i WHERE id = %i", pickupid, id);
- sql_query(sqlHandle, pickup_query);
- }
-
- // Vehicles
- new Result:vehicle_result = sql_query(sqlHandle, "SELECT id FROM vehicle");
- for(new i = 0; i < sql_num_rows(vehicle_result); i++){
- printf("Add: %i | vehicle_id: %i", i, sql_get_field_assoc_int_ex(vehicle_result, i, "id"));
- addvehicle(sql_get_field_assoc_int_ex(vehicle_result, i, "id"));
- }
- // Hobo's with a cane (0 ammo value makes them lose the cane as soon as they switch weapon)
- // Only homeless skins, as players should slowly class up in society.
- AddPlayerClass(134, -184.7607, 950.5010, 16.7740, 358.3032, 15, 0, 0, 0, 0, false); // Fort Carson West boulevard right curb.
- AddPlayerClass(10, -184.7607, 950.5010, 16.7740, 358.3032, 15, 0, 0, 0, 0, false); // Fort Carson West boulevard right curb.
- AddPlayerClass(78, 111.0115, 1189.2029, 18.1627, 89.0095, 15, 0, 0, 0, 0, false); // Fort Carson South boulevard left curb.
- AddPlayerClass(129, 111.0115, 1189.2029, 18.1627, 89.0095, 15, 0, 0, 0, 0, false); // Fort Carson South boulevard left curb.
- AddPlayerClass(162, -109.4227, 1242.4860, 16.8223, 183.5798, 15, 0, 0, 0, 0, false); // Fort Carson East boulevard left curb.
- AddPlayerClass(77, -109.4227, 1242.4860, 16.8223, 183.5798, 15, 0, 0, 0, 0, false); // Fort Carson East boulevard left curb.
- AddPlayerClass(79, -201.5379, 948.1683, 15.9131, 359.9720, 15, 0, 0, 0, 0, false); // Fort Carson West boulevard left curb.
- AddPlayerClass(196, -201.5379, 948.1683, 15.9131, 359.9720, 15, 0, 0, 0, 0, false); // Fort Carson West boulevard left curb.
- AddPlayerClass(239, 62.4694, 1205.0531, 18.8153, 89.9380, 15, 0, 0, 0, 0, false); // Fort Carson South boulevard right curb.
- AddPlayerClass(89, 62.4694, 1205.0531, 18.8153, 89.9380, 15, 0, 0, 0, 0, false); // Fort Carson South boulevard right curb.
- AddPlayerClass(135, -126.0831, 1242.5745, 18.6138, 183.2986, 15, 0, 0, 0, 0, false); // Fort Carson East boulevard right curb.
- AddPlayerClass(197, -126.0831, 1242.5745, 18.6138, 183.2986, 15, 0, 0, 0, 0, false); // Fort Carson East boulevard right curb.
- return 1;
- }
- public OnGameModeExit(){
- // Cycle every player
- for(new playerid, a = GetMaxPlayers(); playerid < a; playerid++){
- if(IsPlayerConnected(playerid)){
- // Set name back to username
- //new client_connect_username[MAX_PLAYER_NAME + 1];
- //GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid);
- //SetPlayerName(playerid, client_connect_username); // Change name in-game back to username, for login after restart PROBLEM: Crashses the server on GMX.
- deleteAllGVars(playerid); // Delete GVars as per https://forum.sa-mp.com/showthread.php?t=151076
- // TODO think of somthing for the usernames, kickign every player, or accapting character names as usersnames.
- }
- }
- logger(LOGLEVEL_NOTICE, "* Global game-mode termination."); // Log event
- sql_wait(sqlHandle); // Wait for queries to finish.
- sql_disconnect(sqlHandle); // Disconnect from database.
- DiscordEcho("* Global game-mode termination.", ECHO_CHANNEL); // Notify discord
- //DiscordEcho("* Global game-mode termination.", MAIN_CHANNEL); // Enable when stable
-
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid){ // Skin selection before spawn.
- if(scriptDebug){
- new message[23 + 4 + MAX_PLAYER_NAME + 1];
- format(message, sizeof(message), "* [%i] %s Class selection.", playerid, getCharacterName(playerid));
- logger(LOGLEVEL_DEBUG, message); // Log event.
- }
- SetPlayerPos(playerid, -185.5514, 944.2042, 15.9337); // In front of Fort Carson city limits sign.
- SetPlayerFacingAngle(playerid, 182.7345); // Charater looks toward the camera.
- SetPlayerCameraPos(playerid, -185.5514, 939.0957, 15.6594); // Further in front of the Fort Carson city limits sign.
- SetPlayerCameraLookAt(playerid, -185.5514, 944.2042, 15.9337); // In front of Fort Carson city limits sign.
- return 1; // Must return one, or skin selection breaks
- }
- public OnPlayerConnect(playerid){
- SetPlayerColor(playerid, COLOR_BLACK);
-
- // Create & populate variables
- new playername[MAX_PLAYER_NAME + 1], playerip[MAX_SQL_IP + 1];
- playername = getPlayerName(playerid);
- GetPlayerIp(playerid, playerip, sizeof(playerip));
- // Global connection notification
- new admin_message[23 + MAX_PLAYER_NAME + MAX_SQL_IP + 1];
- format(admin_message, sizeof(admin_message), "* [%d] %s (IP: %s) connected.", playerid, getCharacterName(playerid), playerip);
- logger(LOGLEVEL_INFO, admin_message); // Log event
- sendToAdmins(COLOR_NOTICE, admin_message); // Notify all admins.
- // Create IP record or update connection attempts
- new ip_query[109 + MAX_SQL_IP + 1];
- format(ip_query, sizeof(ip_query), "INSERT INTO ip(address) VALUES('%s') ON CONFLICT (address) DO UPDATE SET connections = ip.connections+1", playerip);
- sql_query(sqlHandle, ip_query);
-
- // Check if IP is banned
- new ip_id = getIPID(playerid);
-
- new ban_query[75 + MAX_SQL_INTEGER + 1];
- format(ban_query, sizeof(ban_query), "SELECT id, reason FROM ip_ban WHERE ip_id = %i AND expires > NOW()::timestamp", ip_id);
- new Result:ban_result = sql_query(sqlHandle, ban_query);
- if(sql_num_rows(ban_result) > 0){ // Banned
- new kick_message[8 + MAX_SQL_REASON + 1];
- format(kick_message, sizeof(kick_message), "Banned: %s", sql_get_field_assoc_int(ban_result, "reason"));
- kickPlayer(playerid, -1, kick_message, 1);
- }
- // Get user record
- new escaped_username[MAX_PLAYER_NAME + 1], user_query[47 + MAX_PLAYER_NAME + 1]; // Should be longer to allow for escaped characters
- sql_escape_string(sqlHandle, playername, escaped_username, sizeof(escaped_username)); // Escape player name
- format(user_query, sizeof(user_query), "SELECT id FROM \"user\" WHERE name = '%s'", escaped_username);
- //new Result:result = sqlQuery(sqlHandle, user_query); // Middleware broken.
- new Result:result = sql_query(sqlHandle, user_query);
-
- SetGVarString("client_connect_username", playername, playerid); // Used by register, DIALOG_LOGIN, getUserID & OnGameModeExit
-
- if(sql_num_rows(result) == 0){ // Unkown user
- SetGVarInt("userlevel", UNREGISTERED_PLAYER, playerid); // Set userlevel unregistered
- print("UNkown user sending to changeName()");
- changeName(playerid, playername); // Check, force and set role-play name
- }
- else{ // Known user
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Sign in", "Enter your password to log on", "Log in", "Cancel"); // Show password confirmation dialog
- }
- //return 1;
- }
- public OnPlayerDisconnect(playerid, reason){
- if(GetPlayerState(playerid) != PLAYER_STATE_NONE){ // Only save character if spawned
- savePlayerState(playerid); // Save character
- }
- deleteAllGVars(playerid); // Delete GVars as per https://forum.sa-mp.com/showthread.php?t=151076
-
- new playername[MAX_PLAYER_NAME + 1], message[40 + 4 + MAX_PLAYER_NAME + 1];
- playername = getPlayerName(playerid);
- switch(reason){
- case 0: format(message, sizeof(message), "* [%i] %s disconnected. (Lost Connection)", playerid, getCharacterName(playerid));
- case 1: format(message, sizeof(message), "* [%i] %s disconnected. (Leaving)", playerid, getCharacterName(playerid));
- case 2: format(message, sizeof(message), "* [%i] %s disconnected. (Kicked)", playerid, getCharacterName(playerid)); // Leave this in place for RCON kicks.
- }
- logger(LOGLEVEL_INFO, message); // Log event
- SendClientMessageToAll(COLOR_NOTICE, message); // Notify all players.
- DiscordEcho(message, ECHO_CHANNEL); // Notify discord.
-
- return 1;
- }
- public OnPlayerSpawn(playerid){
- if(scriptDebug){ // Log event in case of debugging.
- new message[MAX_PLAYER_NAME + 14 + 1];
- format(message, sizeof(message), "* [%i] %s spawned.", playerid, getCharacterName(playerid));
- logger(LOGLEVEL_DEBUG, message); // Log event.
- }
- if(GetGVarInt("userlevel", playerid) == UNREGISTERED_PLAYER){ // Unregistered player.
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: To reserve your name, save your character, statistics and money, type: /register");
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason){
- new message[15 + MAX_PLAYER_NAME + 1];
- format(message, sizeof(message), "* [%d] %s died.", playerid, getCharacterName(playerid)); // TODO Add killerid & reason.
- logger(LOGLEVEL_DEBUG, message); // Log event
- DiscordEcho(message, ADMIN_ECHO_CHANNEL); // Notify Discord admin echo.
-
- //ResetPlayerMoney(playerid); TODO test if required
- //SpawnPlayer(playerid);
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[]){
- new shortcut_message[128 + 1];
- strfromliteral(shortcut_message, text);
- strdel(shortcut_message, 0, 1); // Remove chat character from text
- switch(strgetfirstc(text)){
- case '`': {
- if(GetGVarInt("chatmode", playerid) == CHAT_LOCAL){
- sendToChat(playerid, CHAT_GLOBAL, shortcut_message, 0, DCC_INVALID_USER);
- }
- else if (GetGVarInt("chatmode", playerid) == CHAT_GLOBAL){
- sendToChat(playerid, CHAT_LOCAL, shortcut_message, 0, DCC_INVALID_USER);
- }
- else{
- sendToChat(playerid, CHAT_GLOBAL, shortcut_message, 0, DCC_INVALID_USER);
- }
- }
- case '~': {sendToChat(playerid, CHAT_GANG, shortcut_message, 0, DCC_INVALID_USER);}
- case '#': {sendToChat(playerid, CHAT_GANG_OC, shortcut_message, 0, DCC_INVALID_USER);}
- case '!': {sendToChat(playerid, CHAT_FACTION, shortcut_message, 0, DCC_INVALID_USER);}
- case '$': {sendToChat(playerid, CHAT_FACTION_OC, shortcut_message, 0, DCC_INVALID_USER);}
- case '^': {sendToChat(playerid, CHAT_VIP, shortcut_message, 0, DCC_INVALID_USER);}
- case '@': {sendToChat(playerid, CHAT_CREW, shortcut_message, 0, DCC_INVALID_USER);}
- case '%': {sendToChat(playerid, CHAT_ADMIN, shortcut_message, 0, DCC_INVALID_USER);}
- case '&': {sendToChat(playerid, CHAT_MANAGEMENT, shortcut_message, 0, DCC_INVALID_USER);}
- case '*': {sendToChat(playerid, CHAT_UNDERCOVER, shortcut_message, 0, DCC_INVALID_USER);}
- case '+': {sendToChat(playerid, CHAT_CALL, shortcut_message, 0, DCC_INVALID_USER);}
- case '-': {sendToChat(playerid, CHAT_SMS, shortcut_message, 0, DCC_INVALID_USER);}
- case '=': {sendToChat(playerid, CHAT_RADIO, shortcut_message, 0, DCC_INVALID_USER);}
- case '>': {
- new recipient_id, message[128 + 1];
- if (sscanf(shortcut_message, "u s", recipient_id, message)){
- SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: > <playerid> <message>");
- }
- else{
- sendPM(playerid, message, recipient_id);
- }
- }
- default:{
- new chatmode = GetGVarInt("chatmode", playerid), message[128 + 1];
- strmid(message, text, 0, 128);
- // message = text;
- if(!chatmode){ // Default is local chat
- sendToChat(playerid, CHAT_LOCAL, message, 0, DCC_INVALID_USER);
- }
- else{ // Send to preferred chat
- printf("chatmode: %i", chatmode);
- sendToChat(playerid, chatmode, message, 0, DCC_INVALID_USER);
- }
- }
- }
- return 0; // Return 1 for default behavior, return 0 to disable default output.
- }
- public OnPlayerCommandText(playerid, cmdtext[]){
- if(scriptDebug){ // Log event in case of debugging.
- new message[5 + 4 + MAX_PLAYER_NAME + 128 + 1]; // 128 = samp text input limit.
- format(message, sizeof(message), "[%d] %s: %s", playerid, getCharacterName(playerid), cmdtext);
- logger(LOGLEVEL_COMMAND, message); // Log event
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[]){ // The website and some cronjobs do RCON commands. TODO create filter not to show some commands to preven spam
- new message[8 + 128 + 1]; // Max samp message legnth = 128.
- format(message, sizeof(message), "* RCON: %s", cmd);
- logger(LOGLEVEL_NOTICE, message); // Log event
- DiscordEcho(message, MANAGEMENT_CHANNEL);
- return 1;
- }
- public OnPlayerRequestSpawn(playerid){ // After picking a skin in class selection.
- SetPlayerColor(playerid, COLOR_WHITE);
-
- new playername[MAX_PLAYER_NAME + 1], message[14 + MAX_PLAYER_NAME + 1];
- playername = getPlayerName(playerid);
- if(scriptDebug){ // Only log spawns when debuggins script.
- format(message, sizeof(message), "* [%d] %s Chose a character.", playerid, getCharacterName(playerid));
- logger(LOGLEVEL_DEBUG, message); // Log event
- }
- if(GetGVarInt("userlevel", playerid) > UNREGISTERED_PLAYER){ // Registered player
- createCharacterRecord(playerid, getUserID(playerid)); // Save character
-
- new client_connect_username[MAX_PLAYER_NAME + 1], admin_message[25 + 4 + MAX_PLAYER_NAME + MAX_PLAYER_NAME + 1];
- GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid); // Get client connect name
- format(admin_message, sizeof(admin_message), "[%i] %s has been created by %s.", playerid, getCharacterName(playerid), client_connect_username);
- DiscordEcho(admin_message, ADMIN_ECHO_CHANNEL);
- }
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- //public OnPlayerPickUpPickup(playerid, pickupid){} // Replaced byOnPlayerPickUpDynamicPickup() streamer.inc
- public OnPlayerPickUpDynamicPickup(playerid, pickupid){ // Requires streamer
- new type = GetGVarInt("pickup_type", pickupid);
- // Special pickup types first, rugular in the else{} conditional statement
- if(type == PICKUP_PORTAL){
- // Do nothing if the player just used a pickup
- if(GetGVarInt("disable_pickups", playerid)){
- return 0;
- }
- new Float:x = GetGVarFloat("pickup_x", pickupid);
- new Float:y = GetGVarFloat("pickup_y", pickupid);
- new Float:z = GetGVarFloat("pickup_z", pickupid);
- new world = GetGVarInt("pickup_world", pickupid);
- // Don't releport when the exit is not set
- if(x == 0 && y == 0 && z == 0){
- return 0;
- }
- // Create dynamic area and temporarily disable pickups for player
- new area = CreateDynamicCircle(x, y, 1.7, world, -1, playerid);
- SetGVarInt("disable_pickups", area, playerid);
- // Teleport player
- teleportPlayer(playerid, x, y, z, GetGVarInt("pickup_angle", pickupid), world, GetGVarInt("pickup_interior", pickupid));
- }
- else{
- // Do nothing if the player just used a pickup
- if(GetGVarInt("disable_pickups", playerid)){
- return 0;
- }
-
- // Create dynamic area and temporarily disable pickups for player
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- new area = CreateDynamicCircle(x, y, 1, GetPlayerVirtualWorld(playerid), -1, playerid);
- SetGVarInt("disable_pickups", area, playerid);
-
- // Regular pickup types
- switch(type){
- case PICKUP_FACTION_PD: {
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{ShowPlayerDialog(playerid, DIALOG_DUTY_PD, DIALOG_STYLE_MSGBOX, "Active police duty", "Go on police duty as a rookie cop?", "Yes", "No");}
- case JOB_POLICE:{ShowPlayerDialog(playerid, DIALOG_DUTY_PD, DIALOG_STYLE_MSGBOX, "Active police duty", "Go off police duty?", "Yes", "No");}
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
- }
- }
- case PICKUP_FACTION_MD:{
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{ShowPlayerDialog(playerid, DIALOG_DUTY_MD, DIALOG_STYLE_MSGBOX, "Active medic duty", "Go on medic duty as a rookie paramedic?", "Yes", "No");}
- case JOB_MEDIC:{ShowPlayerDialog(playerid, DIALOG_DUTY_MD, DIALOG_STYLE_MSGBOX, "Active medic duty", "Go off paramedic duty?", "Yes", "No");}
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you have another job.");}
- }
- }
- case PICKUP_FACTION_FD:{
- printf("jobid: %i", GetGVarInt("job", playerid));
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{ShowPlayerDialog(playerid, DIALOG_DUTY_FD, DIALOG_STYLE_MSGBOX, "Active fire duty", "Go on fire duty as a rookie firefighter?", "Yes", "No");}
- case JOB_FIRE:{ShowPlayerDialog(playerid, DIALOG_DUTY_FD, DIALOG_STYLE_MSGBOX, "Active firefighter duty", "Go off firefighter duty?", "Yes", "No");}
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you have another job.");}
- }
- }
- case PICKUP_FACTION_FBI:{
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{ShowPlayerDialog(playerid, DIALOG_DUTY_FBI, DIALOG_STYLE_MSGBOX, "Active FBI duty", "Go on FBI duty as a rookie agent?", "Yes", "No");}
- case JOB_FBI:{ShowPlayerDialog(playerid, DIALOG_DUTY_FBI, DIALOG_STYLE_MSGBOX, "Active medic duty", "Go off FBI duty?", "Yes", "No");}
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you have another job.");}
- }
- }
- case PICKUP_FACTION_DMV:{
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{ShowPlayerDialog(playerid, DIALOG_DUTY_DMV, DIALOG_STYLE_MSGBOX, "Active DMV duty", "Go on DMV duty as a rookie service officer?", "Yes", "No");}
- case JOB_DMV:{ShowPlayerDialog(playerid, DIALOG_DUTY_DMV, DIALOG_STYLE_MSGBOX, "Active DMV duty", "Go off DMV duty?", "Yes", "No");}
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you have another job.");}
- }
- }
- case PICKUP_FACTION_NEWS:{
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{ShowPlayerDialog(playerid, DIALOG_DUTY_NEWS, DIALOG_STYLE_MSGBOX, "Active broadcasting duty", "Go on network duty as a rookie reporter?", "Yes", "No");}
- case JOB_NEWS:{ShowPlayerDialog(playerid, DIALOG_DUTY_NEWS, DIALOG_STYLE_MSGBOX, "Active broadcasting duty", "Go off network duty?", "Yes", "No");}
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you have another job.");}
- }
- }
- }
-
- }
- return 1;
- }
- public OnPlayerLeaveDynamicArea(playerid, areaid){ // Requires streamer
- // Reactivate pickup after player leaves it
- new area = GetGVarInt("disable_pickups", playerid);
- if(area == 0 && areaid != 0){ // Stop if player had not had this area disabled (With the exception of areaid 0 as GetVarInt() returns 0 on null)
- return;
- }
- else if(area == 0){ // Player has not had picks disabled
- return;
- }
- if(area == areaid){ // Player had this pickup disabled
- DestroyDynamicArea(GetGVarInt("disable_pickups", playerid));
- DeleteGVar("disable_pickups", playerid);
- }
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success){
- new message[30 + MAX_SQL_IP + 1];
- if(success){
- format(message, sizeof(message), "* [%s] authenticated via RCON.", ip);
- }
- else{
- format(message, sizeof(message), "* [%s] invalid RCON authentication.", ip);
- }
- logger(LOGLEVEL_NOTICE, message); // Log event
- DiscordEcho(message, MANAGEMENT_CHANNEL); // Notify Discord management.
- return 1;
- }
- public OnPlayerUpdate(playerid) // Don't use for now.
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid){
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
- switch(dialogid){
- case DIALOG_CHANGENAME:{
- if(GetGVarInt("userlevel", playerid) > UNREGISTERED_PLAYER){ // Registered player
- if(!response){ // User aborted
- return 0; // Allow escaping dialogm without forcing to continue
- }
- }
-
- changeName(playerid, inputtext); // Forced name check and change
- }
- case DIALOG_REGISTER:{
- if(response){ // If they clicked 'Yes' or pressed enter
- // Check password complexity
- new Regex:r = Regex_New("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[0-9!@#\\$%\\^&\\*\\(\\)\\-\\_=+[{\\]}\\\\|;:'\",<.>\\/?]).{8,}$"); // Regex password filter
- new isSecurePassword = Regex_Check(inputtext, r); // Validate name to filter
- Regex_Delete(r);
- if(!isSecurePassword){ // Insecure password
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Insecure password", "Enter a secure password, containg at least:\n\n * A lowercase letter (a-z)\n * A capiral letter (A-Z)\n * A number (0-9).\n * A character that is not a letter (0-9!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?).\n * 8 characters.", "Register", "Cancel"); // Show password requirements.
- }
- else { // Secure password
- // Hash password
- new buffer[MAX_SQL_HASH + 1], hash[MAX_SQL_HASH + 1];
- WP_Hash(buffer, sizeof(buffer), inputtext);
- GetGVarString("hash", hash, sizeof(hash), playerid);
- if(isempty(hash)){ // First password dialog
- SetGVarString("hash", buffer, playerid); // Save password has a GVar
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Password confirmation", "Repeat your password to confirm.", "Register", "Cancel"); // Show password confirmation dialog
- }
- else{ // Password confirmation
- if(!isequal(hash, buffer)){ // Password does not match confirmation
- DeleteGVar("hash", playerid);
-
- SendClientMessage(playerid, COLOR_RED, "ERROR: Password does not match password confirmation.");
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Password", "Enter the same password twice.", "Continue", "Cancel"); // Password prompt
- }
- else{ // Password matches confirmation
- DeleteGVar("hash", playerid);
-
- new client_connect_username[MAX_PLAYER_NAME + 1], playerIP[MAX_SQL_IP + 1], escaped_username[MAX_PLAYER_NAME + 1];
- GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid);
- GetPlayerIp(playerid, playerIP, sizeof(playerIP));
- sql_escape_string(sqlHandle, client_connect_username, escaped_username, sizeof(escaped_username));
- // Create user record
- new user_query[61 + MAX_PLAYER_NAME + MAX_SQL_HASH + 1 + MAX_SQL_IP + 1];
- format(user_query, sizeof(user_query), "INSERT INTO \"user\"(name, password) VALUES('%s', '%s')", escaped_username, hash);
- /*new Result:user_result = sql_query(sqlHandle, user_query);
- //new id = sql_insert_id(user_result); // Broken, always returns 0.
- // sql_insert_id workaround*/
- sql_query(sqlHandle, user_query);
-
- new id = getUserID(playerid); // Get ID user user record
-
- SetGVarInt("userlevel", REGISTERED_PLAYER, playerid);
- // Create user_ip relation table record
- new user_ip_query[50 + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1 ];
- format(user_ip_query, sizeof(user_ip_query), "INSERT INTO user_ip(id, id) VALUES(%i, %i)", getIPID(playerid), id);
- sql_query(sqlHandle, user_ip_query);
- createCharacterRecord(playerid, id); // Save character
-
- // Inform user
- new dialogMessage[135 + MAX_PLAYER_NAME + 1], message[31 + MAX_PLAYER_NAME + 1];
- format(dialogMessage, sizeof(dialogMessage), "To login as any of your characters, connect as: \nRemember your username carefully, as you have to use it to connect with SA-MP client!", client_connect_username);
- ShowPlayerDialog(playerid, DIALOG_ACCOUNT_CREATED, DIALOG_STYLE_MSGBOX, "Account created", dialogMessage, "Play", "");
- format(message, sizeof(message), "SERVER: Remember your username, %s!", client_connect_username);
- SendClientMessage(playerid, COLOR_WARNING, message);
-
- // send discord admin echo
- new admin_message[30 + 4 + MAX_PLAYER_NAME + 1];
- format(admin_message, sizeof(admin_message), "[%i] %s has registered an account.", playerid, client_connect_username);
- DiscordEcho(admin_message, ADMIN_ECHO_CHANNEL);
- }
- }
- }
- }
- else{ // Pressed ESC or clicked cancel
- DeleteGVar("hash", playerid);
- }
- }
- case DIALOG_LOGIN:{
- if(response){ // If they clicked 'Yes' or pressed enter
- // Escape username
- new client_connect_username[MAX_PLAYER_NAME + 1], escaped_username[MAX_PLAYER_NAME + 1];
- GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid);
- sql_escape_string(sqlHandle, client_connect_username, escaped_username, sizeof(escaped_username));
- // Get account
- new user_query[82 + MAX_PLAYER_NAME + 1], hash[MAX_SQL_HASH + 1];
- format(user_query, sizeof(user_query), "SELECT id, password, level FROM \"user\" WHERE name = '%s'", escaped_username);
- new Result:user_result = sql_query(sqlHandle, user_query);
- sql_get_field_assoc_ex(user_result, 0, "password", hash, sizeof(hash));
- // Compare hashes
- new buffer[MAX_SQL_HASH + 1];
- WP_Hash(buffer, sizeof(buffer), inputtext);
- if (!isequal(buffer, hash)){ // Hashes don't match
- // Brute-force protection
- new authentication_count = GetGVarInt("authentication_count", playerid);
- authentication_count++;
- SetGVarInt("authentication_count", authentication_count, playerid);
- ShowPlayerDialog(playerid, DIALOG_LOGIN_FAILED, DIALOG_STYLE_MSGBOX, "Authenticaion failed", "Invalid password.", "Wait", "");
- switch(authentication_count){
- case 0: SetTimerEx("authenticate", 3000, false, "i", playerid); // Return to authentication workflow in 3 second.
- case 1: SetTimerEx("authenticate", 5000, false, "i", playerid); // Return to authentication workflow in 5 seconds.
- case 2: SetTimerEx("authenticate", 7000, false, "i", playerid); // Return to authentication workflow in 7 seconds.
- default: ShowPlayerDialog(playerid, DIALOG_CHANGE_USERNAME, DIALOG_STYLE_INPUT, "Username", "Pick an unregistered username.", "Change", ""); // After 4 failed authentication attempts
- }
- }
- else{ // Hashes match
- // Set userlevel (This has to be done before banning, else the user ban record won't save)
- new userlevel = sql_get_field_assoc_int(user_result, "level");
- printf("Setting userlevel: %i", userlevel);
- SetGVarInt("userlevel", userlevel, playerid);
-
- // Check bans
- new ban_query[76 + MAX_SQL_INTEGER + 1];
- format(ban_query, sizeof(ban_query), "SELECT user_id FROM user_ban WHERE user_id = %i AND expires > NOW()::timestamp", getUserID(playerid));
- new Result:ban_result = sql_query(sqlHandle, ban_query);
- if(sql_num_rows(ban_result) > 0){ // Banned
- new reason[121 + 1];
- format(reason, sizeof(reason), "Logged in with banned account: %i", sql_get_field_assoc_int(ban_result, "user_id"));
- banPlayer(playerid, -1, reason, 10);
- }
-
- // Get character names
- characterSelection(playerid);
- }
- }
- else{ // Pressed ESC or clicked cancel
- ShowPlayerDialog(playerid, DIALOG_CHANGE_USERNAME, DIALOG_STYLE_INPUT, "Username", "Pick an unregistered username.", "Change", "");
- }
- }
- case DIALOG_CHANGE_USERNAME:{
- if(response){ // If they clicked 'Yes' or pressed enter
- new Regex:r = Regex_New("^[0-9a-zA-Z\\[\\]\\(\\)\\$@._=]{1,}$"); // Regex name filter
- new isValidName = Regex_Check(inputtext, r);
- Regex_Delete(r);
- if(isValidName){ // Valid name
- // Get user record
- new escaped_username[MAX_PLAYER_NAME + 1], user_query[36 + MAX_PLAYER_NAME + 1];
- sql_escape_string(sqlHandle, inputtext, escaped_username, sizeof(escaped_username)); // Escape player name
- format(user_query, sizeof(user_query), "SELECT id FROM \"user\" WHERE name = '%s'", escaped_username);
- //new Result:result = sqlQuery(sqlHandle, user_query); // Middleware broken.
- new Result:result = sql_query(sqlHandle, user_query);
-
- if(sql_num_rows(result) > 0){ // Username taken
- ShowPlayerDialog(playerid, DIALOG_CHANGE_USERNAME, DIALOG_STYLE_INPUT, "Username", "Pick an unregistered username.", "Change", "");
- }
- else{ // Username free
- SetGVarString("client_connect_username", inputtext, playerid); // Used by register and DIALOG_LOGIN
- SetPlayerName(playerid, inputtext); // Change name in-game
- return 1; // Do nothing to let player continue class selection
- }
- }
- else{ // Invalid name
- ShowPlayerDialog(playerid, DIALOG_CHANGE_USERNAME, DIALOG_STYLE_INPUT, "Username", "Invalid name. Names may only contain numbers (0-9), letters (a-z) & (A-Z) and special characters ([]()$@._=)", "Change", "");
- }
- }
- else{ // Pick another username
- ShowPlayerDialog(playerid, DIALOG_CHANGE_USERNAME, DIALOG_STYLE_INPUT, "Username", "Pick an unregistered username.", "Change", "");
- }
- }
- case DIALOG_CHARACTERS:{ // TODO set color & skin in case of job
- if(response){ // Spawn as character
- new character_array_string[MAX_CHARACTERS_PER_USER * MAX_SQL_INTEGER + 1], character_array[MAX_CHARACTERS_PER_USER + 1];
- GetGVarString("character_array_string", character_array_string, sizeof(character_array_string), playerid);
- DeleteGVar("character_array_string");
-
- strtobin(character_array, character_array_string);
-
- new character_query[132 + MAX_PLAYER_NAME + 1], name[24 + 1];
- format(character_query, sizeof(character_query), "SELECT name, skin_id, cash, armour, health, pos_x, pos_y, pos_z, rotation, world_id, interior_id, job_id FROM character WHERE id = %i", character_array[listitem]);
- new Result:character_result = sql_query(sqlHandle, character_query);
- sql_get_field_assoc(character_result, "name", name, sizeof(name));
- new skin_id = sql_get_field_assoc_int(character_result, "skin_id");
- new cash = sql_get_field_assoc_int(character_result, "cash");
- new Float:armour = sql_get_field_assoc_int(character_result, "armour");
- new Float:health = sql_get_field_assoc_int(character_result, "health");
- new Float:pos_x = sql_get_field_assoc_int(character_result, "pos_x");
- new Float:pos_y = sql_get_field_assoc_int(character_result, "pos_y");
- new Float:pos_z = sql_get_field_assoc_int(character_result, "pos_z");
- new Float:rotation = sql_get_field_assoc_int(character_result, "rotation");
- new world_id = sql_get_field_assoc_int(character_result, "world_id");
- new interior_id = sql_get_field_assoc_int(character_result, "interior_id");
- //new job_id = sql_get_field_assoc_int(character_result, "job_id");
-
- // Temporary bug workaround TODO find cause
- if(pos_x == 0 && pos_y == 0 && pos_z == 0){ // Sometimes this happens. Due to unreliable OnPlayerDisconnect() & OnGamemodeExit(), due to character creation, or due to (forgot the other possiblity, but had a strong hunch)?
- pos_x = -144.0328;
- pos_y = 1225.0564;
- pos_z = 19.8992;
- rotation = 175.5507;
- }
- SetSpawnInfo(playerid, 0, skin_id, pos_x, pos_y, pos_z, rotation, 0, 0, 0, 0, 0, 0);
- SetGVarInt("character_id", character_array[listitem], playerid);
-
- SetPlayerName(playerid, name); // Change name in-game
- SetPlayerColor(playerid, COLOR_WHITE);
- SpawnPlayer(playerid);
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, cash);
- SetPlayerHealth(playerid, health);
- SetPlayerArmour(playerid, armour);
- SetPlayerVirtualWorld(playerid, world_id);
- SetPlayerInterior(playerid, interior_id);
- // TODO design a way to keep job on rejoin
-
- // Notify all players
- new message[16 + 4 + MAX_PLAYER_NAME + 1];
- format(message, sizeof(message), "* [%i] %s joined.", playerid, getCharacterName(playerid));
- SendClientMessageToAll(COLOR_NOTICE, message); // Notify all players.
- DiscordEcho(message, ECHO_CHANNEL); // Notify discord public echo
-
- }
- else{ // New character
- // character cap
- new id = getUserID(playerid);
- new character_query[60 + MAX_SQL_INTEGER + 1];
- format(character_query, sizeof(character_query), "SELECT id FROM character WHERE character_id = %i", id);
- new Result:character_result = sql_query(sqlHandle, character_query);
- printf("%i", sql_num_rows(character_result));
- if(sql_num_rows(character_result) >= MAX_CHARACTERS_PER_USER){ // At or over character limit
- SendClientMessage(playerid, COLOR_WARNING, "SERVER: Maximum characters reached, can not create another.");
- characterSelection(playerid);
- }
- else{
- ShowPlayerDialog(playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT, "Character name", "Pick a name.\n\nExamples:\n Jo_Bo\n Dingle_P._J._Berry\n Jackson_DeForest_Kelley\n MaryJo_Ann_LaFluer", "Change", ""); // Force RP name.
- // changeName(playerid, ""); // Pick name and save character ANNOYING this forces new character creation, no way out.
- }
-
- }
- }
- case DIALOG_LOGIN_FAILED:{
- ShowPlayerDialog(playerid, DIALOG_LOGIN_FAILED, DIALOG_STYLE_MSGBOX, "Authenticaion failed", "Take some time to think about your password...", "Wait", "Longer");
- }
- case DIALOG_DELETE_CHARACTER:{
- if(response){ // Delete character
- new playername[MAX_PLAYER_NAME + 1];
- playername = getPlayerName(playerid);
-
- // Checkcharacter amount
- new id = getUserID(playerid), character_query[75 + MAX_SQL_INTEGER + MAX_CHARACTERS_PER_USER_DIGITS + 1];
- format(character_query, sizeof(character_query), "SELECT id, name FROM character WHERE user_id = %i LIMIT %i", id, MAX_CHARACTERS_PER_USER);
- new Result:character_result = sql_query(sqlHandle, character_query);
- if(sql_num_rows(character_result) < 2){ // 1 character or less
- SendClientMessage(playerid, COLOR_WARNING, "SERVER: You can not have less then one character.\nCreate another character,before deleting this one.");
-
- }
- else{ // More then 1 character
- // delete character record
- new delete_query[50 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
- format(delete_query, sizeof(delete_query), "DELETE FROM character WHERE name = '%s' AND user_id = %i", playername, getUserID(playerid));
- sql_query(sqlHandle, delete_query);
-
- // infordm admin echo
- new client_connect_username[MAX_PLAYER_NAME + 1], message[28 + 4 + MAX_PLAYER_NAME + MAX_PLAYER_NAME + 1];
- GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid); // Get client connect name
- format(message, sizeof(message), "* [%i] %s has been deleted by it's user: %s", playerid, getCharacterName(playerid), client_connect_username);
- DiscordEcho(message, ADMIN_ECHO_CHANNEL);
- sendToAdmins(COLOR_COMMAND_OUTPUT, message);
-
- // Player must not be spawned or will be able to esacpe the character menu and continue with character without dartabase record
- ForceClassSelection(playerid);
- TogglePlayerSpectating(playerid, true);
- TogglePlayerSpectating(playerid, false);
-
- characterSelection(playerid);
- }
- }
- }
- case DIALOG_GOTO:{
- if(response){
- switch(listitem){
- case GOTO_CATEGORY_INTERIOR:{
- dialogGotoInterior(playerid);
- }
- /*case GOTO_CATEGORY_PLAYER:{
- dialogGotoPlayer(playerid);
- }*/
- }
- }
- }
- case DIALOG_GOTO_INTERIOR:{
- if(response){
- switch(listitem){
-
- case INTERIOR_CATEGORY_AVIATION:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_AVIATION, DIALOG_STYLE_TABLIST, "Aviation interiors", "Francis Intn'l Airport - Ticket sales\tStarting Cutscene\nFrancis Intn'l Airport - Baggage claim\tStarting Cutscene\nShamal cabin\tMission \"Free Fall\"\nAndromada cargo hold\tMission \"Stowaway\"\nLS Airport, Baggage Reclaim\tCutscene in \"Opening Mission\"", "Goto", "Cancel");
- }
- case INTERIOR_CATEGORY_HOUSES:{
- dialogGotoHouses(playerid);
- }
- case INTERIOR_CATEGORY_MISSION:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_MISSION, DIALOG_STYLE_TABLIST, "Mission interiors", "Atrium\tMission \"Just Business\"\tLS\nBig Smoke's Crack Palace\tMission \"End of the Line\"\nJefferson Motel\tMission \"Reuniting the Families\"\tLS\nPleasure Domes/Jizzy's\tMission \"Ice Cold Killa\"\tSF\nRC Battlefield\tMission \"New Model Army\"\nWoozies Apartment/Wu-Zi Mu's\t\tSF\n", "Goto", "Cancel");
- }
- case INTERIOR_CATEGORY_MISSIONEXT:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_MISSIONEXT, DIALOG_STYLE_TABLIST, "Mission exteriors", "Dillimore Gas Station\tMission \"Tanker Commander\"\nLiberty City\tMission \"Saint Marks Bistro\"\nSan Fierro Garage\tDoherty (Locked Camera Position}", "Goto", "Cancel");
- }
- case INTERIOR_CATEGORY_POLICE:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_POLICE, DIALOG_STYLE_LIST, "Police departments", "Las Venturas\nLos Santos\nSan Fierro\nBarbara's love nest", "Goto", "Cancel");
- }
- case INTERIOR_CATEGORY_SEXWORK:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_SEXWORK, DIALOG_STYLE_LIST, "Brothels & stip clubs", "Brother\nBrother2\nBig spread ranch\tBC\n", "Goto", "Cancel");
- }
- case INTERIOR_CATEGORY_SHOPS:{
- dialogGotoShops(playerid);
- }
- case INTERIOR_CATEGORY_STADIA:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_STADIA, DIALOG_STYLE_TABLIST, "Stadia", "Bloodbowl stadium\nKickstart stadium\n8 Track stadium\nDirtbike stadium\n", "Goto", "Cancel");
- }
- }
- }
- else{
- ShowPlayerDialog(playerid, DIALOG_GOTO, DIALOG_STYLE_LIST, "Categories", "Interiors\nPlayers", "Select", "Cancel");
- }
- }
- case DIALOG_GOTO_HOUSES:{
- if(response){
- switch(listitem){
- case INTERIOR_HOUSE_CAT_BURGLARY:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_BURGLARYHOUSE, DIALOG_STYLE_TABLIST, "Burglary houses", "Large\t2 story\t3 bedroom clone of house 9\t\nMedium\t1 story\t1 bedroom\tEast LS\nSmall\t1 story\t1 bedroom\tCalton Heights, SF\nVery large\t2 story\t4 bedrooms\nSmall\t1 story\t2 bedrooms\tJefferson LS\nSmall\t1 story\t2 bedrooms\tEast LS\nSmall\t1 story\t1 bedroom (NO BATHROOM!)", "Goto", "Cancel");
- }
- case INTERIOR_HOUSE_CAT_MISSION:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_MISSIONHOUSE, DIALOG_STYLE_TABLIST, "Mission houses", "Burning Desire house\t\tEast LS\nColonel Furhberger's\tMission \"Home Invasion\"\t Los Flores, LS\nRyder's house\nSweet's house\tCutscene in \"First Date\"\nCrack Den\tMission \"Cleaning The Hood\"", "Goto", "Cancel");
- }
- case INTERIOR_HOUSE_CAT_SAFE:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_SAFEHOUSE, DIALOG_STYLE_TABLIST, "Safe houses", "Golden Bed motel room\t\t\nHashbury house\tHashburry\tSF\nThe Johnson house\tGanton\tLS\nMadd Doggs mansion\tMulholland\tLS\nRed Bed motel Room\nVerdant Bluffs safehouse\tVerdant Bluffs\t LV\nUnused safehouse\tLarge modern safehouse", "Goto", "Cancel");
- }
- case INTERIOR_HOUSE_CAT_U:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_UHOUSE, DIALOG_STYLE_TABLIST, "To be categorized houses", "", "Goto", "Cancel");
- }
- }
- }
- else{
- dialogGotoInterior(playerid);
- }
- }
- case DIALOG_GOTO_SHOPS:{
- if(response){
- switch(listitem){
- case INTERIOR_SHOP_CAT_247:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_247, DIALOG_STYLE_TABLIST, "24/7's", "L-shaped\tBig\tNO EXIT\nOblong\tBig\tNO EXIT\nSquare\tMedium\tCreek, LV\nSquare\tMedium\tNO EXIT\nLong\tSmall\tMulholland\nSquare\tSmall\tWhetstone", "Goto", "Cancel");
- }
- case INTERIOR_SHOP_CAT_AMMUNATION:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_AMMUNATION, DIALOG_STYLE_TABLIST, "Ammunation's", "Ocean Flats\tSF\nPalomino Creek\tLV\nAngel Pine\tSF\nEl Quebrados\tLV\n2 Stories/t with Booth and Range\n Booth\n Range", "Goto", "Cancel");
- }
- case INTERIOR_SHOP_CAT_CASINO:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_SHOP, DIALOG_STYLE_TABLIST, "Casino's", "Caligulas casino\tThe Strip\tLV\nCasino (Redsands West)\tThe Strip\tLV\n4 Dragons casino\tThe Strip\tLV\n Four Dragons' Managerial Suite", "Goto", "Cancel");
- }
- case INTERIOR_SHOP_CAT_MODSHOP:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_MODDING, DIALOG_STYLE_TABLIST, "Modding shops", "Loco Low Co\tLos Santos\nWheel Arch Angels\tSan Fierro\nTransfender", "Goto", "Cancel");
- }
- case INTERIOR_SHOP_CAT_SHOP:{
- ShowPlayerDialog(playerid, DIALOG_GOTO_SHOP, DIALOG_STYLE_TABLIST, "Stores & parlors", "Tattoos\tIdlewood\tLS\nBurger Shot\tWhitewood Estates\nWell Stacked Pizza\tBlueberry\nCluckin' Bell\nRusty Brown's donuts\tMission \"Burning Desire\"\nZero's RC shop\tGarcia\tSF\nThe Welcome Pump\nGanton Gym\tGanton\tLS\nInside Track Betting\nBlastin' Fools Records", "Goto", "Cancel");
- }
- }
- }
- else{
- dialogGotoInterior(playerid);
- }
- }
- case DIALOG_GOTO_247:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[25 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_247_LSHAPED:{
- x = -25.7220;
- y = -187.8216;
- z = 1003.5469;
- interior = 17;
- angle = 5.0760;
- name = "L-shaped ammunation";
- }
- case INTERIOR_247_OBLONG:{
- x = 6.0856;
- y = -28.8966;
- z = 1003.5494;
- interior = 10;
- angle = 5.0365;
- name = "Oblong ammunation";
- }
- case INTERIOR_247_MEDIUM:{
- x = -30.9875;
- y = -89.6806;
- z = 1003.5469;
- interior = 18;
- angle = 359.8401;
- name = "Medium ammunation";
- }
- case INTERIOR_247_MEDIUM_NOEXIT:{
- x = -26.1856;
- y = -140.9164;
- z = 1003.5469;
- interior = 16;
- angle = 2.9087;
- name = "Medium no exit ammunation";
- }
- case INTERIOR_247_LONG:{
- x = -27.844;
- y = 26.6737;
- z = 1003.5573;
- interior = 4;
- angle = 184.3118;
- name = "Small long ammunation";
- }
- case INTERIOR_247_SQAURE:{
- x = -26.8339,
- y = -55.5846,
- z = 1003.5469,
- interior = 6,
- angle = 3.9528;
- name = "Small square ammunation";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoShops(playerid);}
- }
- case DIALOG_GOTO_AVIATION:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[39 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_AVIATION_TICKET:{
- x = -1827.147338;
- y = 7.207418;
- z = 1061.143554;
- interior = 14;
- angle = 335.3199;
- name = "Francis Intn'l Airport - Ticket sales";
- }
- case INTERIOR_AVIATION_BAGGAGE:{
- x = -1855.568725;
- y = 41.263156;
- z = 1061.143554;
- interior = 14;
- angle = 335.3199;
- name = "Francis Intn'l Airport - Baggage claim";
- }
- case INTERIOR_AVIATION_SHAMAL:{
- x = 2.384830;
- y = 33.103397;
- z = 1199.849976 ;
- interior = 1;
- angle = 359.8401;
- name = "Shamal cabin";
- }
- case INTERIOR_AVIATION_ANDROMADA:{
- x = 315.856170;
- y = 1024.496459;
- z = 1949.797363;
- interior = 9;
- angle = 359.6368;
- name = "Andromada cargo hold";
- }
- case INTERIOR_AVIATION_LSAIRPORT:{
- x = -1870.80;
- y = 59.81;
- z = 1056.25;
- interior = 14;
- angle = 85.8541;
- name = "LS Airport, Baggage Reclaim";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoInterior(playerid);}
- }
- case DIALOG_GOTO_AMMUNATION:{ // TODO there are more ammunations that deserve a booth and range teleport
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[31 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_AMMU_OCEAN:{
- x = 286.148987;
- y = -40.644398 ;
- z = 1001.569946;
- interior = 1;
- angle = 0.7529;
- name = "Ocean Flats, SF";
- }
- case INTERIOR_AMMU_PALOMINO:{
- x = 286.800995;
- y = -82.547600;
- z = 1001.539978;
- interior = 4;
- angle = 290.2195;
- name = "Palomino Creek, LV";
- }
- case INTERIOR_AMMU_ANGEL:{
- x = 296.919983;
- y = -108.071999;
- z = 1001.569946;
- interior = 6;
- angle = 290.2195;
- name = "Angel Pine, SF";
- }
- case INTERIOR_AMMU_QUEBRADOS:{
- x = 316.524994;
- y = -167.706985;
- z = 999.661987;
- interior = 6;
- angle = 10.3031;
- name = "El Quebrados, LV";
- }
- case INTERIOR_AMMU_2STORIES:{
- x = 314.820984;
- y = -141.431992;
- z = 999.661987;
- interior = 7;
- angle = 20.2254;
- name = "2 Stories, with booth and range";
- }
- case INTERIOR_AMMU_BOOTH:{
- x = 302.292877;
- y = -143.139099;
- z = 1004.062500;
- interior = 7;
- angle = 20.2254;
- name = "Booth";
- }
- case INTERIOR_AMMU_RANGE:{
- x = 280.795104;
- y = -135.203353;
- z = 1004.062500;
- interior = 7;
- angle = 20.2254;
- name = "Range";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoShops(playerid);}
- }
- case DIALOG_GOTO_BURGLARYHOUSE:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[45 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_BURGRLARY_LARGE:{
- x = 235.508994;
- y = 1189.169897;
- z = 1080.339966;
- interior = 3;
- angle = 349.4844;
- name = "Large: 2 story, 3 bedroom clone of house 9";
- }
- case INTERIOR_BURGRLARY_MEDIUM:{
- x = 225.756989;
- y = 1240.000000;
- z = 1082.149902;
- interior = 2;
- angle = 96.2852;
- name = "Medium: 1 story, 1 bedroom";
- }
- case INTERIOR_BURGRLARY_SMALL:{
- x = 223.043991;
- y = 1289.259888;
- z = 1082.199951;
- interior = 1;
- angle = 359.868;
- name = "Small: 1 story, 1 bedroom";
- }
- case INTERIOR_BURGRLARY_VERYLARGE:{
- x = 225.630997;
- y = 1022.479980;
- z = 1084.069946;
- interior = 7;
- angle = 270.2654;
- name = "VERY Large: 2 story, 4 bedrooms";
- }
- case INTERIOR_BURGRLARY_5:{
- x = 295.138977;
- y = 1474.469971;
- z = 1080.519897;
- interior = 15;
- angle = 0;
- name = "Small: 1 story, 2 bedrooms";
- }
- case INTERIOR_BURGRLARY_6:{
- x = 328.493988;
- y = 1480.589966;
- z = 1084.449951;
- interior = 15;
- angle = 0;
- name = "Small: 1 story, 2 bedrooms";
- }
- case INTERIOR_BURGRLARY_NOBATH:{
- x = 385.803986;
- y = 1471.769897;
- z = 1080.209961;
- interior = 15;
- angle = 0;
- name = "Small: 1 story, 1 bedroom (NO BATHROOM!)";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoHouses(playerid);}
- }
- case DIALOG_GOTO_CASINO:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[30 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_CASINO_CALIGULAS:{
- x = 2233.8032;
- y = 1712.2303;
- z = 1011.7632;
- interior = 1;
- angle = 184.3891;
- name = "Caligulas Casino";
- }
- case INTERIOR_CASINO_REDLAND:{
- x = 1118.8878;
- y = -10.2737;
- z = 1002.0859;
- interior = 12;
- angle = 165.8482;
- name = "Casino (Redsands West)";
- }
- case INTERIOR_CASINO_4DRAGONS:{
- x = 2016.2699;
- y = 1017.7790;
- z = 996.8750;
- interior = 10;
- angle = 88.0055;
- name = "4 Dragons Casino";
- }
- case INTERIOR_CASINO_4DRAGONSUITE:{
- x = 2003.1178;
- y = 1015.1948;
- z = 33.008;
- world = GetPlayerVirtualWorld(playerid);
- interior = 11;
- angle = 351.5789;
- name = "Four Dragons' Managerial Suite";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoInterior(playerid);}
- }
- case DIALOG_GOTO_MISSION:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[30 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_MISSION_ATRIUM:{
- x = 1726.18;
- y = -1641.00;
- z = 20.23;
- interior = 18;
- angle = 172.4193;
- name = "Atrium";
- }
- case INTERIOR_MISSION_BIGSMOKE:{
- x = 2567.52;
- y = -1294.59;
- z = 1063.25 ;
- interior = 2;
- angle = 254.9548;
- name = "Big Smoke's Crack Palace";
- }
- case INTERIOR_MISSION_JEFFERSON:{
- x = 2220.26;
- y = -1148.01;
- z = 1025.80;
- interior = 15;
- angle = 273.7328;
- name = "Jefferson Motel";
- }
- case INTERIOR_MISSION_JIZZY:{
- x = -2637.69;
- y = 1404.24;
- z = 906.46;
- interior = 3;
- angle = 94.6794;
- name = "Pleasure Domes/Jizzy's";
- }
- case INTERIOR_MISSION_RC:{
- x = -1079.99;
- y = 1061.58;
- z = 1343.04;
- interior = 10;
- angle = 274.5268;
- name = "RC Battlefield";
- }
- case INTERIOR_MISSION_WUZI:{
- x = -2158.72;
- y = 641.29;
- z = 1052.38;
- interior = 1;
- angle = 86.5402;
- name = "Woozies Apartment/Wu-Zi Mu's";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoInterior(playerid);}
- }
- case DIALOG_GOTO_MISSIONEXT:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[30 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_MISSIONEXT_GAS:{
- x = 664.19;
- y = -570.73;
- z = 16.34;
- interior = 0;
- angle = 264.9829;
- name = "Dillimore Gas Station";
- }
- case INTERIOR_MISSIONEXT_LIBERTY:{ // TODO Create extra interior inside the shop
- x = -750.80;
- y = 491.00;
- z = 1371.70;
- interior = 1;
- angle = 71.7782;
- name = "Liberty City";
- }
- case INTERIOR_MISSIONEXT_SFGARAGE:{ // TODO Create extra interior of area that does not capture the camera & see about the camera camera capturing (Use it for broadcast? & In other world or interior place more usable?)
- x = -2042.42;
- y = 178.59;
- z = 28.84;
- interior = 1;
- angle = 156.2153;
- name = "San Fierro Garage Interior";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoInterior(playerid);}
- }
- case DIALOG_GOTO_MISSIONHOUSE:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[30 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_MISSIONHOUSE_DESIRE:{
- x = 2338.32;
- y = -1180.61;
- z = 1027.98;
- interior = 5;
- angle = 99.1864;
- name = "Burning Desire House";
- }
- case INTERIOR_MISSIONHOUSE_COLONEL:{
- x = 2807.63;
- y = -1170.15;
- z = 1025.57;
- interior = 8;
- angle = 193.7117;
- name = "Colonel Furhberger's";
- }
- case INTERIOR_MISSIONHOUSE_RYDER:{
- x = 2451.77;
- y = -1699.80;
- z = 1013.51;
- interior = 2;
- angle = 314.5253;
- name = "Ryder's House";
- }
- case INTERIOR_MISSIONHOUSE_SWEET:{
- x = 2535.83;
- y = -1674.32;
- z = 1015.50;
- interior = 1;
- angle = 260.9709;
- name = "Sweet's House";
- }
- case INTERIOR_MISSIONHOUSE_CRACK:{
- x = 318.565;
- y = 1115.210;
- z = 1082.98;
- interior = 5;
- angle = 267.459;
- name = "Crack den";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoHouses(playerid);}
- }
- case DIALOG_GOTO_MODDING:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[25 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_MOD_LOCO:{
- x = 616.7820;
- y = -74.8151;
- z = 997.6350;
- interior = 2;
- angle = 320.9263;
- name = "Loco Low Co";
- }
- case INTERIOR_MOD_WHEEL:{
- x = 615.2851;
- y = -124.2390;
- z = 997.6350;
- interior = 3;
- angle = 266.5704;
- name = "Wheel Arch Angels";
- }
- case INTERIOR_MOD_TRANSFENDER:{
- x = 617.5380;
- y = -1.9900;
- z = 1000.6829;
- interior = 1;
- angle = 15.6789;
- name = "Transfender";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoShops(playerid);}
- }
- case DIALOG_GOTO_POLICE:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[30 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_PD_LV:{
- x = 288.4723;
- y = 170.0647;
- z = 1007.1794;
- interior = 3;
- angle = 22.0477;
- name = "Las Venturas police deparment";
- }
- case INTERIOR_PD_LS:{
- x = 246.6695;
- y = 65.8039;
- z = 1003.6406;
- interior = 6;
- angle = 7.9562;
- name = "Los Santos police deparment";
- }
- case INTERIOR_PD_SF:{
- x = 246.0688;
- y = 108.9703;
- z = 1003.2188;
- interior = 10;
- angle = 0.2922;
- name = "San Fierro police deparment";
- }
- case INTERIOR_PD_BARBARA:{
- x = 322.5014;
- y = 303.6906;
- z = 999.1484;
- interior = 5;
- angle = 8.1747;
- name = "Barbara's Love nest";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoInterior(playerid);}
- }
- case DIALOG_GOTO_SAFEHOUSE:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[25 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_HOUSE_GOLDEN:{
- x = 2251.85;
- y = -1138.16;
- z = 1050.63;
- interior = 9;
- angle = 167.3959;
- name = "Golden Bed motel room";
- }
- case INTERIOR_HOUSE_HASHBURY:{
- x = 2260.76;
- y = -1210.45;
- z = 1049.02;
- interior = 10;
- angle = 266.88;
- name = "Hashbury house";
- }
- case INTERIOR_HOUSE_JOHNSON:{
- x = 2496.65;
- y = -1696.55;
- z = 1014.74;
- interior = 3;
- angle = 179.2174;
- name = "The Johnson house";
- }
- case INTERIOR_HOUSE_MADDDOGG:{
- x = 1299.14;
- y = -794.77;
- z = 1084.00;
- interior = 5;
- angle = 231.3418;
- name = "Madd Doggs mansion";
- }
- case INTERIOR_HOUSE_RED:{
- x = 2262.83;
- y = -1137.71;
- z = 1050.63;
- interior = 10;
- angle = 266.88;
- name = "Red Bed motel room";
- }
- case INTERIOR_HOUSE_VERDANT:{
- x = 2365.42;
- y = -1131.85;
- z = 1050.88;
- interior = 8;
- angle = 177.3947;
- name = "Verdant Bluffs safehouse";
- }
- case INTERIOR_HOUSE_UNUSED:{
- x = 2324.33;
- y = -1144.79;
- z = 1050.71;
- interior = 12;
- angle = 269.0954;
- name = "Unused safe house";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoHouses(playerid);}
- }
- case DIALOG_GOTO_SHOP:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[30 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_SHOP_TATTOO:{
- x = -203.0764;
- y = -24.1658;
- z = 1002.2734;
- interior = 16;
- angle = 252.8154;
- name = "Tattoos";
- }
- case INTERIOR_SHOP_BURGER:{
- x = 366.0248;
- y = -73.3478;
- z = 1001.5078;
- interior = 10;
- angle = 292.0084;
- name = "Burger Shot";
- }
- case INTERIOR_SHOP_PIZZA:{
- x = 372.3520;
- y = -131.6510;
- z = 1001.4922;
- interior = 5;
- angle = 354.2285;
- name = "Well Stacked Pizza";
- }
- case INTERIOR_SHOP_CLUCKIN:{
- x = 365.7158;
- y = -9.8873;
- z = 1001.8516;
- interior = 9;
- angle = 160.528;
- name = "Cluckin' Bell";
- }
- case INTERIOR_SHOP_DONUTS:{
- x = 376.99;
- y = -191.21;
- z = 1000.63;
- interior = 17;
- angle = 141.0245;
- name = "Rusty Brown's donuts";
- }
- case INTERIOR_SHOP_RC:{
- x = -2240.00;
- y = 131.00;
- z = 1035.40;
- interior = 6;
- angle = 269.0954;
- name = "Zero's RC shop";
- }
- case INTERIOR_SHOP_PUMP:{
- x = 681.66;
- y = -453.32;
- z = -25.61;
- interior = 1;
- angle = 166.166;
- name = "The Welcome Pump";
- }
- case INTERIOR_SHOP_GYM:{
- x = 770.8033;
- y = -0.7033;
- z = 1000.7267;
- world = GetPlayerVirtualWorld(playerid);
- interior = 5;
- angle = 22.8599;
- name = "Ganton Gym";
- }
- case INTERIOR_SHOP_BETTING:{
- x = 830.6016;
- y = 5.9404;
- z = 1004.1797;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 125.8149;
- name = "Inside Track Betting";
- }
- case INTERIOR_SHOP_RECORDS:{
- x = 1037.8276;
- y = 0.397;
- z = 1001.2845;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 353.9335;
- name = "Blastin' Fools Records";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoShops(playerid);}
- }
- case DIALOG_GOTO_STADIA:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[25 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_STADIUM_BLOODBOWL:{
- x = -1394.20;
- y = 987.62;
- z = 1023.96;
- interior = 15;
- angle = 0.7013;
- name = "Bloodbowl Stadium";
- }
- case INTERIOR_STADIUM_KICKSTART:{
- x = -1410.72;
- y = 1591.16;
- z = 1052.53;
- interior = 14;
- angle = 159.1255;
- name = "Kickstart Stadium";
- }
- case INTERIOR_STADIUM_8TRACK:{
- x = -1395.958;
- y = -208.197;
- z = 1051.170;
- interior = 7;
- angle = 355.8576;
- name = "8 Track Stadium";
- }
- case INTERIOR_STADIUM_DIRTBIKE:{
- x = -1424.9319;
- y = -664.5869;
- z = 1059.8585;
- interior = 4;
- angle = 170.9341;
- name = "Dirtbike Stadium";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoInterior(playerid);}
- }
- case DIALOG_GOTO_SEXWORK:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[31 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_SEXWORK_BROTHEL:{
- x = 974.0177;
- y = -9.5937;
- z = 1001.1484;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 22.6045;
- name = "Brothel";
- }
- case INTERIOR_SEXWORK_BROTHEL2:{
- x = 961.9308;
- y = -51.9071;
- z = 1001.1172;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 95.5381;
- name = "Brothel2";
- }
- case INTERIOR_SEXWORK_BIGSPREAD:{
- x = 1212.1489;
- y = -28.5388;
- z = 1000.9531;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 170.5692;
- name = "The Big Spread Ranch";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoInterior(playerid);}
- }
-
- /*case DIALOG_GOTO_UNCATAGORIZED:{
- if(response){
- new Float:x, Float:y, Float:z, world, interior, Float:angle, name[31 + 1];
- world = GetPlayerVirtualWorld(playerid);
- switch(listitem){
- case INTERIOR_UNCATEGORIZED_WAREHOUSE1:{
- x = 1290.4106;
- y = 1.9512;
- z = 1001.0201;
- world = GetPlayerVirtualWorld(playerid);
- interior = 18;
- angle = 179.9419;
- name =" Warehouse 1";
- }
- case INTERIOR_UNCATEGORIZED_WAREHOUSE2:{
- x = 1412.1472;
- y = -2.2836;
- z = 1000.9241;
- world = GetPlayerVirtualWorld(playerid);
- interior = 1;
- angle = 114.661;
- name = "Warehouse 2";
- }
- case INTERIOR_UNCATEGORIZED_BDUPAPPARTMENT:{
- x = 1527.0468;
- y = -12.0236;
- z = 1002.0971;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 350.0013;
- name = "B Dup's Apartment";
- }
- case INTERIOR_UNCATEGORIZED_PALACE:{
- x = 1523.5098;
- y = -47.8211;
- z = 1002.2699;
- world = GetPlayerVirtualWorld(playerid);
- interior = 2;
- angle = 262.7038;
- name = "B Dup's Crack Palace";
- }
- case INTERIOR_UNCATEGORIZED_OGLOC:{
- x = 512.9291;
- y = -11.6929;
- z = 1001.5653;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 198.7669;
- name = "OG Loc's House";
- }
- case INTERIOR_UNCATEGORIZED_:{
- x = 418.4666;
- y = -80.4595;
- z = 1001.8047;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 343.2358;
- name = "Barber Shop";
- }
- case INTERIOR_UNCATEGORIZED_PLANDEPT:{
- x = 386.5259;
- y = 173.6381;
- z = 1008.3828;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 63.7399;
- name = "Planning Department";
- }
- case INTERIOR_:{
- x = 206.4627;
- y = -137.7076;
- z = 1003.0938;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 10.9347;
- name = "Pro-Laps";
- }
- case INTERIOR_SHOP_SEX:{
- x = -100.2674;
- y = -22.9376;
- z = 1000.7188;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 17.285;
- name = "Sex Shop";
- }
- case INTERIOR_SHOP_LVTATTOO:{
- x = -201.2236;
- y = -43.2465;
- z = 1002.2734;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 45.8613;
- name = "Las Venturas Tattoo parlor";
- }
- case INTERIOR_SHOP_SFTATTOO:{
- x = -202.9381;
- y = -6.7006;
- z = 1002.2734;
- world = GetPlayerVirtualWorld(playerid);
- interior = 17;
- angle = 204.2693;
- name = "Lost San Fierro Tattoo parlor";
- }
- case INTERIOR_UNCATEGORIZED_DINER1:{
- x = 454.9853;
- y = -107.2548;
- z = 999.4376;
- world = GetPlayerVirtualWorld(playerid);
- interior = 5;
- angle = 309.0195;
- name = "Diner 1";
- }
- case INTERIOR_:{
- x = 372.5565;
- y = -131.3607;
- z = 1001.4922;
- world = GetPlayerVirtualWorld(playerid);
- interior = 5;
- angle = 354.2285;
- name = "Pizza Stack";
- }
- case INTERIOR_:{
- x = 378.026;
- y = -190.5155;
- z = 1000.6328;
- world = GetPlayerVirtualWorld(playerid);
- interior = 17;
- angle = 141.0245;
- name = "Rusty Brown's Donuts";
- }
- case INTERIOR_SHOP_VICTIM:{
- x = 225.0306;
- y = -9.1838;
- z = 1002.218;
- world = GetPlayerVirtualWorld(playerid);
- interior = 5;
- angle = 85.5322;
- name = "Victim";
- }
- case INTERIOR_SHOP_GYM:{
- x = 773.7318;
- y = -74.6957;
- z = 1000.6542;
- world = GetPlayerVirtualWorld(playerid);
- interior = 7;
- angle = 5.2304;
- name = "Below The Belt Gym (Las Venturas)";
- }
- case INTERIOR_UNCATEGORIZED_COQ:{
- x = 445.6003;
- y = -6.9823;
- z = 1000.7344;
- world = GetPlayerVirtualWorld(playerid);
- interior = 1;
- angle = 172.2105;
- name = "World of Coq";
- }
- case INTERIOR_SHOP_URBAN:{
- x = 204.1174;
- y = -46.8047;
- z = 1001.8047;
- world = GetPlayerVirtualWorld(playerid);
- interior = 1;
- angle = 357.5777;
- name = "SubUrban";
- }
- case INTERIOR_GIRL_DENISE:{
- x = 245.2307;
- y = 304.7632;
- z = 999.1484;
- world = GetPlayerVirtualWorld(playerid);
- interior = 1;
- angle = 273.4364;
- name = "Denise's Bedroom";
- }
- case INTERIOR_GIRL_HELENA:{
- x = 290.623;
- y = 309.0622;
- z = 999.1484;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 89.9164;
- name = "Helena's Barn";
- }
- case INTERIOR_:{
- x = -2041.2334;
- y = 178.3969;
- z = 28.8465;
- world = GetPlayerVirtualWorld(playerid);
- interior = 1;
- angle = 156.2153;
- name = "San Fierro Garage";
- }
- case INTERIOR_UNCATEGORIZED_STIPCLUB:{
- x = 1204.6689;
- y = -13.5429;
- z = 1000.9219;
- world = GetPlayerVirtualWorld(playerid);
- interior = 2;
- angle = 350.0204;
- name = "The Pig Pen (strip club 2)";
- }
- case INTERIOR_:{
- x = -741.8495;
- y = 493.0036;
- z = 1371.9766;
- world = GetPlayerVirtualWorld(playerid);
- interior = 1;
- angle = 71.7782;
- name = "Liberty City";
- }
- case INTERIOR_:{
- x = 366.0248;
- y = -73.3478;
- z = 1001.5078;
- world = GetPlayerVirtualWorld(playerid);
- interior = 10;
- angle = 292.0084;
- name = "Burger shot";
- }
- case INTERIOR_GIRL_KATIE:{
- x = 269.6405;
- y = 305.9512;
- z = 999.1484;
- world = GetPlayerVirtualWorld(playerid);
- interior = 2;
- angle = 215.6625;
- name = "Katie's Lovenest";
- }
- case INTERIOR_SHOP_BARBER2:{
- x = 414.2987;
- y = -18.8044;
- z = 1001.8047;
- world = GetPlayerVirtualWorld(playerid);
- interior = 2;
- angle = 41.4265;
- name = "Barber Shop 2 (Reece's)";
- }
- case INTERIOR_:{
- x = 1.1853;
- y = -3.2387;
- z = 999.4284;
- world = GetPlayerVirtualWorld(playerid);
- interior = 2;
- angle = 87.5718;
- name = "Angel Pine Trailer";
- }
- case INTERIOR_SHIP_ZIP:{
- x = 161.4048;
- y = -94.2416;
- z = 1001.8047;
- world = GetPlayerVirtualWorld(playerid);
- interior = 18;
- angle = 0.7938;
- name = "Zip";
- }
- case INTERIOR_:{
- x = 1267.8407;
- y = -776.9587;
- z = 1091.9063;
- world = GetPlayerVirtualWorld(playerid);
- interior = 5;
- angle = 231.3418;
- name = "Madd Dogg's Mansion";
- }
- case INTERIOR_:{
- x = 2536.5322;
- y = -1294.8425;
- z = 1044.125;
- world = GetPlayerVirtualWorld(playerid);
- interior = 2;
- angle = 254.9548;
- name = "Big Smoke's Crack Palace";
- }
- case INTERIOR_:{
- x = 2350.1597;
- y = -1181.0658;
- z = 1027.9766;
- world = GetPlayerVirtualWorld(playerid);
- interior = 5;
- angle = 99.1864;
- name = "Burning Desire Building";
- }
- case INTERIOR_:{
- x = -2158.6731;
- y = 642.09;
- z = 1052.375;
- world = GetPlayerVirtualWorld(playerid);
- interior = 1;
- angle = 86.5402;
- name = "Wu-Zi Mu's";
- }
- case INTERIOR_:{
- x = 419.8936;
- y = 2537.1155;
- z = 10;
- world = GetPlayerVirtualWorld(playerid);
- interior = 10;
- angle = 67.6537;
- name = "Abandoned AC tower";
- }
- case INTERIOR_:{
- x = 256.9047;
- y = -41.6537;
- z = 1002.0234;
- world = GetPlayerVirtualWorld(playerid);
- interior = 14;
- angle = 85.8774;
- name = "Wardrobe/Changing room";
- }
- case INTERIOR_:{
- x = 204.1658;
- y = -165.7678;
- z = 1000.5234;
- world = GetPlayerVirtualWorld(playerid);
- interior = 14;
- angle = 181.7583;
- name = "Didier Sachs";
- }
- case INTERIOR_:{
- x = 493.1443;
- y = -24.2607;
- z = 1000.6797;
- world = GetPlayerVirtualWorld(playerid);
- interior = 17;
- angle = 356.9864;
- name = "Club";
- }
- case INTERIOR_:{
- x = 1727.2853;
- y = -1642.9451;
- z = 20.2254;
- world = GetPlayerVirtualWorld(playerid);
- interior = 18;
- angle = 172.4193;
- name = "Atrium";
- }
- case INTERIOR_:{
- x = -202.842;
- y = -24.0325;
- z = 1002.2734;
- world = GetPlayerVirtualWorld(playerid);
- interior = 16;
- 252.8154;
- name = "Los Santos Tattoo Parlor";
- }
- case INTERIOR_:{
- x = 2233.6919;
- y = -1112.8107;
- z = 1050.8828;
- world = GetPlayerVirtualWorld(playerid);
- interior = 5;
- angle = 8.6483;
- name = "Safe House group 1";
- }
- case INTERIOR_:{
- x = 1211.2484;
- y = 1049.0234;
- z = 359.941;
- world = GetPlayerVirtualWorld(playerid);
- interior = 6;
- angle = 170.9341;
- name = "Safe House group 2";
- }
- case INTERIOR_:{
- x = 2319.1272;
- y = -1023.9562;
- z = 1050.2109;
- world = GetPlayerVirtualWorld(playerid);
- interior = 9;
- angle = 167.3959;
- name = "Safe House group 3";
- }
- case INTERIOR_:{
- x = 2261.0977;
- y = -1137.8833;
- z = 1050.6328;
- world = GetPlayerVirtualWorld(playerid);
- interior = 10;
- angle = 266.88;
- name = "Safe House group 4";
- }
- case INTERIOR_:{
- x = -944.2402;
- y = 1886.1536;
- z = 5.0051;
- world = GetPlayerVirtualWorld(playerid);
- interior = 17;
- angle = 179.8548;
- name = "Sherman Dam";
- }
- case INTERIOR_:{
- x = 2217.281;
- y = -1150.5349;
- z = 1025.7969;
- world = GetPlayerVirtualWorld(playerid);
- interior = 15;
- angle = 273.7328;
- name = "Jefferson Motel";
- }
- case INTERIOR_:{
- x = 234.6087;
- y = 1187.8195;
- z = 1080.2578;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 349.4844;
- name = "Burglary House X1";
- }
- case INTERIOR_:{
- x = 225.5707;
- y = 1240.0643;
- z = 1082.1406;
- world = GetPlayerVirtualWorld(playerid);
- interior = 2;
- angle = 96.2852;
- name = "Burglary House X2";
- }
- case INTERIOR_:{
- x = 224.288;
- y = 1289.1907;
- z = 1082.1406;
- world = GetPlayerVirtualWorld(playerid);
- interior = 1;
- angle = 359.868;
- name = "Burglary House X3";
- }
- case INTERIOR_:{
- x = 239.2819;
- y = 1114.1991;
- z = 1080.9922;
- world = GetPlayerVirtualWorld(playerid);
- interior = 5;
- angle = 270.2654;
- name = "Burglary House X4";
- }
- case INTERIOR_SHOP_BINCO:{
- x = 207.5219;
- y = -109.7448;
- z = 1005.1328;
- world = GetPlayerVirtualWorld(playerid);
- interior = 15;
- angle = 358.62;
- name = "Binco";
- }
- case INTERIOR_:{
- x = 295.1391;
- y = 1473.3719;
- z = 1080.2578;
- world = GetPlayerVirtualWorld(playerid);
- interior = 15;
- angle = 352.9526;
- name = "4 Burglary houses";
- }
- case INTERIOR_:{
- x = 446.3247;
- y = 509.9662;
- z = 1001.4195;
- world = GetPlayerVirtualWorld(playerid);
- interior = 12;
- angle = 330.5671;
- name = "Budget Inn Motel Room";
- }
- case INTERIOR_:{
- x = 2306.3826;
- y = -15.2365;
- z = 26.7496;
- world = GetPlayerVirtualWorld(playerid);
- interior = 0;
- angle = 274.49;
- name = "Palamino Bank";
- }
- case INTERIOR_:{
- x = 2331.8984;
- y = 6.7816;
- z = 26.5032;
- world = GetPlayerVirtualWorld(playerid);
- interior = 0;
- angle = 100.2357;
- name = "Palamino Diner";
- }
- case INTERIOR_:{
- x = 663.0588;
- y = -573.6274;
- z = 16.3359;
- world = GetPlayerVirtualWorld(playerid);
- interior = 0;
- angle = 264.9829;
- name = "Dillimore Gas Station";
- }
- case INTERIOR_:{
- x = -227.5703;
- y = 1401.5544;
- z = 27.7656;
- world = GetPlayerVirtualWorld(playerid);
- interior = 18;
- angle = 269.2978;
- name = "Lil' Probe Inn";
- }
- case INTERIOR_:{
- x = -688.1496;
- y = 942.0826;
- z = 13.6328;
- world = GetPlayerVirtualWorld(playerid);
- interior = 0;
- angle = 177.6574;
- name = "Torreno's Ranch";
- }
- case INTERIOR_:{
- x = -1916.1268;
- y = 714.8617;
- z = 46.5625;
- world = GetPlayerVirtualWorld(playerid);
- interior = 0;
- angle = 152.2839;
- name = "Zombotech - lobby area";
- }
- case INTERIOR_:{
- x = 818.7714;
- y = -1102.8689;
- z = 25.794;
- world = GetPlayerVirtualWorld(playerid);
- interior = 0;
- angle = 91.1439;
- name = "Crypt in LS cemetery (temple)";
- }
- case INTERIOR_:{
- x = 255.2083;
- y = -59.6753;
- z = 1.5703;
- world = GetPlayerVirtualWorld(playerid);
- interior = 0;
- angle = 1.4645;
- name = "Blueberry Liquor Store";
- }
- case INTERIOR_:{
- x = 446.626;
- y = 1397.738;
- z = 1084.3047;
- world = GetPlayerVirtualWorld(playerid);
- interior = 2;
- angle = 343.9647;
- name = "Pair of Burglary Houses";
- }
- case INTERIOR_:{
- x = 227.3922;
- y = 1114.6572;
- z = 1080.9985;
- world = GetPlayerVirtualWorld(playerid);
- interior = 5;
- angle = 267.459;
- name = "Crack Den";
- }
- case INTERIOR_:{
- x = 227.7559;
- y = 1114.3844;
- z = 1080.9922;
- world = GetPlayerVirtualWorld(playerid);
- interior = 5;
- angle = 266.2624;
- name = "Burglary House X11";
- }
- case INTERIOR_:{
- x = 261.1165;
- y = 1287.2197;
- world = GetPlayerVirtualWorld(playerid);
- interior = 4;
- z = 1080.2578;
- angle = 178.9149;
- name = "Burglary House X12";
- }
- case INTERIOR_:{
- x = 449.0172;
- y = -88.9894;
- z = 999.5547;
- world = GetPlayerVirtualWorld(playerid);
- interior = 4;
- angle = 89.6608;
- name = "Jay's Diner";
- }
- case INTERIOR_GIRL_MICHELLE:{
- x = 306.1966;
- y = 307.819;
- z = 1003.3047;
- world = GetPlayerVirtualWorld(playerid);
- interior = 4;
- angle = 203.1354;
- name = "Michelle's Love Nest*";
- }
- case INTERIOR_:{
- x = 24.3769;
- y = 1341.1829;
- z = 1084.375;
- world = GetPlayerVirtualWorld(playerid);
- interior = 10;
- angle = 8.3305;
- name = "Burglary House X14";
- }
- case INTERIOR_:{
- x = 963.0586;
- y = 2159.7563;
- z = 1011.0303;
- world = GetPlayerVirtualWorld(playerid);
- interior = 1;
- angle = 175.313;
- name = "Sindacco Abatoir";
- }
- case INTERIOR_:{
- x = 2548.4807;
- y = 2823.7429;
- z = 10.8203;
- world = GetPlayerVirtualWorld(playerid);
- interior = 0;
- angle = 270.6003;
- name = "K.A.C.C. Military Fuels Depot";
- }
- case INTERIOR_:{
- x = 215.1515;
- y = 1874.0579;
- z = 13.1406;
- world = GetPlayerVirtualWorld(playerid);
- interior = 0;
- angle = 177.553;
- name = "Area 69";
- }
- case INTERIOR_:{
- x = 221.6766;
- y = 1142.4962;
- z = 1082.6094;
- world = GetPlayerVirtualWorld(playerid);
- interior = 4;
- angle = 184.9618;
- name = "Burglary House X13";
- }
- case INTERIOR_:{
- x = 2323.7063;
- y = -1147.6509;
- z = 1050.7101;
- world = GetPlayerVirtualWorld(playerid);
- interior = 12;
- angle = 206.5352;
- name = "Unused Safe House";
- }
- case INTERIOR_GIRL_MILLIE:{
- x = 344.9984;
- y = 307.1824;
- z = 999.1557;
- world = GetPlayerVirtualWorld(playerid);
- interior = 6;
- angle = 193.643;
- name = "Millie's Bedroom";
- }
- case INTERIOR_SHOP_BARBER:{
- x = 411.9707;
- y = -51.9217;
- z = 1001.8984;
- world = GetPlayerVirtualWorld(playerid);
- interior = 12;
- angle = 173.3449;
- name = "Barber Shop";
- }
- case INTERIOR_:{
- x = 773.8887;
- y = -47.7698;
- z = 1000.5859;
- world = GetPlayerVirtualWorld(playerid);
- interior = 6;
- angle = 10.7161;
- name = "Cobra Gym";
- }
- case INTERIOR_:{
- x = -1864.9434;
- y = 55.7325;
- z = 1055.5276;
- world = GetPlayerVirtualWorld(playerid);
- interior = 14;
- angle = 85.8541;
- name = "Los Santos Airport";
- }
- case INTERIOR_:{
- x = -262.1759;
- y = 1456.6158;
- z = 1084.3672;
- world = GetPlayerVirtualWorld(playerid);
- interior = 4;
- angle = 82.459;
- name = "Burglary House X15";
- }
- case INTERIOR_:{
- x = 22.861;
- y = 1404.9165;
- z = 1084.4297;
- world = GetPlayerVirtualWorld(playerid);
- interior = 5;
- angle = 349.6158;
- name = "Burglary House X16";
- }
- case INTERIOR_:{
- x = 140.3679;
- y = 1367.8837;
- z = 1083.8621;
- world = GetPlayerVirtualWorld(playerid);
- interior = 5;
- angle = 349.2372;
- name = "Burglary House X17";
- }
- case INTERIOR_:{
- x = 1494.8589;
- y = 1306.48;
- z = 1093.2953;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 196.065;
- name = "Bike School";
- }
- case INTERIOR_:{
- x = -1401.067;
- y = 1265.3706;
- z = 1039.8672;
- world = GetPlayerVirtualWorld(playerid);
- interior = 16;
- angle = 178.6483;
- name = "Vice Stadium";
- }
- case INTERIOR_:{
- x = 234.2826;
- y = 1065.229;
- z = 1084.2101;
- world = GetPlayerVirtualWorld(playerid);
- interior = 6;
- angle = 4.3864;
- name = "Burglary House X18";
- }
- case INTERIOR_:{
- x = -68.5145;
- y = 1353.8485;
- z = 1080.2109;
- world = GetPlayerVirtualWorld(playerid);
- interior = 6;
- angle = 3.5742;
- name = "Burglary House X19";
- }
- case INTERIOR_:{
- x = -2240.1028;
- y = 136.973;
- z = 1035.4141;
- world = GetPlayerVirtualWorld(playerid);
- interior = 6;
- angle = 269.0954;
- name = "Zero's RC Shop";
- }
- case INTERIOR_:{
- x = -285.2511;
- y = 1471.197;
- z = 1084.375;
- world = GetPlayerVirtualWorld(playerid);
- interior = 15;
- angle = 85.6547;
- name = "Burglary House X20";
- }
- case INTERIOR_:{
- x = 442.1295;
- y = -52.4782;
- z = 999.7167;
- world = GetPlayerVirtualWorld(playerid);
- interior = 6;
- angle = 177.9394;
- name = "Secret Valley Diner";
- }
- case INTERIOR_:{
- x = 2182.2017;
- y = 1628.5848;
- z = 1043.8723;
- world = GetPlayerVirtualWorld(playerid);
- interior = 2;
- angle = 224.8601;
- name = "Rosenberg's Office in Caligulas";
- }
- case INTERIOR_:{
- x = 748.4623;
- y = 1438.2378;
- z = 1102.9531;
- world = GetPlayerVirtualWorld(playerid);
- interior = 6;
- angle = 0.6069;
- name = "Fanny Batter's Whore House";
- }
- case INTERIOR_:{
- x = 2807.3604;
- y = -1171.7048;
- z = 1025.5703;
- world = GetPlayerVirtualWorld(playerid);
- interior = 8;
- angle = 193.7117;
- name = "Colonel Furhberger's";
- }
- case INTERIOR_:{
- x = 366.0002;
- y = -9.4338;
- z = 1001.8516;
- world = GetPlayerVirtualWorld(playerid);
- interior = 9;
- angle = 160.528;
- name = "Cluckin' Bell";
- }
- case INTERIOR_:{
- x = 2216.1282;
- y = -1076.3052;
- z = 1050.4844;
- world = GetPlayerVirtualWorld(playerid);
- interior = 1;
- angle = 86.428;
- name = "The Camel's Toe Safehouse";
- }
- case INTERIOR_:{
- x = 2268.5156;
- y = 1647.7682;
- z = 1084.2344;
- world = GetPlayerVirtualWorld(playerid);
- interior = 1;
- angle = 99.7331;
- name = "Caligula's Roof";
- }
- case INTERIOR_:{
- x = 2236.6997;
- y = -1078.9478;
- z = 1049.0234;
- world = GetPlayerVirtualWorld(playerid);
- interior = 2;
- angle = 2.5706;
- name = "Old Venturas Strip Casino";
- }
- case INTERIOR_:{
- x = -2031.1196;
- y = -115.8287;
- z = 1035.1719;
- world = GetPlayerVirtualWorld(playerid);
- interior = 3;
- angle = 190.1877;
- name = "Driving School";
- }
- case INTERIOR_:{
- x = 2365.1089;
- y = -1133.0795;
- z = 1050.875;
- world = GetPlayerVirtualWorld(playerid);
- interior = 8;
- angle = 177.3947;
- name = "Verdant Bluffs Safehouse";
- }
- case INTERIOR_:{
- x = 1168.512;
- y = 1360.1145;
- z = 10.9293;
- world = GetPlayerVirtualWorld(playerid);
- interior = 0;
- angle = 196.5933;
- name = "Bike School";
- }
- case INTERIOR_:{
- x = 1893.0731;
- y = 1017.8958;
- z = 31.8828;
- world = GetPlayerVirtualWorld(playerid);
- interior = 10;
- angle = 86.1044;
- name = "Four Dragons' Janitor's Office";
- }
- case INTERIOR_:{
- x = 501.9578;
- y = -70.5648;
- z = 998.7578;
- world = GetPlayerVirtualWorld(playerid);
- interior = 11;
- angle = 171.5706;
- name = "Bar";
- }
- case INTERIOR_:{
- x = -42.5267;
- y = 1408.23;
- z = 1084.4297;
- world = GetPlayerVirtualWorld(playerid);
- interior = 8;
- angle = 172.068;
- name = "Burglary House X21";
- }
- case INTERIOR_:{
- x = 2283.3118;
- y = 1139.307;
- z = 1050.8984;
- world = GetPlayerVirtualWorld(playerid);
- interior = 11;
- angle = 19.7032;
- name = "Willowfield Safehouse";
- }
- case INTERIOR_:{
- x = 84.9244;
- y = 1324.2983;
- z = 1083.8594;
- world = GetPlayerVirtualWorld(playerid);
- interior = 9;
- angle = 159.5582;
- name = "Burglary House X22";
- }
- case INTERIOR_:{
- x = 260.7421;
- y = 1238.2261;
- z = 1084.2578;
- world = GetPlayerVirtualWorld(playerid);
- interior = 9;
- angle = 84.3084;
- name = "Burglary House X23";
- }
- case INTERIOR_:{
- x = -1658.1656;
- y = 1215.0002;
- z = 7.25;
- world = GetPlayerVirtualWorld(playerid);
- interior = 0;
- angle = 103.9074;
- name = "Otto's Autos";
- }
- case INTERIOR_:{
- x = -1961.6281;
- y = 295.2378;
- z = 35.4688;
- world = GetPlayerVirtualWorld(playerid);
- interior = 0;
- angle = 264.4891;
- name = "Wang Cars";
- }
- }
- gotoCallback(x, y, z, world, interior, angle, name);
- }
- else{dialogGotoUncatagorized(playerid);}
- }*/
- case DIALOG_CREATE_PICKUP:{
- if(response){
- switch(listitem){
- case 0: ShowPlayerDialog(playerid, DIALOG_CREATE_FACTION_PICKUP, DIALOG_STYLE_LIST, "Faction types", "Police\nMedic\nFire fighter\nFederal Bureau of Investigation\nDepeartment of motorvehicles\nBroadcasting", "Select", "Cancel"); }
- }
- }
- case DIALOG_CREATE_FACTION_PICKUP:{
- if(response){
- printf("Listitem: % i", listitem);
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- new world = GetPlayerVirtualWorld(playerid);
- new interior = GetPlayerInterior(playerid);
-
- new pickupid = createDynamicPickup(1247, x, y, z, world, interior, listitem);
- // Create pickup record
- new pickup_query[127 + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_INTEGER + MAX_SQL_INTEGER + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
- format(pickup_query, sizeof(pickup_query), "INSERT INTO pickup(object_id, pos_x, pos_y, pos_z, world_id, interior_id, type_id, pickup_id) VALUES (1247, '%f', '%f', '%f', %i, %i, %i, %i)", x, y, z, world, interior, listitem, pickupid);
- sql_query(sqlHandle, pickup_query);
- // Get pickup record ID
- new id_query[44 + 1];
- format(id_query, sizeof(id_query), "SELECT id FROM pickup WHERE pickup_id = %i", pickupid);
- new Result:id_result = sql_query(sqlHandle, id_query);
- new pickup_id = sql_get_field_assoc_int(id_result, "id");
-
- new admin_message[21 + 4 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
-
- // Inform admins
- listitem++; // To account for FACTION_NONE
- printf("Listitem: % i", listitem);
- switch(listitem){
- case FACTION_POLICE: format(admin_message, sizeof(admin_message), "* [%i] %s created police faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
- case FACTION_MEDIC: format(admin_message, sizeof(admin_message), "* [%i] %s created medic faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
- case FACTION_FIRE: format(admin_message, sizeof(admin_message), "* [%i] %s created firefighter faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
- case FACTION_SHERIFF: format(admin_message, sizeof(admin_message), "* [%i] %s created shariff faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
- case FACTION_FBI: format(admin_message, sizeof(admin_message), "* [%i] %s created FBI faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
- case FACTION_DMV: format(admin_message, sizeof(admin_message), "* [%i] %s created DMV faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
- case FACTION_NEWS: format(admin_message, sizeof(admin_message), "* [%i] %s created broadcasting faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
- default: return 0;
- }
- sendToAdmins(COLOR_NOTICE, admin_message);
- }
- }
-
- case DIALOG_DUTY_PD:{
- if(response){
- // TODO: Check if has passport
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{ // Is citizen
- // TODO: Check for crimes, warrents, etc
- ShowPlayerDialog(playerid, DIALOG_POLICE_SKIN, DIALOG_STYLE_TABLIST, "Police skins", "Police Officer\tMale\tLS\nPolice Officer\tMale\tSF\nMotorbike Cop\tMale\tLS\nPolice Officer (Without gun holster)\tMale\tLS\nPolice Officer (Without gun holster)\tMale\tSF\nPolice Officer\tFemale\tLS\nPolice Officer\tFemale\tSF", "Duty", "Cancel");
- }
- case JOB_POLICE:{ // Is on duty
- setPlayerJob(playerid, JOB_NONE);
- }
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
- }
- }
- }
- case DIALOG_POLICE_SKIN:{
- if(response){
- new skin;
- switch(listitem){
- case 0:{skin = 280;}
- case 1:{skin = 281;}
- case 2:{skin = 284;}
- case 3:{skin = 300;}
- case 4:{skin = 301;}
- case 5:{skin = 306;}
- case 6:{skin = 307;}
- }
-
- setPlayerJob(playerid, JOB_POLICE, skin, COLOR_POLICE);
- }
- }
- case DIALOG_DUTY_MD:{
- if(response){
- // TODO: Check if has passport
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{
- // TODO: Check for crimes, warrents, etc
- ShowPlayerDialog(playerid, DIALOG_MEDIC_SKIN, DIALOG_STYLE_TABLIST, "Paramedic skins", "Los Santos white\tMale\nLas Venturas blue\tMale\nSan Fierro green\tMale\nSan Fierro green\tFemale", "Duty", "Cancel");
- }
- case JOB_MEDIC:{
- setPlayerJob(playerid, JOB_NONE);
- }
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
- }
- }
- }
- case DIALOG_MEDIC_SKIN:{
- if(response){
- new skin;
- switch(listitem){
- case 0:{skin = 274;}
- case 1:{skin = 275;}
- case 2:{skin = 276;}
- case 3:{skin = 308;} // TODO find out why this is broken.
- }
- setPlayerJob(playerid, JOB_MEDIC, skin, COLOR_MEDIC);
- }
- }
- case DIALOG_DUTY_FD:{
- if(response){
- // TODO: Check if has passport
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{
- // TODO: Check for crimes, warrents, etc
- ShowPlayerDialog(playerid, DIALOG_FIRE_SKIN, DIALOG_STYLE_TABLIST, "Firefighter skins", "Los Santos green\tMale\nLas Venturas yellow\tMale\nSan Fierro black\tMale", "Duty", "Cancel");
- }
- case JOB_FIRE:{
- setPlayerJob(playerid, JOB_NONE);
- }
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
- }
- }
- }
- case DIALOG_FIRE_SKIN:{
- if(response){
- new skin;
- switch(listitem){
- case 0:{skin = 277;}
- case 1:{skin = 278;}
- case 2:{skin = 279;}
- }
- setPlayerJob(playerid, JOB_FIRE, skin, COLOR_FIRE);
- }
- }
- case DIALOG_DUTY_SD:{
- if(response){
- // TODO: Check if has passport
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{
- // TODO: Check for crimes, warrents, etc
- ShowPlayerDialog(playerid, DIALOG_SHERIFF_SKIN, DIALOG_STYLE_TABLIST, "Sheriff skins", "Officer\tMale\tLV\nCounty sheriff\tMale\tCountryside\nDesert sheriff\tMale\tDesert\nOfficer (Without gun holster)\tMale\nOfficer\tFemale\nCounty sheriff (Without hat)\tMale\nDesert sheriff\tMale", "Duty", "Cancel");
- }
- case JOB_SHERIFF:{
- setPlayerJob(playerid, JOB_NONE);
- }
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
- }
- }
- }
- case DIALOG_SHERIFF_SKIN:{
- if(response){
- new skin;
- switch(listitem){
- case 0:{skin = 282;}
- case 1:{skin = 283;}
- case 2:{skin = 288;}
- case 3:{skin = 302;}
- case 4:{skin = 309;}
- case 5:{skin = 310;}
- case 6:{skin = 311;}
- }
- setPlayerJob(playerid, JOB_SHERIFF, skin, COLOR_SHERIFF);
- }
- }
- case DIALOG_DUTY_FBI:{
- if(response){
- // TODO: Check if has passport
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{
- // TODO: Check for crimes, warrents, etc
- ShowPlayerDialog(playerid, DIALOG_FBI_SKIN, DIALOG_STYLE_TABLIST, "Agent skins", "Caucasian MIB agent\tMale\nAfro-American MIB agent\tMale\nSWAT special forces\tMale\nFBI agent\tMale\nAfro-American bouncer\tMale\nCaucasian Bouncer\tMale\nOriental businesswoman\tFemale\nCaucasian businesswoman\tFemale", "Duty", "Cancel");
- }
- case JOB_FBI:{
- setPlayerJob(playerid, JOB_NONE);
- }
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
- }
- }
- }
- case DIALOG_FBI_SKIN:{
- if(response){
- new skin;
- switch(listitem){
- case 0:{skin = 165;}
- case 1:{skin = 166;}
- case 2:{skin = 258;}
- case 3:{skin = 286;}
- case 4:{skin = 163;}
- case 5:{skin = 164;}
- case 7:{skin = 141;}
- case 8:{skin = 150;}
- }
- setPlayerJob(playerid, JOB_FBI, skin, COLOR_FBI);
- }
- }
- case DIALOG_DUTY_DMV:{
- if(response){
- // TODO: Check if has passport
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{
- // TODO: Check for crimes, warrents, etc
- ShowPlayerDialog(playerid, DIALOG_DMV_SKIN, DIALOG_STYLE_TABLIST, "DMV skins", "Airport ground worker\tMale\nSecurity guard\tMale", "Duty", "Cancel");
- }
- case JOB_DMV:{
- setPlayerJob(playerid, JOB_NONE);
- }
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
- }
- }
- }
- case DIALOG_DMV_SKIN:{
- if(response){
- new skin;
- switch(listitem){
- case 0:{skin = 16;}
- case 1:{skin = 71;}
- }
- setPlayerJob(playerid, JOB_DMV, skin, COLOR_DMV);
- }
- }
- case DIALOG_DUTY_NEWS:{
- if(response){
- // TODO: Check if has passport
- switch(GetGVarInt("job", playerid)){
- case JOB_NONE:{
- // TODO: Check for crimes, warrents, etc
- ShowPlayerDialog(playerid, DIALOG_DMV_SKIN, DIALOG_STYLE_TABLIST, "Network skins", "Hispanic businesswoman\nCaucasian Businesswoman\nBusinessman\nRich woman", "Duty", "Cancel");
- }
- case JOB_NEWS:{
- setPlayerJob(playerid, JOB_NONE);
- }
- default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
- }
- }
- }
- case DIALOG_NEWS_SKIN:{
- if(response){
- new skin;
- switch(listitem){
- case 0:{skin = 148;}
- case 1:{skin = 150;}
- case 2:{skin = 187;}
- case 3:{skin = 219;}
- }
- setPlayerJob(playerid, JOB_NEWS, skin, COLOR_NEWS);
- }
- }
- }
-
- return 0; // MUST return 0 here, just like OnPlayerCommandText.
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- public OnEnterExitModShop(playerid, enterexit, interiorid)
- {
- return 1;
- }
- public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
- {
- return 1;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
- {
- return 1;
- }
- // discord-connector events
- public DCC_OnMessageCreate(DCC_Message:message){
- // Originating Discord channel
- new DCC_Channel:channel;
- DCC_GetMessageChannel(message, channel);
- // Originating Discord user
- new DCC_User:author;
- DCC_GetMessageAuthor(message, author);
- // Message content
- new str[128 + 1]; // Orignal was 256
- new command[32 + 1], params[128 + 1];
- DCC_GetMessageContent(message, str);
- sscanf(str, "s[32]s[128]", command, params); // This string is to small some times, and throws an error BROKEN TODO
- // Ignore bots
- new bool:isBot;
- DCC_IsUserBot(author, isBot);
- if(isBot){
- return 1;
- }
- if(!strcmp(command, "!players")){
- new players_string[14 + (2 * MAX_PLAYERS) + (MAX_PLAYER_NAME * MAX_PLAYERS) + 1] = "Online players:";
- for(new playerid, a = GetMaxPlayers(); playerid < a; playerid++){
- if(IsPlayerConnected(playerid)){
- format(players_string, sizeof(players_string), "%s %s,", players_string, getPlayerName(playerid));
- }
- }
- strdel(players_string, strlen(players_string), strlen(players_string)); // Delete trailing comma
- DiscordSendChannelMessage(channel, players_string);
- print("Should be sending players");
- }
- else if(!strcmp(command, "!ip")){
- DiscordSendChannelMessage(channel, "ecrp.h0v1n8.nl:6666");
- }
- else{
- if(channel == echoChannel){
- sendToChat(-1, CHAT_GLOBAL, str, 0, author);
- }
- }
- /*// Beyond this point, don't respond to commands on foreign guilds.
- if(guild != homeGuild){
- return 1;
- }*/
- // Beyond this point, only respond to privilaged channels.
- if(channel != adminEchoChannel && channel != adminChannel && channel != managementChannel){
- return 1;
- }
- // Test command.
- if(!strcmp(command, "!test", true)){
- DiscordSendChannelMessage(channel, "Works.");
- print("Some said !test in the echo channel.");
- }
- return 1;
- }
- // Entrypoint
- main(){
- // Credits
- print("\n*----------------------------------*");
- print(" RPFW by tBKwtWS.");
- new message[21 + 20 + 1];
- format(message, sizeof(message), " Role-play framework v%s", MODE_NAME);
- print(message);
- //printf("System load average: %f",loadavg()); // Linux only TODO: test
- print("*----------------------------------*\n");
- }
|