RPFW.0.0a Build 10.pwn 199 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510
  1. // Developers notes
  2. /* # Coding guideline
  3. * Add +1 at the end of array declarations to visually account for null bit.
  4. * Always log first.
  5. * Always notify discord last.
  6. * Always wait for other queries to finish before initiating one: "sql_wait(sqlHandle); // Wait for other queries to finish"
  7. * 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
  8. * Read all the function before the OnGameModeInit(), to be able to follow the DRY principle. Repeating code will NOT BE ACCEPTED!
  9. */
  10. /* # Style guide
  11. * GLOBAL_CONSTANT
  12. * local_variable
  13. * someFunction
  14. * SomeClass
  15. * playerid // Variable storing in-game player ID
  16. * player_id // Variable storing database player ID
  17. */
  18. /* # Adding a discord bot to your guild.
  19. https://discordapp.com/oauth2/authorize?client_id=%CLIENT_ID%&scope=bot&permissions=3072
  20. Where %CLEINT_ID% is the client id.
  21. */
  22. /* # Todo:
  23. * Add geoiplib, to make connect messages fancier, and add a locate command.
  24. * Show underscores as spaces and convert spaces in changename input to undescores before regex check.
  25. * Vip limit on characters.
  26. * See why sql_insert_id wont work. (Try it via a callback)
  27. * Check if timestamps work (implemented on temp ban), before implementing it more.
  28. * Normalise database column names.
  29. * Some SMALLINT fields are using SQL_INTERGER_LEGNTH for size and could be smaller.
  30. */
  31. /// Global definitions
  32. // Colours
  33. /*
  34. #define COLOR_GREEN 0x33AA33AA
  35. #define COLOR_YELLOW 0xFFFF00AA
  36. #define COLOR_WHITE 0xFFFFFFAA
  37. #define COLOR_BLUE 0x0000BBAA
  38. #define COLOR_LIGHTBLUE 0x33CCFFAA
  39. #define COLOR_ORANGE 0xFF9900AA
  40. #define COLOR_RED 0xAA3333AA
  41. #define COLOR_LIME 0x10F441AA
  42. #define COLOR_NAVY 0x000080AA
  43. #define COLOR_AQUA 0xF0F8FFAA
  44. #define COLOR_CRIMSON 0xDC143CAA
  45. #define COLOR_BISQUE 0xFFE4C4AA
  46. #define COLOR_BLACK 0x000000AA
  47. #define COLOR_CHARTREUSE 0x7FFF00AA
  48. #define COLOR_BROWN 0XA52A2AAA
  49. #define COLOR_CORAL 0xFF7F50AA
  50. #define COLOR_GOLD 0xB8860BAA
  51. #define COLOR_GREENYELLOW 0xADFF2FAA
  52. #define COLOR_INDIGO 0x4B00B0AA
  53. #define COLOR_IVORY 0xFFFF82AA
  54. #define COLOR_LAWNGREEN 0x7CFC00AA
  55. #define COLOR_SEAGREEN 0x20B2AAAA
  56. #define COLOR_SEAGREEN 0x2E8B57AA
  57. #define COLOR_LIMEGREEN 0x32CD32AA //<--- Dark lime
  58. #define COLOR_MIDNIGHTBLUE 0X191970AA
  59. #define COLOR_MAROON 0x800000AA
  60. #define COLOR_OLIVE 0x808000AA
  61. #define COLOR_ORANGERED 0xFF4500AA
  62. #define COLOR_PINK 0xFFC0CBAA // - Light light pink
  63. #define COLOR_SPRINGGREEN 0x00FF7FAA
  64. #define COLOR_TOMATO 0xFF6347AA // - Tomato >:/ sounds wrong lol... well... :P
  65. #define COLOR_YELLOWGREEN 0x9ACD32AA //- like military green
  66. #define COLOR_MEDIUMAQUA 0x83BFBFAA
  67. #define COLOR_MEDIUMMAGENTA 0x8B008BAA // dark magenta ^^
  68. */
  69. #define COLOR_ACTIVEBORDER 0xB4B4B4FF
  70. #define COLOR_ACTIVECAPTION 0x99B4D1FF
  71. #define COLOR_ACTIVECAPTIONTEXT 0x000000FF
  72. #define COLOR_ALICEBLUE 0xF0F8FFFF
  73. #define COLOR_ANTIQUEWHITE 0xFAEBD7FF
  74. #define COLOR_APPWORKSPACE 0xABABABFF
  75. #define COLOR_AQUA 0x00FFFFFF
  76. #define COLOR_AQUAMARINE 0x7FFFD4FF
  77. #define COLOR_AZURE 0xF0FFFFFF
  78. #define COLOR_BEIGE 0xF5F5DCFF
  79. #define COLOR_BISQUE 0xFFE4C4FF
  80. #define COLOR_BLACK 0x000000FF
  81. #define COLOR_BLANCHEDALMOND 0xFFEBCDFF
  82. #define COLOR_BLUE 0x0000FFFF
  83. #define COLOR_BLUEVIOLET 0x8A2BE2FF
  84. #define COLOR_BROWN 0xA52A2AFF
  85. #define COLOR_BURLYWOOD 0xDEB887FF
  86. #define COLOR_BUTTONFACE 0xF0F0F0FF
  87. #define COLOR_BUTTONHIGHLIGHT 0xFFFFFFFF
  88. #define COLOR_BUTTONSHADOW 0xA0A0A0FF
  89. #define COLOR_CADETBLUE 0x5F9EA0FF
  90. #define COLOR_CHARTREUSE 0x7FFF00FF
  91. #define COLOR_CHOCOLATE 0xD2691EFF
  92. #define COLOR_CONTROL 0xF0F0F0FF
  93. #define COLOR_CONTROLDARK 0xA0A0A0FF
  94. #define COLOR_CONTROLDARKDARK 0x696969FF
  95. #define COLOR_CONTROLLIGHT 0xE3E3E3FF
  96. #define COLOR_CONTROLLIGHTLIGHT 0xFFFFFFFF
  97. #define COLOR_CONTROLTEXT 0x000000FF
  98. #define COLOR_CORAL 0xFF7F50FF
  99. #define COLOR_CORNFLOWERBLUE 0x6495EDFF
  100. #define COLOR_CORNSILK 0xFFF8DCFF
  101. #define COLOR_CRIMSON 0xDC143CFF
  102. #define COLOR_CYAN 0x00FFFFFF
  103. #define COLOR_DARKBLUE 0x00008BFF
  104. #define COLOR_DARKCYAN 0x008B8BFF
  105. #define COLOR_DARKGOLDENROD 0xB8860BFF
  106. #define COLOR_DARKGRAY 0xA9A9A9FF
  107. #define COLOR_DARKGREEN 0x006400FF
  108. #define COLOR_DARKKHAKI 0xBDB76BFF
  109. #define COLOR_DARKMAGENTA 0x8B008BFF
  110. #define COLOR_DARKOLIVEGREEN 0x556B2FFF
  111. #define COLOR_DARKORANGE 0xFF8C00FF
  112. #define COLOR_DARKORCHID 0x9932CCFF
  113. #define COLOR_DARKRED 0x8B0000FF
  114. #define COLOR_DARKSALMON 0xE9967AFF
  115. #define COLOR_DARKSEAGREEN 0x8FBC8BFF
  116. #define COLOR_DARKSLATEBLUE 0x483D8BFF
  117. #define COLOR_DARKSLATEGRAY 0x2F4F4FFF
  118. #define COLOR_DARKTURQUOISE 0x00CED1FF
  119. #define COLOR_DARKVIOLET 0x9400D3FF
  120. #define COLOR_DEEPPINK 0xFF1493FF
  121. #define COLOR_DEEPSKYBLUE 0x00BFFFFF
  122. #define COLOR_DEFAULT_CHAT 0xFFFFFFFF
  123. #define COLOR_DESKTOP 0x000000FF
  124. #define COLOR_DIMGRAY 0x696969FF
  125. #define COLOR_DODGERBLUE 0x1E90FFFF
  126. #define COLOR_FIREBRICK 0xB22222FF
  127. #define COLOR_FLBLUE 0x6495EDAA
  128. #define COLOR_FLORALWHITE 0xFFFAF0FF
  129. #define COLOR_FORESTGREEN 0x228B22FF
  130. #define COLOR_GAINSBORO 0xDCDCDCFF
  131. #define COLOR_GHOSTWHITE 0xF8F8FFFF
  132. #define COLOR_GOLD 0xFFD700FF
  133. #define COLOR_GOLDENROD 0xDAA520FF
  134. #define COLOR_GRADIENTACTIVECAPTION 0xB9D1EAFF
  135. #define COLOR_GRADIENTINACTIVECAPTION 0xD7E4F2FF
  136. #define COLOR_GRAY 0x808080FF
  137. #define COLOR_GRAYTEXT 0x808080FF
  138. #define COLOR_GREEN 0x008000FF
  139. #define COLOR_GREENYELLOW 0xADFF2FFF
  140. #define COLOR_GREY 0xAFAFAFAA
  141. #define COLOR_HIGHLIGHT 0x3399FFFF
  142. #define COLOR_HIGHLIGHTTEXT 0xFFFFFFFF
  143. #define COLOR_HONEYDEW 0xF0FFF0FF
  144. #define COLOR_HOTPINK 0xFF69B4FF
  145. #define COLOR_HOTTRACK 0x0066CCFF
  146. #define COLOR_INACTIVEBORDER 0xF4F7FCFF
  147. #define COLOR_INACTIVECAPTION 0xBFCDDBFF
  148. #define COLOR_INACTIVECAPTIONTEXT 0x434E54FF
  149. #define COLOR_INDIANRED 0xCD5C5CFF
  150. #define COLOR_INDIGO 0x4B0082FF
  151. #define COLOR_INFO 0xFFFFE1FF
  152. #define COLOR_INFOTEXT 0x000000FF
  153. #define COLOR_IVORY 0xFFFFF0FF
  154. #define COLOR_KHAKI 0xF0E68CFF
  155. #define COLOR_LAVENDER 0xE6E6FAFF
  156. #define COLOR_LAVENDERBLUSH 0xFFF0F5FF
  157. #define COLOR_LAWNGREEN 0x7CFC00FF
  158. #define COLOR_LEMONCHIFFON 0xFFFACDFF
  159. #define COLOR_LIGHTBLUE 0xADD8E6FF
  160. #define COLOR_LIGHTCORAL 0xF08080FF
  161. #define COLOR_LIGHTCYAN 0xE0FFFFFF
  162. #define COLOR_LIGHTGOLDENRODYELLOW 0xFAFAD2FF
  163. #define COLOR_LIGHTGRAY 0xD3D3D3FF
  164. #define COLOR_LIGHTGREEN 0x90EE90FF
  165. #define COLOR_LIGHTPINK 0xFFB6C1FF
  166. #define COLOR_LIGHTSALMON 0xFFA07AFF
  167. #define COLOR_LIGHTSEAGREEN 0x20B2AAFF
  168. #define COLOR_LIGHTSKYBLUE 0x87CEFAFF
  169. #define COLOR_LIGHTSLATEGRAY 0x778899FF
  170. #define COLOR_LIGHTSTEELBLUE 0xB0C4DEFF
  171. #define COLOR_LIGHTYELLOW 0xFFFFE0FF
  172. #define COLOR_LIME 0x00FF00FF
  173. #define COLOR_LIMEGREEN 0x32CD32FF
  174. #define COLOR_LINEN 0xFAF0E6FF
  175. #define COLOR_MAGENTA 0xFF00FFFF
  176. #define COLOR_MAROON 0x800000FF
  177. #define COLOR_MEDIUMAQUAMARINE 0x66CDAAFF
  178. #define COLOR_MEDIUMBLUE 0x0000CDFF
  179. #define COLOR_MEDIUMORCHID 0xBA55D3FF
  180. #define COLOR_MEDIUMPURPLE 0x9370DBFF
  181. #define COLOR_MEDIUMSEAGREEN 0x3CB371FF
  182. #define COLOR_MEDIUMSLATEBLUE 0x7B68EEFF
  183. #define COLOR_MEDIUMSPRINGGREEN 0x00FA9AFF
  184. #define COLOR_MEDIUMTURQUOISE 0x48D1CCFF
  185. #define COLOR_MEDIUMVIOLETRED 0xC71585FF
  186. #define COLOR_MENU 0xF0F0F0FF
  187. #define COLOR_MENUBAR 0xF0F0F0FF
  188. #define COLOR_MENUHIGHLIGHT 0x3399FFFF
  189. #define COLOR_MENUTEXT 0x000000FF
  190. #define COLOR_MIDNIGHTBLUE 0x191970FF
  191. #define COLOR_MINTCREAM 0xF5FFFAFF
  192. #define COLOR_MISTYROSE 0xFFE4E1FF
  193. #define COLOR_MOCCASIN 0xFFE4B5FF
  194. #define COLOR_NAVAJOWHITE 0xFFDEADFF
  195. #define COLOR_NAVY 0x000080FF
  196. #define COLOR_OLDLACE 0xFDF5E6FF
  197. #define COLOR_OLIVE 0x808000FF
  198. #define COLOR_OLIVEDRAB 0x6B8E23FF
  199. #define COLOR_ORANGE 0xFFA500FF
  200. #define COLOR_ORANGERED 0xFF4500FF
  201. #define COLOR_ORCHID 0xDA70D6FF
  202. #define COLOR_PALEGOLDENROD 0xEEE8AAFF
  203. #define COLOR_PALEGREEN 0x98FB98FF
  204. #define COLOR_PALETURQUOISE 0xAFEEEEFF
  205. #define COLOR_PALEVIOLETRED 0xDB7093FF
  206. #define COLOR_PAPAYAWHIP 0xFFEFD5FF
  207. #define COLOR_PEACHPUFF 0xFFDAB9FF
  208. #define COLOR_PERU 0xCD853FFF
  209. #define COLOR_PINK 0xFFC0CBFF
  210. #define COLOR_PLUM 0xDDA0DDFF
  211. #define COLOR_POWDERBLUE 0xB0E0E6FF
  212. #define COLOR_PURPLE 0x800080FF
  213. #define COLOR_RED 0xFF0000FF
  214. #define COLOR_ROSYBROWN 0xBC8F8FFF
  215. #define COLOR_ROYALBLUE 0x4169E1FF
  216. #define COLOR_SADDLEBROWN 0x8B4513FF
  217. #define COLOR_SALMON 0xFA8072FF
  218. #define COLOR_SANDYBROWN 0xF4A460FF
  219. #define COLOR_SCROLLBAR 0xC8C8C8FF
  220. #define COLOR_SEAGREEN 0x2E8B57FF
  221. #define COLOR_SEASHELL 0xFFF5EEFF
  222. #define COLOR_SIENNA 0xA0522DFF
  223. #define COLOR_SILVER 0xC0C0C0FF
  224. #define COLOR_SKYBLUE 0x87CEEBFF
  225. #define COLOR_SLATEBLUE 0x6A5ACDFF
  226. #define COLOR_SLATEGRAY 0x708090FF
  227. #define COLOR_SNOW 0xFFFAFAFF
  228. #define COLOR_SPRINGGREEN 0x00FF7FFF
  229. #define COLOR_STEELBLUE 0x4682B4FF
  230. #define COLOR_TAN 0xD2B48CFF
  231. #define COLOR_TEAL 0x008080FF
  232. #define COLOR_THISTLE 0xD8BFD8FF
  233. #define COLOR_TOMATO 0xFF6347FF
  234. #define COLOR_TRANSPARENT 0xFFFFFF00
  235. #define COLOR_TURQUOISE 0x40E0D0FF
  236. #define COLOR_VIOLET 0xEE82EEFF
  237. #define COLOR_WHEAT 0xF5DEB3FF
  238. #define COLOR_WHITE 0xFFFFFFFF
  239. #define COLOR_WHITESMOKE 0xF5F5F5FF
  240. #define COLOR_WINDOW 0xFFFFFFFF
  241. #define COLOR_WINDOWFRAME 0x646464FF
  242. #define COLOR_WINDOWTEXT 0x000000FF
  243. #define COLOR_YELLOW 0xFFFF00FF
  244. #define COLOR_YELLOWGREEN 0x9ACD32FF
  245. #define COLOR_STEALTH_ORANGE 0xFF880000
  246. #define COLOR_STEALTH_OLIVE 0x66660000
  247. #define COLOR_STEALTH_GREEN 0x33DD1100
  248. #define COLOR_STEALTH_PINK 0xFF22EE00
  249. #define COLOR_STEALTH_BLUE 0x0077BB00
  250. // Color groups
  251. #define COLOR_COMMAND_OUTPUT 0xFFFFFFFF // White
  252. #define COLOR_NOTICE 0xAFAFAFAA // Grey
  253. #define COLOR_WARNING 0xFFA500FF // Orange? (Looks more yellow to me)
  254. #define COLOR_ERROR 0xFF0000FF // Red
  255. #define COLOR_GLOBAL_CHAT 0xFFFFFFFF // White
  256. #define COLOR_PM_CHAT 0xFFFF00FF // Yellow
  257. #define COLOR_VIP_CHAT 0x800080FF // Purple
  258. #define COLOR_CREW_CHAT 0xFF9900AA // Orange
  259. #define COLOR_ADMIN_CHAT 0xB8860BAA // Gold
  260. #define COLOR_POLICE 0x00008BFF //
  261. #define COLOR_MEDIC 0xFFC0CBAA // Light pink
  262. #define COLOR_FIRE 0xAA3333AA // Red
  263. #define COLOR_SHERIFF 0xF5F5DCFF // Beige
  264. #define COLOR_FBI 0x000080AA // Navy
  265. #define COLOR_DMV 0xF0F8FFAA // Aqua
  266. #define COLOR_NEWS 0x808000FF // Olive
  267. #define EMBED_COLOR_GREY "{838383}"
  268. #define EMBED_COLOR_RED "{FF0000}"
  269. #define EMBED_COLOR_WHITE "{FFFFFF}"
  270. // SQL datatypes
  271. #define MAX_SQL_INTEGER 10
  272. #define MAX_SQL_TIMESTAMP 19 // 1999-01-08 04:05:06 [5 + 4 + 2 + 2 +2 + 2 + 2]
  273. #define MAX_SQL_FLOAT 16
  274. #define MAX_SQL_HASH 128
  275. #define MAX_SQL_IP 45
  276. #define MAX_SQL_REASON 121
  277. // Log levels
  278. #define LOGLEVEL_CHAT -2
  279. #define LOGLEVEL_COMMAND -1
  280. #define LOGLEVEL_DEBUG 0
  281. #define LOGLEVEL_INFO 1
  282. #define LOGLEVEL_NOTICE 2
  283. #define LOGLEVEL_WARNING 3
  284. #define LOGLEVEL_ERROR 4
  285. #define LOGLEVEL_CRITICAL 5
  286. #define LOGLEVEL_PANIC 6
  287. // Userlevels
  288. enum{ // Noted values as comments, for database reference.
  289. UNREGISTERED_PLAYER, // 0
  290. REGISTERED_PLAYER, // 1
  291. REGULAR_PLAYER, // 2 Spent many hours in and around the comunity.
  292. VIP_PLAYER, // 3 Donated.
  293. MODERATOR_CREW, // 4
  294. VETERAN_CREW, // 5 Inactive admins and management that are allowed to keep their rights.
  295. ADMIN_CREW, // 6
  296. UNDERCOVER_ADMIN_CREW, // 7
  297. MANAGEMENT_CREW, // 8
  298. UNDRECOVER_MANAGEMENT_CREW, // 9
  299. FOUNDER_PLAYER, // 10
  300. UNDERCOVER_FOUNDER_PLAYER, // 11
  301. }
  302. // Discord channels
  303. enum{
  304. ECHO_CHANNEL,
  305. MAIN_CHANNEL,
  306. ADMIN_ECHO_CHANNEL,
  307. ADMIN_CHANNEL,
  308. MANAGEMENT_CHANNEL,
  309. }
  310. // Chats
  311. enum{
  312. 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)
  313. CHAT_WHISPER,
  314. CHAT_LOW,
  315. CHAT_ACTION,
  316. CHAT_SHOUT,
  317. CHAT_OC,
  318. CHAT_GLOBAL,
  319. CHAT_CALL,
  320. CHAT_SMS,
  321. CHAT_RADIO,
  322. CHAT_PM,
  323. CHAT_GANG,
  324. CHAT_GANG_OC,
  325. CHAT_FACTION,
  326. CHAT_FACTION_OC,
  327. CHAT_VIP,
  328. CHAT_CREW,
  329. CHAT_ADMIN,
  330. CHAT_MANAGEMENT,
  331. CHAT_UNDERCOVER,
  332. }
  333. // Dialogs
  334. enum{
  335. DIALOG_CHANGENAME,
  336. DIALOG_REGISTER,
  337. DIALOG_ACCOUNT_CREATED,
  338. DIALOG_LOGIN,
  339. DIALOG_CHANGE_USERNAME,
  340. DIALOG_CHARACTERS,
  341. DIALOG_LOGIN_FAILED,
  342. DIALOG_DELETE_CHARACTER,
  343. DIALOG_GOTO,
  344. DIALOG_GOTO_INTERIOR,
  345. DIALOG_GOTO_PLAYER,
  346. DIALOG_GOTO_247,
  347. DIALOG_GOTO_AVIATION,
  348. DIALOG_GOTO_AMMUNATION,
  349. DIALOG_GOTO_BURGLARYHOUSE,
  350. DIALOG_GOTO_CASINO,
  351. DIALOG_GOTO_MISSION,
  352. DIALOG_GOTO_MISSIONEXT,
  353. DIALOG_GOTO_MISSIONHOUSE,
  354. DIALOG_GOTO_MODDING,
  355. DIALOG_GOTO_POLICE,
  356. DIALOG_GOTO_HOUSES,
  357. DIALOG_GOTO_SAFEHOUSE,
  358. DIALOG_GOTO_SHOPS,
  359. DIALOG_GOTO_SHOP,
  360. DIALOG_GOTO_STADIA,
  361. DIALOG_GOTO_UHOUSE,
  362. DIALOG_GOTO_SEXWORK,
  363. DIALOG_GOTO_UNCATAGORIZED,
  364. DIALOG_CREATE_PICKUP,
  365. DIALOG_CREATE_FACTION_PICKUP,
  366. DIALOG_DUTY_PD,
  367. DIALOG_POLICE_SKIN,
  368. DIALOG_DUTY_MD,
  369. DIALOG_MEDIC_SKIN,
  370. DIALOG_DUTY_FD,
  371. DIALOG_FIRE_SKIN,
  372. DIALOG_DUTY_SD,
  373. DIALOG_SHERIFF_SKIN,
  374. DIALOG_DUTY_FBI,
  375. DIALOG_FBI_SKIN,
  376. DIALOG_DUTY_DMV,
  377. DIALOG_DMV_SKIN,
  378. DIALOG_DUTY_NEWS,
  379. DIALOG_NEWS_SKIN,
  380. }
  381. // Pickups
  382. enum{
  383. PICKUP_FACTION_PD,
  384. PICKUP_FACTION_MD,
  385. PICKUP_FACTION_FD,
  386. PICKUP_FACTION_SD,
  387. PICKUP_FACTION_FBI,
  388. PICKUP_FACTION_DMV,
  389. PICKUP_FACTION_NEWS,
  390. PICKUP_PORTAL, // MUST be last as it's not in the pickup create dialog
  391. }
  392. // Location categories
  393. enum{
  394. GOTO_CATEGORY_INTERIOR,
  395. }
  396. enum{
  397. INTERIOR_CATEGORY_AVIATION,
  398. INTERIOR_CATEGORY_HOUSES,
  399. INTERIOR_CATEGORY_MISSION,
  400. INTERIOR_CATEGORY_MISSIONEXT,
  401. INTERIOR_CATEGORY_POLICE,
  402. INTERIOR_CATEGORY_SEXWORK,
  403. INTERIOR_CATEGORY_SHOPS,
  404. INTERIOR_CATEGORY_STADIA,
  405. }
  406. enum{
  407. INTERIOR_HOUSE_CAT_BURGLARY,
  408. INTERIOR_HOUSE_CAT_MISSION,
  409. INTERIOR_HOUSE_CAT_SAFE,
  410. INTERIOR_HOUSE_CAT_U,
  411. }
  412. enum{
  413. INTERIOR_SHOP_CAT_247,
  414. INTERIOR_SHOP_CAT_AMMUNATION,
  415. INTERIOR_SHOP_CAT_CASINO,
  416. INTERIOR_SHOP_CAT_MODSHOP,
  417. INTERIOR_SHOP_CAT_SHOP,
  418. }
  419. enum{INTERIOR_247_LSHAPED, INTERIOR_247_OBLONG, INTERIOR_247_MEDIUM, INTERIOR_247_MEDIUM_NOEXIT, INTERIOR_247_LONG, INTERIOR_247_SQAURE}
  420. enum{
  421. INTERIOR_AVIATION_TICKET,
  422. INTERIOR_AVIATION_BAGGAGE,
  423. INTERIOR_AVIATION_SHAMAL,
  424. INTERIOR_AVIATION_ANDROMADA,
  425. INTERIOR_AVIATION_LSAIRPORT
  426. }
  427. enum{INTERIOR_AMMU_OCEAN, INTERIOR_AMMU_PALOMINO, INTERIOR_AMMU_ANGEL, INTERIOR_AMMU_QUEBRADOS, INTERIOR_AMMU_2STORIES, INTERIOR_AMMU_BOOTH, INTERIOR_AMMU_RANGE}
  428. enum{
  429. INTERIOR_BURGRLARY_LARGE,
  430. INTERIOR_BURGRLARY_MEDIUM,
  431. INTERIOR_BURGRLARY_SMALL,
  432. INTERIOR_BURGRLARY_VERYLARGE,
  433. INTERIOR_BURGRLARY_5,
  434. INTERIOR_BURGRLARY_6,
  435. INTERIOR_BURGRLARY_NOBATH,
  436. }
  437. enum{
  438. INTERIOR_CASINO_CALIGULAS,
  439. INTERIOR_CASINO_REDLAND,
  440. INTERIOR_CASINO_4DRAGONS,
  441. INTERIOR_CASINO_4DRAGONSUITE,
  442. }
  443. enum{
  444. INTERIOR_MISSION_ATRIUM,
  445. INTERIOR_MISSION_BIGSMOKE,
  446. INTERIOR_MISSION_JEFFERSON,
  447. INTERIOR_MISSION_JIZZY,
  448. INTERIOR_MISSION_RC,
  449. INTERIOR_MISSION_WUZI,
  450. }
  451. enum{
  452. INTERIOR_MISSIONEXT_GAS,
  453. INTERIOR_MISSIONEXT_LIBERTY,
  454. INTERIOR_MISSIONEXT_SFGARAGE,
  455. }
  456. enum{
  457. INTERIOR_MISSIONHOUSE_DESIRE,
  458. INTERIOR_MISSIONHOUSE_COLONEL,
  459. INTERIOR_MISSIONHOUSE_RYDER,
  460. INTERIOR_MISSIONHOUSE_SWEET,
  461. INTERIOR_MISSIONHOUSE_CRACK,
  462. }
  463. enum{INTERIOR_MOD_LOCO, INTERIOR_MOD_WHEEL, INTERIOR_MOD_TRANSFENDER}
  464. enum{INTERIOR_PD_LV, INTERIOR_PD_LS, INTERIOR_PD_SF, INTERIOR_PD_BARBARA}
  465. enum{
  466. INTERIOR_HOUSE_GOLDEN,
  467. INTERIOR_HOUSE_HASHBURY,
  468. INTERIOR_HOUSE_JOHNSON,
  469. INTERIOR_HOUSE_MADDDOGG,
  470. INTERIOR_HOUSE_RED,
  471. INTERIOR_HOUSE_VERDANT,
  472. INTERIOR_HOUSE_UNUSED,
  473. }
  474. enum{
  475. INTERIOR_SEXWORK_BROTHEL,
  476. INTERIOR_SEXWORK_BROTHEL2,
  477. INTERIOR_SEXWORK_BIGSPREAD,
  478. }
  479. enum{
  480. INTERIOR_SHOP_TATTOO,
  481. INTERIOR_SHOP_BURGER,
  482. INTERIOR_SHOP_PIZZA,
  483. INTERIOR_SHOP_CLUCKIN,
  484. INTERIOR_SHOP_CALIGULAS,
  485. INTERIOR_SHOP_CASINO,
  486. INTERIOR_SHOP_4DRAGONS,
  487. INTERIOR_SHOP_4DRAGONSUITE,
  488. INTERIOR_SHOP_DONUTS,
  489. INTERIOR_SHOP_RC,
  490. INTERIOR_SHOP_PUMP,
  491. INTERIOR_SHOP_GYM,
  492. INTERIOR_SHOP_BETTING,
  493. INTERIOR_SHOP_RECORDS,
  494. }
  495. enum{
  496. INTERIOR_STADIUM_BLOODBOWL,
  497. INTERIOR_STADIUM_KICKSTART,
  498. INTERIOR_STADIUM_8TRACK,
  499. INTERIOR_STADIUM_DIRTBIKE,
  500. }
  501. enum{
  502. INTERIOR_
  503. }
  504. // Factions
  505. enum{
  506. FACTION_NONE,
  507. FACTION_POLICE,
  508. FACTION_MEDIC,
  509. FACTION_FIRE,
  510. FACTION_SHERIFF,
  511. FACTION_FBI,
  512. FACTION_DMV,
  513. FACTION_NEWS,
  514. }
  515. // Jobs
  516. enum{
  517. JOB_NONE,
  518. JOB_POLICE,
  519. JOB_MEDIC,
  520. JOB_FIRE,
  521. JOB_SHERIFF,
  522. JOB_FBI,
  523. JOB_DMV,
  524. JOB_NEWS,
  525. }
  526. // Vehicles
  527. enum{
  528. EDITVEHICLE_PARK,
  529. EDITVEHICLE_COLOR,
  530. EDITVEHICLE_RESPAWN,
  531. EDITVEHICLE_SIREN,
  532. }
  533. new vehicleNameArray[212][] = {
  534. {"Landstalker"},
  535. {"Bravura"},
  536. {"Buffalo"},
  537. {"Linerunner"},
  538. {"Perrenial"},
  539. {"Sentinel"},
  540. {"Dumper"},
  541. {"Firetruck"},
  542. {"Trashmaster"},
  543. {"Stretch"},
  544. {"Manana"},
  545. {"Infernus"},
  546. {"Voodoo"},
  547. {"Pony"},
  548. {"Mule"},
  549. {"Cheetah"},
  550. {"Ambulance"},
  551. {"Leviathan"},
  552. {"Moonbeam"},
  553. {"Esperanto"},
  554. {"Taxi"},
  555. {"Washington"},
  556. {"Bobcat"},
  557. {"Mr Whoopee"},
  558. {"BF Injection"},
  559. {"Hunter"},
  560. {"Premier"},
  561. {"Enforcer"},
  562. {"Securicar"},
  563. {"Banshee"},
  564. {"Predator"},
  565. {"Bus"},
  566. {"Rhino"},
  567. {"Barracks"},
  568. {"Hotknife"},
  569. {"Trailer 1"},
  570. {"Previon"},
  571. {"Coach"},
  572. {"Cabbie"},
  573. {"Stallion"},
  574. {"Rumpo"},
  575. {"RC Bandit"},
  576. {"Romero"},
  577. {"Packer"},
  578. {"Monster"},
  579. {"Admiral"},
  580. {"Squalo"},
  581. {"Seasparrow"},
  582. {"Pizzaboy"},
  583. {"Tram"},
  584. {"Trailer 2"},
  585. {"Turismo"},
  586. {"Speeder"},
  587. {"Reefer"},
  588. {"Tropic"},
  589. {"Flatbed"},
  590. {"Yankee"},
  591. {"Caddy"},
  592. {"Solair"},
  593. {"Berkley's RC Van"},
  594. {"Skimmer"},
  595. {"PCJ-600"},
  596. {"Faggio"},
  597. {"Freeway"},
  598. {"RC Baron"},
  599. {"RC Raider"},
  600. {"Glendale"},
  601. {"Oceanic"},
  602. {"Sanchez"},
  603. {"Sparrow"},
  604. {"Patriot"},
  605. {"Quad"},
  606. {"Coastguard"},
  607. {"Dinghy"},
  608. {"Hermes"},
  609. {"Sabre"},
  610. {"Rustler"},
  611. {"ZR-350"},
  612. {"Walton"},
  613. {"Regina"},
  614. {"Comet"},
  615. {"BMX"},
  616. {"Burrito"},
  617. {"Camper"},
  618. {"Marquis"},
  619. {"Baggage"},
  620. {"Dozer"},
  621. {"Maverick"},
  622. {"News Chopper"},
  623. {"Rancher"},
  624. {"FBI Rancher"},
  625. {"Virgo"},
  626. {"Greenwood"},
  627. {"Jetmax"},
  628. {"Hotring"},
  629. {"Sandking"},
  630. {"Blista Compact"},
  631. {"Police Maverick"},
  632. {"Boxville"},
  633. {"Benson"},
  634. {"Mesa"},
  635. {"RC Goblin"},
  636. {"Hotring Racer A"},
  637. {"Hotring Racer B"},
  638. {"Bloodring Banger"},
  639. {"Rancher"},
  640. {"Super GT"},
  641. {"Elegant"},
  642. {"Journey"},
  643. {"Bike"},
  644. {"Mountain Bike"},
  645. {"Beagle"},
  646. {"Cropdust"},
  647. {"Stunt"},
  648. {"Tanker"},
  649. {"Roadtrain"},
  650. {"Nebula"},
  651. {"Majestic"},
  652. {"Buccaneer"},
  653. {"Shamal"},
  654. {"Hydra"},
  655. {"FCR-900"},
  656. {"NRG-500"},
  657. {"HPV1000"},
  658. {"Cement Truck"},
  659. {"Tow Truck"},
  660. {"Fortune"},
  661. {"Cadrona"},
  662. {"FBI Truck"},
  663. {"Willard"},
  664. {"Forklift"},
  665. {"Tractor"},
  666. {"Combine"},
  667. {"Feltzer"},
  668. {"Remington"},
  669. {"Slamvan"},
  670. {"Blade"},
  671. {"Freight"},
  672. {"Streak"},
  673. {"Vortex"},
  674. {"Vincent"},
  675. {"Bullet"},
  676. {"Clover"},
  677. {"Sadler"},
  678. {"Firetruck LA"},
  679. {"Hustler"},
  680. {"Intruder"},
  681. {"Primo"},
  682. {"Cargobob"},
  683. {"Tampa"},
  684. {"Sunrise"},
  685. {"Merit"},
  686. {"Utility"},
  687. {"Nevada"},
  688. {"Yosemite"},
  689. {"Windsor"},
  690. {"Monster A"},
  691. {"Monster B"},
  692. {"Uranus"},
  693. {"Jester"},
  694. {"Sultan"},
  695. {"Stratum"},
  696. {"Elegy"},
  697. {"Raindance"},
  698. {"RC Tiger"},
  699. {"Flash"},
  700. {"Tahoma"},
  701. {"Savanna"},
  702. {"Bandito"},
  703. {"Freight Flat"},
  704. {"Streak Carriage"},
  705. {"Kart"},
  706. {"Mower"},
  707. {"Duneride"},
  708. {"Sweeper"},
  709. {"Broadway"},
  710. {"Tornado"},
  711. {"AT-400"},
  712. {"DFT-30"},
  713. {"Huntley"},
  714. {"Stafford"},
  715. {"BF-400"},
  716. {"Newsvan"},
  717. {"Tug"},
  718. {"Trailer 3"},
  719. {"Emperor"},
  720. {"Wayfarer"},
  721. {"Euros"},
  722. {"Hotdog"},
  723. {"Club"},
  724. {"Freight Carriage"},
  725. {"Trailer 3"},
  726. {"Andromada"},
  727. {"Dodo"},
  728. {"RC Cam"},
  729. {"Launch"},
  730. {"Police Car (LSPD)"},
  731. {"Police Car (SFPD)"},
  732. {"Police Car (LVPD)"},
  733. {"Police Ranger"},
  734. {"Picador"},
  735. {"S.W.A.T. Van"},
  736. {"Alpha"},
  737. {"Phoenix"},
  738. {"Glendale"},
  739. {"Sadler"},
  740. {"Luggage Trailer A"},
  741. {"Luggage Trailer B"},
  742. {"Stair Trailer"},
  743. {"Boxville"},
  744. {"Farm Plow"},
  745. {"Utility Trailer"}
  746. };
  747. // Environment settings TODO: THESE SHOULD ALL BE READ FROM A CONFIG FILE!
  748. static bool:scriptDebug = true; // Debug setting
  749. #define MODE_NAME "0.0a Build 10"
  750. #define SERVER_NAME "Bone County RPG"
  751. #define PG_HOST "127.0.0.1"
  752. #define PG_ROLE "rpfw-dev"
  753. #define PG_PASS "nJd&1k$0fs"
  754. #define PG_DB "rpfw-dev"
  755. #define PG_PORT 5432
  756. #define DISCORD_HOME_GUILD_ID "666077037470941184" // Emerald City Roleplay
  757. #define DISCORD_ECHO_CHANNEL_ID "677855051166777344" // #bcrp-echo
  758. //#define DISCORD_ECHO_CHANNEL_ID "666078187079598080" // #ecrp-echo
  759. #define DISCORD_MAIN_CHANNEL_ID "677855315898793984" // #bcrp
  760. //#define DISCORD_MAIN_CHANNEL_ID "667396220402270228" // #development
  761. #define DISCORD_ADMIN_ECHO_CHANNEL_ID "672841892169383936" // #admin-echo
  762. #define DISCORD_ADMIN_CHANNEL_ID "667396026058932236" // #admins
  763. #define DISCORD_MANAGEMENT_CHANNEL_ID "666091376240361492" // #management
  764. // Game-mode limits
  765. #define MAX_CHARACTERS_PER_USER 20 // Maximum of MAX_CHARACTERS_PER_USER_DIGITS digits (Due to SQL query string length)
  766. #define MAX_CHARACTERS_PER_USER_DIGITS 3
  767. // SQL plugin
  768. new SQL:sqlHandle;
  769. // discord-connector
  770. //static DCC_Guild:homeGuild; // Discord guild controlled by game community.
  771. static DCC_Channel:echoChannel; // Public echo channel.
  772. static DCC_Channel:mainChannel; // Channel for communirty notifications.
  773. static DCC_Channel:adminEchoChannel; // Admin echo channel.
  774. static DCC_Channel:adminChannel; // Channel for admin notifications.
  775. static DCC_Channel:managementChannel; // Channel for management notifications.
  776. DiscordEcho(const message[], messageLevel){ // Write to echo channels.
  777. switch(messageLevel) // Output facilities.
  778. {
  779. case ECHO_CHANNEL: { // Public echo message
  780. DiscordSendChannelMessage(echoChannel, message);
  781. 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.
  782. }
  783. case MAIN_CHANNEL: {DiscordSendChannelMessage(mainChannel, message);} // Public notification
  784. case ADMIN_ECHO_CHANNEL: {DiscordSendChannelMessage(adminEchoChannel, message);} // Admin echo message
  785. case ADMIN_CHANNEL: {DiscordSendChannelMessage(adminChannel, message);} // Admin notification
  786. case MANAGEMENT_CHANNEL: {DiscordSendChannelMessage(managementChannel, message);} // Management notification
  787. }
  788. return 0;
  789. }
  790. // Natives
  791. native WP_Hash(buffer[], len, const str[]); // https://forum.sa-mp.com/showthread.php?t=570945
  792. //native Float:loadavg(); // https://forum.sa-mp.com/showthread.php?t=260206 LINUX ONLY
  793. // Includes
  794. #include <a_samp> // https://sa-mp.com
  795. #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
  796. #include <sscanf2> // Newest version: https://github.com/maddinat0r/sscanf/releases | Better readme: https://github.com/Y-Less/sscanf
  797. #include <strlib> // https://github.com/oscar-broman/strlib
  798. #include <Pawn.Regex> // https://github.com/urShadow/Pawn.Regex
  799. #include <Pawn.CMD> // https://github.com/urShadow/Pawn.CMD (Fastest player in town)
  800. #include <gvar> // https://github.com/samp-incognito/samp-gvar-plugin
  801. #include <discord-connector> // https://github.com/maddinat0r/samp-discord-connector (Only player in town)
  802. #include <streamer> // https://github.com/samp-incognisto/samp-streamer-plugin
  803. /// Middle-ware
  804. // Logging
  805. logger(const log_level, const message[]){ // Write to logging facility
  806. // Do not log commands or debug when script debugging is turned off.
  807. if(scriptDebug == false){ // Debug is off
  808. if(log_level == LOGLEVEL_COMMAND || log_level == LOGLEVEL_DEBUG){ // Command or debug message
  809. return 0; // Stop and do not log
  810. }
  811. }
  812. // Messagelevel tag
  813. new human_readable_log_level[8 + 1];
  814. switch(log_level){ // Assign log level.
  815. case LOGLEVEL_CHAT: human_readable_log_level = "chat";
  816. case LOGLEVEL_COMMAND: human_readable_log_level = "command";
  817. case LOGLEVEL_DEBUG: human_readable_log_level = "debug";
  818. case LOGLEVEL_INFO: human_readable_log_level = "info";
  819. case LOGLEVEL_NOTICE: human_readable_log_level = "notice";
  820. case LOGLEVEL_WARNING: human_readable_log_level = "warning";
  821. case LOGLEVEL_ERROR: human_readable_log_level = "error";
  822. case LOGLEVEL_CRITICAL: human_readable_log_level = "critical";
  823. case LOGLEVEL_PANIC: human_readable_log_level = "panic";
  824. }
  825. printf("[%s] %s", human_readable_log_level, message); // Print to STDOUT.
  826. return 0;
  827. }
  828. /*// SQL plugin (BROKEN, look at it again after I have more then a week of experience)
  829. //forward sqlQuery(SQL:handle, query[]);
  830. //public sqlQuery(SQL:handle, query[]){
  831. sqlQuery(SQL:handle, query[]){
  832. //sql_wait(handle); // Wait for all queries to finish.
  833. new Result:result = sql_query(handle, query);
  834. if(sql_error(result)){printf("SQL error");} // Did not work during a test with a faulty statement.
  835. return result;
  836. }*/
  837. // discord-connector
  838. DiscordSendChannelMessage(DCC_Channel:channel, const message[]){
  839. if(scriptDebug){ // Log middle-ware event in debugging mode only
  840. new channel_name[100 + 1]; // Default value from tutorial
  841. DCC_GetChannelName(channel, channel_name);
  842. new logMessage[26 + 100 + 2000 + 1]; // Discord max message length = 2000
  843. format(logMessage, sizeof(logMessage), "Send to discord channel %s: %s", channel_name, message);
  844. logger(LOGLEVEL_DEBUG, logMessage); // Actually log the message
  845. }
  846. DCC_SendChannelMessage(channel, message); // Call discord-connector DISABLE THIS TO STOP ALL OUTGOING DISCORD MESSAGES
  847. }
  848. /// Game-mode
  849. // Account functions
  850. forward changeName(playerid, const name[]);
  851. public changeName(playerid, const name[]){ // Check if name is valid and force change if needed.
  852. // Prevent regex error when comparing against null
  853. if(isempty(name)){ // No name entered
  854. 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.
  855. return 0;
  856. }
  857. // Check name
  858. 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
  859. new isValidName = Regex_Check(name, r); // Validate name to filter
  860. Regex_Delete(r);
  861. if(!isValidName){ // Invalid role-play name
  862. 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.
  863. }
  864. else { // Valid role-play name
  865. print("Valid name");
  866. // Check for name in use
  867. /*new escaped_name[MAX_PLAYER_NAME + 1]; // TODO should be more, to account for escape characters.
  868. 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...*/
  869. new character_query[40 + MAX_PLAYER_NAME + 1], Result:character_result = sql_query(sqlHandle, character_query);
  870. format(character_query, sizeof(character_query), "SELECT id FROM character WHERE name = '%s'", name);
  871. if(sql_num_rows(character_result) > 0){ // Name taken
  872. ShowPlayerDialog(playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT, "Character name", "Name already taken. Please pick an original name.", "Change", ""); // Force RP name.
  873. }
  874. else{ // Name free
  875. // Notify all players
  876. new message[11 + 4 + MAX_PLAYER_NAME + 1];
  877. format(message, sizeof(message), "* [%i] %s joined.", playerid, getCharacterName(playerid));
  878. SendClientMessageToAll(COLOR_NOTICE, message); // Notify all players
  879. DiscordEcho(message, ECHO_CHANNEL); // Notify discord public echo
  880. new client_connect_username[MAX_PLAYER_NAME + 1], admin_message[38 + 4 + MAX_PLAYER_NAME + MAX_PLAYER_NAME + 1];
  881. GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid); // Get client connect name
  882. if(GetPlayerState(playerid) == PLAYER_STATE_NONE){ // Not spawned: character creation (Creating a character without registering)
  883. // Notify admins
  884. format(admin_message, sizeof(admin_message), "* [%i] %s temporary charcter, created by: %s", playerid, getCharacterName(playerid), client_connect_username);
  885. sendToAdmins(COLOR_NOTICE, admin_message);
  886. // Do nothing let continue to spawn, after spawn character will be saved to database.
  887. }
  888. else{ // Spawnedplayer: Creating permanent or renaming an existing permanent character
  889. // Notify admins
  890. format(admin_message, sizeof(admin_message), "* [%i] %s created by: %s", playerid, getCharacterName(playerid), client_connect_username);
  891. sendToAdmins(COLOR_NOTICE, admin_message);
  892. // Send to skin selection
  893. ForceClassSelection(playerid);
  894. TogglePlayerSpectating(playerid, true);
  895. TogglePlayerSpectating(playerid, false);
  896. }
  897. // Change name (No way yet to change name ingame)
  898. /*if(GetGVarInt("userlevel", playerid) > 1){ // Registered player.
  899. // Get username
  900. new username[MAX_PLAYER_NAME + 1], message[75 + MAX_PLAYER_NAME + 1];
  901. GetGVarString("username", username, sizeof(username), playerid);
  902. // Update or create character name in database
  903. new callback[1];
  904. new Result:result;
  905. new query[51 + MAX_PLAYER_NAME + MAX_PLAYER_NAME + 1];
  906. format(query, sizeof(query), "UPDATE \"user\"(name) VALUES('%s') WHERE username == '%s'", name, username);
  907. sql_wait(sqlHandle); // Wait for other queries to finish
  908. result = sql_query(sqlHandle, query, callback = "", "r");
  909. // Inform user
  910. format(message, sizeof(message), "SERVER: Your username remains unchanged, next time connect as: %s", client_connect_username);
  911. SendClientMessage(playerid, COLOR_WHITE, message);
  912. }*/
  913. SetPlayerName(playerid, name); // Change name in-game
  914. }
  915. }
  916. return 0;
  917. }
  918. forward register(playerid);
  919. public register(playerid){ // Register player in database
  920. if(GetPlayerState(playerid) == PLAYER_STATE_NONE){ // Not spawned
  921. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "ERROR: You need to have spawned to register.");
  922. }
  923. else{ // Spawned player
  924. if(GetGVarInt("userlevel", playerid) != UNREGISTERED_PLAYER){ // Registered player.
  925. new message[35 + MAX_PLAYER_NAME + 1];
  926. format(message, sizeof(message), "ERROR: You are already registered"); //, %s.",
  927. SendClientMessage(playerid, COLOR_WHITE, message);
  928. }
  929. else{ // Unregistered player.
  930. 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
  931. }
  932. }
  933. }
  934. forward createCharacterRecord(playerid, id);
  935. public createCharacterRecord(playerid, id){
  936. new character_query[94 + MAX_SQL_INTEGER + MAX_PLAYER_NAME + 3 + 1];
  937. format(character_query, sizeof(character_query), "INSERT INTO character(user_id, name, skin_id) VALUES(%i, '%s', %i)", id, getPlayerName(playerid), GetPlayerSkin(playerid));
  938. sql_query(sqlHandle, character_query);
  939. }
  940. forward authenticate(playerid);
  941. public authenticate(playerid){
  942. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Sign in", "Enter your password to log on", "Log in", "Cancel"); // Show password confirmation dialog
  943. }
  944. forward characterSelection(playerid);
  945. public characterSelection(playerid){
  946. if(GetGVarInt("userlevel", playerid) < REGISTERED_PLAYER){ // Unregistered player (Or worse?)
  947. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: Register first with: /my account register");
  948. }
  949. else{ // Registered player
  950. // If spawned, save current character
  951. if(GetPlayerState(playerid) != PLAYER_STATE_NONE){
  952. savePlayerState(playerid);
  953. }
  954. new id = getUserID(playerid);
  955. new character_query[75 + MAX_SQL_INTEGER + MAX_CHARACTERS_PER_USER_DIGITS + 1];
  956. format(character_query, sizeof(character_query), "SELECT id, name FROM character WHERE user_id = %i LIMIT %i", id, MAX_CHARACTERS_PER_USER);
  957. new Result:character_result = sql_query(sqlHandle, character_query);
  958. new character_string[(MAX_PLAYER_NAME * MAX_CHARACTERS_PER_USER) + 1], character_array[MAX_CHARACTERS_PER_USER + 1];
  959. for(new i = 0; i < sql_num_rows(character_result); i++){
  960. new name[MAX_PLAYER_NAME + 1];
  961. sql_get_field_assoc_ex(character_result, i, "name", name, sizeof(name));
  962. format(character_string, sizeof(character_string), "%s%s\n", character_string, name);
  963. character_array[i] = sql_get_field_assoc_int_ex(character_result, i, "id");
  964. printf("Character ID from array: %i", character_array[i]);
  965. }
  966. new character_array_string[MAX_CHARACTERS_PER_USER * MAX_SQL_INTEGER + 1];
  967. strfrombin(character_array_string, character_array); // Convert array to string for use with GVar
  968. SetGVarString("character_array_string", character_array_string, playerid);
  969. ShowPlayerDialog(playerid, DIALOG_CHARACTERS, DIALOG_STYLE_LIST, "Characters", character_string, "Spawn", "New");
  970. }
  971. }
  972. forward savePlayerState(playerid);
  973. public savePlayerState(playerid){
  974. 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
  975. sql_escape_string(sqlHandle, getPlayerName(playerid), escaped_playername, sizeof(escaped_playername)); // Escape player name
  976. new Float:health, Float:armour, Float:x, Float:y, Float:z, Float:angle;
  977. // Unrealiable TODO change to gvars
  978. GetPlayerHealth(playerid, health);
  979. GetPlayerArmour(playerid, armour);
  980. new world_id, interior_id;
  981. getPlayerLocation(playerid, x, y, z, angle, world_id, interior_id);
  982. 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);
  983. sql_query(sqlHandle, character_query);
  984. }
  985. forward kickPlayerDelay(playerid);
  986. public kickPlayerDelay(playerid){
  987. Kick(playerid);
  988. }
  989. forward kickPlayer(playerid, kickerid, const reason[], banned);
  990. public kickPlayer(playerid, kickerid, const reason[], banned){ // Kick a player
  991. // Issuer of kick
  992. new kickername[MAX_PLAYER_NAME + 1], kicker_id[MAX_SQL_INTEGER + 1];
  993. if(kickerid == -1){ // Not kicked by in-game player
  994. kickername = "SERVER";
  995. kicker_id = "NULL";
  996. }
  997. else{ // Kicked by in-game player
  998. kickername = getPlayerName(playerid);
  999. kicker_id = "%s", getUserID(kickerid);
  1000. }
  1001. strreplace(kickername, "_", " ");
  1002. // Action
  1003. new action[16 + MAX_SQL_INTEGER + 1];
  1004. if(banned){
  1005. if(banned < 1){ // Permanent ban
  1006. action = "banned permanently";
  1007. }
  1008. else{ // Temporary ban
  1009. format(action, sizeof(action), "banned for %i days", banned);
  1010. }
  1011. }
  1012. else{
  1013. action = "kicked";
  1014. }
  1015. // Notify all players
  1016. 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 ? ".
  1017. GetPlayerName(playerid, playername, sizeof(playername));
  1018. format(message, sizeof(message), "* [%i] %s %s, reason: %s", playerid, getCharacterName(playerid), action, reason);
  1019. format(admin_message, sizeof(admin_message), "* [%i] %s kicked %s, reason: %s", kickerid, kickername, getCharacterName(playerid), action, reason);
  1020. logger(LOGLEVEL_INFO, message); // Log event
  1021. SendClientMessageToAll(COLOR_NOTICE, message);
  1022. DiscordEcho(message, ECHO_CHANNEL);
  1023. sendToAdmins(COLOR_NOTICE, admin_message);
  1024. // Inform player (Redundant, but some people are blind or stupid)
  1025. new player_message[30 + 6 + MAX_PLAYER_NAME + MAX_SQL_REASON + 1]; // Max samp chat message length 128 - 8 for "/kick ? ".
  1026. format(player_message, sizeof(player_message), "SERVER: You have been %s, reason: %s", action, reason);
  1027. SendClientMessage(playerid, COLOR_ERROR, player_message); // Notify player
  1028. if(banned){
  1029. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "You may appeal this ban via the forum or Discord.");
  1030. }
  1031. new ip_id = getIPID(playerid);
  1032. // Crearte IP kick record
  1033. new ip_query[61 + 4 + MAX_SQL_REASON + 4 + 1];
  1034. format(ip_query, sizeof(ip_query), "INSERT INTO ip_kick(ip_id, reason, kicker_id) VALUES(%i, '%s', %s)", ip_id, reason, kicker_id);
  1035. sql_query(sqlHandle, ip_query);
  1036. // Get IP kick record
  1037. new ip_id_query[64 + 4 + MAX_SQL_REASON + 4 + 1];
  1038. 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);
  1039. new Result:ip_id_result = sql_query(sqlHandle, ip_id_query);
  1040. new ip_kick_id = sql_get_field_assoc_int(Result:ip_id_result, "id");
  1041. // User kick record
  1042. printf("Userlevel: %i", GetGVarInt("userlevel", playerid));
  1043. if(GetGVarInt("userlevel", playerid) > UNREGISTERED_PLAYER){ // Not logged in to a user account
  1044. new user_query[79 + 4 + MAX_SQL_REASON + 4 + 1];
  1045. 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);
  1046. sql_query(sqlHandle, user_query);
  1047. }
  1048. SetTimerEx("kickPlayerDelay", 50, false, "i", playerid); // Give the message 50 milliseconds to reach the player before kicking.
  1049. }
  1050. banExpiration(days);
  1051. banExpiration(days){
  1052. if(days < 1){ // Permanent ban
  1053. new foo[MAX_SQL_TIMESTAMP + 1] = "0";
  1054. return foo;
  1055. }
  1056. else{ // Temporary ban
  1057. new year, month, day, hour, minute, second, expires[MAX_SQL_TIMESTAMP + 1];
  1058. getdate(year, month, day);
  1059. gettime(hour, minute, second);
  1060. day = day + days;
  1061. format(expires, sizeof(expires), "%i-%i-%i %i:%i:%i", year, month, day, hour, minute, second);
  1062. return expires;
  1063. //return year, month, day, hour, minute, second;
  1064. //return 0;
  1065. }
  1066. }
  1067. forward banPlayer(playerid, bannerid, const reason[], days);
  1068. public banPlayer(playerid, bannerid, const reason[], days){ // Ban & kick a player
  1069. new ip_id = getIPID(playerid);
  1070. // Create IP ban record
  1071. new banner_id, ip_query[72 + MAX_SQL_INTEGER + MAX_SQL_TIMESTAMP + MAX_SQL_REASON + MAX_SQL_INTEGER + 1];
  1072. if(bannerid < 0){ // Not banned by in-game player
  1073. format(ip_query, sizeof(ip_query), "INSERT INTO ip_ban(ip_id, expires, reason) VALUES(%i, '%s', '%s')", ip_id, banExpiration(days), reason);
  1074. }
  1075. else{ // Banned by in-game player
  1076. banner_id = getUserID(bannerid);
  1077. 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);
  1078. }
  1079. sql_query(sqlHandle, ip_query);
  1080. // Get IP ban record ID
  1081. new ban_id_query[61 + MAX_PLAYER_NAME + 1];
  1082. 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);
  1083. new Result:ban_id_result = sql_query(sqlHandle, ban_id_query);
  1084. new ip_ban_id = sql_get_field_assoc_int(ban_id_result, "id");
  1085. // User ban record (As banned players get only kicked, noneed to check for active ban)
  1086. if(GetGVarInt("userlevel", playerid) > 1){ // Registered player
  1087. new user_query[97 + MAX_SQL_INTEGER + MAX_SQL_TIMESTAMP + MAX_SQL_REASON + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
  1088. 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);
  1089. sql_query(sqlHandle, user_query);
  1090. }
  1091. // Kick player
  1092. kickPlayer(playerid, bannerid, reason, days);
  1093. }
  1094. // Database functions
  1095. forward getIPID(playerid);
  1096. public getIPID(playerid){
  1097. new player_ip[MAX_SQL_IP + 1], query[37 + MAX_SQL_IP + 1]; // Create varaibles
  1098. GetPlayerIp(playerid, player_ip, sizeof(player_ip)); // Polulate player_ip variable
  1099. format(query, sizeof(query), "SELECT id FROM ip WHERE address = '%s'", player_ip); // Format query string
  1100. new Result:result = sql_query(sqlHandle, query); // Execute query
  1101. return sql_get_field_assoc_int(result, "id"); // Get id from result
  1102. }
  1103. forward getUserID(playerid);
  1104. public getUserID(playerid){
  1105. // SQL escape username
  1106. 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!)
  1107. GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid); // Get client connect name
  1108. sql_escape_string(sqlHandle, client_connect_username, escaped_username, sizeof(escaped_username)); // Escape player name
  1109. // Get user ID
  1110. new userid_query[47 + MAX_PLAYER_NAME + 1];
  1111. format(userid_query, sizeof(userid_query), "SELECT id FROM \"user\" WHERE name = '%s'", escaped_username);
  1112. new Result:result = sql_query(sqlHandle, userid_query);
  1113. return sql_get_field_assoc_int(result, "id");
  1114. }
  1115. // Player functions
  1116. forward deleteAllGVars(playerid);
  1117. public deleteAllGVars(playerid){ // Delete GVars as per https://forum.sa-mp.com/showthread.php?t=151076
  1118. DeleteGVar("client_connect_username", playerid); // From OnPlayerConnect()
  1119. DeleteGVar("userlevel", playerid); // From OnPlayerConnect()
  1120. DeleteGVar("hash", playerid); // From DIALOG_REGISTER
  1121. DeleteGVar("character_array_string", playerid); // From OnDialogResponse()
  1122. DeleteGVar("authentication_count", playerid); // From DIALOG_LOGIN
  1123. DeleteGVar("character_id", playerid); // From DIALOG_CHARACTERS
  1124. DeleteGVar("chatmode", playerid); // From cmd:my()
  1125. DeleteGVar("disable_pickups", playerid); // From OnPlayerPickUpDynamicPickup()
  1126. DeleteGVar("goto_target", playerid); // From cmd:my() & cmd:p()
  1127. DeleteGVar("job", playerid); // From OnDialogResponse()
  1128. }
  1129. //getPlayerName(playerid);
  1130. getPlayerName(playerid){
  1131. // new playername[MAX_PLAYER_NAME + 1];
  1132. new const playername[MAX_PLAYER_NAME + 1];
  1133. GetPlayerName(playerid, playername, sizeof(playername));
  1134. // new output[MAX_PLAYER_NAME + 1];
  1135. // strfromliteral(output, playername);
  1136. return playername;
  1137. }
  1138. forward gotoCallback(Float:x, Float:y, Float:z, world, interior, Float:angle, const name[], playerid = -1);
  1139. stock gotoCallback(Float:x, Float:y, Float:z, world, interior, Float:angle, const name[], playerid = -1){
  1140. if(playerid== -1){
  1141. playerid = GetGVarInt("goto_target", playerid);
  1142. DeleteGVar("goto_target", playerid);
  1143. }
  1144. teleportPlayer(playerid, x, y, z, angle, world, interior);
  1145. // Inform admins
  1146. new admin_message[21 + 4 + MAX_PLAYER_NAME + 5 + 4 + MAX_PLAYER_NAME + 1 + 1]; // 5 + 4 + MAX_PLAYER_NAME + 1 = name
  1147. format(admin_message, sizeof(admin_message), "* [%i] %s teleported to: %s", playerid, getCharacterName(playerid), name);
  1148. sendToAdmins(COLOR_NOTICE, admin_message);
  1149. }
  1150. forward setPlayerSkin(playerid, skinid);
  1151. public setPlayerSkin(playerid, skinid){
  1152. print("Called setPlayerSkin()");
  1153. new
  1154. Float:tmpPos[4],
  1155. vehicleid = GetPlayerVehicleID(playerid),
  1156. seatid = GetPlayerVehicleSeat(playerid);
  1157. GetPlayerPos(playerid, tmpPos[0], tmpPos[1], tmpPos[2]);
  1158. GetPlayerFacingAngle(playerid, tmpPos[3]);
  1159. if(skinid < 0 || skinid > 299) return 0;
  1160. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DUCK)
  1161. {
  1162. SetPlayerPos(playerid, tmpPos[0], tmpPos[1], tmpPos[2]);
  1163. SetPlayerFacingAngle(playerid, tmpPos[3]);
  1164. TogglePlayerControllable(playerid, 1); // preventing any freeze - optional
  1165. return SetPlayerSkin(playerid, skinid);
  1166. }
  1167. else if(IsPlayerInAnyVehicle(playerid))
  1168. {
  1169. new
  1170. tmp;
  1171. RemovePlayerFromVehicle(playerid);
  1172. SetPlayerPos(playerid, tmpPos[0], tmpPos[1], tmpPos[2]);
  1173. SetPlayerFacingAngle(playerid, tmpPos[3]);
  1174. TogglePlayerControllable(playerid, 1); // preventing any freeze - important - because of doing animations of exiting vehicle
  1175. tmp = SetPlayerSkin(playerid, skinid);
  1176. PutPlayerInVehicle(playerid, vehicleid, (seatid == 128) ? 0 : seatid);
  1177. return tmp;
  1178. }
  1179. else
  1180. {
  1181. return SetPlayerSkin(playerid, skinid);
  1182. }
  1183. }
  1184. forward getPlayerLocation(playerid, &Float:x, &Float:y, &Float:z, &Float:angle, &world, &interior);
  1185. public getPlayerLocation(playerid, &Float:x, &Float:y, &Float:z, &Float:angle, &world, &interior){
  1186. GetPlayerPos(playerid, x, y, z);
  1187. GetPlayerFacingAngle(playerid, angle);
  1188. world = GetPlayerVirtualWorld(playerid);
  1189. interior = GetPlayerInterior(playerid);
  1190. printf("Angle: %f", angle);
  1191. }
  1192. forward teleportPlayer(playerid, Float:x, Float:y, Float:z, Float:angle, world, interior);
  1193. public teleportPlayer(playerid, Float:x, Float:y, Float:z, Float:angle, world, interior){
  1194. SetPlayerPos(playerid, x, y, z);
  1195. SetPlayerVirtualWorld(playerid, world);
  1196. SetPlayerInterior(playerid, interior);
  1197. SetPlayerFacingAngle(playerid, angle);
  1198. }
  1199. //forward setPlayerJob(playerid, job, skin_id = 0, color = COLOR_WHITE);
  1200. stock setPlayerJob(playerid, job, skin_id = 0, color = COLOR_WHITE){
  1201. switch(job){
  1202. case JOB_NONE:{
  1203. // Get skin from character record
  1204. new character_query[42 + MAX_SQL_INTEGER + 1];
  1205. format(character_query, sizeof(character_query), "SELECT skin_id FROM character WHERE id = %i", GetGVarInt("character_id", playerid));
  1206. new Result:id_result = sql_query(sqlHandle, character_query);
  1207. skin_id = sql_get_field_assoc_int(id_result, "skin_id");
  1208. color = COLOR_WHITE;
  1209. ResetPlayerWeapons(playerid);
  1210. // TODO: get weaponskill fromddatabase and set it to player.
  1211. // TODO: Set player weapons from database
  1212. }
  1213. case JOB_POLICE:{
  1214. SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
  1215. GivePlayerWeapon(playerid, 3, 1); // Baton
  1216. GivePlayerWeapon(playerid, 17, 10); // Teargas
  1217. GivePlayerWeapon(playerid, 22, 170); // 10 clips and a 9mm
  1218. }
  1219. // case JOB_MEDIC:
  1220. case JOB_FIRE:{
  1221. GivePlayerWeapon(playerid, 42, 1); // Fire extinguisher
  1222. }
  1223. case JOB_SHERIFF:{
  1224. SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
  1225. GivePlayerWeapon(playerid, 3, 1); // Baton
  1226. GivePlayerWeapon(playerid, 17, 10); // Teargas
  1227. GivePlayerWeapon(playerid, 22, 170); // 10 clips and a 9mm
  1228. }
  1229. case JOB_FBI:{
  1230. GivePlayerWeapon(playerid, 42, 1); // Fire extinguisher
  1231. }
  1232. case JOB_DMV:{
  1233. GivePlayerWeapon(playerid, 17, 10); // Teargas
  1234. }
  1235. case JOB_NEWS:{
  1236. GivePlayerWeapon(playerid, 43, 1); // Camera
  1237. }
  1238. }
  1239. printf("setPlayerSkin(%i, %i);", playerid, skin_id);
  1240. setPlayerSkin(playerid, skin_id);
  1241. SetGVarInt("job", job, playerid);
  1242. SetPlayerColor(playerid, color);
  1243. }
  1244. // Chat functions
  1245. //forward getCharacterName(playerid);
  1246. stock getCharacterName(playerid){ // Convert name from player name
  1247. new playername[MAX_PLAYER_NAME + 1];
  1248. GetPlayerName(playerid, playername, sizeof(playername));
  1249. strreplace(playername, "_", " ");
  1250. return playername;
  1251. }
  1252. forward sendToChat(playerid, target, text[128 + 1], receiver_id, DCC_User:author);
  1253. public sendToChat(playerid, target, text[128 + 1], receiver_id, DCC_User:author){
  1254. strtrim(text); // Trim edge whitespaces
  1255. if(isempty(text)){
  1256. return 0; // Fail if text is empty
  1257. }
  1258. new playername[MAX_PLAYER_NAME + 1];
  1259. if(playerid < 0){
  1260. DCC_GetUserName(author, playername, sizeof(playername));
  1261. } // Discord messagge
  1262. else{playername = getCharacterName(playerid);}
  1263. new chat_format, chat_color, chat_range, chat_userlevel, chat_character[1 + 1], chat_name[13 + 1], discord_channel;
  1264. switch(target){
  1265. case CHAT_WHISPER:{
  1266. chat_format = 2;
  1267. chat_range = 3;
  1268. chat_name = "whispers";
  1269. chat_color = COLOR_COMMAND_OUTPUT;
  1270. discord_channel = ADMIN_ECHO_CHANNEL;
  1271. }
  1272. case CHAT_LOW:{
  1273. chat_format = 2;
  1274. chat_range = 10;
  1275. chat_name = "speaks softly";
  1276. chat_color = COLOR_COMMAND_OUTPUT;
  1277. discord_channel = ADMIN_ECHO_CHANNEL;
  1278. }
  1279. case CHAT_LOCAL:{
  1280. chat_format = 1;
  1281. chat_range = 20;
  1282. chat_color = COLOR_COMMAND_OUTPUT;
  1283. discord_channel = ADMIN_ECHO_CHANNEL;
  1284. }
  1285. case CHAT_SHOUT:{
  1286. chat_format = 2;
  1287. chat_range = 50;
  1288. chat_name = "shouts";
  1289. chat_color = COLOR_COMMAND_OUTPUT;
  1290. discord_channel = ADMIN_ECHO_CHANNEL;
  1291. }
  1292. case CHAT_ACTION:{
  1293. chat_format = 0;
  1294. chat_range = 20;
  1295. chat_color = COLOR_COMMAND_OUTPUT;
  1296. discord_channel = ADMIN_ECHO_CHANNEL;
  1297. }
  1298. case CHAT_OC:{
  1299. chat_format = 3;
  1300. chat_range = 20;
  1301. chat_character = "'";
  1302. chat_name = "OOC";
  1303. chat_color = COLOR_COMMAND_OUTPUT;
  1304. discord_channel = ADMIN_ECHO_CHANNEL;
  1305. }
  1306. case CHAT_GLOBAL:{
  1307. chat_format = 3;
  1308. chat_character = "`";
  1309. chat_name = "Global";
  1310. chat_color = COLOR_COMMAND_OUTPUT;
  1311. discord_channel = ECHO_CHANNEL;
  1312. }
  1313. case CHAT_GANG:{
  1314. chat_format = 3;
  1315. chat_character = "~";
  1316. chat_name = "Gang";
  1317. chat_color = COLOR_CREW_CHAT;
  1318. // TODO: Output to gang Discord channel
  1319. discord_channel = ADMIN_ECHO_CHANNEL;
  1320. }
  1321. case CHAT_GANG_OC:{
  1322. chat_format = 3;
  1323. chat_character = "#";
  1324. chat_name = "Gang OC";
  1325. chat_color = COLOR_CREW_CHAT;
  1326. // TODO: Output to gang Discord channel
  1327. discord_channel = ADMIN_ECHO_CHANNEL;
  1328. }
  1329. case CHAT_FACTION:{
  1330. chat_format = 3;
  1331. chat_character = "!";
  1332. chat_name = "Faction";
  1333. chat_color = COLOR_CREW_CHAT;
  1334. // TODO: Output to faction Discord channel
  1335. discord_channel = ADMIN_ECHO_CHANNEL;
  1336. }
  1337. case CHAT_FACTION_OC:{
  1338. chat_format = 3;
  1339. chat_character = "$";
  1340. chat_name = "Faction OC";
  1341. chat_color = COLOR_CREW_CHAT;
  1342. // TODO: Output to faction Discord channel
  1343. discord_channel = ADMIN_ECHO_CHANNEL;
  1344. }
  1345. case CHAT_CREW:{
  1346. chat_format = 3;
  1347. chat_character = "@";
  1348. chat_name = "Crew";
  1349. chat_color = COLOR_CREW_CHAT;
  1350. chat_userlevel = MODERATOR_CREW;
  1351. discord_channel = ADMIN_ECHO_CHANNEL;
  1352. }
  1353. case CHAT_ADMIN:{
  1354. chat_format = 3;
  1355. chat_character = "%";
  1356. chat_name = "Admin";
  1357. chat_color = COLOR_ADMIN_CHAT;
  1358. chat_userlevel = ADMIN_CREW;
  1359. discord_channel = ADMIN_ECHO_CHANNEL;
  1360. }
  1361. case CHAT_MANAGEMENT:{
  1362. chat_format = 3;
  1363. chat_character = "&";
  1364. chat_name = "Management";
  1365. chat_color = COLOR_ADMIN_CHAT;
  1366. chat_userlevel = MANAGEMENT_CREW;
  1367. discord_channel = MANAGEMENT_CHANNEL;
  1368. }
  1369. case CHAT_VIP:{
  1370. chat_format = 3;
  1371. chat_character = "^";
  1372. chat_name = "VIP";
  1373. chat_color = COLOR_VIP_CHAT;
  1374. chat_userlevel = VIP_PLAYER;
  1375. discord_channel = ADMIN_ECHO_CHANNEL;
  1376. //TODO: Add VIP discord channel.
  1377. }
  1378. case CHAT_UNDERCOVER:{
  1379. chat_format = -1;
  1380. chat_character = "*";
  1381. chat_color = COLOR_COMMAND_OUTPUT;
  1382. chat_userlevel = ADMIN_CREW;
  1383. discord_channel = ECHO_CHANNEL;
  1384. }
  1385. case CHAT_PM:{
  1386. chat_format = 3;
  1387. chat_character = ">";
  1388. chat_name = "PM";
  1389. chat_color = COLOR_PM_CHAT;
  1390. discord_channel = ADMIN_ECHO_CHANNEL;
  1391. }
  1392. case CHAT_CALL:{
  1393. chat_format = 3;
  1394. chat_character = "+";
  1395. chat_name = "Call";
  1396. chat_color = COLOR_PM_CHAT;
  1397. discord_channel = ADMIN_ECHO_CHANNEL;
  1398. }
  1399. case CHAT_SMS:{
  1400. chat_format = 3;
  1401. chat_character = "-";
  1402. chat_name = "SMS";
  1403. chat_color = COLOR_PM_CHAT;
  1404. discord_channel = ADMIN_ECHO_CHANNEL;
  1405. }
  1406. case CHAT_RADIO:{
  1407. chat_format = 3;
  1408. chat_character = "=";
  1409. chat_name = "Radio";
  1410. chat_color = COLOR_PM_CHAT;
  1411. discord_channel = ADMIN_ECHO_CHANNEL;
  1412. }
  1413. }
  1414. // Format chat message
  1415. new message[9 + sizeof(chat_character) + (6 * 8) + sizeof(chat_name) + 4 + MAX_PLAYER_NAME + 128 + 1];
  1416. new discord_message[23 + sizeof(chat_character) + sizeof(chat_name) + sizeof(playerid) + MAX_PLAYER_NAME + 128 + 1];
  1417. switch(chat_format){
  1418. case -1:{
  1419. format(message, sizeof(message), "%s %s", chat_character, text);
  1420. format(discord_message, sizeof(discord_message), "```css\n%s %s\n```", chat_character, text);
  1421. }
  1422. case 0:{
  1423. 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);
  1424. format(discord_message, sizeof(discord_message), "```css\n[%i] %s %s\n```", playerid, playername, text);
  1425. }
  1426. case 1:{
  1427. 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);
  1428. format(discord_message, sizeof(discord_message), "```css\n[%i] %s: %s\n```", playerid, playername, text);
  1429. }
  1430. case 2:{
  1431. 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);
  1432. format(discord_message, sizeof(discord_message), "```css\n[%i] %s %s: %s\n```", playerid, playername, chat_name, text);
  1433. }
  1434. case 3:{
  1435. 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);
  1436. format(discord_message, sizeof(discord_message), "```css\n%s (%s) [%i] %s: %s\n```", chat_character, chat_name, playerid, playername, text);
  1437. }// Good discord tag options for color effects: yaml, css, moon, elixir, haxe, groovy, brainfuck, accesslog,inform7, c,
  1438. }
  1439. // Authorisation
  1440. if(chat_userlevel && chat_userlevel > GetGVarInt("userlevel", playerid)){ // User not privilged to read chat
  1441. if(target == CHAT_CREW){ // Show the user the message was sent to crew chat.
  1442. SendClientMessage(playerid, chat_color, message);
  1443. }
  1444. else{
  1445. SendClientMessage(playerid, COLOR_CREW_CHAT, "ERROR: You are not authorized to speak in this chat.");
  1446. return 0; // Fail to send the message
  1447. }
  1448. }
  1449. // Send TODO: Add checks for muted.
  1450. if(chat_range){ // Ranged chats
  1451. logger(LOGLEVEL_CHAT, message); // Log event
  1452. // Show message to players in range
  1453. new Float:x, Float:y, Float:z;
  1454. GetPlayerPos(playerid, x, y, z);
  1455. for(new recipient_id, a = GetMaxPlayers(); recipient_id < a; recipient_id++){
  1456. if(IsPlayerConnected(receiver_id)){
  1457. new Float:distance = GetPlayerDistanceFromPoint(recipient_id, x, y, z);
  1458. if(distance <= chat_range){ // Player nearby
  1459. sendClientMultiMessage(recipient_id, chat_color, message, Bool:false);
  1460. }
  1461. }
  1462. }
  1463. DiscordEcho(discord_message, discord_channel);
  1464. }
  1465. else{ // Global chats
  1466. if(target == CHAT_GLOBAL){ // Public chat
  1467. logger(LOGLEVEL_CHAT, message); // Log event
  1468. sendClientMultiMessage(0, chat_color, message, Bool:true);
  1469. DiscordEcho(discord_message, discord_channel);
  1470. }
  1471. 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
  1472. // TODO
  1473. // TODO sendToAdmins();
  1474. // TODO send to specific discord channel
  1475. SendClientMessage(playerid, chat_color, "You are not a member of the required entity.");
  1476. }
  1477. else if(target == CHAT_PM){
  1478. new output[sizeof(message)];
  1479. strdel(message, 0, 1);
  1480. format(output, sizeof(output), "<%s", message);
  1481. sendClientMultiMessage(receiver_id, chat_color, output, Bool:false);
  1482. new receipt[12 + 1 + sizeof(chat_name) + 4 + MAX_PLAYER_NAME + 128 + 1];
  1483. format(receipt, sizeof(receipt), "%s (%s) to [%i] %s: %s", chat_character, chat_name, receiver_id, playername, text);
  1484. sendClientMultiMessage(playerid, chat_color, receipt, Bool:false);
  1485. new admin_message[15 + 1 + sizeof(chat_name) + 4 + MAX_PLAYER_NAME + 4 + 128 + 1];
  1486. format(admin_message, sizeof(admin_message), "%s (%s) [%i] %s to [%i]: %s", chat_character, chat_name, playerid, playername, receiver_id, text);
  1487. logger(LOGLEVEL_CHAT, admin_message); // Log event
  1488. sendToAdmins(chat_color, admin_message);
  1489. }
  1490. else{ // Chat with privileged users
  1491. for(new recipient_id, a = GetMaxPlayers(); recipient_id < a; recipient_id++){
  1492. if(IsPlayerConnected(recipient_id)){
  1493. if(GetGVarInt("userlevel", recipient_id) >= chat_userlevel){ // Privileged
  1494. logger(LOGLEVEL_CHAT, message); // Log event
  1495. sendClientMultiMessage(recipient_id, chat_color, message, Bool:false);
  1496. DiscordEcho(discord_message, discord_channel);
  1497. }
  1498. }
  1499. }
  1500. }
  1501. }
  1502. return 1;
  1503. }
  1504. forward sendToAdmins(chat_color, const message[]);
  1505. public sendToAdmins(chat_color, const message[]){
  1506. for(new recipient_id, a = GetMaxPlayers(); recipient_id < a; recipient_id++){
  1507. if(IsPlayerConnected(recipient_id)){
  1508. if(GetGVarInt("userlevel", recipient_id) >= ADMIN_CREW){ // Privileged
  1509. SendClientMessage(recipient_id, chat_color, message);
  1510. }
  1511. }
  1512. }
  1513. DiscordEcho(message, ADMIN_ECHO_CHANNEL);
  1514. }
  1515. forward sendPM(playerid, text[128 + 1], recipient_id);
  1516. public sendPM(playerid, text[128 + 1], recipient_id){
  1517. if (recipient_id == INVALID_PLAYER_ID){
  1518. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "ERROR: Player not found.");
  1519. }
  1520. else{
  1521. sendToChat(playerid, CHAT_PM, text, recipient_id, DCC_INVALID_USER);
  1522. }
  1523. }
  1524. forward sendClientMultiMessage(recipient_id, chat_color, const message[], Bool:toall);
  1525. public sendClientMultiMessage(recipient_id, chat_color, const message[], Bool:toall){
  1526. if(strlen(message) > 144){ // SAMP does not send messages longer than 144 characters
  1527. new part_1[144 + 1], part_2[144 + 1];
  1528. strmid(part_1, message, 0, 143); // TODO see if this can be moved 1 bit
  1529. strmid(part_2, message, 143, 286);
  1530. if(toall){
  1531. SendClientMessageToAll(chat_color, part_1);
  1532. SendClientMessageToAll(chat_color, part_2);
  1533. }
  1534. else{
  1535. SendClientMessage(recipient_id, chat_color, part_1);
  1536. SendClientMessage(recipient_id, chat_color, part_2);
  1537. }
  1538. }
  1539. else{
  1540. if(toall){SendClientMessageToAll(chat_color, message);}
  1541. else{SendClientMessage(recipient_id, chat_color, message);}
  1542. }
  1543. }
  1544. // Pickup functions
  1545. forward createDynamicPickup(object, Float:x, Float:y, Float:z, world, interior, pickup_type);
  1546. public createDynamicPickup(object, Float:x, Float:y, Float:z, world, interior, pickup_type){
  1547. // Object position corrections
  1548. if(object == 19902){
  1549. z = z - 0.5;
  1550. }
  1551. else if(object == 19607){
  1552. z = z - 0.5;
  1553. }
  1554. // Pickup types
  1555. new type;
  1556. switch(pickup_type){
  1557. case 99999: type = 2;
  1558. default: type = 1;
  1559. }
  1560. new pickupid = CreateDynamicPickup(object, type, x, y, z, world, interior);
  1561. SetGVarInt("pickup_type", pickup_type, pickupid);
  1562. printf("new pickupid = CreateDynamicPickup(%i, %i, %f, %f, %f, %i, %i);", pickupid, object, type, x, y, z, world, interior);
  1563. return pickupid;
  1564. }
  1565. 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);
  1566. 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){
  1567. new pickup_id = createDynamicPickup(object, pos_x, pos_y, pos_z, world, interior, PICKUP_PORTAL);
  1568. SetGVarFloat("pickup_x", exit_pos_x, pickup_id);
  1569. SetGVarFloat("pickup_y", exit_pos_y, pickup_id);
  1570. SetGVarFloat("pickup_z", exit_pos_z, pickup_id);
  1571. SetGVarInt("pickup_world", exit_world, pickup_id);
  1572. SetGVarInt("pickup_interior", exit_interior, pickup_id);
  1573. new exit_pickup_id = createDynamicPickup(exit_object, exit_pos_x, exit_pos_y, exit_pos_z, exit_world, exit_interior, PICKUP_PORTAL);
  1574. SetGVarFloat("pickup_x", pos_x, exit_pickup_id);
  1575. SetGVarFloat("pickup_y", pos_y, exit_pickup_id);
  1576. SetGVarFloat("pickup_z", pos_z, exit_pickup_id);
  1577. SetGVarInt("pickup_world", world, exit_pickup_id);
  1578. SetGVarInt("pickup_interior", interior, exit_pickup_id);
  1579. new portal_query[64 + MAX_SQL_INTEGER + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
  1580. 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);
  1581. sql_query(sqlHandle, portal_query);
  1582. }
  1583. forward destroyPortal(id);
  1584. public destroyPortal(id){
  1585. DestroyDynamicPickup(id);
  1586. DeleteGVar("pickup_type", id);
  1587. DeleteGVar("pickup_x", id);
  1588. DeleteGVar("pickup_y", id);
  1589. DeleteGVar("pickup_z", id);
  1590. DeleteGVar("pickup_world", id);
  1591. DeleteGVar("pickup_interior", id);
  1592. }
  1593. // Vehicle functions
  1594. getVehicleModelFromName(name[])
  1595. {
  1596. for(new i = 0; i < 211; i++)
  1597. {
  1598. if(strfind(vehicleNameArray[i], name, true) != -1)
  1599. return i + 400;
  1600. }
  1601. return -1;
  1602. }
  1603. stock editVehicle(playerid, target, option, color1 = -1, color2 = -1, respawn = -1){
  1604. new vehicleid = GetPlayerVehicleID(target);
  1605. if(vehicleid == 0){
  1606. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Target player does not occupy a vehicle.");
  1607. }
  1608. // Get vehicle record
  1609. new vehicle_query[54 + sizeof(vehicleid) + 1], admin_message[23 + (4 * 2) + (MAX_PLAYER_NAME * 2) + 1];
  1610. format(vehicle_query, sizeof(vehicle_query), "SELECT id, addsiren FROM vehicle WHERE vehicle_id = %i", vehicleid);
  1611. new Result:vehicle_result = sql_query(sqlHandle, vehicle_query), record_id;
  1612. if(sql_num_rows(vehicle_result) > 0){ // Record exists
  1613. record_id = sql_get_field_assoc_int(vehicle_result, "id");
  1614. }
  1615. new save_query[88 + (MAX_SQL_INTEGER *2) + (MAX_SQL_FLOAT * 4) + 1];
  1616. switch(option){
  1617. case EDITVEHICLE_PARK:{
  1618. new Float:x, Float:y, Float:z, Float:angle;
  1619. GetVehiclePos(vehicleid, x, y, z);
  1620. GetVehicleZAngle(vehicleid, angle);
  1621. if(sql_num_rows(vehicle_result) < 1){ // New vehicle
  1622. 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);
  1623. format(admin_message, sizeof(admin_message), "* [%i] %s has saved a vehicle for [%i] %s", playerid, getPlayerName(playerid), target, getPlayerName(target));
  1624. }
  1625. else{ // Existing vehicle
  1626. 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);
  1627. format(admin_message, sizeof(admin_message), "* [%i] %s has parked vehicle %i, for [%i] %s", record_id, getPlayerName(playerid), record_id, target, getPlayerName(target));
  1628. }
  1629. sql_query(sqlHandle, save_query);
  1630. sendToAdmins(COLOR_NOTICE, admin_message);
  1631. }
  1632. case EDITVEHICLE_COLOR:{
  1633. if(sql_num_rows(vehicle_result) < 1){
  1634. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "To be able to permanently save colours, the vehicle needs to be parked first.");
  1635. }
  1636. else{
  1637. format(save_query, sizeof(save_query), "UPDATE vehicle(color1, color2) VALUES(%i, %i) WHERE id = %i", color1, color2, record_id);
  1638. 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));
  1639. sql_query(sqlHandle, save_query);
  1640. }
  1641. ChangeVehicleColor(vehicleid, color1, color2);
  1642. }
  1643. case EDITVEHICLE_RESPAWN:{
  1644. if(sql_num_rows(vehicle_result) < 1){
  1645. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "To be able to save the respawn delay, the vehicle needs to be parked first.");
  1646. }
  1647. else{
  1648. DestroyVehicle(vehicleid);
  1649. format(save_query, sizeof(save_query), "UPDATE vehicle SET respawn_delay = %i WHERE id = %i", respawn, record_id);
  1650. 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));
  1651. sql_query(sqlHandle, save_query);
  1652. vehicleid = addvehicle(record_id);
  1653. PutPlayerInVehicle(target, vehicleid, 0);
  1654. }
  1655. }
  1656. case EDITVEHICLE_SIREN:{
  1657. printf("num rows: %i", sql_num_rows(vehicle_result));
  1658. if(sql_num_rows(vehicle_result) < 1){
  1659. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "To be able to save the siren, the vehicle needs to be parked first.");
  1660. }
  1661. else{
  1662. DestroyVehicle(vehicleid);
  1663. new siren = sql_get_field_assoc_int(vehicle_result, "addsiren");
  1664. if(siren){
  1665. format(save_query, sizeof(save_query), "UPDATE vehicle(siren) VALUES(0) WHERE id = %i", record_id);
  1666. 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));
  1667. vehicleid = addvehicle(record_id);
  1668. PutPlayerInVehicle(target, vehicleid, 0);
  1669. }
  1670. else{
  1671. format(save_query, sizeof(save_query), "UPDATE vehicle(siren) VALUES(1) WHERE id = %i", record_id);
  1672. 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));
  1673. sql_query(sqlHandle, save_query);
  1674. vehicleid = addvehicle(record_id);
  1675. PutPlayerInVehicle(target, vehicleid, 0);
  1676. }
  1677. }
  1678. }
  1679. }
  1680. return 0;
  1681. }
  1682. addvehicle(vehicle_id){
  1683. // Get vehicle record
  1684. new vehicle_query[109 + (MAX_SQL_INTEGER * 6) + (MAX_SQL_FLOAT * 4) + 1];
  1685. 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);
  1686. new Result:vehicle_result = sql_query(sqlHandle, vehicle_query);
  1687. if(sql_num_rows(vehicle_result) > 0){ // Record exists
  1688. 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.
  1689. 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"));
  1690. printf("Added ingame vehicle: %i", vehicleid);
  1691. new update_query[44 + (MAX_SQL_INTEGER * 2) + 1];
  1692. format(update_query, sizeof(update_query), "UPDATE vehicle SET vehicle_id = %i WHERE id = %i", vehicleid, vehicle_id);
  1693. sql_query(sqlHandle, update_query);
  1694. return vehicleid;
  1695. }
  1696. return 0;
  1697. }
  1698. // Command functions
  1699. public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags){
  1700. if(result == -1){
  1701. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: Unknown command.");
  1702. return 0;
  1703. }
  1704. return 1;
  1705. }
  1706. public OnPlayerCommandReceived(playerid, cmd[], params[], flags){
  1707. new userlevel = GetGVarInt("userlevel", playerid);
  1708. if(flags){
  1709. if(flags > userlevel){
  1710. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: Access denied.");
  1711. 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
  1712. return 0;
  1713. }
  1714. }
  1715. return 1;
  1716. }
  1717. public PC_OnInit(){ // TODO
  1718. return 1; // Remove this once stuff is in place.
  1719. }
  1720. flags:test(ADMIN_CREW);
  1721. cmd:test(playerid, params[]){
  1722. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Executed");
  1723. return 1;
  1724. }
  1725. // Command commands
  1726. cmd:help(playerid, params[]){
  1727. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: Ask questions in the chat, on Discord or the forum.\nTo list all commands: /cmds");
  1728. return 1;
  1729. }
  1730. alias:help("h");
  1731. cmd:cmds(playerid, params[]){
  1732. SendClientMessage(playerid, COLOR_NOTICE, "Command help syntax: \"/\" = start of cmd, \"()\" = group, \"|\" = or, \"<>\" = required parameter, \"[]\" = optional parameter, \",\" = next item.");
  1733. SendClientMessage(playerid, COLOR_NOTICE, "Command help syntax example: /command <parameter> [optional_parameter], /next_command (option | option | option <parameter> <parameter>)");
  1734. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "General commands: (/help, /h), (/cmds, /cmd, /commands), (/my, /myself, /mine), (/v, /vehivle, /veh), (/p, /player)");
  1735. 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>");
  1736. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Chat commands: (/g, `, /global, /public) <msg>, (/gc, ~) <msg>, (/fc, !) <msg>, (/vc, &) <msg>, (/cc, @) <msg>, /my chatmode <chat_name>");
  1737. if(GetGVarInt("userlevel", playerid) >= ADMIN_CREW){
  1738. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Admin commands: /property (pickup | portal)");
  1739. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Admin commands extend the options for commands like /my, /p & /v");
  1740. }
  1741. return 0;
  1742. }
  1743. alias:cmds("commands", "cmd");
  1744. // User commands
  1745. cmd:register(playerid, params[]){
  1746. register(playerid);
  1747. }
  1748. cmd:my(playerid, params[]){
  1749. // No option specified
  1750. if(strlen(params) < 1){
  1751. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /my <option> <value>");
  1752. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Options: account, chatmode");
  1753. if(GetGVarInt("userlevel", playerid) >= ADMIN_CREW){
  1754. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Admin options: goto");
  1755. }
  1756. return 0;
  1757. }
  1758. // Options
  1759. if(!strcmp(params, "account", true, 7)){ // /my account
  1760. strdel(params, 0, 8); // Remove first 8 characters, "account ", from the string.
  1761. // Values
  1762. if (isequal(params, "register", .ignorecase = true)){ // /my account register
  1763. register(playerid); // Call public register function
  1764. }
  1765. else if (isequal(params, "characters", .ignorecase = true)){ // /my account characters
  1766. characterSelection(playerid);
  1767. }
  1768. else if (isequal(params, "deletecharacter", .ignorecase = true)){ // /my account characters
  1769. 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");
  1770. }
  1771. else{ // Invalid value
  1772. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /my account ( register | characters | deletecharacter)");
  1773. }
  1774. }
  1775. else if(!strcmp(params, "chatmode", true, 8)){ // /my chatmode
  1776. strdel(params, 0, 9); // Remove first 9 characters, "account ", from the string.
  1777. // Values
  1778. if (isequal(params, "whisper", .ignorecase = true)){
  1779. SetGVarInt("chatmode", CHAT_WHISPER, playerid);
  1780. }
  1781. else if (isequal(params, "low", .ignorecase = true)){
  1782. SetGVarInt("chatmode", CHAT_LOW, playerid);
  1783. }
  1784. else if (isequal(params, "local", .ignorecase = true)){
  1785. SetGVarInt("chatmode", CHAT_LOCAL, playerid);
  1786. }
  1787. else if (isequal(params, "shout", .ignorecase = true)){
  1788. SetGVarInt("chatmode", CHAT_SHOUT, playerid);
  1789. }
  1790. else if (isequal(params, "oc", .ignorecase = true)){
  1791. SetGVarInt("chatmode", CHAT_OC, playerid);
  1792. }
  1793. else if (isequal(params, "global", .ignorecase = true)){
  1794. SetGVarInt("chatmode", CHAT_GLOBAL, playerid);
  1795. }
  1796. else if (isequal(params, "gang", .ignorecase = true)){
  1797. SetGVarInt("chatmode", CHAT_GANG, playerid);
  1798. }
  1799. else if (isequal(params, "faction", .ignorecase = true)){
  1800. SetGVarInt("chatmode", CHAT_FACTION, playerid);
  1801. }
  1802. else if (isequal(params, "vip", .ignorecase = true)){
  1803. SetGVarInt("chatmode", CHAT_VIP, playerid);
  1804. }
  1805. else if (isequal(params, "crew", .ignorecase = true)){
  1806. SetGVarInt("chatmode", CHAT_CREW, playerid);
  1807. }
  1808. else if (isequal(params, "admin", .ignorecase = true)){
  1809. SetGVarInt("chatmode", CHAT_ADMIN, playerid);
  1810. }
  1811. else if (isequal(params, "management", .ignorecase = true)){
  1812. SetGVarInt("chatmode", CHAT_MANAGEMENT, playerid);
  1813. }
  1814. else{ // Invalid value
  1815. printf("else isequals register");
  1816. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /my chatmode <value>");
  1817. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Values: whisper low local shout oc global gang faction vip crew admin management");
  1818. }
  1819. }
  1820. else if(!strcmp(params, "goto", true, 4) || !strcmp(params, "sendto", true, 6) || !strcmp(params, "teleport", true, 8)){
  1821. if(GetGVarInt("userlevel", playerid) < ADMIN_CREW){
  1822. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: Access denied.");
  1823. }
  1824. SetGVarInt("goto_target", playerid, playerid);
  1825. ShowPlayerDialog(playerid, DIALOG_GOTO, DIALOG_STYLE_LIST, "Categories", "Interiors\nPlayers", "Select", "Cancel");
  1826. }
  1827. else{ // Invalid option
  1828. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/my options: account chatmode");
  1829. if(GetGVarInt("userlevel", playerid) >= ADMIN_CREW){
  1830. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Admin options: goto");
  1831. }
  1832. }
  1833. return 0;
  1834. }
  1835. alias:my("myself", "mine");
  1836. // Chat commands
  1837. cmd:w(playerid, params[128 + 1]){
  1838. sendToChat(playerid, CHAT_WHISPER, params, 0, DCC_INVALID_USER);
  1839. return 1;
  1840. }
  1841. alias:w("whisper");
  1842. cmd:low(playerid, params[128 + 1]){
  1843. sendToChat(playerid, CHAT_LOW, params, 0, DCC_INVALID_USER);
  1844. return 1;
  1845. }
  1846. alias:low("soft");
  1847. cmd:l(playerid, params[128 + 1]){
  1848. sendToChat(playerid, CHAT_LOCAL, params, 0, DCC_INVALID_USER);
  1849. return 1;
  1850. }
  1851. alias:l("local");
  1852. cmd:me(playerid, params[128 + 1]){
  1853. sendToChat(playerid, CHAT_ACTION, params, 0, DCC_INVALID_USER);
  1854. return 1;
  1855. }
  1856. alias:me("emote", "action");
  1857. cmd:s(playerid, params[128 + 1]){
  1858. sendToChat(playerid, CHAT_SHOUT, params, 0, DCC_INVALID_USER);
  1859. return 1;
  1860. }
  1861. alias:s("shout", "scream");
  1862. cmd:o(playerid, params[128 + 1]){
  1863. sendToChat(playerid, CHAT_OC, params, 0, DCC_INVALID_USER);
  1864. return 1;
  1865. }
  1866. alias:o("oc", "ooc");
  1867. cmd:g(playerid, params[128 + 1]){
  1868. sendToChat(playerid, CHAT_GLOBAL, params, 0, DCC_INVALID_USER);
  1869. return 1;
  1870. }
  1871. alias:g("global", "public");
  1872. cmd:gc(playerid, params[128 + 1]){
  1873. sendToChat(playerid, CHAT_GANG, params, 0, DCC_INVALID_USER);
  1874. return 1;
  1875. }
  1876. cmd:fc(playerid, params[128 + 1]){
  1877. sendToChat(playerid, CHAT_FACTION, params, 0, DCC_INVALID_USER);
  1878. return 1;
  1879. }
  1880. cmd:vc(playerid, params[128 + 1]){
  1881. sendToChat(playerid, CHAT_VIP, params, 0, DCC_INVALID_USER);
  1882. return 1;
  1883. }
  1884. cmd:cc(playerid, params[128 + 1]){
  1885. sendToChat(playerid, CHAT_CREW, params, 0, DCC_INVALID_USER);
  1886. return 1;
  1887. }
  1888. cmd:pm(playerid, params[128 + 1]){
  1889. new recipient_id, message[128 + 1];
  1890. if (sscanf(params, "u s", recipient_id, message)){
  1891. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /pm <playerid> <message>");
  1892. }
  1893. else{
  1894. sendPM(playerid, message, recipient_id);
  1895. }
  1896. return 1;
  1897. }
  1898. alias:pm("msg", "dm");
  1899. // Vehicle commands
  1900. flags:v(ADMIN_CREW);
  1901. cmd:v(playerid, params[]){
  1902. //new vehicle_id;
  1903. if(strlen(params) < 1){
  1904. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /v [playerID] <model> | park | respawn <seconds> | siren");
  1905. }
  1906. //new option[125 + 1];
  1907. new target;
  1908. if(!sscanf(params, "i s", target, params)){ // This should overwrite the params to excluse the player id, or cause problems.
  1909. if(!IsPlayerConnected(target)){
  1910. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "That player is not ingame.");
  1911. }
  1912. }
  1913. else{
  1914. target = playerid;
  1915. }
  1916. if(!strcmp(params, "park", true, 4)){
  1917. editVehicle(playerid, target, EDITVEHICLE_PARK);
  1918. /*new vehicleid = GetPlayerVehicleID(target);
  1919. if(vehicleid == 0){
  1920. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Player not in a vehicle.");
  1921. }
  1922. new Float:x, Float:y, Float:z, Float:angle;
  1923. GetVehiclePos(vehicleid, x, y, z);
  1924. GetVehicleZAngle(vehicleid, angle);
  1925. // Get vehicle record
  1926. new vehicle_query[75 + 1], admin_message[23 + 4 + MAX_PLAYER_NAME + 1];
  1927. format(vehicle_query, sizeof(vehicle_query), "SELECT id FROM vehicle WHERE vehicle_id = %i", vehicleid);
  1928. new Result:vehicle_result = sql_query(sqlHandle, vehicle_query);
  1929. new save_query[75 + 1];
  1930. if(sql_num_rows(vehicle_result) < 1){ // New vehicle
  1931. 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);
  1932. format(admin_message, sizeof(admin_message), "[%i] %s has saved a vehicle.", playerid, getPlayerName(playerid));
  1933. }
  1934. else{ // Existing vehicle
  1935. new id = sql_get_field_assoc_int(vehicle_result, "id");
  1936. 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);
  1937. format(admin_message, sizeof(admin_message), "[%i] %s has updated vehicle: %i", playerid, getPlayerName(playerid), id);
  1938. }
  1939. sql_query(sqlHandle, save_query);
  1940. sendToAdmins(COLOR_NOTICE, admin_message);*/
  1941. }
  1942. else if(!strcmp(params, "respawn", true, 7)){
  1943. strdel(params, 0, 8); // Remove first 8 characters from the string.
  1944. new respawn;
  1945. if(!sscanf(params, "i", respawn)){
  1946. editVehicle(playerid, target, EDITVEHICLE_RESPAWN, -1, -1, respawn);
  1947. }
  1948. else{
  1949. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/v [ID] respawn usage: <seconds>");
  1950. }
  1951. }
  1952. else if(!strcmp(params, "siren", true, 5)){
  1953. editVehicle(playerid, target, EDITVEHICLE_SIREN);
  1954. }
  1955. else if(!sscanf(params, "s")){
  1956. // Get model ID
  1957. new modelid = getVehicleModelFromName(params);
  1958. if(modelid == -1){
  1959. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Unkown parameter or model name.");
  1960. }
  1961. new Float:x, Float:y, Float:z, Float:angle, worldid, interiorid;
  1962. getPlayerLocation(target, x, y, z, angle, worldid, interiorid);
  1963. // To prevent crashses in certain situations.
  1964. if(IsPlayerInAnyVehicle(target)){
  1965. GetVehicleZAngle(GetPlayerVehicleID(target), angle);
  1966. RemovePlayerFromVehicle(target);
  1967. }
  1968. new vehicleid = AddStaticVehicleEx(modelid, x, y, z, angle, -1, -1, -1);
  1969. SetVehicleVirtualWorld(vehicleid, worldid);
  1970. PutPlayerInVehicle(target, vehicleid, 0);
  1971. new admin_message[33 + 4 + MAX_PLAYER_NAME + 1];
  1972. format(admin_message, sizeof(admin_message), "[%i] %s has created a temporary vehicle.", playerid, getPlayerName(playerid));
  1973. sendToAdmins(COLOR_NOTICE, admin_message);
  1974. }
  1975. else{
  1976. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /v (model_name_part | park | respawn <seconds>| siren");
  1977. }
  1978. return 1;
  1979. }
  1980. alias:v("vehicle", "veh");
  1981. // Player commands
  1982. cmd:p(playerid, params[]){
  1983. // No parameters
  1984. if(strlen(params) < 1){
  1985. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /p <ID> option");
  1986. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/p options: admin, goto");
  1987. }
  1988. // Syntax
  1989. new player_id, option[123 + 1];
  1990. if(sscanf(params, "i s", player_id, option)){
  1991. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /p <ID> <option>");
  1992. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/p options: admin, goto");
  1993. }
  1994. if(!strcmp(option, "admin", true, 5)){
  1995. SetGVarInt("userlevel", ADMIN_CREW, player_id);
  1996. // TODO take admin if already admin
  1997. // TODO notify admins
  1998. }
  1999. else if(!strcmp(option, "goto", true, 4) && !strcmp(option, "sendto", true, 6 && !strcmp(option, "teleport", true, 8)) ){
  2000. if(GetGVarInt("userlevel", playerid) < ADMIN_CREW){
  2001. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: Access denied.");
  2002. SetGVarInt("goto_target", player_id);
  2003. }
  2004. }
  2005. else{
  2006. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/p <ID> options: admin, goto");
  2007. }
  2008. return 1;
  2009. }
  2010. alias:p("player");
  2011. // Admin commands
  2012. flags:property(ADMIN_CREW);
  2013. cmd:property(playerid, params[]){
  2014. // No option specified
  2015. if(strlen(params) < 1){
  2016. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/property options: pickup, portal");
  2017. }
  2018. // Options
  2019. if(!strcmp(params, "pickup", true, 6)){ // /property pickup
  2020. strdel(params, 0, 7); // Remove first 7 characters, "pickup ", from the string.
  2021. // No parameters
  2022. if(strlen(params) < 1){
  2023. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /property pickup <create | ID <goto | move | delete>>");
  2024. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/p options: admin, goto");
  2025. }
  2026. // Values
  2027. new pickup_id, option[110 + 1];
  2028. if(!strcmp(params, "create", true)){ // /property pickup create
  2029. ShowPlayerDialog(playerid, DIALOG_CREATE_PICKUP, DIALOG_STYLE_LIST, "Pickup caterogy", "Faction", "Select", "Cancel");
  2030. }
  2031. else if (!sscanf(params, "i s", pickup_id, option)){
  2032. new pickup_query[69 + MAX_SQL_INTEGER + 1];
  2033. 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);
  2034. new Result:pickup_result = sql_query(sqlHandle, pickup_query);
  2035. if(sql_num_rows(pickup_result) < 1){ // Invalid pickup ID
  2036. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Invalid pickup ID");
  2037. }
  2038. new pickupid = sql_get_field_assoc_int(pickup_result, "pickup_id");
  2039. if(!strcmp(option, "move", true)){
  2040. // Destroy old pickup
  2041. DestroyDynamicPickup(pickupid);
  2042. // Create new pickup
  2043. new Float:x, Float:y, Float:z;
  2044. GetPlayerPos(playerid, x, y, z);
  2045. new interior = GetPlayerInterior(playerid);
  2046. new world = GetPlayerVirtualWorld(playerid);
  2047. new Float:angle;
  2048. new object_id = sql_get_field_assoc_int(pickup_result, "object_id");
  2049. new type_id = sql_get_field_assoc_int(pickup_result, "type_id");
  2050. new new_pickupid = createDynamicPickup(object_id, x, y, z, world, interior, type_id);
  2051. angle = GetPlayerFacingAngle(playerid, angle);
  2052. // Update pickup record
  2053. new update_query[118 + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_INTEGER + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
  2054. 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);
  2055. sql_query(sqlHandle, update_query);
  2056. // Inform admins
  2057. new admin_message[39 + 4 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
  2058. format(admin_message, sizeof(admin_message), "* [%i] %s modified the location of pickup: %i", playerid, getPlayerName(playerid), pickup_id);
  2059. sendToAdmins(COLOR_NOTICE, admin_message);
  2060. }
  2061. else if(!strcmp(option, "delete", true)){
  2062. // Destroy pickup
  2063. DestroyDynamicPickup(pickupid);
  2064. // Delete pickup record
  2065. new update_query[95 + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_INTEGER + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
  2066. format(update_query, sizeof(update_query), "DELETE FROM pickup WHERE id = %i", pickup_id);
  2067. sql_query(sqlHandle, update_query);
  2068. // Inform admins
  2069. new admin_message[39 + 4 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
  2070. format(admin_message, sizeof(admin_message), "* [%i] %s deleted pickup: %i", playerid, getPlayerName(playerid), pickup_id);
  2071. sendToAdmins(COLOR_NOTICE, admin_message);
  2072. }
  2073. else if(!strcmp(option, "goto", true)){
  2074. new name[7 + MAX_SQL_INTEGER];
  2075. format(name, sizeof(name), "pickup %i", pickupid);
  2076. 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
  2077. }
  2078. else{ // Invalid option.
  2079. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/property pickup <ID> usage: goto, move, delete");
  2080. }
  2081. }
  2082. else{ // Invalid value
  2083. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/property pickup usage: create, <ID> <goto | move | delete>");
  2084. }
  2085. }
  2086. else if(!strcmp(params, "portal", true, 6)){ // /property portal
  2087. strdel(params, 0, 7); // Remove first 7 characters, "portal ", from the string.
  2088. // No parameters
  2089. if(strlen(params) < 1){
  2090. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /property portal <create | ID <goto | exit | entrance | object | delete>>");
  2091. }
  2092. // Values
  2093. new portal_id, option[116 + 1];
  2094. if (!strcmp(params, "create", true, 6)){ // /property portal create
  2095. strdel(params, 0, 7); // Remove first 7 characters, "create ", from the string.
  2096. // Worlds
  2097. new value[105 + 1], world_id;
  2098. if (sscanf(params, "s", value)){
  2099. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "For a portal that works in all worlds use: /property portal create all");
  2100. }
  2101. if(!strcmp(value, "all", true)){
  2102. world_id = -1;
  2103. }
  2104. else{
  2105. world_id = GetPlayerVirtualWorld(playerid);
  2106. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Invalid world option, creating default portal.");
  2107. }
  2108. new Float:x, Float:y, Float:z, Float:angle, world, interior;
  2109. getPlayerLocation(playerid, x, y, z, angle, world, interior);
  2110. new pickup_id = createDynamicPickup(19902, x, y, z, world_id, interior, PICKUP_PORTAL);
  2111. // Create portal database record
  2112. new portal_query[120 + (MAX_SQL_FLOAT * 3) + (MAX_SQL_INTEGER * 3) + MAX_SQL_FLOAT + 1];
  2113. 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);
  2114. sql_query(sqlHandle, portal_query);
  2115. // Inform user(s)
  2116. new portal_id_query[91 + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_INTEGER + 1];
  2117. 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);
  2118. new Result:portal_id_result = sql_query(sqlHandle, portal_id_query);
  2119. portal_id = sql_get_field_assoc_int(Result:portal_id_result, "id");
  2120. new message[69 + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1], admin_message[21 + 4 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
  2121. format(message, sizeof(message), "Portal %i created. Create the other side with: /property portal %i exit", portal_id, portal_id);
  2122. format(admin_message, sizeof(admin_message), "* [%i] %s created portal: %i", playerid, getPlayerName(playerid), portal_id);
  2123. sendToAdmins(COLOR_NOTICE , admin_message);
  2124. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, message);
  2125. }
  2126. else if (!sscanf(params, "i s", portal_id, option)){
  2127. // Get portal record
  2128. new portal_query[189 + MAX_SQL_INTEGER + 1];
  2129. 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);
  2130. new Result:portal_result = sql_query(sqlHandle, portal_query);
  2131. // Invalid portal ID
  2132. if(sql_num_rows(portal_result) < 1){ // Invalid portal ID
  2133. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Invalid portal ID");
  2134. }
  2135. if (!strcmp(option, "exit", true, 4)){
  2136. new Float:pos_x = sql_get_field_assoc_float(portal_result, "pos_x");
  2137. new Float:pos_y = sql_get_field_assoc_float(portal_result, "pos_y");
  2138. new Float:pos_z = sql_get_field_assoc_float(portal_result, "pos_z");
  2139. new world_id = sql_get_field_assoc_int(portal_result, "world");
  2140. new interior_id = sql_get_field_assoc_int(portal_result, "interior_id");
  2141. new session_id = sql_get_field_assoc_int(portal_result, "pickup_id");
  2142. new exit_pickup_id = sql_get_field_assoc_int(portal_result, "exit_pickup_id");
  2143. new Float:angle = sql_get_field_assoc_float(portal_result, "angle");
  2144. // Location
  2145. new Float:x, Float:y, Float:z, Float:player_angle, world, interior;
  2146. getPlayerLocation(playerid, x, y, z, player_angle, world, interior);
  2147. // World
  2148. if(world_id != -1){ // Not an all-world portal
  2149. world = GetPlayerVirtualWorld(playerid);
  2150. }
  2151. else{
  2152. world = world_id;
  2153. }
  2154. // Delete old exit if exists
  2155. if(exit_pickup_id){
  2156. destroyPortal(exit_pickup_id);
  2157. }
  2158. new pickup_id = createDynamicPickup(19607, x, y, z, world, interior, PICKUP_PORTAL);
  2159. SetGVarFloat("pickup_x", pos_x, pickup_id);
  2160. SetGVarFloat("pickup_y", pos_y, pickup_id);
  2161. SetGVarFloat("pickup_z", pos_z, pickup_id);
  2162. SetGVarInt("pickup_world", world_id, pickup_id);
  2163. SetGVarFloat("pickup_angle", angle, pickup_id);
  2164. SetGVarInt("pickup_interior", interior_id, pickup_id);
  2165. SetGVarFloat("pickup_x", x, session_id);
  2166. SetGVarFloat("pickup_y", y, session_id);
  2167. SetGVarFloat("pickup_z", z, session_id);
  2168. SetGVarInt("pickup_world", world, session_id);
  2169. SetGVarFloat("pickup_angle", player_angle, session_id);
  2170. SetGVarInt("pickup_interior", interior, session_id);
  2171. // Update portal record
  2172. new update_query[172 + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_FLOAT + MAX_SQL_INTEGER + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
  2173. 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);
  2174. sql_query(sqlHandle, update_query);
  2175. // Inform admins and Discord
  2176. new admin_message[61 + 4 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
  2177. format(admin_message, sizeof(admin_message), "* [%i] %s modified the exit location of portal: %i", playerid, getPlayerName(playerid), portal_id);
  2178. sendToAdmins(COLOR_NOTICE , admin_message);
  2179. }
  2180. else if(!strcmp(option, "object", true, 6)){
  2181. strdel(option, 0, 7); // Remove first 7 characters, from the string.
  2182. new object, exit_object;
  2183. print(option);
  2184. if (sscanf(option, "i i", object, exit_object)){
  2185. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Invalid syntax, specify two object ID's: /property portal <ID> object <ID> <ID>");
  2186. }
  2187. new Float:pos_x = sql_get_field_assoc_float(portal_result, "pos_x");
  2188. new Float:pos_y = sql_get_field_assoc_float(portal_result, "pos_y");
  2189. new Float:pos_z = sql_get_field_assoc_float(portal_result, "pos_z");
  2190. new world_id = sql_get_field_assoc_int(portal_result, "world");
  2191. new interior_id = sql_get_field_assoc_int(portal_result, "interior_id");
  2192. new pickup_id = sql_get_field_assoc_int(portal_result, "pickup_id");
  2193. new Float:exit_pos_x = sql_get_field_assoc_float(portal_result, "exit_pos_x");
  2194. new Float:exit_pos_y = sql_get_field_assoc_float(portal_result, "exit_pos_y");
  2195. new Float:exit_pos_z = sql_get_field_assoc_float(portal_result, "exit_pos_z");
  2196. new exit_world_id = sql_get_field_assoc_int(portal_result, "exit_world");
  2197. new exit_interior_id = sql_get_field_assoc_int(portal_result, "exit_interior_id");
  2198. new exit_pickup_id = sql_get_field_assoc_int(portal_result, "exit_pickup_id");
  2199. destroyPortal(exit_pickup_id);
  2200. destroyPortal(pickup_id);
  2201. 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);
  2202. new update_query[57 + MAX_SQL_INTEGER + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
  2203. format(update_query, sizeof(update_query), "UPDATE portal SET (object, exit_object) = (%i, %i) WHERE id = %i", object, exit_object, portal_id);
  2204. sql_query(sqlHandle, update_query);
  2205. }
  2206. else if(!strcmp(option, "delete", true, 6)){
  2207. new pickup_id = sql_get_field_assoc_int(portal_result, "pickup_id");
  2208. new exit_pickup_id = sql_get_field_assoc_int(portal_result, "exit_pickup_id");
  2209. // TODO: Confirmation, by spectating the pickup or having to be near.
  2210. destroyPortal(exit_pickup_id);
  2211. destroyPortal(pickup_id);
  2212. // Delete portal record
  2213. new delete_query[31 + MAX_SQL_INTEGER + 1];
  2214. format(delete_query, sizeof(delete_query), "DELETE FROM portal WHERE id = %i", portal_id);
  2215. sql_query(sqlHandle, delete_query);
  2216. }
  2217. else if(!strcmp(option, "entrance", true, 8)){
  2218. new object = sql_get_field_assoc_int(portal_result, "object");
  2219. //new Float:x = sql_get_field_assoc_float(portal_result, "pos_x");
  2220. //new Float:y = sql_get_field_assoc_float(portal_result, "pos_y");
  2221. //new Float:z = sql_get_field_assoc_float(portal_result, "pos_z"); todo shorten qeury
  2222. new world = sql_get_field_assoc_int(portal_result, "world");
  2223. new pickup_id = sql_get_field_assoc_int(portal_result, "pickup_id");
  2224. new Float:pos_x = sql_get_field_assoc_float(portal_result, "exit_pos_x");
  2225. new Float:pos_y = sql_get_field_assoc_float(portal_result, "exit_pos_y");
  2226. new Float:pos_z = sql_get_field_assoc_float(portal_result, "exit_pos_z");
  2227. new world_id = sql_get_field_assoc_int(portal_result, "exit_world");
  2228. new interior_id = sql_get_field_assoc_int(portal_result, "exit_interior");
  2229. new Float:angle = sql_get_field_assoc_float(portal_result, "exit_angle");
  2230. if(sql_num_rows(portal_result) < 1){ // Invalid portal ID
  2231. return SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Invalid portal ID");
  2232. }
  2233. // Location
  2234. new Float:x, Float:y, Float:z, Float:player_angle, player_world, interior;
  2235. getPlayerLocation(playerid, x, y, z, player_angle, player_world, interior);
  2236. // World
  2237. if(world_id == -1){ // All-world portal
  2238. world = world_id;
  2239. }
  2240. destroyPortal(pickup_id); // Despawn old pickups and remove GVars
  2241. new pickupid = createDynamicPickup(object, x, y, z, world, interior, PICKUP_PORTAL);
  2242. SetGVarFloat("pickup_x", pos_x, pickupid);
  2243. SetGVarFloat("pickup_y", pos_y, pickupid);
  2244. SetGVarFloat("pickup_z", pos_z, pickupid);
  2245. SetGVarInt("pickup_world", world_id, pickupid);
  2246. SetGVarInt("pickup_interior", interior_id, pickupid);
  2247. SetGVarFloat("pickup_angle", angle, pickupid);
  2248. // Inform admins and Discord
  2249. new admin_message[65 + 4 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
  2250. format(admin_message, sizeof(admin_message), "* [%i] %s modified the entrance location of portal: %i", playerid, getPlayerName(playerid), portal_id);
  2251. sendToAdmins(COLOR_NOTICE, admin_message);
  2252. }
  2253. else if(!strcmp(option, "goto", true)){
  2254. 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"));
  2255. }
  2256. else{ // Invalid option
  2257. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/property portal <ID> options: goto, exit, entrance, object, delete");
  2258. }
  2259. }
  2260. else{ // Invalid value
  2261. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: /property portal <create | ID <goto | exit | entrance | object | delete>>");
  2262. }
  2263. }
  2264. else{ // Invalid option
  2265. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "/property options: pickup, portal");
  2266. }
  2267. return 1;
  2268. }
  2269. // Dialog functions
  2270. forward dialogGotoInterior(playerid);
  2271. public dialogGotoInterior(playerid){
  2272. ShowPlayerDialog(playerid, DIALOG_GOTO_INTERIOR, DIALOG_STYLE_LIST, "Categories", "Avaition\nHouses\nMissions\nMission exteriors\nPolice departments\nSex work\nShops\nStadia", "Select", "Back");
  2273. }
  2274. forward dialogGotoPlayer(playerid);
  2275. public dialogGotoPlayer(playerid){
  2276. for(new targetid, a = GetMaxPlayers(); targetid < a; targetid++){
  2277. if(IsPlayerConnected(targetid)){
  2278. // TODO: Decide to use this or TABplayer list.
  2279. }
  2280. }
  2281. ShowPlayerDialog(playerid, DIALOG_GOTO_PLAYER, DIALOG_STYLE_LIST, "Players", "", "Goto", "Back");
  2282. }
  2283. dialogGotoHouses(playerid){
  2284. ShowPlayerDialog(playerid, DIALOG_GOTO_HOUSES, DIALOG_STYLE_TABLIST, "Houses", "Burglary houses\nMission houses\nSafe houses\nUncategorized", "Select", "Cancel");
  2285. }
  2286. dialogGotoShops(playerid){
  2287. ShowPlayerDialog(playerid, DIALOG_GOTO_SHOPS, DIALOG_STYLE_TABLIST, "Shops", "24/7's\nAmmunation's\nCasino's\nModding shops\nUncatagorized", "Select", "Cancel");
  2288. }
  2289. // a_samp events
  2290. public OnGameModeInit(){
  2291. new message[36 + 22 + 1];
  2292. format(message, sizeof(message), "* Global game-mode initialization: v%s", MODE_NAME);
  2293. logger(LOGLEVEL_NOTICE, "* Global game-mode initialization."); // Log event.
  2294. // Player radar blip markers only visible to nearby players.
  2295. ShowPlayerMarkers(PLAYER_MARKERS_MODE_STREAMED);
  2296. LimitPlayerMarkerRadius(15);
  2297. // Set mode name
  2298. SetGameModeText(MODE_NAME);
  2299. // SQL log level
  2300. if(scriptDebug){
  2301. sql_debug(LOG_ALL, LOG_ALL); // Log everything everywhere.
  2302. }
  2303. else{
  2304. sql_debug(LOG_INFO, LOG_WARNING); // Loglevel info for file and worning for console.
  2305. }
  2306. // Connect to database
  2307. sqlHandle = SQL:sql_connect(SQL_HANDLER_POSTGRESQL, PG_HOST, PG_ROLE, PG_PASS, PG_DB, PG_PORT);
  2308. printf("sqlconnection = %d", _:sqlHandle);
  2309. if(!sql_ping(sqlHandle)){
  2310. print( " + Database connection" );
  2311. }
  2312. else{
  2313. print( "Database connection failed" );
  2314. }
  2315. // Initialize Discord
  2316. //homeGuild = DCC_GetGuildId(DISCORD_HOME_GUILD_ID); // Set home guild ID. NOT NEEDED FOR NOW AND BROKEN
  2317. echoChannel = DCC_FindChannelById(DISCORD_ECHO_CHANNEL_ID); // Set main echo channel ID.
  2318. mainChannel = DCC_FindChannelById(DISCORD_MAIN_CHANNEL_ID); // Set main notification channel ID.
  2319. adminEchoChannel = DCC_FindChannelById(DISCORD_ADMIN_ECHO_CHANNEL_ID); // Set admin echo channel ID.
  2320. adminChannel = DCC_FindChannelById(DISCORD_ADMIN_CHANNEL_ID); // Set admin notification channel ID.
  2321. managementChannel = DCC_FindChannelById(DISCORD_MANAGEMENT_CHANNEL_ID); // Set management notification channel ID.
  2322. DiscordEcho(message, ECHO_CHANNEL); // Notify Discord
  2323. //DiscordEcho(message, MAIN_CHANNEL); // TODO Enable after we are stable
  2324. // Portals
  2325. 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");
  2326. for(new i = 0; i < sql_num_rows(portal_result); i++){
  2327. new id = sql_get_field_assoc_int_ex(portal_result, i, "id");
  2328. new object = sql_get_field_assoc_int_ex(portal_result, i, "object");
  2329. new Float:pos_x = sql_get_field_assoc_float_ex(portal_result, i, "pos_x");
  2330. new Float:pos_y = sql_get_field_assoc_float_ex(portal_result, i, "pos_y");
  2331. new Float:pos_z = sql_get_field_assoc_float_ex(portal_result, i, "pos_z");
  2332. new world = sql_get_field_assoc_int_ex(portal_result, i, "world");
  2333. new interior = sql_get_field_assoc_int_ex(portal_result, i, "interior_id");
  2334. new exit_object = sql_get_field_assoc_int_ex(portal_result, i, "exit_object");
  2335. new Float:exit_pos_x = sql_get_field_assoc_float_ex(portal_result, i, "exit_pos_x");
  2336. new Float:exit_pos_y = sql_get_field_assoc_float_ex(portal_result, i, "exit_pos_y");
  2337. new Float:exit_pos_z = sql_get_field_assoc_float_ex(portal_result, i, "exit_pos_z");
  2338. new exit_world = sql_get_field_assoc_int_ex(portal_result, i, "exit_world");
  2339. new exit_interior = sql_get_field_assoc_int_ex(portal_result, i, "exit_interior_id");
  2340. 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);
  2341. }
  2342. // Pickups
  2343. 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");
  2344. for(new i = 0; i < sql_num_rows(pickup_result); i++){
  2345. new id = sql_get_field_assoc_int_ex(pickup_result, i, "id");
  2346. new object_id = sql_get_field_assoc_int_ex(pickup_result, i, "object_id");
  2347. new Float:pos_x = sql_get_field_assoc_float_ex(pickup_result, i, "pos_x");
  2348. new Float:pos_y = sql_get_field_assoc_float_ex(pickup_result, i, "pos_y");
  2349. new Float:pos_z = sql_get_field_assoc_float_ex(pickup_result, i, "pos_z");
  2350. new world_id = sql_get_field_assoc_int_ex(pickup_result, i, "world_id");
  2351. new interior_id = sql_get_field_assoc_int_ex(pickup_result, i, "interior_id");
  2352. new type_id = sql_get_field_assoc_int_ex(pickup_result, i, "type_id");
  2353. new pickupid = createDynamicPickup(object_id, pos_x, pos_y, pos_z, world_id, interior_id, type_id);
  2354. // Update pickup record
  2355. new pickup_query[44 + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1];
  2356. format(pickup_query, sizeof(pickup_query), "UPDATE pickup SET pickup_id = %i WHERE id = %i", pickupid, id);
  2357. sql_query(sqlHandle, pickup_query);
  2358. }
  2359. // Vehicles
  2360. new Result:vehicle_result = sql_query(sqlHandle, "SELECT id FROM vehicle");
  2361. for(new i = 0; i < sql_num_rows(vehicle_result); i++){
  2362. printf("Add: %i | vehicle_id: %i", i, sql_get_field_assoc_int_ex(vehicle_result, i, "id"));
  2363. addvehicle(sql_get_field_assoc_int_ex(vehicle_result, i, "id"));
  2364. }
  2365. // Hobo's with a cane (0 ammo value makes them lose the cane as soon as they switch weapon)
  2366. // Only homeless skins, as players should slowly class up in society.
  2367. AddPlayerClass(134, -184.7607, 950.5010, 16.7740, 358.3032, 15, 0, 0, 0, 0, false); // Fort Carson West boulevard right curb.
  2368. AddPlayerClass(10, -184.7607, 950.5010, 16.7740, 358.3032, 15, 0, 0, 0, 0, false); // Fort Carson West boulevard right curb.
  2369. AddPlayerClass(78, 111.0115, 1189.2029, 18.1627, 89.0095, 15, 0, 0, 0, 0, false); // Fort Carson South boulevard left curb.
  2370. AddPlayerClass(129, 111.0115, 1189.2029, 18.1627, 89.0095, 15, 0, 0, 0, 0, false); // Fort Carson South boulevard left curb.
  2371. AddPlayerClass(162, -109.4227, 1242.4860, 16.8223, 183.5798, 15, 0, 0, 0, 0, false); // Fort Carson East boulevard left curb.
  2372. AddPlayerClass(77, -109.4227, 1242.4860, 16.8223, 183.5798, 15, 0, 0, 0, 0, false); // Fort Carson East boulevard left curb.
  2373. AddPlayerClass(79, -201.5379, 948.1683, 15.9131, 359.9720, 15, 0, 0, 0, 0, false); // Fort Carson West boulevard left curb.
  2374. AddPlayerClass(196, -201.5379, 948.1683, 15.9131, 359.9720, 15, 0, 0, 0, 0, false); // Fort Carson West boulevard left curb.
  2375. AddPlayerClass(239, 62.4694, 1205.0531, 18.8153, 89.9380, 15, 0, 0, 0, 0, false); // Fort Carson South boulevard right curb.
  2376. AddPlayerClass(89, 62.4694, 1205.0531, 18.8153, 89.9380, 15, 0, 0, 0, 0, false); // Fort Carson South boulevard right curb.
  2377. AddPlayerClass(135, -126.0831, 1242.5745, 18.6138, 183.2986, 15, 0, 0, 0, 0, false); // Fort Carson East boulevard right curb.
  2378. AddPlayerClass(197, -126.0831, 1242.5745, 18.6138, 183.2986, 15, 0, 0, 0, 0, false); // Fort Carson East boulevard right curb.
  2379. return 1;
  2380. }
  2381. public OnGameModeExit(){
  2382. // Cycle every player
  2383. for(new playerid, a = GetMaxPlayers(); playerid < a; playerid++){
  2384. if(IsPlayerConnected(playerid)){
  2385. // Set name back to username
  2386. //new client_connect_username[MAX_PLAYER_NAME + 1];
  2387. //GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid);
  2388. //SetPlayerName(playerid, client_connect_username); // Change name in-game back to username, for login after restart PROBLEM: Crashses the server on GMX.
  2389. deleteAllGVars(playerid); // Delete GVars as per https://forum.sa-mp.com/showthread.php?t=151076
  2390. // TODO think of somthing for the usernames, kickign every player, or accapting character names as usersnames.
  2391. }
  2392. }
  2393. logger(LOGLEVEL_NOTICE, "* Global game-mode termination."); // Log event
  2394. sql_wait(sqlHandle); // Wait for queries to finish.
  2395. sql_disconnect(sqlHandle); // Disconnect from database.
  2396. DiscordEcho("* Global game-mode termination.", ECHO_CHANNEL); // Notify discord
  2397. //DiscordEcho("* Global game-mode termination.", MAIN_CHANNEL); // Enable when stable
  2398. return 1;
  2399. }
  2400. public OnPlayerRequestClass(playerid, classid){ // Skin selection before spawn.
  2401. if(scriptDebug){
  2402. new message[23 + 4 + MAX_PLAYER_NAME + 1];
  2403. format(message, sizeof(message), "* [%i] %s Class selection.", playerid, getCharacterName(playerid));
  2404. logger(LOGLEVEL_DEBUG, message); // Log event.
  2405. }
  2406. SetPlayerPos(playerid, -185.5514, 944.2042, 15.9337); // In front of Fort Carson city limits sign.
  2407. SetPlayerFacingAngle(playerid, 182.7345); // Charater looks toward the camera.
  2408. SetPlayerCameraPos(playerid, -185.5514, 939.0957, 15.6594); // Further in front of the Fort Carson city limits sign.
  2409. SetPlayerCameraLookAt(playerid, -185.5514, 944.2042, 15.9337); // In front of Fort Carson city limits sign.
  2410. return 1; // Must return one, or skin selection breaks
  2411. }
  2412. public OnPlayerConnect(playerid){
  2413. SetPlayerColor(playerid, COLOR_BLACK);
  2414. // Create & populate variables
  2415. new playername[MAX_PLAYER_NAME + 1], playerip[MAX_SQL_IP + 1];
  2416. playername = getPlayerName(playerid);
  2417. GetPlayerIp(playerid, playerip, sizeof(playerip));
  2418. // Global connection notification
  2419. new admin_message[23 + MAX_PLAYER_NAME + MAX_SQL_IP + 1];
  2420. format(admin_message, sizeof(admin_message), "* [%d] %s (IP: %s) connected.", playerid, getCharacterName(playerid), playerip);
  2421. logger(LOGLEVEL_INFO, admin_message); // Log event
  2422. sendToAdmins(COLOR_NOTICE, admin_message); // Notify all admins.
  2423. // Create IP record or update connection attempts
  2424. new ip_query[109 + MAX_SQL_IP + 1];
  2425. format(ip_query, sizeof(ip_query), "INSERT INTO ip(address) VALUES('%s') ON CONFLICT (address) DO UPDATE SET connections = ip.connections+1", playerip);
  2426. sql_query(sqlHandle, ip_query);
  2427. // Check if IP is banned
  2428. new ip_id = getIPID(playerid);
  2429. new ban_query[75 + MAX_SQL_INTEGER + 1];
  2430. format(ban_query, sizeof(ban_query), "SELECT id, reason FROM ip_ban WHERE ip_id = %i AND expires > NOW()::timestamp", ip_id);
  2431. new Result:ban_result = sql_query(sqlHandle, ban_query);
  2432. if(sql_num_rows(ban_result) > 0){ // Banned
  2433. new kick_message[8 + MAX_SQL_REASON + 1];
  2434. format(kick_message, sizeof(kick_message), "Banned: %s", sql_get_field_assoc_int(ban_result, "reason"));
  2435. kickPlayer(playerid, -1, kick_message, 1);
  2436. }
  2437. // Get user record
  2438. new escaped_username[MAX_PLAYER_NAME + 1], user_query[47 + MAX_PLAYER_NAME + 1]; // Should be longer to allow for escaped characters
  2439. sql_escape_string(sqlHandle, playername, escaped_username, sizeof(escaped_username)); // Escape player name
  2440. format(user_query, sizeof(user_query), "SELECT id FROM \"user\" WHERE name = '%s'", escaped_username);
  2441. //new Result:result = sqlQuery(sqlHandle, user_query); // Middleware broken.
  2442. new Result:result = sql_query(sqlHandle, user_query);
  2443. SetGVarString("client_connect_username", playername, playerid); // Used by register, DIALOG_LOGIN, getUserID & OnGameModeExit
  2444. if(sql_num_rows(result) == 0){ // Unkown user
  2445. SetGVarInt("userlevel", UNREGISTERED_PLAYER, playerid); // Set userlevel unregistered
  2446. print("UNkown user sending to changeName()");
  2447. changeName(playerid, playername); // Check, force and set role-play name
  2448. }
  2449. else{ // Known user
  2450. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Sign in", "Enter your password to log on", "Log in", "Cancel"); // Show password confirmation dialog
  2451. }
  2452. //return 1;
  2453. }
  2454. public OnPlayerDisconnect(playerid, reason){
  2455. if(GetPlayerState(playerid) != PLAYER_STATE_NONE){ // Only save character if spawned
  2456. savePlayerState(playerid); // Save character
  2457. }
  2458. deleteAllGVars(playerid); // Delete GVars as per https://forum.sa-mp.com/showthread.php?t=151076
  2459. new playername[MAX_PLAYER_NAME + 1], message[40 + 4 + MAX_PLAYER_NAME + 1];
  2460. playername = getPlayerName(playerid);
  2461. switch(reason){
  2462. case 0: format(message, sizeof(message), "* [%i] %s disconnected. (Lost Connection)", playerid, getCharacterName(playerid));
  2463. case 1: format(message, sizeof(message), "* [%i] %s disconnected. (Leaving)", playerid, getCharacterName(playerid));
  2464. case 2: format(message, sizeof(message), "* [%i] %s disconnected. (Kicked)", playerid, getCharacterName(playerid)); // Leave this in place for RCON kicks.
  2465. }
  2466. logger(LOGLEVEL_INFO, message); // Log event
  2467. SendClientMessageToAll(COLOR_NOTICE, message); // Notify all players.
  2468. DiscordEcho(message, ECHO_CHANNEL); // Notify discord.
  2469. return 1;
  2470. }
  2471. public OnPlayerSpawn(playerid){
  2472. if(scriptDebug){ // Log event in case of debugging.
  2473. new message[MAX_PLAYER_NAME + 14 + 1];
  2474. format(message, sizeof(message), "* [%i] %s spawned.", playerid, getCharacterName(playerid));
  2475. logger(LOGLEVEL_DEBUG, message); // Log event.
  2476. }
  2477. if(GetGVarInt("userlevel", playerid) == UNREGISTERED_PLAYER){ // Unregistered player.
  2478. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "SERVER: To reserve your name, save your character, statistics and money, type: /register");
  2479. }
  2480. return 1;
  2481. }
  2482. public OnPlayerDeath(playerid, killerid, reason){
  2483. new message[15 + MAX_PLAYER_NAME + 1];
  2484. format(message, sizeof(message), "* [%d] %s died.", playerid, getCharacterName(playerid)); // TODO Add killerid & reason.
  2485. logger(LOGLEVEL_DEBUG, message); // Log event
  2486. DiscordEcho(message, ADMIN_ECHO_CHANNEL); // Notify Discord admin echo.
  2487. //ResetPlayerMoney(playerid); TODO test if required
  2488. //SpawnPlayer(playerid);
  2489. return 1;
  2490. }
  2491. public OnVehicleSpawn(vehicleid)
  2492. {
  2493. return 1;
  2494. }
  2495. public OnVehicleDeath(vehicleid, killerid)
  2496. {
  2497. return 1;
  2498. }
  2499. public OnPlayerText(playerid, text[]){
  2500. new shortcut_message[128 + 1];
  2501. strfromliteral(shortcut_message, text);
  2502. strdel(shortcut_message, 0, 1); // Remove chat character from text
  2503. switch(strgetfirstc(text)){
  2504. case '`': {
  2505. if(GetGVarInt("chatmode", playerid) == CHAT_LOCAL){
  2506. sendToChat(playerid, CHAT_GLOBAL, shortcut_message, 0, DCC_INVALID_USER);
  2507. }
  2508. else if (GetGVarInt("chatmode", playerid) == CHAT_GLOBAL){
  2509. sendToChat(playerid, CHAT_LOCAL, shortcut_message, 0, DCC_INVALID_USER);
  2510. }
  2511. else{
  2512. sendToChat(playerid, CHAT_GLOBAL, shortcut_message, 0, DCC_INVALID_USER);
  2513. }
  2514. }
  2515. case '~': {sendToChat(playerid, CHAT_GANG, shortcut_message, 0, DCC_INVALID_USER);}
  2516. case '#': {sendToChat(playerid, CHAT_GANG_OC, shortcut_message, 0, DCC_INVALID_USER);}
  2517. case '!': {sendToChat(playerid, CHAT_FACTION, shortcut_message, 0, DCC_INVALID_USER);}
  2518. case '$': {sendToChat(playerid, CHAT_FACTION_OC, shortcut_message, 0, DCC_INVALID_USER);}
  2519. case '^': {sendToChat(playerid, CHAT_VIP, shortcut_message, 0, DCC_INVALID_USER);}
  2520. case '@': {sendToChat(playerid, CHAT_CREW, shortcut_message, 0, DCC_INVALID_USER);}
  2521. case '%': {sendToChat(playerid, CHAT_ADMIN, shortcut_message, 0, DCC_INVALID_USER);}
  2522. case '&': {sendToChat(playerid, CHAT_MANAGEMENT, shortcut_message, 0, DCC_INVALID_USER);}
  2523. case '*': {sendToChat(playerid, CHAT_UNDERCOVER, shortcut_message, 0, DCC_INVALID_USER);}
  2524. case '+': {sendToChat(playerid, CHAT_CALL, shortcut_message, 0, DCC_INVALID_USER);}
  2525. case '-': {sendToChat(playerid, CHAT_SMS, shortcut_message, 0, DCC_INVALID_USER);}
  2526. case '=': {sendToChat(playerid, CHAT_RADIO, shortcut_message, 0, DCC_INVALID_USER);}
  2527. case '>': {
  2528. new recipient_id, message[128 + 1];
  2529. if (sscanf(shortcut_message, "u s", recipient_id, message)){
  2530. SendClientMessage(playerid, COLOR_COMMAND_OUTPUT, "Usage: > <playerid> <message>");
  2531. }
  2532. else{
  2533. sendPM(playerid, message, recipient_id);
  2534. }
  2535. }
  2536. default:{
  2537. new chatmode = GetGVarInt("chatmode", playerid), message[128 + 1];
  2538. strmid(message, text, 0, 128);
  2539. // message = text;
  2540. if(!chatmode){ // Default is local chat
  2541. sendToChat(playerid, CHAT_LOCAL, message, 0, DCC_INVALID_USER);
  2542. }
  2543. else{ // Send to preferred chat
  2544. printf("chatmode: %i", chatmode);
  2545. sendToChat(playerid, chatmode, message, 0, DCC_INVALID_USER);
  2546. }
  2547. }
  2548. }
  2549. return 0; // Return 1 for default behavior, return 0 to disable default output.
  2550. }
  2551. public OnPlayerCommandText(playerid, cmdtext[]){
  2552. if(scriptDebug){ // Log event in case of debugging.
  2553. new message[5 + 4 + MAX_PLAYER_NAME + 128 + 1]; // 128 = samp text input limit.
  2554. format(message, sizeof(message), "[%d] %s: %s", playerid, getCharacterName(playerid), cmdtext);
  2555. logger(LOGLEVEL_COMMAND, message); // Log event
  2556. }
  2557. return 0;
  2558. }
  2559. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  2560. {
  2561. return 1;
  2562. }
  2563. public OnPlayerExitVehicle(playerid, vehicleid)
  2564. {
  2565. return 1;
  2566. }
  2567. public OnPlayerStateChange(playerid, newstate, oldstate)
  2568. {
  2569. return 1;
  2570. }
  2571. public OnPlayerEnterCheckpoint(playerid)
  2572. {
  2573. return 1;
  2574. }
  2575. public OnPlayerLeaveCheckpoint(playerid)
  2576. {
  2577. return 1;
  2578. }
  2579. public OnPlayerEnterRaceCheckpoint(playerid)
  2580. {
  2581. return 1;
  2582. }
  2583. public OnPlayerLeaveRaceCheckpoint(playerid)
  2584. {
  2585. return 1;
  2586. }
  2587. public OnRconCommand(cmd[]){ // The website and some cronjobs do RCON commands. TODO create filter not to show some commands to preven spam
  2588. new message[8 + 128 + 1]; // Max samp message legnth = 128.
  2589. format(message, sizeof(message), "* RCON: %s", cmd);
  2590. logger(LOGLEVEL_NOTICE, message); // Log event
  2591. DiscordEcho(message, MANAGEMENT_CHANNEL);
  2592. return 1;
  2593. }
  2594. public OnPlayerRequestSpawn(playerid){ // After picking a skin in class selection.
  2595. SetPlayerColor(playerid, COLOR_WHITE);
  2596. new playername[MAX_PLAYER_NAME + 1], message[14 + MAX_PLAYER_NAME + 1];
  2597. playername = getPlayerName(playerid);
  2598. if(scriptDebug){ // Only log spawns when debuggins script.
  2599. format(message, sizeof(message), "* [%d] %s Chose a character.", playerid, getCharacterName(playerid));
  2600. logger(LOGLEVEL_DEBUG, message); // Log event
  2601. }
  2602. if(GetGVarInt("userlevel", playerid) > UNREGISTERED_PLAYER){ // Registered player
  2603. createCharacterRecord(playerid, getUserID(playerid)); // Save character
  2604. new client_connect_username[MAX_PLAYER_NAME + 1], admin_message[25 + 4 + MAX_PLAYER_NAME + MAX_PLAYER_NAME + 1];
  2605. GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid); // Get client connect name
  2606. format(admin_message, sizeof(admin_message), "[%i] %s has been created by %s.", playerid, getCharacterName(playerid), client_connect_username);
  2607. DiscordEcho(admin_message, ADMIN_ECHO_CHANNEL);
  2608. }
  2609. return 1;
  2610. }
  2611. public OnObjectMoved(objectid)
  2612. {
  2613. return 1;
  2614. }
  2615. public OnPlayerObjectMoved(playerid, objectid)
  2616. {
  2617. return 1;
  2618. }
  2619. //public OnPlayerPickUpPickup(playerid, pickupid){} // Replaced byOnPlayerPickUpDynamicPickup() streamer.inc
  2620. public OnPlayerPickUpDynamicPickup(playerid, pickupid){ // Requires streamer
  2621. new type = GetGVarInt("pickup_type", pickupid);
  2622. // Special pickup types first, rugular in the else{} conditional statement
  2623. if(type == PICKUP_PORTAL){
  2624. // Do nothing if the player just used a pickup
  2625. if(GetGVarInt("disable_pickups", playerid)){
  2626. return 0;
  2627. }
  2628. new Float:x = GetGVarFloat("pickup_x", pickupid);
  2629. new Float:y = GetGVarFloat("pickup_y", pickupid);
  2630. new Float:z = GetGVarFloat("pickup_z", pickupid);
  2631. new world = GetGVarInt("pickup_world", pickupid);
  2632. // Don't releport when the exit is not set
  2633. if(x == 0 && y == 0 && z == 0){
  2634. return 0;
  2635. }
  2636. // Create dynamic area and temporarily disable pickups for player
  2637. new area = CreateDynamicCircle(x, y, 1.7, world, -1, playerid);
  2638. SetGVarInt("disable_pickups", area, playerid);
  2639. // Teleport player
  2640. teleportPlayer(playerid, x, y, z, GetGVarInt("pickup_angle", pickupid), world, GetGVarInt("pickup_interior", pickupid));
  2641. }
  2642. else{
  2643. // Do nothing if the player just used a pickup
  2644. if(GetGVarInt("disable_pickups", playerid)){
  2645. return 0;
  2646. }
  2647. // Create dynamic area and temporarily disable pickups for player
  2648. new Float:x, Float:y, Float:z;
  2649. GetPlayerPos(playerid, x, y, z);
  2650. new area = CreateDynamicCircle(x, y, 1, GetPlayerVirtualWorld(playerid), -1, playerid);
  2651. SetGVarInt("disable_pickups", area, playerid);
  2652. // Regular pickup types
  2653. switch(type){
  2654. case PICKUP_FACTION_PD: {
  2655. switch(GetGVarInt("job", playerid)){
  2656. case JOB_NONE:{ShowPlayerDialog(playerid, DIALOG_DUTY_PD, DIALOG_STYLE_MSGBOX, "Active police duty", "Go on police duty as a rookie cop?", "Yes", "No");}
  2657. case JOB_POLICE:{ShowPlayerDialog(playerid, DIALOG_DUTY_PD, DIALOG_STYLE_MSGBOX, "Active police duty", "Go off police duty?", "Yes", "No");}
  2658. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
  2659. }
  2660. }
  2661. case PICKUP_FACTION_MD:{
  2662. switch(GetGVarInt("job", playerid)){
  2663. case JOB_NONE:{ShowPlayerDialog(playerid, DIALOG_DUTY_MD, DIALOG_STYLE_MSGBOX, "Active medic duty", "Go on medic duty as a rookie paramedic?", "Yes", "No");}
  2664. case JOB_MEDIC:{ShowPlayerDialog(playerid, DIALOG_DUTY_MD, DIALOG_STYLE_MSGBOX, "Active medic duty", "Go off paramedic duty?", "Yes", "No");}
  2665. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you have another job.");}
  2666. }
  2667. }
  2668. case PICKUP_FACTION_FD:{
  2669. printf("jobid: %i", GetGVarInt("job", playerid));
  2670. switch(GetGVarInt("job", playerid)){
  2671. case JOB_NONE:{ShowPlayerDialog(playerid, DIALOG_DUTY_FD, DIALOG_STYLE_MSGBOX, "Active fire duty", "Go on fire duty as a rookie firefighter?", "Yes", "No");}
  2672. case JOB_FIRE:{ShowPlayerDialog(playerid, DIALOG_DUTY_FD, DIALOG_STYLE_MSGBOX, "Active firefighter duty", "Go off firefighter duty?", "Yes", "No");}
  2673. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you have another job.");}
  2674. }
  2675. }
  2676. case PICKUP_FACTION_FBI:{
  2677. switch(GetGVarInt("job", playerid)){
  2678. case JOB_NONE:{ShowPlayerDialog(playerid, DIALOG_DUTY_FBI, DIALOG_STYLE_MSGBOX, "Active FBI duty", "Go on FBI duty as a rookie agent?", "Yes", "No");}
  2679. case JOB_FBI:{ShowPlayerDialog(playerid, DIALOG_DUTY_FBI, DIALOG_STYLE_MSGBOX, "Active medic duty", "Go off FBI duty?", "Yes", "No");}
  2680. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you have another job.");}
  2681. }
  2682. }
  2683. case PICKUP_FACTION_DMV:{
  2684. switch(GetGVarInt("job", playerid)){
  2685. 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");}
  2686. case JOB_DMV:{ShowPlayerDialog(playerid, DIALOG_DUTY_DMV, DIALOG_STYLE_MSGBOX, "Active DMV duty", "Go off DMV duty?", "Yes", "No");}
  2687. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you have another job.");}
  2688. }
  2689. }
  2690. case PICKUP_FACTION_NEWS:{
  2691. switch(GetGVarInt("job", playerid)){
  2692. case JOB_NONE:{ShowPlayerDialog(playerid, DIALOG_DUTY_NEWS, DIALOG_STYLE_MSGBOX, "Active broadcasting duty", "Go on network duty as a rookie reporter?", "Yes", "No");}
  2693. case JOB_NEWS:{ShowPlayerDialog(playerid, DIALOG_DUTY_NEWS, DIALOG_STYLE_MSGBOX, "Active broadcasting duty", "Go off network duty?", "Yes", "No");}
  2694. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you have another job.");}
  2695. }
  2696. }
  2697. }
  2698. }
  2699. return 1;
  2700. }
  2701. public OnPlayerLeaveDynamicArea(playerid, areaid){ // Requires streamer
  2702. // Reactivate pickup after player leaves it
  2703. new area = GetGVarInt("disable_pickups", playerid);
  2704. 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)
  2705. return;
  2706. }
  2707. else if(area == 0){ // Player has not had picks disabled
  2708. return;
  2709. }
  2710. if(area == areaid){ // Player had this pickup disabled
  2711. DestroyDynamicArea(GetGVarInt("disable_pickups", playerid));
  2712. DeleteGVar("disable_pickups", playerid);
  2713. }
  2714. }
  2715. public OnVehicleMod(playerid, vehicleid, componentid)
  2716. {
  2717. return 1;
  2718. }
  2719. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  2720. {
  2721. return 1;
  2722. }
  2723. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  2724. {
  2725. return 1;
  2726. }
  2727. public OnPlayerSelectedMenuRow(playerid, row)
  2728. {
  2729. return 1;
  2730. }
  2731. public OnPlayerExitedMenu(playerid)
  2732. {
  2733. return 1;
  2734. }
  2735. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  2736. {
  2737. return 1;
  2738. }
  2739. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  2740. {
  2741. return 1;
  2742. }
  2743. public OnRconLoginAttempt(ip[], password[], success){
  2744. new message[30 + MAX_SQL_IP + 1];
  2745. if(success){
  2746. format(message, sizeof(message), "* [%s] authenticated via RCON.", ip);
  2747. }
  2748. else{
  2749. format(message, sizeof(message), "* [%s] invalid RCON authentication.", ip);
  2750. }
  2751. logger(LOGLEVEL_NOTICE, message); // Log event
  2752. DiscordEcho(message, MANAGEMENT_CHANNEL); // Notify Discord management.
  2753. return 1;
  2754. }
  2755. public OnPlayerUpdate(playerid) // Don't use for now.
  2756. {
  2757. return 1;
  2758. }
  2759. public OnPlayerStreamIn(playerid, forplayerid){
  2760. return 1;
  2761. }
  2762. public OnPlayerStreamOut(playerid, forplayerid)
  2763. {
  2764. return 1;
  2765. }
  2766. public OnVehicleStreamIn(vehicleid, forplayerid)
  2767. {
  2768. return 1;
  2769. }
  2770. public OnVehicleStreamOut(vehicleid, forplayerid)
  2771. {
  2772. return 1;
  2773. }
  2774. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
  2775. switch(dialogid){
  2776. case DIALOG_CHANGENAME:{
  2777. if(GetGVarInt("userlevel", playerid) > UNREGISTERED_PLAYER){ // Registered player
  2778. if(!response){ // User aborted
  2779. return 0; // Allow escaping dialogm without forcing to continue
  2780. }
  2781. }
  2782. changeName(playerid, inputtext); // Forced name check and change
  2783. }
  2784. case DIALOG_REGISTER:{
  2785. if(response){ // If they clicked 'Yes' or pressed enter
  2786. // Check password complexity
  2787. new Regex:r = Regex_New("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[0-9!@#\\$%\\^&\\*\\(\\)\\-\\_=+[{\\]}\\\\|;:'\",<.>\\/?]).{8,}$"); // Regex password filter
  2788. new isSecurePassword = Regex_Check(inputtext, r); // Validate name to filter
  2789. Regex_Delete(r);
  2790. if(!isSecurePassword){ // Insecure password
  2791. 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.
  2792. }
  2793. else { // Secure password
  2794. // Hash password
  2795. new buffer[MAX_SQL_HASH + 1], hash[MAX_SQL_HASH + 1];
  2796. WP_Hash(buffer, sizeof(buffer), inputtext);
  2797. GetGVarString("hash", hash, sizeof(hash), playerid);
  2798. if(isempty(hash)){ // First password dialog
  2799. SetGVarString("hash", buffer, playerid); // Save password has a GVar
  2800. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Password confirmation", "Repeat your password to confirm.", "Register", "Cancel"); // Show password confirmation dialog
  2801. }
  2802. else{ // Password confirmation
  2803. if(!isequal(hash, buffer)){ // Password does not match confirmation
  2804. DeleteGVar("hash", playerid);
  2805. SendClientMessage(playerid, COLOR_RED, "ERROR: Password does not match password confirmation.");
  2806. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Password", "Enter the same password twice.", "Continue", "Cancel"); // Password prompt
  2807. }
  2808. else{ // Password matches confirmation
  2809. DeleteGVar("hash", playerid);
  2810. new client_connect_username[MAX_PLAYER_NAME + 1], playerIP[MAX_SQL_IP + 1], escaped_username[MAX_PLAYER_NAME + 1];
  2811. GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid);
  2812. GetPlayerIp(playerid, playerIP, sizeof(playerIP));
  2813. sql_escape_string(sqlHandle, client_connect_username, escaped_username, sizeof(escaped_username));
  2814. // Create user record
  2815. new user_query[61 + MAX_PLAYER_NAME + MAX_SQL_HASH + 1 + MAX_SQL_IP + 1];
  2816. format(user_query, sizeof(user_query), "INSERT INTO \"user\"(name, password) VALUES('%s', '%s')", escaped_username, hash);
  2817. /*new Result:user_result = sql_query(sqlHandle, user_query);
  2818. //new id = sql_insert_id(user_result); // Broken, always returns 0.
  2819. // sql_insert_id workaround*/
  2820. sql_query(sqlHandle, user_query);
  2821. new id = getUserID(playerid); // Get ID user user record
  2822. SetGVarInt("userlevel", REGISTERED_PLAYER, playerid);
  2823. // Create user_ip relation table record
  2824. new user_ip_query[50 + MAX_SQL_INTEGER + MAX_SQL_INTEGER + 1 ];
  2825. format(user_ip_query, sizeof(user_ip_query), "INSERT INTO user_ip(id, id) VALUES(%i, %i)", getIPID(playerid), id);
  2826. sql_query(sqlHandle, user_ip_query);
  2827. createCharacterRecord(playerid, id); // Save character
  2828. // Inform user
  2829. new dialogMessage[135 + MAX_PLAYER_NAME + 1], message[31 + MAX_PLAYER_NAME + 1];
  2830. 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);
  2831. ShowPlayerDialog(playerid, DIALOG_ACCOUNT_CREATED, DIALOG_STYLE_MSGBOX, "Account created", dialogMessage, "Play", "");
  2832. format(message, sizeof(message), "SERVER: Remember your username, %s!", client_connect_username);
  2833. SendClientMessage(playerid, COLOR_WARNING, message);
  2834. // send discord admin echo
  2835. new admin_message[30 + 4 + MAX_PLAYER_NAME + 1];
  2836. format(admin_message, sizeof(admin_message), "[%i] %s has registered an account.", playerid, client_connect_username);
  2837. DiscordEcho(admin_message, ADMIN_ECHO_CHANNEL);
  2838. }
  2839. }
  2840. }
  2841. }
  2842. else{ // Pressed ESC or clicked cancel
  2843. DeleteGVar("hash", playerid);
  2844. }
  2845. }
  2846. case DIALOG_LOGIN:{
  2847. if(response){ // If they clicked 'Yes' or pressed enter
  2848. // Escape username
  2849. new client_connect_username[MAX_PLAYER_NAME + 1], escaped_username[MAX_PLAYER_NAME + 1];
  2850. GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid);
  2851. sql_escape_string(sqlHandle, client_connect_username, escaped_username, sizeof(escaped_username));
  2852. // Get account
  2853. new user_query[82 + MAX_PLAYER_NAME + 1], hash[MAX_SQL_HASH + 1];
  2854. format(user_query, sizeof(user_query), "SELECT id, password, level FROM \"user\" WHERE name = '%s'", escaped_username);
  2855. new Result:user_result = sql_query(sqlHandle, user_query);
  2856. sql_get_field_assoc_ex(user_result, 0, "password", hash, sizeof(hash));
  2857. // Compare hashes
  2858. new buffer[MAX_SQL_HASH + 1];
  2859. WP_Hash(buffer, sizeof(buffer), inputtext);
  2860. if (!isequal(buffer, hash)){ // Hashes don't match
  2861. // Brute-force protection
  2862. new authentication_count = GetGVarInt("authentication_count", playerid);
  2863. authentication_count++;
  2864. SetGVarInt("authentication_count", authentication_count, playerid);
  2865. ShowPlayerDialog(playerid, DIALOG_LOGIN_FAILED, DIALOG_STYLE_MSGBOX, "Authenticaion failed", "Invalid password.", "Wait", "");
  2866. switch(authentication_count){
  2867. case 0: SetTimerEx("authenticate", 3000, false, "i", playerid); // Return to authentication workflow in 3 second.
  2868. case 1: SetTimerEx("authenticate", 5000, false, "i", playerid); // Return to authentication workflow in 5 seconds.
  2869. case 2: SetTimerEx("authenticate", 7000, false, "i", playerid); // Return to authentication workflow in 7 seconds.
  2870. default: ShowPlayerDialog(playerid, DIALOG_CHANGE_USERNAME, DIALOG_STYLE_INPUT, "Username", "Pick an unregistered username.", "Change", ""); // After 4 failed authentication attempts
  2871. }
  2872. }
  2873. else{ // Hashes match
  2874. // Set userlevel (This has to be done before banning, else the user ban record won't save)
  2875. new userlevel = sql_get_field_assoc_int(user_result, "level");
  2876. printf("Setting userlevel: %i", userlevel);
  2877. SetGVarInt("userlevel", userlevel, playerid);
  2878. // Check bans
  2879. new ban_query[76 + MAX_SQL_INTEGER + 1];
  2880. format(ban_query, sizeof(ban_query), "SELECT user_id FROM user_ban WHERE user_id = %i AND expires > NOW()::timestamp", getUserID(playerid));
  2881. new Result:ban_result = sql_query(sqlHandle, ban_query);
  2882. if(sql_num_rows(ban_result) > 0){ // Banned
  2883. new reason[121 + 1];
  2884. format(reason, sizeof(reason), "Logged in with banned account: %i", sql_get_field_assoc_int(ban_result, "user_id"));
  2885. banPlayer(playerid, -1, reason, 10);
  2886. }
  2887. // Get character names
  2888. characterSelection(playerid);
  2889. }
  2890. }
  2891. else{ // Pressed ESC or clicked cancel
  2892. ShowPlayerDialog(playerid, DIALOG_CHANGE_USERNAME, DIALOG_STYLE_INPUT, "Username", "Pick an unregistered username.", "Change", "");
  2893. }
  2894. }
  2895. case DIALOG_CHANGE_USERNAME:{
  2896. if(response){ // If they clicked 'Yes' or pressed enter
  2897. new Regex:r = Regex_New("^[0-9a-zA-Z\\[\\]\\(\\)\\$@._=]{1,}$"); // Regex name filter
  2898. new isValidName = Regex_Check(inputtext, r);
  2899. Regex_Delete(r);
  2900. if(isValidName){ // Valid name
  2901. // Get user record
  2902. new escaped_username[MAX_PLAYER_NAME + 1], user_query[36 + MAX_PLAYER_NAME + 1];
  2903. sql_escape_string(sqlHandle, inputtext, escaped_username, sizeof(escaped_username)); // Escape player name
  2904. format(user_query, sizeof(user_query), "SELECT id FROM \"user\" WHERE name = '%s'", escaped_username);
  2905. //new Result:result = sqlQuery(sqlHandle, user_query); // Middleware broken.
  2906. new Result:result = sql_query(sqlHandle, user_query);
  2907. if(sql_num_rows(result) > 0){ // Username taken
  2908. ShowPlayerDialog(playerid, DIALOG_CHANGE_USERNAME, DIALOG_STYLE_INPUT, "Username", "Pick an unregistered username.", "Change", "");
  2909. }
  2910. else{ // Username free
  2911. SetGVarString("client_connect_username", inputtext, playerid); // Used by register and DIALOG_LOGIN
  2912. SetPlayerName(playerid, inputtext); // Change name in-game
  2913. return 1; // Do nothing to let player continue class selection
  2914. }
  2915. }
  2916. else{ // Invalid name
  2917. 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", "");
  2918. }
  2919. }
  2920. else{ // Pick another username
  2921. ShowPlayerDialog(playerid, DIALOG_CHANGE_USERNAME, DIALOG_STYLE_INPUT, "Username", "Pick an unregistered username.", "Change", "");
  2922. }
  2923. }
  2924. case DIALOG_CHARACTERS:{ // TODO set color & skin in case of job
  2925. if(response){ // Spawn as character
  2926. new character_array_string[MAX_CHARACTERS_PER_USER * MAX_SQL_INTEGER + 1], character_array[MAX_CHARACTERS_PER_USER + 1];
  2927. GetGVarString("character_array_string", character_array_string, sizeof(character_array_string), playerid);
  2928. DeleteGVar("character_array_string");
  2929. strtobin(character_array, character_array_string);
  2930. new character_query[132 + MAX_PLAYER_NAME + 1], name[24 + 1];
  2931. 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]);
  2932. new Result:character_result = sql_query(sqlHandle, character_query);
  2933. sql_get_field_assoc(character_result, "name", name, sizeof(name));
  2934. new skin_id = sql_get_field_assoc_int(character_result, "skin_id");
  2935. new cash = sql_get_field_assoc_int(character_result, "cash");
  2936. new Float:armour = sql_get_field_assoc_int(character_result, "armour");
  2937. new Float:health = sql_get_field_assoc_int(character_result, "health");
  2938. new Float:pos_x = sql_get_field_assoc_int(character_result, "pos_x");
  2939. new Float:pos_y = sql_get_field_assoc_int(character_result, "pos_y");
  2940. new Float:pos_z = sql_get_field_assoc_int(character_result, "pos_z");
  2941. new Float:rotation = sql_get_field_assoc_int(character_result, "rotation");
  2942. new world_id = sql_get_field_assoc_int(character_result, "world_id");
  2943. new interior_id = sql_get_field_assoc_int(character_result, "interior_id");
  2944. //new job_id = sql_get_field_assoc_int(character_result, "job_id");
  2945. // Temporary bug workaround TODO find cause
  2946. 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)?
  2947. pos_x = -144.0328;
  2948. pos_y = 1225.0564;
  2949. pos_z = 19.8992;
  2950. rotation = 175.5507;
  2951. }
  2952. SetSpawnInfo(playerid, 0, skin_id, pos_x, pos_y, pos_z, rotation, 0, 0, 0, 0, 0, 0);
  2953. SetGVarInt("character_id", character_array[listitem], playerid);
  2954. SetPlayerName(playerid, name); // Change name in-game
  2955. SetPlayerColor(playerid, COLOR_WHITE);
  2956. SpawnPlayer(playerid);
  2957. ResetPlayerMoney(playerid);
  2958. GivePlayerMoney(playerid, cash);
  2959. SetPlayerHealth(playerid, health);
  2960. SetPlayerArmour(playerid, armour);
  2961. SetPlayerVirtualWorld(playerid, world_id);
  2962. SetPlayerInterior(playerid, interior_id);
  2963. // TODO design a way to keep job on rejoin
  2964. // Notify all players
  2965. new message[16 + 4 + MAX_PLAYER_NAME + 1];
  2966. format(message, sizeof(message), "* [%i] %s joined.", playerid, getCharacterName(playerid));
  2967. SendClientMessageToAll(COLOR_NOTICE, message); // Notify all players.
  2968. DiscordEcho(message, ECHO_CHANNEL); // Notify discord public echo
  2969. }
  2970. else{ // New character
  2971. // character cap
  2972. new id = getUserID(playerid);
  2973. new character_query[60 + MAX_SQL_INTEGER + 1];
  2974. format(character_query, sizeof(character_query), "SELECT id FROM character WHERE character_id = %i", id);
  2975. new Result:character_result = sql_query(sqlHandle, character_query);
  2976. printf("%i", sql_num_rows(character_result));
  2977. if(sql_num_rows(character_result) >= MAX_CHARACTERS_PER_USER){ // At or over character limit
  2978. SendClientMessage(playerid, COLOR_WARNING, "SERVER: Maximum characters reached, can not create another.");
  2979. characterSelection(playerid);
  2980. }
  2981. else{
  2982. 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.
  2983. // changeName(playerid, ""); // Pick name and save character ANNOYING this forces new character creation, no way out.
  2984. }
  2985. }
  2986. }
  2987. case DIALOG_LOGIN_FAILED:{
  2988. ShowPlayerDialog(playerid, DIALOG_LOGIN_FAILED, DIALOG_STYLE_MSGBOX, "Authenticaion failed", "Take some time to think about your password...", "Wait", "Longer");
  2989. }
  2990. case DIALOG_DELETE_CHARACTER:{
  2991. if(response){ // Delete character
  2992. new playername[MAX_PLAYER_NAME + 1];
  2993. playername = getPlayerName(playerid);
  2994. // Checkcharacter amount
  2995. new id = getUserID(playerid), character_query[75 + MAX_SQL_INTEGER + MAX_CHARACTERS_PER_USER_DIGITS + 1];
  2996. format(character_query, sizeof(character_query), "SELECT id, name FROM character WHERE user_id = %i LIMIT %i", id, MAX_CHARACTERS_PER_USER);
  2997. new Result:character_result = sql_query(sqlHandle, character_query);
  2998. if(sql_num_rows(character_result) < 2){ // 1 character or less
  2999. SendClientMessage(playerid, COLOR_WARNING, "SERVER: You can not have less then one character.\nCreate another character,before deleting this one.");
  3000. }
  3001. else{ // More then 1 character
  3002. // delete character record
  3003. new delete_query[50 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
  3004. format(delete_query, sizeof(delete_query), "DELETE FROM character WHERE name = '%s' AND user_id = %i", playername, getUserID(playerid));
  3005. sql_query(sqlHandle, delete_query);
  3006. // infordm admin echo
  3007. new client_connect_username[MAX_PLAYER_NAME + 1], message[28 + 4 + MAX_PLAYER_NAME + MAX_PLAYER_NAME + 1];
  3008. GetGVarString("client_connect_username", client_connect_username, sizeof(client_connect_username), playerid); // Get client connect name
  3009. format(message, sizeof(message), "* [%i] %s has been deleted by it's user: %s", playerid, getCharacterName(playerid), client_connect_username);
  3010. DiscordEcho(message, ADMIN_ECHO_CHANNEL);
  3011. sendToAdmins(COLOR_COMMAND_OUTPUT, message);
  3012. // Player must not be spawned or will be able to esacpe the character menu and continue with character without dartabase record
  3013. ForceClassSelection(playerid);
  3014. TogglePlayerSpectating(playerid, true);
  3015. TogglePlayerSpectating(playerid, false);
  3016. characterSelection(playerid);
  3017. }
  3018. }
  3019. }
  3020. case DIALOG_GOTO:{
  3021. if(response){
  3022. switch(listitem){
  3023. case GOTO_CATEGORY_INTERIOR:{
  3024. dialogGotoInterior(playerid);
  3025. }
  3026. /*case GOTO_CATEGORY_PLAYER:{
  3027. dialogGotoPlayer(playerid);
  3028. }*/
  3029. }
  3030. }
  3031. }
  3032. case DIALOG_GOTO_INTERIOR:{
  3033. if(response){
  3034. switch(listitem){
  3035. case INTERIOR_CATEGORY_AVIATION:{
  3036. 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");
  3037. }
  3038. case INTERIOR_CATEGORY_HOUSES:{
  3039. dialogGotoHouses(playerid);
  3040. }
  3041. case INTERIOR_CATEGORY_MISSION:{
  3042. 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");
  3043. }
  3044. case INTERIOR_CATEGORY_MISSIONEXT:{
  3045. 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");
  3046. }
  3047. case INTERIOR_CATEGORY_POLICE:{
  3048. ShowPlayerDialog(playerid, DIALOG_GOTO_POLICE, DIALOG_STYLE_LIST, "Police departments", "Las Venturas\nLos Santos\nSan Fierro\nBarbara's love nest", "Goto", "Cancel");
  3049. }
  3050. case INTERIOR_CATEGORY_SEXWORK:{
  3051. ShowPlayerDialog(playerid, DIALOG_GOTO_SEXWORK, DIALOG_STYLE_LIST, "Brothels & stip clubs", "Brother\nBrother2\nBig spread ranch\tBC\n", "Goto", "Cancel");
  3052. }
  3053. case INTERIOR_CATEGORY_SHOPS:{
  3054. dialogGotoShops(playerid);
  3055. }
  3056. case INTERIOR_CATEGORY_STADIA:{
  3057. ShowPlayerDialog(playerid, DIALOG_GOTO_STADIA, DIALOG_STYLE_TABLIST, "Stadia", "Bloodbowl stadium\nKickstart stadium\n8 Track stadium\nDirtbike stadium\n", "Goto", "Cancel");
  3058. }
  3059. }
  3060. }
  3061. else{
  3062. ShowPlayerDialog(playerid, DIALOG_GOTO, DIALOG_STYLE_LIST, "Categories", "Interiors\nPlayers", "Select", "Cancel");
  3063. }
  3064. }
  3065. case DIALOG_GOTO_HOUSES:{
  3066. if(response){
  3067. switch(listitem){
  3068. case INTERIOR_HOUSE_CAT_BURGLARY:{
  3069. 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");
  3070. }
  3071. case INTERIOR_HOUSE_CAT_MISSION:{
  3072. 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");
  3073. }
  3074. case INTERIOR_HOUSE_CAT_SAFE:{
  3075. 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");
  3076. }
  3077. case INTERIOR_HOUSE_CAT_U:{
  3078. ShowPlayerDialog(playerid, DIALOG_GOTO_UHOUSE, DIALOG_STYLE_TABLIST, "To be categorized houses", "", "Goto", "Cancel");
  3079. }
  3080. }
  3081. }
  3082. else{
  3083. dialogGotoInterior(playerid);
  3084. }
  3085. }
  3086. case DIALOG_GOTO_SHOPS:{
  3087. if(response){
  3088. switch(listitem){
  3089. case INTERIOR_SHOP_CAT_247:{
  3090. 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");
  3091. }
  3092. case INTERIOR_SHOP_CAT_AMMUNATION:{
  3093. 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");
  3094. }
  3095. case INTERIOR_SHOP_CAT_CASINO:{
  3096. 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");
  3097. }
  3098. case INTERIOR_SHOP_CAT_MODSHOP:{
  3099. ShowPlayerDialog(playerid, DIALOG_GOTO_MODDING, DIALOG_STYLE_TABLIST, "Modding shops", "Loco Low Co\tLos Santos\nWheel Arch Angels\tSan Fierro\nTransfender", "Goto", "Cancel");
  3100. }
  3101. case INTERIOR_SHOP_CAT_SHOP:{
  3102. 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");
  3103. }
  3104. }
  3105. }
  3106. else{
  3107. dialogGotoInterior(playerid);
  3108. }
  3109. }
  3110. case DIALOG_GOTO_247:{
  3111. if(response){
  3112. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[25 + 1];
  3113. world = GetPlayerVirtualWorld(playerid);
  3114. switch(listitem){
  3115. case INTERIOR_247_LSHAPED:{
  3116. x = -25.7220;
  3117. y = -187.8216;
  3118. z = 1003.5469;
  3119. interior = 17;
  3120. angle = 5.0760;
  3121. name = "L-shaped ammunation";
  3122. }
  3123. case INTERIOR_247_OBLONG:{
  3124. x = 6.0856;
  3125. y = -28.8966;
  3126. z = 1003.5494;
  3127. interior = 10;
  3128. angle = 5.0365;
  3129. name = "Oblong ammunation";
  3130. }
  3131. case INTERIOR_247_MEDIUM:{
  3132. x = -30.9875;
  3133. y = -89.6806;
  3134. z = 1003.5469;
  3135. interior = 18;
  3136. angle = 359.8401;
  3137. name = "Medium ammunation";
  3138. }
  3139. case INTERIOR_247_MEDIUM_NOEXIT:{
  3140. x = -26.1856;
  3141. y = -140.9164;
  3142. z = 1003.5469;
  3143. interior = 16;
  3144. angle = 2.9087;
  3145. name = "Medium no exit ammunation";
  3146. }
  3147. case INTERIOR_247_LONG:{
  3148. x = -27.844;
  3149. y = 26.6737;
  3150. z = 1003.5573;
  3151. interior = 4;
  3152. angle = 184.3118;
  3153. name = "Small long ammunation";
  3154. }
  3155. case INTERIOR_247_SQAURE:{
  3156. x = -26.8339,
  3157. y = -55.5846,
  3158. z = 1003.5469,
  3159. interior = 6,
  3160. angle = 3.9528;
  3161. name = "Small square ammunation";
  3162. }
  3163. }
  3164. gotoCallback(x, y, z, world, interior, angle, name);
  3165. }
  3166. else{dialogGotoShops(playerid);}
  3167. }
  3168. case DIALOG_GOTO_AVIATION:{
  3169. if(response){
  3170. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[39 + 1];
  3171. world = GetPlayerVirtualWorld(playerid);
  3172. switch(listitem){
  3173. case INTERIOR_AVIATION_TICKET:{
  3174. x = -1827.147338;
  3175. y = 7.207418;
  3176. z = 1061.143554;
  3177. interior = 14;
  3178. angle = 335.3199;
  3179. name = "Francis Intn'l Airport - Ticket sales";
  3180. }
  3181. case INTERIOR_AVIATION_BAGGAGE:{
  3182. x = -1855.568725;
  3183. y = 41.263156;
  3184. z = 1061.143554;
  3185. interior = 14;
  3186. angle = 335.3199;
  3187. name = "Francis Intn'l Airport - Baggage claim";
  3188. }
  3189. case INTERIOR_AVIATION_SHAMAL:{
  3190. x = 2.384830;
  3191. y = 33.103397;
  3192. z = 1199.849976 ;
  3193. interior = 1;
  3194. angle = 359.8401;
  3195. name = "Shamal cabin";
  3196. }
  3197. case INTERIOR_AVIATION_ANDROMADA:{
  3198. x = 315.856170;
  3199. y = 1024.496459;
  3200. z = 1949.797363;
  3201. interior = 9;
  3202. angle = 359.6368;
  3203. name = "Andromada cargo hold";
  3204. }
  3205. case INTERIOR_AVIATION_LSAIRPORT:{
  3206. x = -1870.80;
  3207. y = 59.81;
  3208. z = 1056.25;
  3209. interior = 14;
  3210. angle = 85.8541;
  3211. name = "LS Airport, Baggage Reclaim";
  3212. }
  3213. }
  3214. gotoCallback(x, y, z, world, interior, angle, name);
  3215. }
  3216. else{dialogGotoInterior(playerid);}
  3217. }
  3218. case DIALOG_GOTO_AMMUNATION:{ // TODO there are more ammunations that deserve a booth and range teleport
  3219. if(response){
  3220. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[31 + 1];
  3221. world = GetPlayerVirtualWorld(playerid);
  3222. switch(listitem){
  3223. case INTERIOR_AMMU_OCEAN:{
  3224. x = 286.148987;
  3225. y = -40.644398 ;
  3226. z = 1001.569946;
  3227. interior = 1;
  3228. angle = 0.7529;
  3229. name = "Ocean Flats, SF";
  3230. }
  3231. case INTERIOR_AMMU_PALOMINO:{
  3232. x = 286.800995;
  3233. y = -82.547600;
  3234. z = 1001.539978;
  3235. interior = 4;
  3236. angle = 290.2195;
  3237. name = "Palomino Creek, LV";
  3238. }
  3239. case INTERIOR_AMMU_ANGEL:{
  3240. x = 296.919983;
  3241. y = -108.071999;
  3242. z = 1001.569946;
  3243. interior = 6;
  3244. angle = 290.2195;
  3245. name = "Angel Pine, SF";
  3246. }
  3247. case INTERIOR_AMMU_QUEBRADOS:{
  3248. x = 316.524994;
  3249. y = -167.706985;
  3250. z = 999.661987;
  3251. interior = 6;
  3252. angle = 10.3031;
  3253. name = "El Quebrados, LV";
  3254. }
  3255. case INTERIOR_AMMU_2STORIES:{
  3256. x = 314.820984;
  3257. y = -141.431992;
  3258. z = 999.661987;
  3259. interior = 7;
  3260. angle = 20.2254;
  3261. name = "2 Stories, with booth and range";
  3262. }
  3263. case INTERIOR_AMMU_BOOTH:{
  3264. x = 302.292877;
  3265. y = -143.139099;
  3266. z = 1004.062500;
  3267. interior = 7;
  3268. angle = 20.2254;
  3269. name = "Booth";
  3270. }
  3271. case INTERIOR_AMMU_RANGE:{
  3272. x = 280.795104;
  3273. y = -135.203353;
  3274. z = 1004.062500;
  3275. interior = 7;
  3276. angle = 20.2254;
  3277. name = "Range";
  3278. }
  3279. }
  3280. gotoCallback(x, y, z, world, interior, angle, name);
  3281. }
  3282. else{dialogGotoShops(playerid);}
  3283. }
  3284. case DIALOG_GOTO_BURGLARYHOUSE:{
  3285. if(response){
  3286. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[45 + 1];
  3287. world = GetPlayerVirtualWorld(playerid);
  3288. switch(listitem){
  3289. case INTERIOR_BURGRLARY_LARGE:{
  3290. x = 235.508994;
  3291. y = 1189.169897;
  3292. z = 1080.339966;
  3293. interior = 3;
  3294. angle = 349.4844;
  3295. name = "Large: 2 story, 3 bedroom clone of house 9";
  3296. }
  3297. case INTERIOR_BURGRLARY_MEDIUM:{
  3298. x = 225.756989;
  3299. y = 1240.000000;
  3300. z = 1082.149902;
  3301. interior = 2;
  3302. angle = 96.2852;
  3303. name = "Medium: 1 story, 1 bedroom";
  3304. }
  3305. case INTERIOR_BURGRLARY_SMALL:{
  3306. x = 223.043991;
  3307. y = 1289.259888;
  3308. z = 1082.199951;
  3309. interior = 1;
  3310. angle = 359.868;
  3311. name = "Small: 1 story, 1 bedroom";
  3312. }
  3313. case INTERIOR_BURGRLARY_VERYLARGE:{
  3314. x = 225.630997;
  3315. y = 1022.479980;
  3316. z = 1084.069946;
  3317. interior = 7;
  3318. angle = 270.2654;
  3319. name = "VERY Large: 2 story, 4 bedrooms";
  3320. }
  3321. case INTERIOR_BURGRLARY_5:{
  3322. x = 295.138977;
  3323. y = 1474.469971;
  3324. z = 1080.519897;
  3325. interior = 15;
  3326. angle = 0;
  3327. name = "Small: 1 story, 2 bedrooms";
  3328. }
  3329. case INTERIOR_BURGRLARY_6:{
  3330. x = 328.493988;
  3331. y = 1480.589966;
  3332. z = 1084.449951;
  3333. interior = 15;
  3334. angle = 0;
  3335. name = "Small: 1 story, 2 bedrooms";
  3336. }
  3337. case INTERIOR_BURGRLARY_NOBATH:{
  3338. x = 385.803986;
  3339. y = 1471.769897;
  3340. z = 1080.209961;
  3341. interior = 15;
  3342. angle = 0;
  3343. name = "Small: 1 story, 1 bedroom (NO BATHROOM!)";
  3344. }
  3345. }
  3346. gotoCallback(x, y, z, world, interior, angle, name);
  3347. }
  3348. else{dialogGotoHouses(playerid);}
  3349. }
  3350. case DIALOG_GOTO_CASINO:{
  3351. if(response){
  3352. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[30 + 1];
  3353. world = GetPlayerVirtualWorld(playerid);
  3354. switch(listitem){
  3355. case INTERIOR_CASINO_CALIGULAS:{
  3356. x = 2233.8032;
  3357. y = 1712.2303;
  3358. z = 1011.7632;
  3359. interior = 1;
  3360. angle = 184.3891;
  3361. name = "Caligulas Casino";
  3362. }
  3363. case INTERIOR_CASINO_REDLAND:{
  3364. x = 1118.8878;
  3365. y = -10.2737;
  3366. z = 1002.0859;
  3367. interior = 12;
  3368. angle = 165.8482;
  3369. name = "Casino (Redsands West)";
  3370. }
  3371. case INTERIOR_CASINO_4DRAGONS:{
  3372. x = 2016.2699;
  3373. y = 1017.7790;
  3374. z = 996.8750;
  3375. interior = 10;
  3376. angle = 88.0055;
  3377. name = "4 Dragons Casino";
  3378. }
  3379. case INTERIOR_CASINO_4DRAGONSUITE:{
  3380. x = 2003.1178;
  3381. y = 1015.1948;
  3382. z = 33.008;
  3383. world = GetPlayerVirtualWorld(playerid);
  3384. interior = 11;
  3385. angle = 351.5789;
  3386. name = "Four Dragons' Managerial Suite";
  3387. }
  3388. }
  3389. gotoCallback(x, y, z, world, interior, angle, name);
  3390. }
  3391. else{dialogGotoInterior(playerid);}
  3392. }
  3393. case DIALOG_GOTO_MISSION:{
  3394. if(response){
  3395. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[30 + 1];
  3396. world = GetPlayerVirtualWorld(playerid);
  3397. switch(listitem){
  3398. case INTERIOR_MISSION_ATRIUM:{
  3399. x = 1726.18;
  3400. y = -1641.00;
  3401. z = 20.23;
  3402. interior = 18;
  3403. angle = 172.4193;
  3404. name = "Atrium";
  3405. }
  3406. case INTERIOR_MISSION_BIGSMOKE:{
  3407. x = 2567.52;
  3408. y = -1294.59;
  3409. z = 1063.25 ;
  3410. interior = 2;
  3411. angle = 254.9548;
  3412. name = "Big Smoke's Crack Palace";
  3413. }
  3414. case INTERIOR_MISSION_JEFFERSON:{
  3415. x = 2220.26;
  3416. y = -1148.01;
  3417. z = 1025.80;
  3418. interior = 15;
  3419. angle = 273.7328;
  3420. name = "Jefferson Motel";
  3421. }
  3422. case INTERIOR_MISSION_JIZZY:{
  3423. x = -2637.69;
  3424. y = 1404.24;
  3425. z = 906.46;
  3426. interior = 3;
  3427. angle = 94.6794;
  3428. name = "Pleasure Domes/Jizzy's";
  3429. }
  3430. case INTERIOR_MISSION_RC:{
  3431. x = -1079.99;
  3432. y = 1061.58;
  3433. z = 1343.04;
  3434. interior = 10;
  3435. angle = 274.5268;
  3436. name = "RC Battlefield";
  3437. }
  3438. case INTERIOR_MISSION_WUZI:{
  3439. x = -2158.72;
  3440. y = 641.29;
  3441. z = 1052.38;
  3442. interior = 1;
  3443. angle = 86.5402;
  3444. name = "Woozies Apartment/Wu-Zi Mu's";
  3445. }
  3446. }
  3447. gotoCallback(x, y, z, world, interior, angle, name);
  3448. }
  3449. else{dialogGotoInterior(playerid);}
  3450. }
  3451. case DIALOG_GOTO_MISSIONEXT:{
  3452. if(response){
  3453. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[30 + 1];
  3454. world = GetPlayerVirtualWorld(playerid);
  3455. switch(listitem){
  3456. case INTERIOR_MISSIONEXT_GAS:{
  3457. x = 664.19;
  3458. y = -570.73;
  3459. z = 16.34;
  3460. interior = 0;
  3461. angle = 264.9829;
  3462. name = "Dillimore Gas Station";
  3463. }
  3464. case INTERIOR_MISSIONEXT_LIBERTY:{ // TODO Create extra interior inside the shop
  3465. x = -750.80;
  3466. y = 491.00;
  3467. z = 1371.70;
  3468. interior = 1;
  3469. angle = 71.7782;
  3470. name = "Liberty City";
  3471. }
  3472. 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?)
  3473. x = -2042.42;
  3474. y = 178.59;
  3475. z = 28.84;
  3476. interior = 1;
  3477. angle = 156.2153;
  3478. name = "San Fierro Garage Interior";
  3479. }
  3480. }
  3481. gotoCallback(x, y, z, world, interior, angle, name);
  3482. }
  3483. else{dialogGotoInterior(playerid);}
  3484. }
  3485. case DIALOG_GOTO_MISSIONHOUSE:{
  3486. if(response){
  3487. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[30 + 1];
  3488. world = GetPlayerVirtualWorld(playerid);
  3489. switch(listitem){
  3490. case INTERIOR_MISSIONHOUSE_DESIRE:{
  3491. x = 2338.32;
  3492. y = -1180.61;
  3493. z = 1027.98;
  3494. interior = 5;
  3495. angle = 99.1864;
  3496. name = "Burning Desire House";
  3497. }
  3498. case INTERIOR_MISSIONHOUSE_COLONEL:{
  3499. x = 2807.63;
  3500. y = -1170.15;
  3501. z = 1025.57;
  3502. interior = 8;
  3503. angle = 193.7117;
  3504. name = "Colonel Furhberger's";
  3505. }
  3506. case INTERIOR_MISSIONHOUSE_RYDER:{
  3507. x = 2451.77;
  3508. y = -1699.80;
  3509. z = 1013.51;
  3510. interior = 2;
  3511. angle = 314.5253;
  3512. name = "Ryder's House";
  3513. }
  3514. case INTERIOR_MISSIONHOUSE_SWEET:{
  3515. x = 2535.83;
  3516. y = -1674.32;
  3517. z = 1015.50;
  3518. interior = 1;
  3519. angle = 260.9709;
  3520. name = "Sweet's House";
  3521. }
  3522. case INTERIOR_MISSIONHOUSE_CRACK:{
  3523. x = 318.565;
  3524. y = 1115.210;
  3525. z = 1082.98;
  3526. interior = 5;
  3527. angle = 267.459;
  3528. name = "Crack den";
  3529. }
  3530. }
  3531. gotoCallback(x, y, z, world, interior, angle, name);
  3532. }
  3533. else{dialogGotoHouses(playerid);}
  3534. }
  3535. case DIALOG_GOTO_MODDING:{
  3536. if(response){
  3537. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[25 + 1];
  3538. world = GetPlayerVirtualWorld(playerid);
  3539. switch(listitem){
  3540. case INTERIOR_MOD_LOCO:{
  3541. x = 616.7820;
  3542. y = -74.8151;
  3543. z = 997.6350;
  3544. interior = 2;
  3545. angle = 320.9263;
  3546. name = "Loco Low Co";
  3547. }
  3548. case INTERIOR_MOD_WHEEL:{
  3549. x = 615.2851;
  3550. y = -124.2390;
  3551. z = 997.6350;
  3552. interior = 3;
  3553. angle = 266.5704;
  3554. name = "Wheel Arch Angels";
  3555. }
  3556. case INTERIOR_MOD_TRANSFENDER:{
  3557. x = 617.5380;
  3558. y = -1.9900;
  3559. z = 1000.6829;
  3560. interior = 1;
  3561. angle = 15.6789;
  3562. name = "Transfender";
  3563. }
  3564. }
  3565. gotoCallback(x, y, z, world, interior, angle, name);
  3566. }
  3567. else{dialogGotoShops(playerid);}
  3568. }
  3569. case DIALOG_GOTO_POLICE:{
  3570. if(response){
  3571. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[30 + 1];
  3572. world = GetPlayerVirtualWorld(playerid);
  3573. switch(listitem){
  3574. case INTERIOR_PD_LV:{
  3575. x = 288.4723;
  3576. y = 170.0647;
  3577. z = 1007.1794;
  3578. interior = 3;
  3579. angle = 22.0477;
  3580. name = "Las Venturas police deparment";
  3581. }
  3582. case INTERIOR_PD_LS:{
  3583. x = 246.6695;
  3584. y = 65.8039;
  3585. z = 1003.6406;
  3586. interior = 6;
  3587. angle = 7.9562;
  3588. name = "Los Santos police deparment";
  3589. }
  3590. case INTERIOR_PD_SF:{
  3591. x = 246.0688;
  3592. y = 108.9703;
  3593. z = 1003.2188;
  3594. interior = 10;
  3595. angle = 0.2922;
  3596. name = "San Fierro police deparment";
  3597. }
  3598. case INTERIOR_PD_BARBARA:{
  3599. x = 322.5014;
  3600. y = 303.6906;
  3601. z = 999.1484;
  3602. interior = 5;
  3603. angle = 8.1747;
  3604. name = "Barbara's Love nest";
  3605. }
  3606. }
  3607. gotoCallback(x, y, z, world, interior, angle, name);
  3608. }
  3609. else{dialogGotoInterior(playerid);}
  3610. }
  3611. case DIALOG_GOTO_SAFEHOUSE:{
  3612. if(response){
  3613. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[25 + 1];
  3614. world = GetPlayerVirtualWorld(playerid);
  3615. switch(listitem){
  3616. case INTERIOR_HOUSE_GOLDEN:{
  3617. x = 2251.85;
  3618. y = -1138.16;
  3619. z = 1050.63;
  3620. interior = 9;
  3621. angle = 167.3959;
  3622. name = "Golden Bed motel room";
  3623. }
  3624. case INTERIOR_HOUSE_HASHBURY:{
  3625. x = 2260.76;
  3626. y = -1210.45;
  3627. z = 1049.02;
  3628. interior = 10;
  3629. angle = 266.88;
  3630. name = "Hashbury house";
  3631. }
  3632. case INTERIOR_HOUSE_JOHNSON:{
  3633. x = 2496.65;
  3634. y = -1696.55;
  3635. z = 1014.74;
  3636. interior = 3;
  3637. angle = 179.2174;
  3638. name = "The Johnson house";
  3639. }
  3640. case INTERIOR_HOUSE_MADDDOGG:{
  3641. x = 1299.14;
  3642. y = -794.77;
  3643. z = 1084.00;
  3644. interior = 5;
  3645. angle = 231.3418;
  3646. name = "Madd Doggs mansion";
  3647. }
  3648. case INTERIOR_HOUSE_RED:{
  3649. x = 2262.83;
  3650. y = -1137.71;
  3651. z = 1050.63;
  3652. interior = 10;
  3653. angle = 266.88;
  3654. name = "Red Bed motel room";
  3655. }
  3656. case INTERIOR_HOUSE_VERDANT:{
  3657. x = 2365.42;
  3658. y = -1131.85;
  3659. z = 1050.88;
  3660. interior = 8;
  3661. angle = 177.3947;
  3662. name = "Verdant Bluffs safehouse";
  3663. }
  3664. case INTERIOR_HOUSE_UNUSED:{
  3665. x = 2324.33;
  3666. y = -1144.79;
  3667. z = 1050.71;
  3668. interior = 12;
  3669. angle = 269.0954;
  3670. name = "Unused safe house";
  3671. }
  3672. }
  3673. gotoCallback(x, y, z, world, interior, angle, name);
  3674. }
  3675. else{dialogGotoHouses(playerid);}
  3676. }
  3677. case DIALOG_GOTO_SHOP:{
  3678. if(response){
  3679. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[30 + 1];
  3680. world = GetPlayerVirtualWorld(playerid);
  3681. switch(listitem){
  3682. case INTERIOR_SHOP_TATTOO:{
  3683. x = -203.0764;
  3684. y = -24.1658;
  3685. z = 1002.2734;
  3686. interior = 16;
  3687. angle = 252.8154;
  3688. name = "Tattoos";
  3689. }
  3690. case INTERIOR_SHOP_BURGER:{
  3691. x = 366.0248;
  3692. y = -73.3478;
  3693. z = 1001.5078;
  3694. interior = 10;
  3695. angle = 292.0084;
  3696. name = "Burger Shot";
  3697. }
  3698. case INTERIOR_SHOP_PIZZA:{
  3699. x = 372.3520;
  3700. y = -131.6510;
  3701. z = 1001.4922;
  3702. interior = 5;
  3703. angle = 354.2285;
  3704. name = "Well Stacked Pizza";
  3705. }
  3706. case INTERIOR_SHOP_CLUCKIN:{
  3707. x = 365.7158;
  3708. y = -9.8873;
  3709. z = 1001.8516;
  3710. interior = 9;
  3711. angle = 160.528;
  3712. name = "Cluckin' Bell";
  3713. }
  3714. case INTERIOR_SHOP_DONUTS:{
  3715. x = 376.99;
  3716. y = -191.21;
  3717. z = 1000.63;
  3718. interior = 17;
  3719. angle = 141.0245;
  3720. name = "Rusty Brown's donuts";
  3721. }
  3722. case INTERIOR_SHOP_RC:{
  3723. x = -2240.00;
  3724. y = 131.00;
  3725. z = 1035.40;
  3726. interior = 6;
  3727. angle = 269.0954;
  3728. name = "Zero's RC shop";
  3729. }
  3730. case INTERIOR_SHOP_PUMP:{
  3731. x = 681.66;
  3732. y = -453.32;
  3733. z = -25.61;
  3734. interior = 1;
  3735. angle = 166.166;
  3736. name = "The Welcome Pump";
  3737. }
  3738. case INTERIOR_SHOP_GYM:{
  3739. x = 770.8033;
  3740. y = -0.7033;
  3741. z = 1000.7267;
  3742. world = GetPlayerVirtualWorld(playerid);
  3743. interior = 5;
  3744. angle = 22.8599;
  3745. name = "Ganton Gym";
  3746. }
  3747. case INTERIOR_SHOP_BETTING:{
  3748. x = 830.6016;
  3749. y = 5.9404;
  3750. z = 1004.1797;
  3751. world = GetPlayerVirtualWorld(playerid);
  3752. interior = 3;
  3753. angle = 125.8149;
  3754. name = "Inside Track Betting";
  3755. }
  3756. case INTERIOR_SHOP_RECORDS:{
  3757. x = 1037.8276;
  3758. y = 0.397;
  3759. z = 1001.2845;
  3760. world = GetPlayerVirtualWorld(playerid);
  3761. interior = 3;
  3762. angle = 353.9335;
  3763. name = "Blastin' Fools Records";
  3764. }
  3765. }
  3766. gotoCallback(x, y, z, world, interior, angle, name);
  3767. }
  3768. else{dialogGotoShops(playerid);}
  3769. }
  3770. case DIALOG_GOTO_STADIA:{
  3771. if(response){
  3772. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[25 + 1];
  3773. world = GetPlayerVirtualWorld(playerid);
  3774. switch(listitem){
  3775. case INTERIOR_STADIUM_BLOODBOWL:{
  3776. x = -1394.20;
  3777. y = 987.62;
  3778. z = 1023.96;
  3779. interior = 15;
  3780. angle = 0.7013;
  3781. name = "Bloodbowl Stadium";
  3782. }
  3783. case INTERIOR_STADIUM_KICKSTART:{
  3784. x = -1410.72;
  3785. y = 1591.16;
  3786. z = 1052.53;
  3787. interior = 14;
  3788. angle = 159.1255;
  3789. name = "Kickstart Stadium";
  3790. }
  3791. case INTERIOR_STADIUM_8TRACK:{
  3792. x = -1395.958;
  3793. y = -208.197;
  3794. z = 1051.170;
  3795. interior = 7;
  3796. angle = 355.8576;
  3797. name = "8 Track Stadium";
  3798. }
  3799. case INTERIOR_STADIUM_DIRTBIKE:{
  3800. x = -1424.9319;
  3801. y = -664.5869;
  3802. z = 1059.8585;
  3803. interior = 4;
  3804. angle = 170.9341;
  3805. name = "Dirtbike Stadium";
  3806. }
  3807. }
  3808. gotoCallback(x, y, z, world, interior, angle, name);
  3809. }
  3810. else{dialogGotoInterior(playerid);}
  3811. }
  3812. case DIALOG_GOTO_SEXWORK:{
  3813. if(response){
  3814. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[31 + 1];
  3815. world = GetPlayerVirtualWorld(playerid);
  3816. switch(listitem){
  3817. case INTERIOR_SEXWORK_BROTHEL:{
  3818. x = 974.0177;
  3819. y = -9.5937;
  3820. z = 1001.1484;
  3821. world = GetPlayerVirtualWorld(playerid);
  3822. interior = 3;
  3823. angle = 22.6045;
  3824. name = "Brothel";
  3825. }
  3826. case INTERIOR_SEXWORK_BROTHEL2:{
  3827. x = 961.9308;
  3828. y = -51.9071;
  3829. z = 1001.1172;
  3830. world = GetPlayerVirtualWorld(playerid);
  3831. interior = 3;
  3832. angle = 95.5381;
  3833. name = "Brothel2";
  3834. }
  3835. case INTERIOR_SEXWORK_BIGSPREAD:{
  3836. x = 1212.1489;
  3837. y = -28.5388;
  3838. z = 1000.9531;
  3839. world = GetPlayerVirtualWorld(playerid);
  3840. interior = 3;
  3841. angle = 170.5692;
  3842. name = "The Big Spread Ranch";
  3843. }
  3844. }
  3845. gotoCallback(x, y, z, world, interior, angle, name);
  3846. }
  3847. else{dialogGotoInterior(playerid);}
  3848. }
  3849. /*case DIALOG_GOTO_UNCATAGORIZED:{
  3850. if(response){
  3851. new Float:x, Float:y, Float:z, world, interior, Float:angle, name[31 + 1];
  3852. world = GetPlayerVirtualWorld(playerid);
  3853. switch(listitem){
  3854. case INTERIOR_UNCATEGORIZED_WAREHOUSE1:{
  3855. x = 1290.4106;
  3856. y = 1.9512;
  3857. z = 1001.0201;
  3858. world = GetPlayerVirtualWorld(playerid);
  3859. interior = 18;
  3860. angle = 179.9419;
  3861. name =" Warehouse 1";
  3862. }
  3863. case INTERIOR_UNCATEGORIZED_WAREHOUSE2:{
  3864. x = 1412.1472;
  3865. y = -2.2836;
  3866. z = 1000.9241;
  3867. world = GetPlayerVirtualWorld(playerid);
  3868. interior = 1;
  3869. angle = 114.661;
  3870. name = "Warehouse 2";
  3871. }
  3872. case INTERIOR_UNCATEGORIZED_BDUPAPPARTMENT:{
  3873. x = 1527.0468;
  3874. y = -12.0236;
  3875. z = 1002.0971;
  3876. world = GetPlayerVirtualWorld(playerid);
  3877. interior = 3;
  3878. angle = 350.0013;
  3879. name = "B Dup's Apartment";
  3880. }
  3881. case INTERIOR_UNCATEGORIZED_PALACE:{
  3882. x = 1523.5098;
  3883. y = -47.8211;
  3884. z = 1002.2699;
  3885. world = GetPlayerVirtualWorld(playerid);
  3886. interior = 2;
  3887. angle = 262.7038;
  3888. name = "B Dup's Crack Palace";
  3889. }
  3890. case INTERIOR_UNCATEGORIZED_OGLOC:{
  3891. x = 512.9291;
  3892. y = -11.6929;
  3893. z = 1001.5653;
  3894. world = GetPlayerVirtualWorld(playerid);
  3895. interior = 3;
  3896. angle = 198.7669;
  3897. name = "OG Loc's House";
  3898. }
  3899. case INTERIOR_UNCATEGORIZED_:{
  3900. x = 418.4666;
  3901. y = -80.4595;
  3902. z = 1001.8047;
  3903. world = GetPlayerVirtualWorld(playerid);
  3904. interior = 3;
  3905. angle = 343.2358;
  3906. name = "Barber Shop";
  3907. }
  3908. case INTERIOR_UNCATEGORIZED_PLANDEPT:{
  3909. x = 386.5259;
  3910. y = 173.6381;
  3911. z = 1008.3828;
  3912. world = GetPlayerVirtualWorld(playerid);
  3913. interior = 3;
  3914. angle = 63.7399;
  3915. name = "Planning Department";
  3916. }
  3917. case INTERIOR_:{
  3918. x = 206.4627;
  3919. y = -137.7076;
  3920. z = 1003.0938;
  3921. world = GetPlayerVirtualWorld(playerid);
  3922. interior = 3;
  3923. angle = 10.9347;
  3924. name = "Pro-Laps";
  3925. }
  3926. case INTERIOR_SHOP_SEX:{
  3927. x = -100.2674;
  3928. y = -22.9376;
  3929. z = 1000.7188;
  3930. world = GetPlayerVirtualWorld(playerid);
  3931. interior = 3;
  3932. angle = 17.285;
  3933. name = "Sex Shop";
  3934. }
  3935. case INTERIOR_SHOP_LVTATTOO:{
  3936. x = -201.2236;
  3937. y = -43.2465;
  3938. z = 1002.2734;
  3939. world = GetPlayerVirtualWorld(playerid);
  3940. interior = 3;
  3941. angle = 45.8613;
  3942. name = "Las Venturas Tattoo parlor";
  3943. }
  3944. case INTERIOR_SHOP_SFTATTOO:{
  3945. x = -202.9381;
  3946. y = -6.7006;
  3947. z = 1002.2734;
  3948. world = GetPlayerVirtualWorld(playerid);
  3949. interior = 17;
  3950. angle = 204.2693;
  3951. name = "Lost San Fierro Tattoo parlor";
  3952. }
  3953. case INTERIOR_UNCATEGORIZED_DINER1:{
  3954. x = 454.9853;
  3955. y = -107.2548;
  3956. z = 999.4376;
  3957. world = GetPlayerVirtualWorld(playerid);
  3958. interior = 5;
  3959. angle = 309.0195;
  3960. name = "Diner 1";
  3961. }
  3962. case INTERIOR_:{
  3963. x = 372.5565;
  3964. y = -131.3607;
  3965. z = 1001.4922;
  3966. world = GetPlayerVirtualWorld(playerid);
  3967. interior = 5;
  3968. angle = 354.2285;
  3969. name = "Pizza Stack";
  3970. }
  3971. case INTERIOR_:{
  3972. x = 378.026;
  3973. y = -190.5155;
  3974. z = 1000.6328;
  3975. world = GetPlayerVirtualWorld(playerid);
  3976. interior = 17;
  3977. angle = 141.0245;
  3978. name = "Rusty Brown's Donuts";
  3979. }
  3980. case INTERIOR_SHOP_VICTIM:{
  3981. x = 225.0306;
  3982. y = -9.1838;
  3983. z = 1002.218;
  3984. world = GetPlayerVirtualWorld(playerid);
  3985. interior = 5;
  3986. angle = 85.5322;
  3987. name = "Victim";
  3988. }
  3989. case INTERIOR_SHOP_GYM:{
  3990. x = 773.7318;
  3991. y = -74.6957;
  3992. z = 1000.6542;
  3993. world = GetPlayerVirtualWorld(playerid);
  3994. interior = 7;
  3995. angle = 5.2304;
  3996. name = "Below The Belt Gym (Las Venturas)";
  3997. }
  3998. case INTERIOR_UNCATEGORIZED_COQ:{
  3999. x = 445.6003;
  4000. y = -6.9823;
  4001. z = 1000.7344;
  4002. world = GetPlayerVirtualWorld(playerid);
  4003. interior = 1;
  4004. angle = 172.2105;
  4005. name = "World of Coq";
  4006. }
  4007. case INTERIOR_SHOP_URBAN:{
  4008. x = 204.1174;
  4009. y = -46.8047;
  4010. z = 1001.8047;
  4011. world = GetPlayerVirtualWorld(playerid);
  4012. interior = 1;
  4013. angle = 357.5777;
  4014. name = "SubUrban";
  4015. }
  4016. case INTERIOR_GIRL_DENISE:{
  4017. x = 245.2307;
  4018. y = 304.7632;
  4019. z = 999.1484;
  4020. world = GetPlayerVirtualWorld(playerid);
  4021. interior = 1;
  4022. angle = 273.4364;
  4023. name = "Denise's Bedroom";
  4024. }
  4025. case INTERIOR_GIRL_HELENA:{
  4026. x = 290.623;
  4027. y = 309.0622;
  4028. z = 999.1484;
  4029. world = GetPlayerVirtualWorld(playerid);
  4030. interior = 3;
  4031. angle = 89.9164;
  4032. name = "Helena's Barn";
  4033. }
  4034. case INTERIOR_:{
  4035. x = -2041.2334;
  4036. y = 178.3969;
  4037. z = 28.8465;
  4038. world = GetPlayerVirtualWorld(playerid);
  4039. interior = 1;
  4040. angle = 156.2153;
  4041. name = "San Fierro Garage";
  4042. }
  4043. case INTERIOR_UNCATEGORIZED_STIPCLUB:{
  4044. x = 1204.6689;
  4045. y = -13.5429;
  4046. z = 1000.9219;
  4047. world = GetPlayerVirtualWorld(playerid);
  4048. interior = 2;
  4049. angle = 350.0204;
  4050. name = "The Pig Pen (strip club 2)";
  4051. }
  4052. case INTERIOR_:{
  4053. x = -741.8495;
  4054. y = 493.0036;
  4055. z = 1371.9766;
  4056. world = GetPlayerVirtualWorld(playerid);
  4057. interior = 1;
  4058. angle = 71.7782;
  4059. name = "Liberty City";
  4060. }
  4061. case INTERIOR_:{
  4062. x = 366.0248;
  4063. y = -73.3478;
  4064. z = 1001.5078;
  4065. world = GetPlayerVirtualWorld(playerid);
  4066. interior = 10;
  4067. angle = 292.0084;
  4068. name = "Burger shot";
  4069. }
  4070. case INTERIOR_GIRL_KATIE:{
  4071. x = 269.6405;
  4072. y = 305.9512;
  4073. z = 999.1484;
  4074. world = GetPlayerVirtualWorld(playerid);
  4075. interior = 2;
  4076. angle = 215.6625;
  4077. name = "Katie's Lovenest";
  4078. }
  4079. case INTERIOR_SHOP_BARBER2:{
  4080. x = 414.2987;
  4081. y = -18.8044;
  4082. z = 1001.8047;
  4083. world = GetPlayerVirtualWorld(playerid);
  4084. interior = 2;
  4085. angle = 41.4265;
  4086. name = "Barber Shop 2 (Reece's)";
  4087. }
  4088. case INTERIOR_:{
  4089. x = 1.1853;
  4090. y = -3.2387;
  4091. z = 999.4284;
  4092. world = GetPlayerVirtualWorld(playerid);
  4093. interior = 2;
  4094. angle = 87.5718;
  4095. name = "Angel Pine Trailer";
  4096. }
  4097. case INTERIOR_SHIP_ZIP:{
  4098. x = 161.4048;
  4099. y = -94.2416;
  4100. z = 1001.8047;
  4101. world = GetPlayerVirtualWorld(playerid);
  4102. interior = 18;
  4103. angle = 0.7938;
  4104. name = "Zip";
  4105. }
  4106. case INTERIOR_:{
  4107. x = 1267.8407;
  4108. y = -776.9587;
  4109. z = 1091.9063;
  4110. world = GetPlayerVirtualWorld(playerid);
  4111. interior = 5;
  4112. angle = 231.3418;
  4113. name = "Madd Dogg's Mansion";
  4114. }
  4115. case INTERIOR_:{
  4116. x = 2536.5322;
  4117. y = -1294.8425;
  4118. z = 1044.125;
  4119. world = GetPlayerVirtualWorld(playerid);
  4120. interior = 2;
  4121. angle = 254.9548;
  4122. name = "Big Smoke's Crack Palace";
  4123. }
  4124. case INTERIOR_:{
  4125. x = 2350.1597;
  4126. y = -1181.0658;
  4127. z = 1027.9766;
  4128. world = GetPlayerVirtualWorld(playerid);
  4129. interior = 5;
  4130. angle = 99.1864;
  4131. name = "Burning Desire Building";
  4132. }
  4133. case INTERIOR_:{
  4134. x = -2158.6731;
  4135. y = 642.09;
  4136. z = 1052.375;
  4137. world = GetPlayerVirtualWorld(playerid);
  4138. interior = 1;
  4139. angle = 86.5402;
  4140. name = "Wu-Zi Mu's";
  4141. }
  4142. case INTERIOR_:{
  4143. x = 419.8936;
  4144. y = 2537.1155;
  4145. z = 10;
  4146. world = GetPlayerVirtualWorld(playerid);
  4147. interior = 10;
  4148. angle = 67.6537;
  4149. name = "Abandoned AC tower";
  4150. }
  4151. case INTERIOR_:{
  4152. x = 256.9047;
  4153. y = -41.6537;
  4154. z = 1002.0234;
  4155. world = GetPlayerVirtualWorld(playerid);
  4156. interior = 14;
  4157. angle = 85.8774;
  4158. name = "Wardrobe/Changing room";
  4159. }
  4160. case INTERIOR_:{
  4161. x = 204.1658;
  4162. y = -165.7678;
  4163. z = 1000.5234;
  4164. world = GetPlayerVirtualWorld(playerid);
  4165. interior = 14;
  4166. angle = 181.7583;
  4167. name = "Didier Sachs";
  4168. }
  4169. case INTERIOR_:{
  4170. x = 493.1443;
  4171. y = -24.2607;
  4172. z = 1000.6797;
  4173. world = GetPlayerVirtualWorld(playerid);
  4174. interior = 17;
  4175. angle = 356.9864;
  4176. name = "Club";
  4177. }
  4178. case INTERIOR_:{
  4179. x = 1727.2853;
  4180. y = -1642.9451;
  4181. z = 20.2254;
  4182. world = GetPlayerVirtualWorld(playerid);
  4183. interior = 18;
  4184. angle = 172.4193;
  4185. name = "Atrium";
  4186. }
  4187. case INTERIOR_:{
  4188. x = -202.842;
  4189. y = -24.0325;
  4190. z = 1002.2734;
  4191. world = GetPlayerVirtualWorld(playerid);
  4192. interior = 16;
  4193. 252.8154;
  4194. name = "Los Santos Tattoo Parlor";
  4195. }
  4196. case INTERIOR_:{
  4197. x = 2233.6919;
  4198. y = -1112.8107;
  4199. z = 1050.8828;
  4200. world = GetPlayerVirtualWorld(playerid);
  4201. interior = 5;
  4202. angle = 8.6483;
  4203. name = "Safe House group 1";
  4204. }
  4205. case INTERIOR_:{
  4206. x = 1211.2484;
  4207. y = 1049.0234;
  4208. z = 359.941;
  4209. world = GetPlayerVirtualWorld(playerid);
  4210. interior = 6;
  4211. angle = 170.9341;
  4212. name = "Safe House group 2";
  4213. }
  4214. case INTERIOR_:{
  4215. x = 2319.1272;
  4216. y = -1023.9562;
  4217. z = 1050.2109;
  4218. world = GetPlayerVirtualWorld(playerid);
  4219. interior = 9;
  4220. angle = 167.3959;
  4221. name = "Safe House group 3";
  4222. }
  4223. case INTERIOR_:{
  4224. x = 2261.0977;
  4225. y = -1137.8833;
  4226. z = 1050.6328;
  4227. world = GetPlayerVirtualWorld(playerid);
  4228. interior = 10;
  4229. angle = 266.88;
  4230. name = "Safe House group 4";
  4231. }
  4232. case INTERIOR_:{
  4233. x = -944.2402;
  4234. y = 1886.1536;
  4235. z = 5.0051;
  4236. world = GetPlayerVirtualWorld(playerid);
  4237. interior = 17;
  4238. angle = 179.8548;
  4239. name = "Sherman Dam";
  4240. }
  4241. case INTERIOR_:{
  4242. x = 2217.281;
  4243. y = -1150.5349;
  4244. z = 1025.7969;
  4245. world = GetPlayerVirtualWorld(playerid);
  4246. interior = 15;
  4247. angle = 273.7328;
  4248. name = "Jefferson Motel";
  4249. }
  4250. case INTERIOR_:{
  4251. x = 234.6087;
  4252. y = 1187.8195;
  4253. z = 1080.2578;
  4254. world = GetPlayerVirtualWorld(playerid);
  4255. interior = 3;
  4256. angle = 349.4844;
  4257. name = "Burglary House X1";
  4258. }
  4259. case INTERIOR_:{
  4260. x = 225.5707;
  4261. y = 1240.0643;
  4262. z = 1082.1406;
  4263. world = GetPlayerVirtualWorld(playerid);
  4264. interior = 2;
  4265. angle = 96.2852;
  4266. name = "Burglary House X2";
  4267. }
  4268. case INTERIOR_:{
  4269. x = 224.288;
  4270. y = 1289.1907;
  4271. z = 1082.1406;
  4272. world = GetPlayerVirtualWorld(playerid);
  4273. interior = 1;
  4274. angle = 359.868;
  4275. name = "Burglary House X3";
  4276. }
  4277. case INTERIOR_:{
  4278. x = 239.2819;
  4279. y = 1114.1991;
  4280. z = 1080.9922;
  4281. world = GetPlayerVirtualWorld(playerid);
  4282. interior = 5;
  4283. angle = 270.2654;
  4284. name = "Burglary House X4";
  4285. }
  4286. case INTERIOR_SHOP_BINCO:{
  4287. x = 207.5219;
  4288. y = -109.7448;
  4289. z = 1005.1328;
  4290. world = GetPlayerVirtualWorld(playerid);
  4291. interior = 15;
  4292. angle = 358.62;
  4293. name = "Binco";
  4294. }
  4295. case INTERIOR_:{
  4296. x = 295.1391;
  4297. y = 1473.3719;
  4298. z = 1080.2578;
  4299. world = GetPlayerVirtualWorld(playerid);
  4300. interior = 15;
  4301. angle = 352.9526;
  4302. name = "4 Burglary houses";
  4303. }
  4304. case INTERIOR_:{
  4305. x = 446.3247;
  4306. y = 509.9662;
  4307. z = 1001.4195;
  4308. world = GetPlayerVirtualWorld(playerid);
  4309. interior = 12;
  4310. angle = 330.5671;
  4311. name = "Budget Inn Motel Room";
  4312. }
  4313. case INTERIOR_:{
  4314. x = 2306.3826;
  4315. y = -15.2365;
  4316. z = 26.7496;
  4317. world = GetPlayerVirtualWorld(playerid);
  4318. interior = 0;
  4319. angle = 274.49;
  4320. name = "Palamino Bank";
  4321. }
  4322. case INTERIOR_:{
  4323. x = 2331.8984;
  4324. y = 6.7816;
  4325. z = 26.5032;
  4326. world = GetPlayerVirtualWorld(playerid);
  4327. interior = 0;
  4328. angle = 100.2357;
  4329. name = "Palamino Diner";
  4330. }
  4331. case INTERIOR_:{
  4332. x = 663.0588;
  4333. y = -573.6274;
  4334. z = 16.3359;
  4335. world = GetPlayerVirtualWorld(playerid);
  4336. interior = 0;
  4337. angle = 264.9829;
  4338. name = "Dillimore Gas Station";
  4339. }
  4340. case INTERIOR_:{
  4341. x = -227.5703;
  4342. y = 1401.5544;
  4343. z = 27.7656;
  4344. world = GetPlayerVirtualWorld(playerid);
  4345. interior = 18;
  4346. angle = 269.2978;
  4347. name = "Lil' Probe Inn";
  4348. }
  4349. case INTERIOR_:{
  4350. x = -688.1496;
  4351. y = 942.0826;
  4352. z = 13.6328;
  4353. world = GetPlayerVirtualWorld(playerid);
  4354. interior = 0;
  4355. angle = 177.6574;
  4356. name = "Torreno's Ranch";
  4357. }
  4358. case INTERIOR_:{
  4359. x = -1916.1268;
  4360. y = 714.8617;
  4361. z = 46.5625;
  4362. world = GetPlayerVirtualWorld(playerid);
  4363. interior = 0;
  4364. angle = 152.2839;
  4365. name = "Zombotech - lobby area";
  4366. }
  4367. case INTERIOR_:{
  4368. x = 818.7714;
  4369. y = -1102.8689;
  4370. z = 25.794;
  4371. world = GetPlayerVirtualWorld(playerid);
  4372. interior = 0;
  4373. angle = 91.1439;
  4374. name = "Crypt in LS cemetery (temple)";
  4375. }
  4376. case INTERIOR_:{
  4377. x = 255.2083;
  4378. y = -59.6753;
  4379. z = 1.5703;
  4380. world = GetPlayerVirtualWorld(playerid);
  4381. interior = 0;
  4382. angle = 1.4645;
  4383. name = "Blueberry Liquor Store";
  4384. }
  4385. case INTERIOR_:{
  4386. x = 446.626;
  4387. y = 1397.738;
  4388. z = 1084.3047;
  4389. world = GetPlayerVirtualWorld(playerid);
  4390. interior = 2;
  4391. angle = 343.9647;
  4392. name = "Pair of Burglary Houses";
  4393. }
  4394. case INTERIOR_:{
  4395. x = 227.3922;
  4396. y = 1114.6572;
  4397. z = 1080.9985;
  4398. world = GetPlayerVirtualWorld(playerid);
  4399. interior = 5;
  4400. angle = 267.459;
  4401. name = "Crack Den";
  4402. }
  4403. case INTERIOR_:{
  4404. x = 227.7559;
  4405. y = 1114.3844;
  4406. z = 1080.9922;
  4407. world = GetPlayerVirtualWorld(playerid);
  4408. interior = 5;
  4409. angle = 266.2624;
  4410. name = "Burglary House X11";
  4411. }
  4412. case INTERIOR_:{
  4413. x = 261.1165;
  4414. y = 1287.2197;
  4415. world = GetPlayerVirtualWorld(playerid);
  4416. interior = 4;
  4417. z = 1080.2578;
  4418. angle = 178.9149;
  4419. name = "Burglary House X12";
  4420. }
  4421. case INTERIOR_:{
  4422. x = 449.0172;
  4423. y = -88.9894;
  4424. z = 999.5547;
  4425. world = GetPlayerVirtualWorld(playerid);
  4426. interior = 4;
  4427. angle = 89.6608;
  4428. name = "Jay's Diner";
  4429. }
  4430. case INTERIOR_GIRL_MICHELLE:{
  4431. x = 306.1966;
  4432. y = 307.819;
  4433. z = 1003.3047;
  4434. world = GetPlayerVirtualWorld(playerid);
  4435. interior = 4;
  4436. angle = 203.1354;
  4437. name = "Michelle's Love Nest*";
  4438. }
  4439. case INTERIOR_:{
  4440. x = 24.3769;
  4441. y = 1341.1829;
  4442. z = 1084.375;
  4443. world = GetPlayerVirtualWorld(playerid);
  4444. interior = 10;
  4445. angle = 8.3305;
  4446. name = "Burglary House X14";
  4447. }
  4448. case INTERIOR_:{
  4449. x = 963.0586;
  4450. y = 2159.7563;
  4451. z = 1011.0303;
  4452. world = GetPlayerVirtualWorld(playerid);
  4453. interior = 1;
  4454. angle = 175.313;
  4455. name = "Sindacco Abatoir";
  4456. }
  4457. case INTERIOR_:{
  4458. x = 2548.4807;
  4459. y = 2823.7429;
  4460. z = 10.8203;
  4461. world = GetPlayerVirtualWorld(playerid);
  4462. interior = 0;
  4463. angle = 270.6003;
  4464. name = "K.A.C.C. Military Fuels Depot";
  4465. }
  4466. case INTERIOR_:{
  4467. x = 215.1515;
  4468. y = 1874.0579;
  4469. z = 13.1406;
  4470. world = GetPlayerVirtualWorld(playerid);
  4471. interior = 0;
  4472. angle = 177.553;
  4473. name = "Area 69";
  4474. }
  4475. case INTERIOR_:{
  4476. x = 221.6766;
  4477. y = 1142.4962;
  4478. z = 1082.6094;
  4479. world = GetPlayerVirtualWorld(playerid);
  4480. interior = 4;
  4481. angle = 184.9618;
  4482. name = "Burglary House X13";
  4483. }
  4484. case INTERIOR_:{
  4485. x = 2323.7063;
  4486. y = -1147.6509;
  4487. z = 1050.7101;
  4488. world = GetPlayerVirtualWorld(playerid);
  4489. interior = 12;
  4490. angle = 206.5352;
  4491. name = "Unused Safe House";
  4492. }
  4493. case INTERIOR_GIRL_MILLIE:{
  4494. x = 344.9984;
  4495. y = 307.1824;
  4496. z = 999.1557;
  4497. world = GetPlayerVirtualWorld(playerid);
  4498. interior = 6;
  4499. angle = 193.643;
  4500. name = "Millie's Bedroom";
  4501. }
  4502. case INTERIOR_SHOP_BARBER:{
  4503. x = 411.9707;
  4504. y = -51.9217;
  4505. z = 1001.8984;
  4506. world = GetPlayerVirtualWorld(playerid);
  4507. interior = 12;
  4508. angle = 173.3449;
  4509. name = "Barber Shop";
  4510. }
  4511. case INTERIOR_:{
  4512. x = 773.8887;
  4513. y = -47.7698;
  4514. z = 1000.5859;
  4515. world = GetPlayerVirtualWorld(playerid);
  4516. interior = 6;
  4517. angle = 10.7161;
  4518. name = "Cobra Gym";
  4519. }
  4520. case INTERIOR_:{
  4521. x = -1864.9434;
  4522. y = 55.7325;
  4523. z = 1055.5276;
  4524. world = GetPlayerVirtualWorld(playerid);
  4525. interior = 14;
  4526. angle = 85.8541;
  4527. name = "Los Santos Airport";
  4528. }
  4529. case INTERIOR_:{
  4530. x = -262.1759;
  4531. y = 1456.6158;
  4532. z = 1084.3672;
  4533. world = GetPlayerVirtualWorld(playerid);
  4534. interior = 4;
  4535. angle = 82.459;
  4536. name = "Burglary House X15";
  4537. }
  4538. case INTERIOR_:{
  4539. x = 22.861;
  4540. y = 1404.9165;
  4541. z = 1084.4297;
  4542. world = GetPlayerVirtualWorld(playerid);
  4543. interior = 5;
  4544. angle = 349.6158;
  4545. name = "Burglary House X16";
  4546. }
  4547. case INTERIOR_:{
  4548. x = 140.3679;
  4549. y = 1367.8837;
  4550. z = 1083.8621;
  4551. world = GetPlayerVirtualWorld(playerid);
  4552. interior = 5;
  4553. angle = 349.2372;
  4554. name = "Burglary House X17";
  4555. }
  4556. case INTERIOR_:{
  4557. x = 1494.8589;
  4558. y = 1306.48;
  4559. z = 1093.2953;
  4560. world = GetPlayerVirtualWorld(playerid);
  4561. interior = 3;
  4562. angle = 196.065;
  4563. name = "Bike School";
  4564. }
  4565. case INTERIOR_:{
  4566. x = -1401.067;
  4567. y = 1265.3706;
  4568. z = 1039.8672;
  4569. world = GetPlayerVirtualWorld(playerid);
  4570. interior = 16;
  4571. angle = 178.6483;
  4572. name = "Vice Stadium";
  4573. }
  4574. case INTERIOR_:{
  4575. x = 234.2826;
  4576. y = 1065.229;
  4577. z = 1084.2101;
  4578. world = GetPlayerVirtualWorld(playerid);
  4579. interior = 6;
  4580. angle = 4.3864;
  4581. name = "Burglary House X18";
  4582. }
  4583. case INTERIOR_:{
  4584. x = -68.5145;
  4585. y = 1353.8485;
  4586. z = 1080.2109;
  4587. world = GetPlayerVirtualWorld(playerid);
  4588. interior = 6;
  4589. angle = 3.5742;
  4590. name = "Burglary House X19";
  4591. }
  4592. case INTERIOR_:{
  4593. x = -2240.1028;
  4594. y = 136.973;
  4595. z = 1035.4141;
  4596. world = GetPlayerVirtualWorld(playerid);
  4597. interior = 6;
  4598. angle = 269.0954;
  4599. name = "Zero's RC Shop";
  4600. }
  4601. case INTERIOR_:{
  4602. x = -285.2511;
  4603. y = 1471.197;
  4604. z = 1084.375;
  4605. world = GetPlayerVirtualWorld(playerid);
  4606. interior = 15;
  4607. angle = 85.6547;
  4608. name = "Burglary House X20";
  4609. }
  4610. case INTERIOR_:{
  4611. x = 442.1295;
  4612. y = -52.4782;
  4613. z = 999.7167;
  4614. world = GetPlayerVirtualWorld(playerid);
  4615. interior = 6;
  4616. angle = 177.9394;
  4617. name = "Secret Valley Diner";
  4618. }
  4619. case INTERIOR_:{
  4620. x = 2182.2017;
  4621. y = 1628.5848;
  4622. z = 1043.8723;
  4623. world = GetPlayerVirtualWorld(playerid);
  4624. interior = 2;
  4625. angle = 224.8601;
  4626. name = "Rosenberg's Office in Caligulas";
  4627. }
  4628. case INTERIOR_:{
  4629. x = 748.4623;
  4630. y = 1438.2378;
  4631. z = 1102.9531;
  4632. world = GetPlayerVirtualWorld(playerid);
  4633. interior = 6;
  4634. angle = 0.6069;
  4635. name = "Fanny Batter's Whore House";
  4636. }
  4637. case INTERIOR_:{
  4638. x = 2807.3604;
  4639. y = -1171.7048;
  4640. z = 1025.5703;
  4641. world = GetPlayerVirtualWorld(playerid);
  4642. interior = 8;
  4643. angle = 193.7117;
  4644. name = "Colonel Furhberger's";
  4645. }
  4646. case INTERIOR_:{
  4647. x = 366.0002;
  4648. y = -9.4338;
  4649. z = 1001.8516;
  4650. world = GetPlayerVirtualWorld(playerid);
  4651. interior = 9;
  4652. angle = 160.528;
  4653. name = "Cluckin' Bell";
  4654. }
  4655. case INTERIOR_:{
  4656. x = 2216.1282;
  4657. y = -1076.3052;
  4658. z = 1050.4844;
  4659. world = GetPlayerVirtualWorld(playerid);
  4660. interior = 1;
  4661. angle = 86.428;
  4662. name = "The Camel's Toe Safehouse";
  4663. }
  4664. case INTERIOR_:{
  4665. x = 2268.5156;
  4666. y = 1647.7682;
  4667. z = 1084.2344;
  4668. world = GetPlayerVirtualWorld(playerid);
  4669. interior = 1;
  4670. angle = 99.7331;
  4671. name = "Caligula's Roof";
  4672. }
  4673. case INTERIOR_:{
  4674. x = 2236.6997;
  4675. y = -1078.9478;
  4676. z = 1049.0234;
  4677. world = GetPlayerVirtualWorld(playerid);
  4678. interior = 2;
  4679. angle = 2.5706;
  4680. name = "Old Venturas Strip Casino";
  4681. }
  4682. case INTERIOR_:{
  4683. x = -2031.1196;
  4684. y = -115.8287;
  4685. z = 1035.1719;
  4686. world = GetPlayerVirtualWorld(playerid);
  4687. interior = 3;
  4688. angle = 190.1877;
  4689. name = "Driving School";
  4690. }
  4691. case INTERIOR_:{
  4692. x = 2365.1089;
  4693. y = -1133.0795;
  4694. z = 1050.875;
  4695. world = GetPlayerVirtualWorld(playerid);
  4696. interior = 8;
  4697. angle = 177.3947;
  4698. name = "Verdant Bluffs Safehouse";
  4699. }
  4700. case INTERIOR_:{
  4701. x = 1168.512;
  4702. y = 1360.1145;
  4703. z = 10.9293;
  4704. world = GetPlayerVirtualWorld(playerid);
  4705. interior = 0;
  4706. angle = 196.5933;
  4707. name = "Bike School";
  4708. }
  4709. case INTERIOR_:{
  4710. x = 1893.0731;
  4711. y = 1017.8958;
  4712. z = 31.8828;
  4713. world = GetPlayerVirtualWorld(playerid);
  4714. interior = 10;
  4715. angle = 86.1044;
  4716. name = "Four Dragons' Janitor's Office";
  4717. }
  4718. case INTERIOR_:{
  4719. x = 501.9578;
  4720. y = -70.5648;
  4721. z = 998.7578;
  4722. world = GetPlayerVirtualWorld(playerid);
  4723. interior = 11;
  4724. angle = 171.5706;
  4725. name = "Bar";
  4726. }
  4727. case INTERIOR_:{
  4728. x = -42.5267;
  4729. y = 1408.23;
  4730. z = 1084.4297;
  4731. world = GetPlayerVirtualWorld(playerid);
  4732. interior = 8;
  4733. angle = 172.068;
  4734. name = "Burglary House X21";
  4735. }
  4736. case INTERIOR_:{
  4737. x = 2283.3118;
  4738. y = 1139.307;
  4739. z = 1050.8984;
  4740. world = GetPlayerVirtualWorld(playerid);
  4741. interior = 11;
  4742. angle = 19.7032;
  4743. name = "Willowfield Safehouse";
  4744. }
  4745. case INTERIOR_:{
  4746. x = 84.9244;
  4747. y = 1324.2983;
  4748. z = 1083.8594;
  4749. world = GetPlayerVirtualWorld(playerid);
  4750. interior = 9;
  4751. angle = 159.5582;
  4752. name = "Burglary House X22";
  4753. }
  4754. case INTERIOR_:{
  4755. x = 260.7421;
  4756. y = 1238.2261;
  4757. z = 1084.2578;
  4758. world = GetPlayerVirtualWorld(playerid);
  4759. interior = 9;
  4760. angle = 84.3084;
  4761. name = "Burglary House X23";
  4762. }
  4763. case INTERIOR_:{
  4764. x = -1658.1656;
  4765. y = 1215.0002;
  4766. z = 7.25;
  4767. world = GetPlayerVirtualWorld(playerid);
  4768. interior = 0;
  4769. angle = 103.9074;
  4770. name = "Otto's Autos";
  4771. }
  4772. case INTERIOR_:{
  4773. x = -1961.6281;
  4774. y = 295.2378;
  4775. z = 35.4688;
  4776. world = GetPlayerVirtualWorld(playerid);
  4777. interior = 0;
  4778. angle = 264.4891;
  4779. name = "Wang Cars";
  4780. }
  4781. }
  4782. gotoCallback(x, y, z, world, interior, angle, name);
  4783. }
  4784. else{dialogGotoUncatagorized(playerid);}
  4785. }*/
  4786. case DIALOG_CREATE_PICKUP:{
  4787. if(response){
  4788. switch(listitem){
  4789. 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"); }
  4790. }
  4791. }
  4792. case DIALOG_CREATE_FACTION_PICKUP:{
  4793. if(response){
  4794. printf("Listitem: % i", listitem);
  4795. new Float:x, Float:y, Float:z;
  4796. GetPlayerPos(playerid, x, y, z);
  4797. new world = GetPlayerVirtualWorld(playerid);
  4798. new interior = GetPlayerInterior(playerid);
  4799. new pickupid = createDynamicPickup(1247, x, y, z, world, interior, listitem);
  4800. // Create pickup record
  4801. 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];
  4802. 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);
  4803. sql_query(sqlHandle, pickup_query);
  4804. // Get pickup record ID
  4805. new id_query[44 + 1];
  4806. format(id_query, sizeof(id_query), "SELECT id FROM pickup WHERE pickup_id = %i", pickupid);
  4807. new Result:id_result = sql_query(sqlHandle, id_query);
  4808. new pickup_id = sql_get_field_assoc_int(id_result, "id");
  4809. new admin_message[21 + 4 + MAX_PLAYER_NAME + MAX_SQL_INTEGER + 1];
  4810. // Inform admins
  4811. listitem++; // To account for FACTION_NONE
  4812. printf("Listitem: % i", listitem);
  4813. switch(listitem){
  4814. case FACTION_POLICE: format(admin_message, sizeof(admin_message), "* [%i] %s created police faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
  4815. case FACTION_MEDIC: format(admin_message, sizeof(admin_message), "* [%i] %s created medic faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
  4816. case FACTION_FIRE: format(admin_message, sizeof(admin_message), "* [%i] %s created firefighter faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
  4817. case FACTION_SHERIFF: format(admin_message, sizeof(admin_message), "* [%i] %s created shariff faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
  4818. case FACTION_FBI: format(admin_message, sizeof(admin_message), "* [%i] %s created FBI faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
  4819. case FACTION_DMV: format(admin_message, sizeof(admin_message), "* [%i] %s created DMV faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
  4820. case FACTION_NEWS: format(admin_message, sizeof(admin_message), "* [%i] %s created broadcasting faction pickup: %i", playerid, getPlayerName(playerid), pickup_id);
  4821. default: return 0;
  4822. }
  4823. sendToAdmins(COLOR_NOTICE, admin_message);
  4824. }
  4825. }
  4826. case DIALOG_DUTY_PD:{
  4827. if(response){
  4828. // TODO: Check if has passport
  4829. switch(GetGVarInt("job", playerid)){
  4830. case JOB_NONE:{ // Is citizen
  4831. // TODO: Check for crimes, warrents, etc
  4832. 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");
  4833. }
  4834. case JOB_POLICE:{ // Is on duty
  4835. setPlayerJob(playerid, JOB_NONE);
  4836. }
  4837. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
  4838. }
  4839. }
  4840. }
  4841. case DIALOG_POLICE_SKIN:{
  4842. if(response){
  4843. new skin;
  4844. switch(listitem){
  4845. case 0:{skin = 280;}
  4846. case 1:{skin = 281;}
  4847. case 2:{skin = 284;}
  4848. case 3:{skin = 300;}
  4849. case 4:{skin = 301;}
  4850. case 5:{skin = 306;}
  4851. case 6:{skin = 307;}
  4852. }
  4853. setPlayerJob(playerid, JOB_POLICE, skin, COLOR_POLICE);
  4854. }
  4855. }
  4856. case DIALOG_DUTY_MD:{
  4857. if(response){
  4858. // TODO: Check if has passport
  4859. switch(GetGVarInt("job", playerid)){
  4860. case JOB_NONE:{
  4861. // TODO: Check for crimes, warrents, etc
  4862. 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");
  4863. }
  4864. case JOB_MEDIC:{
  4865. setPlayerJob(playerid, JOB_NONE);
  4866. }
  4867. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
  4868. }
  4869. }
  4870. }
  4871. case DIALOG_MEDIC_SKIN:{
  4872. if(response){
  4873. new skin;
  4874. switch(listitem){
  4875. case 0:{skin = 274;}
  4876. case 1:{skin = 275;}
  4877. case 2:{skin = 276;}
  4878. case 3:{skin = 308;} // TODO find out why this is broken.
  4879. }
  4880. setPlayerJob(playerid, JOB_MEDIC, skin, COLOR_MEDIC);
  4881. }
  4882. }
  4883. case DIALOG_DUTY_FD:{
  4884. if(response){
  4885. // TODO: Check if has passport
  4886. switch(GetGVarInt("job", playerid)){
  4887. case JOB_NONE:{
  4888. // TODO: Check for crimes, warrents, etc
  4889. ShowPlayerDialog(playerid, DIALOG_FIRE_SKIN, DIALOG_STYLE_TABLIST, "Firefighter skins", "Los Santos green\tMale\nLas Venturas yellow\tMale\nSan Fierro black\tMale", "Duty", "Cancel");
  4890. }
  4891. case JOB_FIRE:{
  4892. setPlayerJob(playerid, JOB_NONE);
  4893. }
  4894. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
  4895. }
  4896. }
  4897. }
  4898. case DIALOG_FIRE_SKIN:{
  4899. if(response){
  4900. new skin;
  4901. switch(listitem){
  4902. case 0:{skin = 277;}
  4903. case 1:{skin = 278;}
  4904. case 2:{skin = 279;}
  4905. }
  4906. setPlayerJob(playerid, JOB_FIRE, skin, COLOR_FIRE);
  4907. }
  4908. }
  4909. case DIALOG_DUTY_SD:{
  4910. if(response){
  4911. // TODO: Check if has passport
  4912. switch(GetGVarInt("job", playerid)){
  4913. case JOB_NONE:{
  4914. // TODO: Check for crimes, warrents, etc
  4915. 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");
  4916. }
  4917. case JOB_SHERIFF:{
  4918. setPlayerJob(playerid, JOB_NONE);
  4919. }
  4920. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
  4921. }
  4922. }
  4923. }
  4924. case DIALOG_SHERIFF_SKIN:{
  4925. if(response){
  4926. new skin;
  4927. switch(listitem){
  4928. case 0:{skin = 282;}
  4929. case 1:{skin = 283;}
  4930. case 2:{skin = 288;}
  4931. case 3:{skin = 302;}
  4932. case 4:{skin = 309;}
  4933. case 5:{skin = 310;}
  4934. case 6:{skin = 311;}
  4935. }
  4936. setPlayerJob(playerid, JOB_SHERIFF, skin, COLOR_SHERIFF);
  4937. }
  4938. }
  4939. case DIALOG_DUTY_FBI:{
  4940. if(response){
  4941. // TODO: Check if has passport
  4942. switch(GetGVarInt("job", playerid)){
  4943. case JOB_NONE:{
  4944. // TODO: Check for crimes, warrents, etc
  4945. 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");
  4946. }
  4947. case JOB_FBI:{
  4948. setPlayerJob(playerid, JOB_NONE);
  4949. }
  4950. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
  4951. }
  4952. }
  4953. }
  4954. case DIALOG_FBI_SKIN:{
  4955. if(response){
  4956. new skin;
  4957. switch(listitem){
  4958. case 0:{skin = 165;}
  4959. case 1:{skin = 166;}
  4960. case 2:{skin = 258;}
  4961. case 3:{skin = 286;}
  4962. case 4:{skin = 163;}
  4963. case 5:{skin = 164;}
  4964. case 7:{skin = 141;}
  4965. case 8:{skin = 150;}
  4966. }
  4967. setPlayerJob(playerid, JOB_FBI, skin, COLOR_FBI);
  4968. }
  4969. }
  4970. case DIALOG_DUTY_DMV:{
  4971. if(response){
  4972. // TODO: Check if has passport
  4973. switch(GetGVarInt("job", playerid)){
  4974. case JOB_NONE:{
  4975. // TODO: Check for crimes, warrents, etc
  4976. ShowPlayerDialog(playerid, DIALOG_DMV_SKIN, DIALOG_STYLE_TABLIST, "DMV skins", "Airport ground worker\tMale\nSecurity guard\tMale", "Duty", "Cancel");
  4977. }
  4978. case JOB_DMV:{
  4979. setPlayerJob(playerid, JOB_NONE);
  4980. }
  4981. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
  4982. }
  4983. }
  4984. }
  4985. case DIALOG_DMV_SKIN:{
  4986. if(response){
  4987. new skin;
  4988. switch(listitem){
  4989. case 0:{skin = 16;}
  4990. case 1:{skin = 71;}
  4991. }
  4992. setPlayerJob(playerid, JOB_DMV, skin, COLOR_DMV);
  4993. }
  4994. }
  4995. case DIALOG_DUTY_NEWS:{
  4996. if(response){
  4997. // TODO: Check if has passport
  4998. switch(GetGVarInt("job", playerid)){
  4999. case JOB_NONE:{
  5000. // TODO: Check for crimes, warrents, etc
  5001. ShowPlayerDialog(playerid, DIALOG_DMV_SKIN, DIALOG_STYLE_TABLIST, "Network skins", "Hispanic businesswoman\nCaucasian Businesswoman\nBusinessman\nRich woman", "Duty", "Cancel");
  5002. }
  5003. case JOB_NEWS:{
  5004. setPlayerJob(playerid, JOB_NONE);
  5005. }
  5006. default:{SendClientMessage(playerid, COLOR_ERROR, "SERVER: You can not use this pickup as long as you are on another job.");}
  5007. }
  5008. }
  5009. }
  5010. case DIALOG_NEWS_SKIN:{
  5011. if(response){
  5012. new skin;
  5013. switch(listitem){
  5014. case 0:{skin = 148;}
  5015. case 1:{skin = 150;}
  5016. case 2:{skin = 187;}
  5017. case 3:{skin = 219;}
  5018. }
  5019. setPlayerJob(playerid, JOB_NEWS, skin, COLOR_NEWS);
  5020. }
  5021. }
  5022. }
  5023. return 0; // MUST return 0 here, just like OnPlayerCommandText.
  5024. }
  5025. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  5026. {
  5027. return 1;
  5028. }
  5029. public OnEnterExitModShop(playerid, enterexit, interiorid)
  5030. {
  5031. return 1;
  5032. }
  5033. public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
  5034. {
  5035. return 1;
  5036. }
  5037. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  5038. {
  5039. return 1;
  5040. }
  5041. // discord-connector events
  5042. public DCC_OnMessageCreate(DCC_Message:message){
  5043. // Originating Discord channel
  5044. new DCC_Channel:channel;
  5045. DCC_GetMessageChannel(message, channel);
  5046. // Originating Discord user
  5047. new DCC_User:author;
  5048. DCC_GetMessageAuthor(message, author);
  5049. // Message content
  5050. new str[128 + 1]; // Orignal was 256
  5051. new command[32 + 1], params[128 + 1];
  5052. DCC_GetMessageContent(message, str);
  5053. sscanf(str, "s[32]s[128]", command, params); // This string is to small some times, and throws an error BROKEN TODO
  5054. // Ignore bots
  5055. new bool:isBot;
  5056. DCC_IsUserBot(author, isBot);
  5057. if(isBot){
  5058. return 1;
  5059. }
  5060. if(!strcmp(command, "!players")){
  5061. new players_string[14 + (2 * MAX_PLAYERS) + (MAX_PLAYER_NAME * MAX_PLAYERS) + 1] = "Online players:";
  5062. for(new playerid, a = GetMaxPlayers(); playerid < a; playerid++){
  5063. if(IsPlayerConnected(playerid)){
  5064. format(players_string, sizeof(players_string), "%s %s,", players_string, getPlayerName(playerid));
  5065. }
  5066. }
  5067. strdel(players_string, strlen(players_string), strlen(players_string)); // Delete trailing comma
  5068. DiscordSendChannelMessage(channel, players_string);
  5069. print("Should be sending players");
  5070. }
  5071. else if(!strcmp(command, "!ip")){
  5072. DiscordSendChannelMessage(channel, "ecrp.h0v1n8.nl:6666");
  5073. }
  5074. else{
  5075. if(channel == echoChannel){
  5076. sendToChat(-1, CHAT_GLOBAL, str, 0, author);
  5077. }
  5078. }
  5079. /*// Beyond this point, don't respond to commands on foreign guilds.
  5080. if(guild != homeGuild){
  5081. return 1;
  5082. }*/
  5083. // Beyond this point, only respond to privilaged channels.
  5084. if(channel != adminEchoChannel && channel != adminChannel && channel != managementChannel){
  5085. return 1;
  5086. }
  5087. // Test command.
  5088. if(!strcmp(command, "!test", true)){
  5089. DiscordSendChannelMessage(channel, "Works.");
  5090. print("Some said !test in the echo channel.");
  5091. }
  5092. return 1;
  5093. }
  5094. // Entrypoint
  5095. main(){
  5096. // Credits
  5097. print("\n*----------------------------------*");
  5098. print(" RPFW by tBKwtWS.");
  5099. new message[21 + 20 + 1];
  5100. format(message, sizeof(message), " Role-play framework v%s", MODE_NAME);
  5101. print(message);
  5102. //printf("System load average: %f",loadavg()); // Linux only TODO: test
  5103. print("*----------------------------------*\n");
  5104. }