| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330 |
- #if defined _INC_WEAPON_CONFIG
- #endinput
- #endif
- #define _INC_WEAPON_CONFIG
- #include <a_samp>
- // Print debug messages in the chat and server log
- #if !defined WC_DEBUG
- #define WC_DEBUG false
- #endif
- // Print debug messages to the console but not the chat
- #if !defined WC_DEBUG_SILENT
- #define WC_DEBUG_SILENT false
- #endif
- // Max number of rejected hits (GetRejectedHit)
- #if !defined WC_MAX_REJECTED_HITS
- #define WC_MAX_REJECTED_HITS 15
- #endif
- // Max ranges for DAMAGE_TYPE_RANGE(_MULTIPLIER)
- #if !defined WC_MAX_DAMAGE_RANGES
- #define WC_MAX_DAMAGE_RANGES 5
- #endif
- // The world a player has after the death animation finished until he respawns or enters class selection
- #if !defined WC_DEATH_WORLD
- #define WC_DEATH_WORLD 0x00DEAD00
- #endif
- // The max number of entries in the damage feeds
- #if !defined WC_FEED_HEIGHT
- #define WC_FEED_HEIGHT 5
- #endif
- // Use Incognito's streamer for custom vending machines
- #if !defined WC_USE_STREAMER
- #define WC_USE_STREAMER false
- #endif
- // For SetWeaponName
- #if !defined WC_MAX_WEAPON_NAME
- #define WC_MAX_WEAPON_NAME 21
- #endif
- // For modes that always have negative cash
- #if !defined WC_CUSTOM_VENDING_MACHINES
- #define WC_CUSTOM_VENDING_MACHINES true
- #endif
- #if WC_USE_STREAMER && !defined Streamer_IncludeFileVersion
- #error streamer.inc is required when WC_USE_STREAMER=true
- #endif
- // https://github.com/oscar-broman/SKY/blob/master/SKY.inc
- #if !defined _INC_SKY
- #tryinclude <SKY>
- #if !defined _INC_SKY
- #error The SKY plugin is required, get it here: github.com/oscar-broman/sky
- #endif
- #endif
- // Given in OnInvalidWeaponDamage
- enum {
- WC_NO_ERROR,
- WC_NO_ISSUER,
- WC_NO_DAMAGED,
- WC_INVALID_DAMAGE,
- WC_INVALID_DISTANCE
- }
- // Used in SetWeaponDamage
- enum {
- DAMAGE_TYPE_MULTIPLIER,
- DAMAGE_TYPE_STATIC,
- DAMAGE_TYPE_RANGE_MULTIPLIER,
- DAMAGE_TYPE_RANGE
- }
- // Hits displayed in the damage feeds
- enum E_DAMAGE_FEED_HIT {
- e_Issuer,
- e_Name[MAX_PLAYER_NAME],
- Float:e_Amount,
- e_Weapon,
- e_Tick
- }
- // Given in OnRejectedHit
- enum E_REJECTED_HIT {
- e_Time,
- e_Hour,
- e_Minute,
- e_Second,
- e_Weapon,
- e_Reason,
- e_Info1,
- e_Info2,
- e_Info3,
- e_Name[MAX_PLAYER_NAME]
- }
- // e_Reason in E_REJECTED_HIT
- enum {
- HIT_NO_DAMAGEDID,
- HIT_INVALID_WEAPON,
- HIT_LAST_SHOT_INVALID,
- HIT_MULTIPLE_PLAYERS,
- HIT_MULTIPLE_PLAYERS_SHOTGUN,
- HIT_DYING_PLAYER,
- HIT_SAME_TEAM,
- HIT_UNSTREAMED,
- HIT_INVALID_HITTYPE,
- HIT_BEING_RESYNCED,
- HIT_NOT_SPAWNED,
- HIT_OUT_OF_RANGE,
- HIT_TOO_FAR_FROM_SHOT,
- SHOOTING_RATE_TOO_FAST,
- SHOOTING_RATE_TOO_FAST_MULTIPLE,
- HIT_RATE_TOO_FAST,
- HIT_RATE_TOO_FAST_MULTIPLE,
- HIT_KNIFE_FAILED,
- HIT_TOO_FAR_FROM_ORIGIN,
- HIT_INVALID_DAMAGE,
- HIT_SAME_VEHICLE,
- HIT_OWN_VEHICLE,
- HIT_INVALID_VEHICLE,
- HIT_DISCONNECTED
- }
- // Must be in sync with the enum above
- // Used in debug messages and GetRejectedHit
- stock const g_HitRejectReasons[][] = {
- "None or invalid player shot",
- "Invalid weapon",
- "Last shot invalid",
- "One bullet hit %d players",
- "Hit too many players with shotgun: %d",
- "Hit a dying player",
- "Hit a teammate",
- "Hit someone that can't see you (not streamed in)",
- "Invalid hit type: %d",
- "Hit while being resynced",
- "Hit when not spawned or dying",
- "Hit out of range (%f > %f)",
- "Hit player too far from hit position (dist %f)",
- "Shooting rate too fast: %d (%d samples, max %d)",
- "Shooting rate too fast: %d (%d samples, multiple weapons)",
- "Hit rate too fast: %d (%d samples, max %d)",
- "Hit rate too fast: %d (%d samples, multiple weapons)",
- "The knife kill did not sync",
- "Damage inflicted too far from current position (dist %f)",
- "Invalid weapon damage (%.4f)",
- "Hit a player in the same vehicle",
- "Hit the vehicle you're in",
- "Hit invalid vehicle: %d",
- "Hit a disconnected player ID: %d"
- };
- // Used for SetCustomVendingMachines
- #if WC_CUSTOM_VENDING_MACHINES
- enum E_VENDING_MACHINE {
- e_Model,
- e_Interior,
- Float:e_PosX,
- Float:e_PosY,
- Float:e_PosZ,
- Float:e_RotX,
- Float:e_RotY,
- Float:e_RotZ,
- Float:e_FrontX,
- Float:e_FrontY
- }
- #endif
- // Used to resync players that got team-knifed in lagshot mode
- enum E_RESYNC_DATA {
- Float:e_Health,
- Float:e_Armour,
- e_Skin,
- e_Team,
- Float:e_PosX,
- Float:e_PosY,
- Float:e_PosZ,
- Float:e_PosA,
- e_Weapon,
- e_WeaponId[13],
- e_WeaponAmmo[13]
- }
- // From OnPlayerWeaponShot
- enum E_SHOT_INFO {
- e_Tick,
- e_Weapon,
- e_HitType,
- e_HitId,
- e_Hits,
- Float:e_X,
- Float:e_Y,
- Float:e_Z,
- Float:e_OX,
- Float:e_OY,
- Float:e_OZ,
- Float:e_HX,
- Float:e_HY,
- Float:e_HZ,
- Float:e_Length,
- bool:e_Valid
- }
- enum E_HIT_INFO {
- e_Tick,
- e_Issuer,
- e_Weapon,
- Float:e_Amount,
- Float:e_Health,
- Float:e_Armour,
- e_Bodypart
- }
- enum E_SPAWN_INFO {
- e_Skin,
- e_Team,
- Float:e_PosX,
- Float:e_PosY,
- Float:e_PosZ,
- Float:e_Rot,
- e_Weapon1,
- e_Ammo1,
- e_Weapon2,
- e_Ammo2,
- e_Weapon3,
- e_Ammo3
- }
- // When a player takes or gives invalid damage (WC_* errors above)
- forward OnInvalidWeaponDamage(playerid, damagedid, Float:amount, weaponid, bodypart, error, bool:given);
- // Before damage is inflicted
- forward OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart);
- // After OnPlayerDamage
- forward OnPlayerDamageDone(playerid, Float:amount, issuerid, weapon, bodypart);
- // Before the death animation is applied
- forward OnPlayerPrepareDeath(playerid, animlib[32], animname[32], &anim_lock, &respawn_time);
- // When the death animation is finished and the player has been sent to respawn
- forward OnPlayerDeathFinished(playerid, bool:cancelable);
- // When a shot or damage given is rejected
- forward OnRejectedHit(playerid, hit[E_REJECTED_HIT]);
- #if WC_CUSTOM_VENDING_MACHINES
- // When a player is about to use a vending machine
- forward OnPlayerUseVendingMachine(playerid, &Float:health_given);
- #endif
- // If you have your own definitions, remove them and use these instead
- #define BODY_PART_UNKNOWN 0
- #define WEAPON_UNARMED 0
- #define WEAPON_VEHICLE_M4 19
- #define WEAPON_VEHICLE_MINIGUN 20
- #define WEAPON_PISTOLWHIP 48
- #define WEAPON_HELIBLADES 50
- #define WEAPON_EXPLOSION 51
- #define WEAPON_CARPARK 52
- #define WEAPON_UNKNOWN 55
- #if WC_DEBUG_SILENT
- static s_DebugMsgBuf[512];
- #define DebugMessage(%1,%2) \
- format(s_DebugMsgBuf,512,%2),printf("(wc:%d) %s",%1,s_DebugMsgBuf)
- #define DebugMessageRed(%1,%2) \
- format(s_DebugMsgBuf,512,%2),printf("(wc:%d) WARN: %s",%1,s_DebugMsgBuf)
- #define DebugMessageAll(%1) \
- printf(s_DebugMsgBuf,"(wc) " %1)
- #define DebugMessageRedAll(%1) \
- printf(s_DebugMsgBuf,"(wc) WARN: " %1)
- #elseif WC_DEBUG
- static s_DebugMsgBuf[512];
- #define DebugMessage(%1,%2) \
- format(s_DebugMsgBuf,512,"(wc) " %2),SendClientMessage(%1,-1,s_DebugMsgBuf), \
- format(s_DebugMsgBuf,512,%2),printf("(wc:%d) %s",%1,s_DebugMsgBuf)
- #define DebugMessageRed(%1,%2) \
- format(s_DebugMsgBuf,512,"(wc) " %2),SendClientMessage(%1,0xcc0000ff,s_DebugMsgBuf), \
- format(s_DebugMsgBuf,512,%2),printf("(wc:%d) WARN: %s",%1,s_DebugMsgBuf)
- #define DebugMessageAll(%1) \
- format(s_DebugMsgBuf,512,"(wc) " %1),SendClientMessageToAll(-1,s_DebugMsgBuf), \
- printf(s_DebugMsgBuf,"(wc) " %1)
- #define DebugMessageRedAll(%1) \
- format(s_DebugMsgBuf,512,"(wc) " %1),SendClientMessageToAll(0xcc0000ff,s_DebugMsgBuf), \
- printf(s_DebugMsgBuf,"(wc) WARN: " %1)
- #else
- #define DebugMessage(%1);
- #define DebugMessageRed(%1);
- #define DebugMessageAll(%1);
- #define DebugMessageRedAll(%1);
- #endif
- // Weapons allowed in OnPlayerGiveDamage
- static const s_ValidDamageGiven[] = {
- 1, // 0 - Fist
- 1, // 1 - Brass knuckles
- 1, // 2 - Golf club
- 1, // 3 - Nitestick
- 1, // 4 - Knife
- 1, // 5 - Bat
- 1, // 6 - Shovel
- 1, // 7 - Pool cue
- 1, // 8 - Katana
- 1, // 9 - Chainsaw
- 1, // 10 - Dildo
- 1, // 11 - Dildo 2
- 1, // 12 - Vibrator
- 1, // 13 - Vibrator 2
- 1, // 14 - Flowers
- 1, // 15 - Cane
- 0, // 16 - Grenade
- 0, // 17 - Teargas
- 0, // 18 - Molotov
- 0, // 19 - Vehicle M4 (custom)
- 0, // 20 - Vehicle minigun
- 0, // 21
- 1, // 22 - Colt 45
- 1, // 23 - Silenced
- 1, // 24 - Deagle
- 1, // 25 - Shotgun
- 1, // 26 - Sawed-off
- 1, // 27 - Spas
- 1, // 28 - UZI
- 1, // 29 - MP5
- 1, // 30 - AK47
- 1, // 31 - M4
- 1, // 32 - Tec9
- 1, // 33 - Cuntgun
- 1, // 34 - Sniper
- 0, // 35 - Rocket launcher
- 0, // 36 - Heatseeker
- 0, // 37 - Flamethrower
- 1, // 38 - Minigun
- 0, // 39 - Satchel
- 0, // 40 - Detonator
- 1, // 41 - Spraycan
- 1, // 42 - Fire extinguisher
- 0, // 43 - Camera
- 0, // 44 - Night vision
- 0, // 45 - Infrared
- 1 // 46 - Parachute
- };
- // Weapons allowed in OnPlayerTakeDamage
- // 2 = valid in both OnPlayerGiveDamage and OnPlayerTakeDamage
- static const s_ValidDamageTaken[] = {
- 1, // 0 - Fist
- 1, // 1 - Brass knuckles
- 1, // 2 - Golf club
- 1, // 3 - Nitestick
- 1, // 4 - Knife
- 1, // 5 - Bat
- 1, // 6 - Shovel
- 1, // 7 - Pool cue
- 1, // 8 - Katana
- 1, // 9 - Chainsaw
- 1, // 10 - Dildo
- 1, // 11 - Dildo 2
- 1, // 12 - Vibrator
- 1, // 13 - Vibrator 2
- 1, // 14 - Flowers
- 1, // 15 - Cane
- 0, // 16 - Grenade
- 0, // 17 - Teargas
- 0, // 18 - Molotov
- 0, // 19 - Vehicle M4 (custom)
- 0, // 20 - Vehicle minigun (custom)
- 0, // 21
- 1, // 22 - Colt 45
- 1, // 23 - Silenced
- 1, // 24 - Deagle
- 1, // 25 - Shotgun
- 1, // 26 - Sawed-off
- 1, // 27 - Spas
- 1, // 28 - UZI
- 1, // 29 - MP5
- 1, // 30 - AK47
- 1, // 31 - M4
- 1, // 32 - Tec9
- 1, // 33 - Cuntgun
- 1, // 34 - Sniper
- 0, // 35 - Rocket launcher
- 0, // 36 - Heatseeker
- 2, // 37 - Flamethrower
- 1, // 38 - Minigun
- 0, // 39 - Satchel
- 0, // 40 - Detonator
- 1, // 41 - Spraycan
- 1, // 42 - Fire extinguisher
- 0, // 43 - Camera
- 0, // 44 - Night vision
- 0, // 45 - Infrared
- 1, // 46 - Parachute
- 0, // 47 - Fake pistol
- 0, // 48 - Pistol whip (custom)
- 2, // 49 - Vehicle
- 2, // 50 - Helicopter blades
- 2, // 51 - Explosion
- 0, // 52 - Car park (custom)
- 2, // 53 - Drowning
- 2 // 54 - Splat
- };
- // Default weapon damage. Connected to s_DamageType.
- // Melee weapons are multipliers because the damage differs
- // depending on type of punch/kick and fight style.
- static Float:s_WeaponDamage[] = {
- 1.0, // 0 - Fist
- 1.0, // 1 - Brass knuckles
- 1.0, // 2 - Golf club
- 1.0, // 3 - Nitestick
- 1.0, // 4 - Knife
- 1.0, // 5 - Bat
- 1.0, // 6 - Shovel
- 1.0, // 7 - Pool cue
- 1.0, // 8 - Katana
- 1.0, // 9 - Chainsaw
- 1.0, // 10 - Dildo
- 1.0, // 11 - Dildo 2
- 1.0, // 12 - Vibrator
- 1.0, // 13 - Vibrator 2
- 1.0, // 14 - Flowers
- 1.0, // 15 - Cane
- 82.5, // 16 - Grenade
- 0.0, // 17 - Teargas
- 1.0, // 18 - Molotov
- 9.9, // 19 - Vehicle M4 (custom)
- 46.2, // 20 - Vehicle minigun (custom)
- 0.0, // 21
- 8.25, // 22 - Colt 45
- 13.2, // 23 - Silenced
- 46.2, // 24 - Deagle
- 3.3, // 25 - Shotgun
- 3.3, // 26 - Sawed-off
- 4.95, // 27 - Spas
- 6.6, // 28 - UZI
- 8.25, // 29 - MP5
- 9.9, // 30 - AK47
- 9.9, // 31 - M4
- 6.6, // 32 - Tec9
- 24.75, // 33 - Cuntgun
- 41.25, // 34 - Sniper
- 82.5, // 35 - Rocket launcher
- 82.5, // 36 - Heatseeker
- 1.0, // 37 - Flamethrower
- 46.2, // 38 - Minigun
- 82.5, // 39 - Satchel
- 0.0, // 40 - Detonator
- 0.33, // 41 - Spraycan
- 0.33, // 42 - Fire extinguisher
- 0.0, // 43 - Camera
- 0.0, // 44 - Night vision
- 0.0, // 45 - Infrared
- 0.0, // 46 - Parachute
- 0.0, // 47 - Fake pistol
- 2.64, // 48 - Pistol whip (custom)
- 9.9, // 49 - Vehicle
- 330.0, // 50 - Helicopter blades
- 82.5, // 51 - Explosion
- 1.0, // 52 - Car park (custom)
- 1.0, // 53 - Drowning
- 165.0 // 54 - Splat
- };
- #assert DAMAGE_TYPE_MULTIPLIER == 0
- #assert DAMAGE_TYPE_STATIC == 1
- // Whether the damage is multiplied by the given/taken value (0) or always the same value (1)
- static s_DamageType[] = {
- 0, // 0 - Fist
- 0, // 1 - Brass knuckles
- 0, // 2 - Golf club
- 0, // 3 - Nitestick
- 0, // 4 - Knife
- 0, // 5 - Bat
- 0, // 6 - Shovel
- 0, // 7 - Pool cue
- 0, // 8 - Katana
- 0, // 9 - Chainsaw
- 0, // 10 - Dildo
- 0, // 11 - Dildo 2
- 0, // 12 - Vibrator
- 0, // 13 - Vibrator 2
- 0, // 14 - Flowers
- 0, // 15 - Cane
- 0, // 16 - Grenade
- 1, // 17 - Teargas
- 0, // 18 - Molotov
- 1, // 19 - Vehicle M4 (custom)
- 1, // 20 - Vehicle minigun (custom)
- 0, // 21
- 1, // 22 - Colt 45
- 1, // 23 - Silenced
- 1, // 24 - Deagle
- 1, // 25 - Shotgun
- 1, // 26 - Sawed-off
- 1, // 27 - Spas
- 1, // 28 - UZI
- 1, // 29 - MP5
- 1, // 30 - AK47
- 1, // 31 - M4
- 1, // 32 - Tec9
- 1, // 33 - Cuntgun
- 1, // 34 - Sniper
- 0, // 35 - Rocket launcher
- 0, // 36 - Heatseeker
- 0, // 37 - Flamethrower
- 1, // 38 - Minigun
- 0, // 39 - Satchel
- 0, // 40 - Detonator
- 1, // 41 - Spraycan
- 1, // 42 - Fire extinguisher
- 0, // 43 - Camera
- 0, // 44 - Night vision
- 0, // 45 - Infrared
- 0, // 46 - Parachute
- 0, // 47 - Fake pistol
- 1, // 48 - Pistol whip (custom)
- 1, // 49 - Vehicle
- 1, // 50 - Helicopter blades
- 0, // 51 - Explosion
- 0, // 52 - Car park
- 0, // 53 - Drowning
- 0 // 54 - Splat
- };
- // The default weapon range (from weapon.dat)
- // Note that due to various bugs, these can be exceeded, but
- // this include blocks out-of-range values.
- static Float:s_WeaponRange[] = {
- 0.0, // 0 - Fist
- 0.0, // 1 - Brass knuckles
- 0.0, // 2 - Golf club
- 0.0, // 3 - Nitestick
- 0.0, // 4 - Knife
- 0.0, // 5 - Bat
- 0.0, // 6 - Shovel
- 0.0, // 7 - Pool cue
- 0.0, // 8 - Katana
- 0.0, // 9 - Chainsaw
- 0.0, // 10 - Dildo
- 0.0, // 11 - Dildo 2
- 0.0, // 12 - Vibrator
- 0.0, // 13 - Vibrator 2
- 0.0, // 14 - Flowers
- 0.0, // 15 - Cane
- 0.0, // 16 - Grenade
- 0.0, // 17 - Teargas
- 0.0, // 18 - Molotov
- 90.0, // 19 - Vehicle M4 (custom)
- 75.0, // 20 - Vehicle minigun (custom)
- 0.0, // 21
- 35.0, // 22 - Colt 45
- 35.0, // 23 - Silenced
- 35.0, // 24 - Deagle
- 40.0, // 25 - Shotgun
- 35.0, // 26 - Sawed-off
- 40.0, // 27 - Spas
- 35.0, // 28 - UZI
- 45.0, // 29 - MP5
- 70.0, // 30 - AK47
- 90.0, // 31 - M4
- 35.0, // 32 - Tec9
- 100.0, // 33 - Cuntgun
- 320.0, // 34 - Sniper
- 0.0, // 35 - Rocket launcher
- 0.0, // 36 - Heatseeker
- 0.0, // 37 - Flamethrower
- 75.0 // 38 - Minigun
- };
- // The fastest possible gap between weapon shots in milliseconds
- static s_MaxWeaponShootRate[] = {
- 250, // 0 - Fist
- 250, // 1 - Brass knuckles
- 250, // 2 - Golf club
- 250, // 3 - Nitestick
- 250, // 4 - Knife
- 250, // 5 - Bat
- 250, // 6 - Shovel
- 250, // 7 - Pool cue
- 250, // 8 - Katana
- 30, // 9 - Chainsaw
- 250, // 10 - Dildo
- 250, // 11 - Dildo 2
- 250, // 12 - Vibrator
- 250, // 13 - Vibrator 2
- 250, // 14 - Flowers
- 250, // 15 - Cane
- 0, // 16 - Grenade
- 0, // 17 - Teargas
- 0, // 18 - Molotov
- 20, // 19 - Vehicle M4 (custom)
- 20, // 20 - Vehicle minigun (custom)
- 0, // 21
- 160, // 22 - Colt 45
- 120, // 23 - Silenced
- 120, // 24 - Deagle
- 800, // 25 - Shotgun
- 120, // 26 - Sawed-off
- 120, // 27 - Spas
- 50, // 28 - UZI
- 90, // 29 - MP5
- 90, // 30 - AK47
- 90, // 31 - M4
- 70, // 32 - Tec9
- 800, // 33 - Cuntgun
- 900, // 34 - Sniper
- 0, // 35 - Rocket launcher
- 0, // 36 - Heatseeker
- 0, // 37 - Flamethrower
- 20, // 38 - Minigun
- 0, // 39 - Satchel
- 0, // 40 - Detonator
- 10, // 41 - Spraycan
- 10, // 42 - Fire extinguisher
- 0, // 43 - Camera
- 0, // 44 - Night vision
- 0, // 45 - Infrared
- 0, // 46 - Parachute
- 0, // 47 - Fake pistol
- 400 // 48 - Pistol whip (custom)
- };
- // Whether the damage is applied directly to health (1) or is distributed between health and armour (0), and whether this rule applies only to the torso (1) or not (0)
- static s_DamageArmour[][2] = {
- {0, 0}, // 0 - Fist
- {0, 0}, // 1 - Brass knuckles
- {0, 0}, // 2 - Golf club
- {0, 0}, // 3 - Nitestick
- {0, 0}, // 4 - Knife
- {0, 0}, // 5 - Bat
- {0, 0}, // 6 - Shovel
- {0, 0}, // 7 - Pool cue
- {0, 0}, // 8 - Katana
- {0, 0}, // 9 - Chainsaw
- {0, 0}, // 10 - Dildo
- {0, 0}, // 11 - Dildo 2
- {0, 0}, // 12 - Vibrator
- {0, 0}, // 13 - Vibrator 2
- {0, 0}, // 14 - Flowers
- {0, 0}, // 15 - Cane
- {0, 0}, // 16 - Grenade
- {0, 0}, // 17 - Teargas
- {0, 0}, // 18 - Molotov
- {1, 1}, // 19 - Vehicle M4 (custom)
- {1, 1}, // 20 - Vehicle minigun (custom)
- {1, 0}, // 21
- {1, 1}, // 22 - Colt 45
- {1, 1}, // 23 - Silenced
- {1, 1}, // 24 - Deagle
- {1, 1}, // 25 - Shotgun
- {1, 1}, // 26 - Sawed-off
- {1, 1}, // 27 - Spas
- {1, 1}, // 28 - UZI
- {1, 1}, // 29 - MP5
- {1, 1}, // 30 - AK47
- {1, 1}, // 31 - M4
- {1, 1}, // 32 - Tec9
- {1, 1}, // 33 - Cuntgun
- {1, 1}, // 34 - Sniper
- {0, 0}, // 35 - Rocket launcher
- {0, 0}, // 36 - Heatseeker
- {0, 0}, // 37 - Flamethrower
- {1, 1}, // 38 - Minigun
- {0, 0}, // 39 - Satchel
- {0, 0}, // 40 - Detonator
- {0, 0}, // 41 - Spraycan
- {0, 0}, // 42 - Fire extinguisher
- {1, 0}, // 43 - Camera
- {1, 0}, // 44 - Night vision
- {1, 0}, // 45 - Infrared
- {1, 0}, // 46 - Parachute
- {1, 0}, // 47 - Fake pistol
- {0, 0}, // 48 - Pistol whip (custom)
- {0, 0}, // 49 - Vehicle
- {0, 1}, // 50 - Helicopter blades
- {0, 0}, // 51 - Explosion
- {0, 0}, // 52 - Car park
- {0, 0}, // 53 - Drowning
- {0, 0} // 54 - Splat
- };
- // That's right, it's called cuntgun
- stock const g_WeaponName[57][WC_MAX_WEAPON_NAME] = {
- {"Fist" }, {"Brass knuckles"}, {"Golf club" },
- {"Nightstick" }, {"Knife" }, {"Bat" },
- {"Shovel" }, {"Pool cue" }, {"Katana" },
- {"Chainsaw" }, {"Purple dildo" }, {"Dildo" },
- {"Vibrator" }, {"Vibrator" }, {"Flowers" },
- {"Cane" }, {"Grenade" }, {"Tear gas" },
- {"Molotov" }, {"Vehicle gun" }, {"Vehicle gun" },
- {"" }, {"Colt 45" }, {"Silenced pistol" },
- {"Deagle" }, {"Shotgun" }, {"Sawn-off shotgun" },
- {"Combat shotgun" }, {"Mac-10" }, {"MP5" },
- {"AK-47" }, {"M4" }, {"Tec-9" },
- {"Cuntgun" }, {"Sniper" }, {"Rocket launcher" },
- {"Heat seeking RPG" }, {"Flamethrower" }, {"Minigun" },
- {"Satchel" }, {"Detonator" }, {"Spraycan" },
- {"Fire extinguisher"}, {"Camera" }, {"Night vision goggles"},
- {"Infrared goggles" }, {"Parachute" }, {"Fake pistol" },
- {"Pistol whip" }, {"Vehicle" }, {"Helicopter blades" },
- {"Explosion" }, {"Car parking" }, {"Drowning" },
- {"Collision" }, {"Splat" }, {"Unknown" }
- };
- // Yes - this is every single one of them
- #if WC_CUSTOM_VENDING_MACHINES
- static const Float:sc_VendingMachines[][E_VENDING_MACHINE] = {
- {955, 0, -862.82, 1536.60, 21.98, 0.00, 0.00, 180.00, -862.84, 1537.60},
- {956, 0, 2271.72, -76.46, 25.96, 0.00, 0.00, 0.00, 2271.72, -77.46},
- {955, 0, 1277.83, 372.51, 18.95, 0.00, 0.00, 64.00, 1278.73, 372.07},
- {956, 0, 662.42, -552.16, 15.71, 0.00, 0.00, 180.00, 662.41, -551.16},
- {955, 0, 201.01, -107.61, 0.89, 0.00, 0.00, 270.00, 200.01, -107.63},
- {955, 0, -253.74, 2597.95, 62.24, 0.00, 0.00, 90.00, -252.74, 2597.95},
- {956, 0, -253.74, 2599.75, 62.24, 0.00, 0.00, 90.00, -252.74, 2599.75},
- {956, 0, -76.03, 1227.99, 19.12, 0.00, 0.00, 90.00, -75.03, 1227.99},
- {955, 0, -14.70, 1175.35, 18.95, 0.00, 0.00, 180.00, -14.72, 1176.35},
- {1977, 7, 316.87, -140.35, 998.58, 0.00, 0.00, 270.00, 315.87, -140.36},
- {1775, 17, 373.82, -178.14, 1000.73, 0.00, 0.00, 0.00, 373.82, -179.14},
- {1776, 17, 379.03, -178.88, 1000.73, 0.00, 0.00, 270.00, 378.03, -178.90},
- {1775, 17, 495.96, -24.32, 1000.73, 0.00, 0.00, 180.00, 495.95, -23.32},
- {1776, 17, 500.56, -1.36, 1000.73, 0.00, 0.00, 0.00, 500.56, -2.36},
- {1775, 17, 501.82, -1.42, 1000.73, 0.00, 0.00, 0.00, 501.82, -2.42},
- {956, 0, -1455.11, 2591.66, 55.23, 0.00, 0.00, 180.00, -1455.13, 2592.66},
- {955, 0, 2352.17, -1357.15, 23.77, 0.00, 0.00, 90.00, 2353.17, -1357.15},
- {955, 0, 2325.97, -1645.13, 14.21, 0.00, 0.00, 0.00, 2325.97, -1646.13},
- {956, 0, 2139.51, -1161.48, 23.35, 0.00, 0.00, 87.00, 2140.51, -1161.53},
- {956, 0, 2153.23, -1016.14, 62.23, 0.00, 0.00, 127.00, 2154.03, -1015.54},
- {955, 0, 1928.73, -1772.44, 12.94, 0.00, 0.00, 90.00, 1929.73, -1772.44},
- {1776, 1, 2222.36, 1602.64, 1000.06, 0.00, 0.00, 90.00, 2223.36, 1602.64},
- {1775, 1, 2222.20, 1606.77, 1000.05, 0.00, 0.00, 90.00, 2223.20, 1606.77},
- {1775, 1, 2155.90, 1606.77, 1000.05, 0.00, 0.00, 90.00, 2156.90, 1606.77},
- {1775, 1, 2209.90, 1607.19, 1000.05, 0.00, 0.00, 270.00, 2208.90, 1607.17},
- {1776, 1, 2155.84, 1607.87, 1000.06, 0.00, 0.00, 90.00, 2156.84, 1607.87},
- {1776, 1, 2202.45, 1617.00, 1000.06, 0.00, 0.00, 180.00, 2202.43, 1618.00},
- {1776, 1, 2209.24, 1621.21, 1000.06, 0.00, 0.00, 0.00, 2209.24, 1620.21},
- {1776, 3, 330.67, 178.50, 1020.07, 0.00, 0.00, 0.00, 330.67, 177.50},
- {1776, 3, 331.92, 178.50, 1020.07, 0.00, 0.00, 0.00, 331.92, 177.50},
- {1776, 3, 350.90, 206.08, 1008.47, 0.00, 0.00, 90.00, 351.90, 206.08},
- {1776, 3, 361.56, 158.61, 1008.47, 0.00, 0.00, 180.00, 361.54, 159.61},
- {1776, 3, 371.59, 178.45, 1020.07, 0.00, 0.00, 0.00, 371.59, 177.45},
- {1776, 3, 374.89, 188.97, 1008.47, 0.00, 0.00, 0.00, 374.89, 187.97},
- {1775, 2, 2576.70, -1284.43, 1061.09, 0.00, 0.00, 270.00, 2575.70, -1284.44},
- {1775, 15, 2225.20, -1153.42, 1025.90, 0.00, 0.00, 270.00, 2224.20, -1153.43},
- {955, 0, 1154.72, -1460.89, 15.15, 0.00, 0.00, 270.00, 1153.72, -1460.90},
- {956, 0, 2480.85, -1959.27, 12.96, 0.00, 0.00, 180.00, 2480.84, -1958.27},
- {955, 0, 2060.11, -1897.64, 12.92, 0.00, 0.00, 0.00, 2060.11, -1898.64},
- {955, 0, 1729.78, -1943.04, 12.94, 0.00, 0.00, 0.00, 1729.78, -1944.04},
- {956, 0, 1634.10, -2237.53, 12.89, 0.00, 0.00, 0.00, 1634.10, -2238.53},
- {955, 0, 1789.21, -1369.26, 15.16, 0.00, 0.00, 270.00, 1788.21, -1369.28},
- {956, 0, -2229.18, 286.41, 34.70, 0.00, 0.00, 180.00, -2229.20, 287.41},
- {955, 256, -1980.78, 142.66, 27.07, 0.00, 0.00, 270.00, -1981.78, 142.64},
- {955, 256, -2118.96, -423.64, 34.72, 0.00, 0.00, 255.00, -2119.93, -423.40},
- {955, 256, -2118.61, -422.41, 34.72, 0.00, 0.00, 255.00, -2119.58, -422.17},
- {955, 256, -2097.27, -398.33, 34.72, 0.00, 0.00, 180.00, -2097.29, -397.33},
- {955, 256, -2092.08, -490.05, 34.72, 0.00, 0.00, 0.00, -2092.08, -491.05},
- {955, 256, -2063.27, -490.05, 34.72, 0.00, 0.00, 0.00, -2063.27, -491.05},
- {955, 256, -2005.64, -490.05, 34.72, 0.00, 0.00, 0.00, -2005.64, -491.05},
- {955, 256, -2034.46, -490.05, 34.72, 0.00, 0.00, 0.00, -2034.46, -491.05},
- {955, 256, -2068.56, -398.33, 34.72, 0.00, 0.00, 180.00, -2068.58, -397.33},
- {955, 256, -2039.85, -398.33, 34.72, 0.00, 0.00, 180.00, -2039.86, -397.33},
- {955, 256, -2011.14, -398.33, 34.72, 0.00, 0.00, 180.00, -2011.15, -397.33},
- {955, 2048, -1350.11, 492.28, 10.58, 0.00, 0.00, 90.00, -1349.11, 492.28},
- {956, 2048, -1350.11, 493.85, 10.58, 0.00, 0.00, 90.00, -1349.11, 493.85},
- {955, 0, 2319.99, 2532.85, 10.21, 0.00, 0.00, 0.00, 2319.99, 2531.85},
- {956, 0, 2845.72, 1295.04, 10.78, 0.00, 0.00, 0.00, 2845.72, 1294.04},
- {955, 0, 2503.14, 1243.69, 10.21, 0.00, 0.00, 180.00, 2503.12, 1244.69},
- {956, 0, 2647.69, 1129.66, 10.21, 0.00, 0.00, 0.00, 2647.69, 1128.66},
- {1209, 0, -2420.21, 984.57, 44.29, 0.00, 0.00, 90.00, -2419.21, 984.57},
- {1302, 0, -2420.17, 985.94, 44.29, 0.00, 0.00, 90.00, -2419.17, 985.94},
- {955, 0, 2085.77, 2071.35, 10.45, 0.00, 0.00, 90.00, 2086.77, 2071.35},
- {956, 0, 1398.84, 2222.60, 10.42, 0.00, 0.00, 180.00, 1398.82, 2223.60},
- {956, 0, 1659.46, 1722.85, 10.21, 0.00, 0.00, 0.00, 1659.46, 1721.85},
- {955, 0, 1520.14, 1055.26, 10.00, 0.00, 0.00, 270.00, 1519.14, 1055.24},
- {1775, 6, -19.03, -57.83, 1003.63, 0.00, 0.00, 180.00, -19.05, -56.83},
- {1775, 18, -16.11, -91.64, 1003.63, 0.00, 0.00, 180.00, -16.13, -90.64},
- {1775, 16, -15.10, -140.22, 1003.63, 0.00, 0.00, 180.00, -15.11, -139.22},
- {1775, 17, -32.44, -186.69, 1003.63, 0.00, 0.00, 180.00, -32.46, -185.69},
- {1775, 16, -35.72, -140.22, 1003.63, 0.00, 0.00, 180.00, -35.74, -139.22},
- {1776, 6, -36.14, -57.87, 1003.63, 0.00, 0.00, 180.00, -36.16, -56.87},
- {1776, 18, -17.54, -91.71, 1003.63, 0.00, 0.00, 180.00, -17.56, -90.71},
- {1776, 16, -16.53, -140.29, 1003.63, 0.00, 0.00, 180.00, -16.54, -139.29},
- {1776, 17, -33.87, -186.76, 1003.63, 0.00, 0.00, 180.00, -33.89, -185.76},
- {1775, 6, -19.03, -57.83, 1003.63, 0.00, 0.00, 180.00, -19.05, -56.83},
- {1776, 6, -36.14, -57.87, 1003.63, 0.00, 0.00, 180.00, -36.16, -56.87},
- {1775, 18, -16.11, -91.64, 1003.63, 0.00, 0.00, 180.00, -16.13, -90.64},
- {1776, 18, -17.54, -91.71, 1003.63, 0.00, 0.00, 180.00, -17.56, -90.71},
- {1776, 16, -16.53, -140.29, 1003.63, 0.00, 0.00, 180.00, -16.54, -139.29},
- {1775, 16, -15.10, -140.22, 1003.63, 0.00, 0.00, 180.00, -15.11, -139.22},
- {1776, 17, -33.87, -186.76, 1003.63, 0.00, 0.00, 180.00, -33.89, -185.76},
- {1775, 17, -32.44, -186.69, 1003.63, 0.00, 0.00, 180.00, -32.46, -185.69},
- {1775, 16, -35.72, -140.22, 1003.63, 0.00, 0.00, 180.00, -35.74, -139.22}
- };
- #endif
- // Sorry about the mess..
- static s_LagCompMode;
- static s_LastExplosive[MAX_PLAYERS];
- static s_LastShot[MAX_PLAYERS][E_SHOT_INFO];
- static s_LastShotTicks[MAX_PLAYERS][10];
- static s_LastShotWeapons[MAX_PLAYERS][10];
- static s_LastShotIdx[MAX_PLAYERS];
- static s_LastHitTicks[MAX_PLAYERS][10];
- static s_LastHitWeapons[MAX_PLAYERS][10];
- static s_LastHitIdx[MAX_PLAYERS];
- static s_ShotsFired[MAX_PLAYERS];
- static s_HitsIssued[MAX_PLAYERS];
- static s_MaxShootRateSamples = 5;
- static s_MaxHitRateSamples = 5;
- static Float:s_PlayerMaxHealth[MAX_PLAYERS] = {100.0, ...};
- static Float:s_PlayerHealth[MAX_PLAYERS] = {100.0, ...};
- static Float:s_PlayerMaxArmour[MAX_PLAYERS] = {100.0, ...};
- static Float:s_PlayerArmour[MAX_PLAYERS] = {0.0, ...};
- static s_LastSentHealth[MAX_PLAYERS];
- static s_LastSentArmour[MAX_PLAYERS];
- static bool:s_DamageArmourToggle[2] = {false, ...};
- static s_PlayerTeam[MAX_PLAYERS] = {NO_TEAM, ...};
- static s_IsDying[MAX_PLAYERS];
- static s_DeathTimer[MAX_PLAYERS] = {-1, ...};
- static bool:s_HealthBarVisible[MAX_PLAYERS];
- static bool:s_SpawnForStreamedIn[MAX_PLAYERS];
- static s_RespawnTime = 3000;
- static s_CustomFallDamage = false;
- static bool:s_CbugAllowed = true;
- static s_CbugFroze[MAX_PLAYERS];
- static s_DamageFeed = true;
- static s_DamageFeedPlayer[MAX_PLAYERS] = {-1, ...};
- static s_DamageFeedHideDelay = 3000;
- static s_DamageFeedMaxUpdateRate = 250;
- static s_VehiclePassengerDamage = false;
- static s_VehicleUnoccupiedDamage = false;
- static Float:s_FallDeathVelocity = -0.6;
- static s_DamageTakenSound = 1190;
- static s_DamageGivenSound = 17802;
- static s_RejectedHits[MAX_PLAYERS][WC_MAX_REJECTED_HITS][E_REJECTED_HIT];
- static s_RejectedHitsIdx[MAX_PLAYERS];
- static s_World[MAX_PLAYERS];
- static s_LastAnim[MAX_PLAYERS] = {-1, ...};
- static Float:s_LastZVelo[MAX_PLAYERS] = {0.0, ...};
- static Float:s_LastZ[MAX_PLAYERS] = {0.0, ...};
- static s_LastUpdate[MAX_PLAYERS] = {-1, ...};
- static PlayerText:s_DamageFeedTaken[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
- static PlayerText:s_DamageFeedGiven[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
- static s_DamageFeedHitsGiven[MAX_PLAYERS][WC_FEED_HEIGHT][E_DAMAGE_FEED_HIT];
- static s_DamageFeedHitsTaken[MAX_PLAYERS][WC_FEED_HEIGHT][E_DAMAGE_FEED_HIT];
- static s_DamageFeedTimer[MAX_PLAYERS] = {-1, ...};
- static s_DamageFeedLastUpdate[MAX_PLAYERS];
- static s_Spectating[MAX_PLAYERS] = {INVALID_PLAYER_ID, ...};
- static s_LastStop[MAX_PLAYERS];
- static bool:s_FirstSpawn[MAX_PLAYERS] = {true, ...};
- #if WC_CUSTOM_VENDING_MACHINES
- static bool:s_CustomVendingMachines = true;
- static s_VendingMachineObject[sizeof(sc_VendingMachines)] = {-1, ...};
- static s_VendingUseTimer[MAX_PLAYERS] = {-1, ...};
- #endif
- static s_BeingResynced[MAX_PLAYERS];
- static s_KnifeTimeout[MAX_PLAYERS] = {-1, ...};
- static s_SyncData[MAX_PLAYERS][E_RESYNC_DATA];
- static Text:s_HealthBarBorder = Text:INVALID_TEXT_DRAW;
- static Text:s_HealthBarBackground = Text:INVALID_TEXT_DRAW;
- static PlayerText:s_HealthBarForeground[MAX_PLAYERS] = {PlayerText:INVALID_TEXT_DRAW, ...};
- static s_DamageRangeSteps[55];
- static Float:s_DamageRangeRanges[55][WC_MAX_DAMAGE_RANGES];
- static Float:s_DamageRangeValues[55][WC_MAX_DAMAGE_RANGES];
- static s_LastVehicleShooter[MAX_VEHICLES + 1] = {INVALID_PLAYER_ID, ...};
- static bool:s_InternalTextDraw[Text:MAX_TEXT_DRAWS];
- static bool:s_InternalPlayerTextDraw[MAX_PLAYERS][PlayerText:MAX_PLAYER_TEXT_DRAWS];
- static s_LastVehicleEnterTime[MAX_PLAYERS];
- static s_TrueDeath[MAX_PLAYERS];
- static s_InClassSelection[MAX_PLAYERS];
- static s_ForceClassSelection[MAX_PLAYERS];
- static s_ClassSpawnInfo[320][E_SPAWN_INFO];
- static s_PlayerSpawnInfo[MAX_PLAYERS][E_SPAWN_INFO];
- static s_PlayerFallbackSpawnInfo[MAX_PLAYERS][E_SPAWN_INFO];
- static s_PlayerClass[MAX_PLAYERS] = {-2, ...};
- static bool:s_SpawnInfoModified[MAX_PLAYERS];
- static bool:s_AlreadyConnected[MAX_PLAYERS];
- static s_DeathSkip[MAX_PLAYERS];
- static s_DeathSkipTick[MAX_PLAYERS];
- static s_LastVehicleTick[MAX_PLAYERS];
- static s_PreviousHits[MAX_PLAYERS][10][E_HIT_INFO];
- static s_PreviousHitI[MAX_PLAYERS];
- static Float:s_DamageDoneHealth[MAX_PLAYERS];
- static Float:s_DamageDoneArmour[MAX_PLAYERS];
- static s_DelayedDeathTimer[MAX_PLAYERS] = {-1, ...};
- static bool:s_VehicleAlive[MAX_VEHICLES] = {false, ...};
- static s_VehicleRespawnTimer[MAX_VEHICLES] = {-1, ...};
- native WC_IsValidVehicle(vehicleid) = IsValidVehicle;
- /*
- * Public API
- */
- stock IsBulletWeapon(weaponid)
- {
- return (WEAPON_COLT45 <= weaponid <= WEAPON_SNIPER) || weaponid == WEAPON_MINIGUN;
- }
- stock IsHighRateWeapon(weaponid)
- {
- switch (weaponid) {
- case WEAPON_FLAMETHROWER, WEAPON_DROWN, WEAPON_CARPARK,
- WEAPON_SPRAYCAN, WEAPON_FIREEXTINGUISHER: {
- return true;
- }
- }
- return false;
- }
- stock IsMeleeWeapon(weaponid)
- {
- return (WEAPON_UNARMED <= weaponid <= WEAPON_KATANA) || (WEAPON_DILDO <= weaponid <= WEAPON_CANE) || weaponid == WEAPON_PISTOLWHIP;
- }
- stock IsPlayerSpawned(playerid)
- {
- if (s_IsDying[playerid] || s_BeingResynced[playerid]) {
- return false;
- }
- switch (GetPlayerState(playerid)) {
- case PLAYER_STATE_ONFOOT .. PLAYER_STATE_PASSENGER,
- PLAYER_STATE_SPAWNED: {
- return true;
- }
- }
- return false;
- }
- stock AverageShootRate(playerid, shots, &multiple_weapons = 0)
- {
- if (playerid == INVALID_PLAYER_ID || s_ShotsFired[playerid] < shots) {
- return -1;
- }
- new total = 0, idx = s_LastShotIdx[playerid];
- multiple_weapons = false;
- for (new i = shots - 2; i >= 0; i--) {
- new prev_idx = (idx - i - 1) % sizeof(s_LastShotTicks[]);
- // JIT plugin fix
- if (prev_idx < 0) {
- prev_idx += sizeof(s_LastShotTicks[]);
- }
- new prev = s_LastShotTicks[playerid][prev_idx];
- new prev_weap = s_LastShotWeapons[playerid][prev_idx];
- new this_idx = (idx - i) % sizeof(s_LastShotTicks[]);
- // JIT plugin fix
- if (this_idx < 0) {
- this_idx += sizeof(s_LastShotTicks[]);
- }
- if (prev_weap != s_LastShotWeapons[playerid][this_idx]) {
- multiple_weapons = true;
- }
- total += s_LastShotTicks[playerid][this_idx] - prev;
- }
- return total / (shots - 1);
- }
- stock AverageHitRate(playerid, hits, &multiple_weapons = 0)
- {
- if (playerid == INVALID_PLAYER_ID || s_HitsIssued[playerid] < hits) {
- return -1;
- }
- new total = 0, idx = s_LastHitIdx[playerid];
- multiple_weapons = false;
- for (new i = hits - 2; i >= 0; i--) {
- new prev_idx = (idx - i - 1) % sizeof(s_LastHitTicks[]);
- // JIT plugin fix
- if (prev_idx < 0) {
- prev_idx += sizeof(s_LastHitTicks[]);
- }
- new prev = s_LastHitTicks[playerid][prev_idx];
- new prev_weap = s_LastHitWeapons[playerid][prev_idx];
- new this_idx = (idx - i) % sizeof(s_LastHitTicks[]);
- // JIT plugin fix
- if (this_idx < 0) {
- this_idx += sizeof(s_LastHitTicks[]);
- }
- if (prev_weap != s_LastHitWeapons[playerid][this_idx]) {
- multiple_weapons = true;
- }
- total += s_LastHitTicks[playerid][this_idx] - prev;
- }
- return total / (hits - 1);
- }
- stock SetRespawnTime(ms)
- {
- s_RespawnTime = max(0, ms);
- }
- stock GetRespawnTime()
- {
- return s_RespawnTime;
- }
- stock ReturnWeaponName(weaponid)
- {
- new name[sizeof(g_WeaponName[])];
- WC_GetWeaponName(weaponid, name);
- return name;
- }
- stock SetWeaponDamage(weaponid, damage_type, Float:amount, Float:...)
- {
- if (weaponid < 0 || weaponid >= sizeof(s_WeaponDamage)) {
- return 0;
- }
- if (damage_type == DAMAGE_TYPE_RANGE || damage_type == DAMAGE_TYPE_RANGE_MULTIPLIER) {
- if (!IsBulletWeapon(weaponid)) {
- return 0;
- }
- new args = numargs();
- if (!(args & 0b1)) {
- return 0;
- }
- new steps = (args - 1) / 2;
- s_DamageType[weaponid] = damage_type;
- s_DamageRangeSteps[weaponid] = steps;
- for (new i = 0; i < steps; i++) {
- if (i) {
- s_DamageRangeRanges[weaponid][i] = Float:getarg(1 + i*2);
- s_DamageRangeValues[weaponid][i] = Float:getarg(2 + i*2);
- } else {
- s_DamageRangeValues[weaponid][i] = amount;
- }
- }
- return 1;
- } else if (damage_type == DAMAGE_TYPE_MULTIPLIER || damage_type == DAMAGE_TYPE_STATIC) {
- s_DamageType[weaponid] = damage_type;
- s_DamageRangeSteps[weaponid] = 0;
- s_WeaponDamage[weaponid] = amount;
- return 1;
- }
- return 0;
- }
- stock SetCustomArmourRules(bool:armour_rules, bool:torso_rules = false)
- {
- s_DamageArmourToggle[0] = armour_rules;
- s_DamageArmourToggle[1] = torso_rules;
- }
- stock SetWeaponArmourRule(weaponid, bool:affects_armour, bool:torso_only = false)
- {
- if (weaponid < 0 || weaponid >= sizeof(s_WeaponDamage)) {
- return 0;
- }
- s_DamageArmour[weaponid][0] = affects_armour;
- s_DamageArmour[weaponid][1] = torso_only;
- return 1;
- }
- stock SetDamageSounds(taken, given)
- {
- s_DamageTakenSound = taken;
- s_DamageGivenSound = given;
- }
- stock SetCbugAllowed(bool:enabled)
- {
- s_CbugAllowed = enabled;
- }
- stock bool:GetCbugAllowed()
- {
- return s_CbugAllowed;
- }
- stock SetCustomFallDamage(bool:toggle, Float:damage_multiplier = 25.0, Float:death_velocity = -0.6)
- {
- s_CustomFallDamage = toggle;
- if (toggle) {
- s_WeaponDamage[WEAPON_COLLISION] = damage_multiplier;
- s_FallDeathVelocity = -floatabs(death_velocity);
- }
- }
- #if WC_CUSTOM_VENDING_MACHINES
- stock SetCustomVendingMachines(bool:toggle)
- {
- s_CustomVendingMachines = toggle;
- if (toggle) {
- CreateVendingMachines();
- } else {
- DestroyVendingMachines();
- }
- }
- #endif
- stock SetVehiclePassengerDamage(bool:toggle)
- {
- s_VehiclePassengerDamage = toggle;
- }
- stock SetVehicleUnoccupiedDamage(bool:toggle)
- {
- s_VehicleUnoccupiedDamage = toggle;
- }
- stock SetDamageFeedForPlayer(playerid, toggle = -1)
- {
- if (IsPlayerConnected(playerid))
- {
- s_DamageFeedPlayer[playerid] = toggle;
- DamageFeedUpdate(playerid);
- return 1;
- }
- return 0;
- }
- stock IsDamageFeedActive(playerid = -1)
- {
- if (playerid != -1) {
- return s_DamageFeedPlayer[playerid] == 1 || s_DamageFeed && s_DamageFeedPlayer[playerid] != 0;
- }
- return s_DamageFeed;
- }
- stock SetDamageFeed(bool:toggle)
- {
- s_DamageFeed = toggle;
- for (new i = 0; i < MAX_PLAYERS; i++) {
- if (IsPlayerConnected(i)) {
- DamageFeedUpdate(i);
- }
- }
- }
- stock SetWeaponShootRate(weaponid, max_rate)
- {
- if (0 <= weaponid < sizeof(s_MaxWeaponShootRate)) {
- s_MaxWeaponShootRate[weaponid] = max_rate;
- return 1;
- }
- return 0;
- }
- stock IsPlayerDying(playerid)
- {
- if (0 <= playerid < MAX_PLAYERS) {
- return s_IsDying[playerid];
- }
- return false;
- }
- stock SetWeaponMaxRange(weaponid, Float:range)
- {
- if (!IsBulletWeapon(weaponid)) {
- return 0;
- }
- s_WeaponRange[weaponid] = range;
- return 1;
- }
- stock SetPlayerMaxHealth(playerid, Float:value)
- {
- if (0 <= playerid < MAX_PLAYERS) {
- s_PlayerMaxHealth[playerid] = value;
- }
- }
- stock SetPlayerMaxArmour(playerid, Float:value)
- {
- if (0 <= playerid < MAX_PLAYERS) {
- s_PlayerMaxArmour[playerid] = value;
- }
- }
- stock Float:GetPlayerMaxHealth(playerid)
- {
- if (0 <= playerid < MAX_PLAYERS) {
- return s_PlayerMaxHealth[playerid];
- }
- return 0.0;
- }
- stock Float:GetPlayerMaxArmour(playerid)
- {
- if (0 <= playerid < MAX_PLAYERS) {
- return s_PlayerMaxArmour[playerid];
- }
- return 0.0;
- }
- stock Float:GetLastDamageHealth(playerid)
- {
- if (0 <= playerid < MAX_PLAYERS) {
- return s_DamageDoneHealth[playerid];
- }
- return 0.0;
- }
- stock Float:GetLastDamageArmour(playerid)
- {
- if (0 <= playerid < MAX_PLAYERS) {
- return s_DamageDoneArmour[playerid];
- }
- return 0.0;
- }
- stock DamagePlayer(playerid, Float:amount, issuerid = INVALID_PLAYER_ID, weaponid = WEAPON_UNKNOWN, bodypart = BODY_PART_UNKNOWN, bool:ignore_armour = false)
- {
- if (playerid < 0 || playerid > MAX_PLAYERS || !IsPlayerConnected(playerid)) {
- return 0;
- }
- if (amount < 0.0) {
- return 0;
- }
- if (weaponid < 0 || weaponid > 55) {
- weaponid = WEAPON_UNKNOWN;
- }
- if (issuerid < 0 || issuerid > MAX_PLAYERS || !IsPlayerConnected(issuerid)) {
- issuerid = INVALID_PLAYER_ID;
- }
- InflictDamage(playerid, amount, issuerid, weaponid, bodypart, ignore_armour);
- return 1;
- }
- stock GetRejectedHit(playerid, idx, output[], maxlength = sizeof(output))
- {
- if (idx >= WC_MAX_REJECTED_HITS) {
- return 0;
- }
- new real_idx = (s_RejectedHitsIdx[playerid] - idx) % WC_MAX_REJECTED_HITS;
- // JIT plugin fix
- if (real_idx < 0) {
- real_idx += WC_MAX_REJECTED_HITS;
- }
- if (!s_RejectedHits[playerid][real_idx][e_Time]) {
- return 0;
- }
- new reason = s_RejectedHits[playerid][real_idx][e_Reason];
- new hour = s_RejectedHits[playerid][real_idx][e_Hour];
- new minute = s_RejectedHits[playerid][real_idx][e_Minute];
- new second = s_RejectedHits[playerid][real_idx][e_Second];
- new i1 = s_RejectedHits[playerid][real_idx][e_Info1];
- new i2 = s_RejectedHits[playerid][real_idx][e_Info2];
- new i3 = s_RejectedHits[playerid][real_idx][e_Info3];
- new weapon = s_RejectedHits[playerid][real_idx][e_Weapon];
- new weapon_name[32];
- WC_GetWeaponName(weapon, weapon_name);
- format(output, maxlength, "[%02d:%02d:%02d] (%s -> %s) %s", hour, minute, second, weapon_name, s_RejectedHits[playerid][real_idx][e_Name], g_HitRejectReasons[reason]);
- format(output, maxlength, output, i1, i2, i3);
- return 1;
- }
- stock ResyncPlayer(playerid)
- {
- SaveSyncData(playerid);
- s_BeingResynced[playerid] = true;
- SpawnPlayerInPlace(playerid);
- }
- /*
- * Hooked natives
- */
- stock WC_SpawnPlayer(playerid)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS || s_IsDying[playerid]) {
- return 0;
- }
- if (s_PlayerHealth[playerid] == 0.0) {
- s_PlayerHealth[playerid] = s_PlayerMaxHealth[playerid];
- }
- SpawnPlayer(playerid);
- return 1;
- }
- stock WC_GetPlayerState(playerid)
- {
- if (s_IsDying[playerid]) {
- return PLAYER_STATE_WASTED;
- }
- return GetPlayerState(playerid);
- }
- stock Float:WC_GetPlayerHealth(playerid, &Float:health = 0.0)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) {
- health = 0.0;
- return 0.0;
- }
- health = s_PlayerHealth[playerid];
- return health;
- }
- stock WC_SetPlayerHealth(playerid, Float:health, Float:armour = -1.0)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) {
- return 0;
- }
- if (health <= 0.0) {
- s_PlayerArmour[playerid] = 0.0;
- s_PlayerHealth[playerid] = 0.0;
- InflictDamage(playerid, 0.0);
- } else {
- if (armour != -1.0) {
- if (armour > s_PlayerMaxArmour[playerid]) {
- armour = s_PlayerMaxArmour[playerid];
- }
- s_PlayerArmour[playerid] = armour;
- }
- if (health > s_PlayerMaxHealth[playerid]) {
- health = s_PlayerMaxHealth[playerid];
- }
- s_PlayerHealth[playerid] = health;
- UpdateHealthBar(playerid, true);
- }
- return 1;
- }
- stock Float:WC_GetPlayerArmour(playerid, &Float:armour = 0.0)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) {
- armour = 0.0;
- return 0.0;
- }
- armour = s_PlayerArmour[playerid];
- return armour;
- }
- stock WC_SetPlayerArmour(playerid, Float:armour)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) {
- return 0;
- }
- if (armour > s_PlayerMaxArmour[playerid]) {
- armour = s_PlayerMaxArmour[playerid];
- }
- s_PlayerArmour[playerid] = armour;
- UpdateHealthBar(playerid, true);
- return 1;
- }
- stock WC_GetPlayerTeam(playerid)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) {
- return NO_TEAM;
- }
- if (!IsPlayerConnected(playerid)) {
- return NO_TEAM;
- }
- return s_PlayerTeam[playerid];
- }
- stock WC_SetPlayerTeam(playerid, team)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) {
- return 0;
- }
- s_PlayerTeam[playerid] = team;
- return 1;
- }
- stock WC_SendDeathMessage(killer, killee, weapon)
- {
- if (weapon == WEAPON_CARPARK) {
- weapon = WEAPON_VEHICLE;
- } else if (weapon == WEAPON_PISTOLWHIP) {
- weapon = WEAPON_UNARMED;
- } else if (weapon == WEAPON_UNKNOWN) {
- weapon = WEAPON_DROWN;
- } else if (weapon == WEAPON_VEHICLE_M4) {
- weapon = WEAPON_M4;
- } if (weapon == WEAPON_VEHICLE_MINIGUN) {
- weapon = WEAPON_MINIGUN;
- }
- SendDeathMessage(killer, killee, weapon);
- return 1;
- }
- stock SetWeaponName(weaponid, const name[])
- {
- if (weaponid < 0 || weaponid >= sizeof(g_WeaponName)) {
- return 0;
- }
- strunpack(g_WeaponName[weaponid], name, sizeof(g_WeaponName[]));
- return 1;
- }
- stock WC_GetWeaponName(weaponid, weapon[], len = sizeof(weapon))
- {
- if (weaponid < 0 || weaponid >= sizeof(g_WeaponName)) {
- format(weapon, len, "Weapon %d", weaponid);
- } else {
- strunpack(weapon, g_WeaponName[weaponid], len);
- }
- return 1;
- }
- stock WC_ApplyAnimation(playerid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time, forcesync = 0)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS || s_IsDying[playerid]) {
- return 0;
- }
- return ApplyAnimation(playerid, animlib, animname, fDelta, loop, lockx, locky, freeze, time, forcesync);
- }
- stock WC_ClearAnimations(playerid, forcesync = 1)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS || s_IsDying[playerid]) {
- return 0;
- }
- s_LastStop[playerid] = GetTickCount();
- return ClearAnimations(playerid, forcesync);
- }
- stock WC_AddPlayerClass(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
- {
- new classid = AddPlayerClass(modelid, spawn_x, spawn_y, spawn_z, z_angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
- s_ClassSpawnInfo[classid][e_Skin] = modelid;
- s_ClassSpawnInfo[classid][e_Team] = 0x7FFFFFFF;
- s_ClassSpawnInfo[classid][e_PosX] = spawn_x;
- s_ClassSpawnInfo[classid][e_PosY] = spawn_y;
- s_ClassSpawnInfo[classid][e_PosZ] = spawn_z;
- s_ClassSpawnInfo[classid][e_Rot] = z_angle;
- s_ClassSpawnInfo[classid][e_Weapon1] = weapon1;
- s_ClassSpawnInfo[classid][e_Ammo1] = weapon1_ammo;
- s_ClassSpawnInfo[classid][e_Weapon2] = weapon2;
- s_ClassSpawnInfo[classid][e_Ammo2] = weapon2_ammo;
- s_ClassSpawnInfo[classid][e_Weapon3] = weapon3;
- s_ClassSpawnInfo[classid][e_Ammo3] = weapon3_ammo;
- return classid;
- }
- stock WC_AddPlayerClassEx(teamid, modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
- {
- new classid = AddPlayerClassEx(teamid, modelid, spawn_x, spawn_y, spawn_z, z_angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
- s_ClassSpawnInfo[classid][e_Skin] = modelid;
- s_ClassSpawnInfo[classid][e_Team] = teamid;
- s_ClassSpawnInfo[classid][e_PosX] = spawn_x;
- s_ClassSpawnInfo[classid][e_PosY] = spawn_y;
- s_ClassSpawnInfo[classid][e_PosZ] = spawn_z;
- s_ClassSpawnInfo[classid][e_Rot] = z_angle;
- s_ClassSpawnInfo[classid][e_Weapon1] = weapon1;
- s_ClassSpawnInfo[classid][e_Ammo1] = weapon1_ammo;
- s_ClassSpawnInfo[classid][e_Weapon2] = weapon2;
- s_ClassSpawnInfo[classid][e_Ammo2] = weapon2_ammo;
- s_ClassSpawnInfo[classid][e_Weapon3] = weapon3;
- s_ClassSpawnInfo[classid][e_Ammo3] = weapon3_ammo;
- return classid;
- }
- stock WC_SetSpawnInfo(playerid, team, skin, Float:x, Float:y, Float:z, Float:rotation, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
- {
- s_PlayerClass[playerid] = -1;
- s_SpawnInfoModified[playerid] = false;
- s_PlayerSpawnInfo[playerid][e_Skin] = skin;
- s_PlayerSpawnInfo[playerid][e_Team] = team;
- s_PlayerSpawnInfo[playerid][e_PosX] = x;
- s_PlayerSpawnInfo[playerid][e_PosY] = y;
- s_PlayerSpawnInfo[playerid][e_PosZ] = z;
- s_PlayerSpawnInfo[playerid][e_Rot] = rotation;
- s_PlayerSpawnInfo[playerid][e_Weapon1] = weapon1;
- s_PlayerSpawnInfo[playerid][e_Ammo1] = weapon1_ammo;
- s_PlayerSpawnInfo[playerid][e_Weapon2] = weapon2;
- s_PlayerSpawnInfo[playerid][e_Ammo2] = weapon2_ammo;
- s_PlayerSpawnInfo[playerid][e_Weapon3] = weapon3;
- s_PlayerSpawnInfo[playerid][e_Ammo3] = weapon3_ammo;
- return SetSpawnInfo(playerid, team, skin, x, y, z, rotation, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
- }
- stock WC_TogglePlayerSpectating(playerid, toggle)
- {
- if (toggle) {
- if (s_DeathTimer[playerid] != -1) {
- KillTimer(s_DeathTimer[playerid]);
- s_DeathTimer[playerid] = -1;
- }
- #if WC_CUSTOM_VENDING_MACHINES
- if (s_VendingUseTimer[playerid] != -1) {
- KillTimer(s_VendingUseTimer[playerid]);
- s_VendingUseTimer[playerid] = -1;
- }
- #endif
- s_IsDying[playerid] = false;
- }
- return TogglePlayerSpectating(playerid, toggle);
- }
- stock WC_TogglePlayerControllable(playerid, toggle)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS || s_IsDying[playerid]) {
- return 0;
- }
- s_LastStop[playerid] = GetTickCount();
- return TogglePlayerControllable(playerid, toggle);
- }
- stock WC_SetPlayerPos(playerid, Float:x, Float:y, Float:z)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS || s_IsDying[playerid]) {
- return 0;
- }
- s_LastStop[playerid] = GetTickCount();
- return SetPlayerPos(playerid, x, y, z);
- }
- stock WC_SetPlayerPosFindZ(playerid, Float:x, Float:y, Float:z)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS || s_IsDying[playerid]) {
- return 0;
- }
- s_LastStop[playerid] = GetTickCount();
- return SetPlayerPosFindZ(playerid, x, y, z);
- }
- stock WC_SetPlayerVelocity(playerid, Float:X, Float:Y, Float:Z)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS || s_IsDying[playerid]) {
- return 0;
- }
- if (X == 0.0 && Y == 0.0 && Z == 0.0) {
- s_LastStop[playerid] = GetTickCount();
- }
- return SetPlayerVelocity(playerid, X, Y, Z);
- }
- stock wc_SetPlayerVirtualWorld(playerid, worldid)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) {
- return 0;
- }
- s_World[playerid] = worldid;
- if (s_IsDying[playerid]) {
- return 1;
- }
- return SetPlayerVirtualWorld(playerid, worldid);
- }
- stock WC_GetPlayerVirtualWorld(playerid)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) {
- return 0;
- }
- new worldid = GetPlayerVirtualWorld(playerid);
- if (worldid == WC_DEATH_WORLD) {
- return s_World[playerid];
- }
- return worldid;
- }
- stock WC_PlayerSpectatePlayer(playerid, targetplayerid, mode = SPECTATE_MODE_NORMAL)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS || targetplayerid < 0 || targetplayerid >= MAX_PLAYERS) {
- return 0;
- }
- s_Spectating[playerid] = targetplayerid;
- return PlayerSpectatePlayer(playerid, targetplayerid, mode);
- }
- stock WC_DestroyVehicle(vehicleid)
- {
- if (0 < vehicleid < MAX_VEHICLES) {
- s_LastVehicleShooter[vehicleid] = INVALID_PLAYER_ID;
- s_VehicleAlive[vehicleid] = false;
- if (s_VehicleRespawnTimer[vehicleid] != -1) {
- KillTimer(s_VehicleRespawnTimer[vehicleid]);
- s_VehicleRespawnTimer[vehicleid] = -1;
- }
- }
- return DestroyVehicle(vehicleid);
- }
- stock WC_CreateVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay, addsiren = 0)
- {
- new id = CreateVehicle(modelid, x, y, z, angle, color1, color2, respawn_delay, addsiren);
- if (id != INVALID_VEHICLE_ID) {
- s_VehicleAlive[id] = true;
- return id;
- }
- return INVALID_VEHICLE_ID;
- }
- stock WC_AddStaticVehicle(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2)
- {
- new id = AddStaticVehicle(modelid, x, y, z, angle, color1, color2);
- if (id != INVALID_VEHICLE_ID) {
- s_VehicleAlive[id] = true;
- return id;
- }
- return INVALID_VEHICLE_ID;
- }
- stock WC_AddStaticVehicleEx(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay, addsiren = 0)
- {
- new id = AddStaticVehicleEx(modelid, x, y, z, angle, color1, color2, respawn_delay, addsiren);
- if (id != INVALID_VEHICLE_ID) {
- s_VehicleAlive[id] = true;
- return id;
- }
- return INVALID_VEHICLE_ID;
- }
- stock WC_IsPlayerInCheckpoint(playerid)
- {
- if (!IsPlayerSpawned(playerid)) {
- return 0;
- }
- return IsPlayerInCheckpoint(playerid);
- }
- stock WC_SetPlayerSpecialAction(playerid, actionid)
- {
- if (!IsPlayerSpawned(playerid)) {
- return 0;
- }
- return SetPlayerSpecialAction(playerid, actionid);
- }
- stock Text:WC_TextDrawCreate(Float:x, Float:y, text[])
- {
- new Text:td = TextDrawCreate(x, y, text);
- if (td != Text:INVALID_TEXT_DRAW) {
- s_InternalTextDraw[td] = false;
- }
- return td;
- }
- stock WC_TextDrawDestroy(Text:text)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawDestroy(text);
- }
- stock WC_TextDrawLetterSize(Text:text, Float:x, Float:y)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawLetterSize(text, x, y);
- }
- stock WC_TextDrawTextSize(Text:text, Float:x, Float:y)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawTextSize(text, x, y);
- }
- stock WC_TextDrawAlignment(Text:text, alignment)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawAlignment(text, alignment);
- }
- stock WC_TextDrawColor(Text:text, color)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawColor(text, color);
- }
- stock WC_TextDrawUseBox(Text:text, use)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawUseBox(text, use);
- }
- stock WC_TextDrawBoxColor(Text:text, color)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawBoxColor(text, color);
- }
- stock WC_TextDrawSetShadow(Text:text, size)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawSetShadow(text, size);
- }
- stock WC_TextDrawSetOutline(Text:text, size)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawSetOutline(text, size);
- }
- stock WC_TextDrawBackgroundColor(Text:text, color)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawBackgroundColor(text, color);
- }
- stock WC_TextDrawFont(Text:text, font)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawFont(text, font);
- }
- stock WC_TextDrawSetProportional(Text:text, set)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawSetProportional(text, set);
- }
- stock WC_TextDrawSetSelectable(Text:text, set)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawSetSelectable(text, set);
- }
- stock WC_TextDrawShowForPlayer(playerid, Text:text)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawShowForPlayer(playerid, text);
- }
- stock WC_TextDrawHideForPlayer(playerid, Text:text)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawHideForPlayer(playerid, text);
- }
- stock WC_TextDrawShowForAll(Text:text)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawShowForAll(text);
- }
- stock WC_TextDrawHideForAll(Text:text)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawHideForAll(text);
- }
- stock WC_TextDrawSetString(Text:text, string[])
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawSetString(text, string);
- }
- stock WC_TextDrawSetPreviewModel(Text:text, modelindex)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawSetPreviewModel(text, modelindex);
- }
- stock WC_TextDrawSetPreviewRot(Text:text, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fZoom = 1.0)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawSetPreviewRot(text, fRotX, fRotY, fRotZ, fZoom);
- }
- stock WC_TextDrawSetPreviewVehCol(Text:text, color1, color2)
- {
- if (_:text < 0 || _:text >= MAX_TEXT_DRAWS || s_InternalTextDraw[text]) return 0;
- return TextDrawSetPreviewVehCol(text, color1, color2);
- }
- stock PlayerText:WC_CreatePlayerTextDraw(playerid, Float:x, Float:y, text[])
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return PlayerText:INVALID_TEXT_DRAW;
- new PlayerText:td = CreatePlayerTextDraw(playerid, x, y, text);
- if (td != PlayerText:INVALID_TEXT_DRAW) {
- s_InternalPlayerTextDraw[playerid][td] = false;
- }
- return td;
- }
- stock WC_PlayerTextDrawDestroy(playerid, PlayerText:text)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawDestroy(playerid, text);
- }
- stock WC_PlayerTextDrawLetterSize(playerid, PlayerText:text, Float:x, Float:y)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawLetterSize(playerid, text, x, y);
- }
- stock WC_PlayerTextDrawTextSize(playerid, PlayerText:text, Float:x, Float:y)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawTextSize(playerid, text, x, y);
- }
- stock WC_PlayerTextDrawAlignment(playerid, PlayerText:text, alignment)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawAlignment(playerid, text, alignment);
- }
- stock WC_PlayerTextDrawColor(playerid, PlayerText:text, color)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawColor(playerid, text, color);
- }
- stock WC_PlayerTextDrawUseBox(playerid, PlayerText:text, use)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawUseBox(playerid, text, use);
- }
- stock WC_PlayerTextDrawBoxColor(playerid, PlayerText:text, color)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawBoxColor(playerid, text, color);
- }
- stock WC_PlayerTextDrawSetShadow(playerid, PlayerText:text, size)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawSetShadow(playerid, text, size);
- }
- stock WC_PlayerTextDrawSetOutline(playerid, PlayerText:text, size)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawSetOutline(playerid, text, size);
- }
- stock WC_PlayerTextDrawBackgroundColo(playerid, PlayerText:text, color)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawBackgroundColor(playerid, text, color);
- }
- stock WC_PlayerTextDrawFont(playerid, PlayerText:text, font)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawFont(playerid, text, font);
- }
- stock WC_PlayerTextDrawSetProportiona(playerid, PlayerText:text, set)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawSetProportional(playerid, text, set);
- }
- stock WC_PlayerTextDrawSetSelectable(playerid, PlayerText:text, set)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawSetSelectable(playerid, text, set);
- }
- stock WC_PlayerTextDrawShow(playerid, PlayerText:text)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawShow(playerid, text);
- }
- stock WC_PlayerTextDrawHide(playerid, PlayerText:text)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawHide(playerid, text);
- }
- stock WC_PlayerTextDrawSetString(playerid, PlayerText:text, string[])
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawSetString(playerid, text, string);
- }
- stock WC_PlayerTextDrawSetPreviewMode(playerid, PlayerText:text, modelindex)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawSetPreviewModel(playerid, text, modelindex);
- }
- stock WC_PlayerTextDrawSetPreviewRot(playerid, PlayerText:text, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fZoom = 1.0)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawSetPreviewRot(playerid, text, fRotX, fRotY, fRotZ, fZoom);
- }
- stock WC_PlayerTextDrawSetPreviewVehC(playerid, PlayerText:text, color1, color2)
- {
- if (playerid < 0 || playerid >= MAX_PLAYERS) return 0;
- if (_:text < 0 || _:text >= MAX_PLAYER_TEXT_DRAWS || s_InternalPlayerTextDraw[playerid][text]) return 0;
- return PlayerTextDrawSetPreviewVehCol(playerid, text, color1, color2);
- }
- /*
- * Hooked callbacks
- */
- public OnGameModeInit()
- {
- ScriptInit();
- #if defined WC_OnGameModeInit
- return WC_OnGameModeInit();
- #else
- return 1;
- #endif
- }
- public OnGameModeExit()
- {
- ScriptExit();
- #if defined WC_OnGameModeExit
- return WC_OnGameModeExit();
- #else
- return 1;
- #endif
- }
- public OnFilterScriptInit()
- {
- ScriptInit();
- #if defined WC_OnFilterScriptInit
- return WC_OnFilterScriptInit();
- #else
- return 1;
- #endif
- }
- public OnFilterScriptExit()
- {
- ScriptExit();
- #if defined WC_OnFilterScriptExit
- return WC_OnFilterScriptExit();
- #else
- return 1;
- #endif
- }
- public OnPlayerConnect(playerid)
- {
- new tick = GetTickCount();
- s_PlayerMaxHealth[playerid] = 100.0;
- s_PlayerHealth[playerid] = 100.0;
- s_PlayerMaxArmour[playerid] = 100.0;
- s_PlayerArmour[playerid] = 0.0;
- s_LastExplosive[playerid] = 0;
- s_LastShotIdx[playerid] = 0;
- s_LastShot[playerid][e_Tick] = 0;
- s_LastHitIdx[playerid] = 0;
- s_RejectedHitsIdx[playerid] = 0;
- s_ShotsFired[playerid] = 0;
- s_HitsIssued[playerid] = 0;
- s_PlayerTeam[playerid] = NO_TEAM;
- s_IsDying[playerid] = false;
- s_BeingResynced[playerid] = false;
- s_SpawnForStreamedIn[playerid] = false;
- s_World[playerid] = 0;
- s_LastAnim[playerid] = -1;
- s_LastZVelo[playerid] = 0.0;
- s_LastZ[playerid] = 0.0;
- s_LastUpdate[playerid] = tick;
- s_DamageFeedTimer[playerid] = -1;
- s_DamageFeedLastUpdate[playerid] = tick;
- s_Spectating[playerid] = INVALID_PLAYER_ID;
- s_HealthBarVisible[playerid] = false;
- s_LastSentHealth[playerid] = 0;
- s_LastSentArmour[playerid] = 0;
- s_LastStop[playerid] = tick;
- s_FirstSpawn[playerid] = true;
- s_LastVehicleEnterTime[playerid] = 0;
- s_TrueDeath[playerid] = true;
- s_InClassSelection[playerid] = false;
- s_ForceClassSelection[playerid] = false;
- s_PlayerClass[playerid] = -2;
- s_SpawnInfoModified[playerid] = false;
- s_PlayerFallbackSpawnInfo[playerid][e_Skin] = -1;
- s_DeathSkip[playerid] = 0;
- s_LastVehicleTick[playerid] = 0;
- s_PreviousHitI[playerid] = 0;
- s_CbugFroze[playerid] = 0;
- s_DeathTimer[playerid] = -1;
- s_DelayedDeathTimer[playerid] = -1;
- s_DamageFeedPlayer[playerid] = -1;
- for (new i = 0; i < sizeof(s_PreviousHits[]); i++) {
- s_PreviousHits[playerid][i][e_Tick] = 0;
- }
- for (new i = 0; i < sizeof(s_RejectedHits[]); i++) {
- s_RejectedHits[playerid][i][e_Time] = 0;
- }
- for (new i = 0; i < sizeof(s_DamageFeedHitsGiven[]); i++) {
- s_DamageFeedHitsGiven[playerid][i][e_Tick] = 0;
- s_DamageFeedHitsTaken[playerid][i][e_Tick] = 0;
- }
- SetPlayerTeam(playerid, 0xFE);
- FreezeSyncData(playerid, false);
- SetFakeFacingAngle(playerid, _);
- DamageFeedUpdate(playerid);
- #if WC_CUSTOM_VENDING_MACHINES
- if (!s_AlreadyConnected[playerid]) {
- RemoveDefaultVendingMachines(playerid);
- }
- #endif
- s_AlreadyConnected[playerid] = false;
- #if defined WC_OnPlayerConnect
- return WC_OnPlayerConnect(playerid);
- #else
- return 1;
- #endif
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- #if defined WC_OnPlayerDisconnect
- WC_OnPlayerDisconnect(playerid, reason);
- #endif
-
- #if WC_CUSTOM_VENDING_MACHINES
- if (s_VendingUseTimer[playerid] != -1) {
- KillTimer(s_VendingUseTimer[playerid]);
- s_VendingUseTimer[playerid] = -1;
- }
- #endif
- if (s_DelayedDeathTimer[playerid] != -1) {
- KillTimer(s_DelayedDeathTimer[playerid]);
- s_DelayedDeathTimer[playerid] = -1;
- }
- if (s_DeathTimer[playerid] != -1) {
- KillTimer(s_DeathTimer[playerid]);
- s_DeathTimer[playerid] = -1;
- }
- if (s_KnifeTimeout[playerid] != -1) {
- KillTimer(s_KnifeTimeout[playerid]);
- s_KnifeTimeout[playerid] = -1;
- }
- if (s_HealthBarForeground[playerid] != PlayerText:INVALID_TEXT_DRAW) {
- PlayerTextDrawDestroy(playerid, s_HealthBarForeground[playerid]);
- s_InternalPlayerTextDraw[playerid][s_HealthBarForeground[playerid]] = false;
- s_HealthBarForeground[playerid] = PlayerText:INVALID_TEXT_DRAW;
- }
- if (s_DamageFeedGiven[playerid] != PlayerText:INVALID_TEXT_DRAW) {
- PlayerTextDrawDestroy(playerid, s_DamageFeedGiven[playerid]);
- s_InternalPlayerTextDraw[playerid][s_DamageFeedGiven[playerid]] = false;
- s_DamageFeedGiven[playerid] = PlayerText:INVALID_TEXT_DRAW;
- }
- if (s_DamageFeedTaken[playerid] != PlayerText:INVALID_TEXT_DRAW) {
- PlayerTextDrawDestroy(playerid, s_DamageFeedTaken[playerid]);
- s_InternalPlayerTextDraw[playerid][s_DamageFeedTaken[playerid]] = false;
- s_DamageFeedTaken[playerid] = PlayerText:INVALID_TEXT_DRAW;
- }
- if (s_DamageFeedTimer[playerid] != -1) {
- KillTimer(s_DamageFeedTimer[playerid]);
- s_DamageFeedTimer[playerid] = -1;
- }
- SetHealthBarVisible(playerid, false);
- s_Spectating[playerid] = INVALID_PLAYER_ID;
- for (new i = 0; i < sizeof(s_LastVehicleShooter); i++) {
- if (s_LastVehicleShooter[i] == playerid) {
- s_LastVehicleShooter[i] = INVALID_PLAYER_ID;
- }
- }
- for (new i = 0; i < sizeof(s_InternalPlayerTextDraw[]); i++) {
- s_InternalPlayerTextDraw[playerid][PlayerText:i] = false;
- }
- for (new i = 0; i < MAX_PLAYERS; i++) {
- if (!IsPlayerConnected(i)) {
- continue;
- }
- for (new j = 0; j < sizeof(s_PreviousHits[]); j++) {
- if (s_PreviousHits[i][j][e_Issuer] == playerid) {
- s_PreviousHits[i][j][e_Issuer] = INVALID_PLAYER_ID;
- }
- }
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- s_TrueDeath[playerid] = false;
- s_InClassSelection[playerid] = false;
- if (s_ForceClassSelection[playerid]) {
- DebugMessage(playerid, "Being forced into class selection");
- ForceClassSelection(playerid);
- SetPlayerHealth(playerid, 0.0);
- SetPlayerVirtualWorld(playerid, WC_DEATH_WORLD);
- return 1;
- }
- s_LastUpdate[playerid] = GetTickCount();
- s_LastStop[playerid] = GetTickCount();
- if (s_BeingResynced[playerid]) {
- s_BeingResynced[playerid] = false;
- UpdateHealthBar(playerid);
- SetPlayerPos(playerid, s_SyncData[playerid][e_PosX], s_SyncData[playerid][e_PosY], s_SyncData[playerid][e_PosZ]);
- SetPlayerFacingAngle(playerid, s_SyncData[playerid][e_PosA]);
- SetPlayerSkin(playerid, s_SyncData[playerid][e_Skin]);
- SetPlayerTeam(playerid, s_SyncData[playerid][e_Team]);
- for (new i = 0; i < 13; i++) {
- if (s_SyncData[playerid][e_WeaponId][i]) {
- GivePlayerWeapon(playerid, s_SyncData[playerid][e_WeaponId][i], s_SyncData[playerid][e_WeaponAmmo][i]);
- }
- }
- GivePlayerWeapon(playerid, s_SyncData[playerid][e_Weapon], 0);
- return 1;
- }
- if (s_SpawnInfoModified[playerid]) {
- new spawn_info[E_SPAWN_INFO], classid = s_PlayerClass[playerid];
- s_SpawnInfoModified[playerid] = false;
- if (classid == -1) {
- spawn_info = s_PlayerSpawnInfo[playerid];
- } else if (classid == -2) {
- spawn_info = s_PlayerFallbackSpawnInfo[playerid];
- } else {
- if (s_ClassSpawnInfo[classid][e_Skin] == -1 && s_PlayerFallbackSpawnInfo[playerid][e_Skin] != -1) {
- spawn_info = s_PlayerFallbackSpawnInfo[playerid];
- } else {
- spawn_info = s_ClassSpawnInfo[classid];
- }
- }
- if (spawn_info[e_Skin] != -1) {
- SetSpawnInfo(
- playerid,
- spawn_info[e_Team],
- spawn_info[e_Skin],
- spawn_info[e_PosX],
- spawn_info[e_PosY],
- spawn_info[e_PosZ],
- spawn_info[e_Rot],
- spawn_info[e_Weapon1],
- spawn_info[e_Ammo1],
- spawn_info[e_Weapon2],
- spawn_info[e_Ammo2],
- spawn_info[e_Weapon3],
- spawn_info[e_Ammo3]
- );
- }
- } else {
- s_PlayerFallbackSpawnInfo[playerid][e_Team] = s_PlayerTeam[playerid];
- s_PlayerFallbackSpawnInfo[playerid][e_Skin] = GetPlayerSkin(playerid);
- GetPlayerPos(
- playerid,
- s_PlayerFallbackSpawnInfo[playerid][e_PosX],
- s_PlayerFallbackSpawnInfo[playerid][e_PosY],
- s_PlayerFallbackSpawnInfo[playerid][e_PosZ]
- );
- GetPlayerFacingAngle(playerid, s_PlayerFallbackSpawnInfo[playerid][e_Rot]);
- }
- if (s_DeathTimer[playerid] != -1) {
- KillTimer(s_DeathTimer[playerid]);
- s_DeathTimer[playerid] = -1;
- }
- if (s_IsDying[playerid]) {
- s_IsDying[playerid] = false;
- }
- if (s_PlayerHealth[playerid] == 0.0) {
- s_PlayerHealth[playerid] = s_PlayerMaxHealth[playerid];
- }
- UpdatePlayerVirtualWorld(playerid);
- UpdateHealthBar(playerid, true);
- FreezeSyncData(playerid, false);
- SetFakeFacingAngle(playerid, _);
- DamageFeedUpdate(playerid);
- if (GetPlayerTeam(playerid) != 0xFE) {
- SetPlayerTeam(playerid, 0xFE);
- }
- if (s_DeathSkip[playerid] == 2) {
- DebugMessage(playerid, "Death skipped");
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- GivePlayerWeapon(playerid, 0, 1);
- SetPlayerArmedWeapon(playerid, 0);
- ClearAnimations(playerid);
- ApplyAnimation(playerid, "PED", "IDLE_stance", 4.1, 1, 0, 0, 0, 1, 1);
- s_DeathSkip[playerid] = 1;
- s_DeathSkipTick[playerid] = GetTickCount();
- return 1;
- }
- if (s_FirstSpawn[playerid]) {
- s_FirstSpawn[playerid] = false;
- #if WC_CUSTOM_VENDING_MACHINES
- if (s_CustomVendingMachines) {
- ApplyAnimation(playerid, "VENDING", "null", 0, 0, 0, 0, 0, 0);
- }
- #endif
- }
- #if defined WC_OnPlayerSpawn
- return WC_OnPlayerSpawn(playerid);
- #else
- return 1;
- #endif
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- DebugMessage(playerid, "Requested class: %d", classid);
- if (s_DeathSkip[playerid]) {
- DebugMessage(playerid, "Skipping death - class selection skipped");
- SpawnPlayer(playerid);
- return 0;
- }
- if (s_ForceClassSelection[playerid]) {
- s_ForceClassSelection[playerid] = false;
- }
- if (s_BeingResynced[playerid]) {
- s_TrueDeath[playerid] = false;
- SpawnPlayerInPlace(playerid);
- return 0;
- }
- if (s_DeathTimer[playerid] != -1) {
- KillTimer(s_DeathTimer[playerid]);
- s_DeathTimer[playerid] = -1;
- }
- if (s_IsDying[playerid]) {
- OnPlayerDeathFinished(playerid, false);
- s_IsDying[playerid] = false;
- }
- FreezeSyncData(playerid, false);
- UpdatePlayerVirtualWorld(playerid);
- if (s_TrueDeath[playerid]) {
- if (!s_InClassSelection[playerid]) {
- DebugMessage(playerid, "True death class selection");
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- RemoveBuildingForPlayer(playerid, 1484, x, y, z, 350.0),
- RemoveBuildingForPlayer(playerid, 1485, x, y, z, 350.0),
- RemoveBuildingForPlayer(playerid, 1486, x, y, z, 350.0);
- s_InClassSelection[playerid] = true;
- }
- #if defined WC_OnPlayerRequestClass
- if (WC_OnPlayerRequestClass(playerid, classid)) {
- s_PlayerClass[playerid] = classid;
- return 1;
- } else {
- return 0;
- }
- #else
- s_PlayerClass[playerid] = classid;
- return 1;
- #endif
- } else {
- DebugMessage(playerid, "Not true death - being respawned");
- s_ForceClassSelection[playerid] = true;
- SpawnPlayerInPlace(playerid);
- return 0;
- }
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- s_TrueDeath[playerid] = true;
- s_InClassSelection[playerid] = false;
- #if WC_CUSTOM_VENDING_MACHINES
- if (s_VendingUseTimer[playerid] != -1) {
- KillTimer(s_VendingUseTimer[playerid]);
- s_VendingUseTimer[playerid] = -1;
- }
- #endif
- if (s_BeingResynced[playerid] || s_ForceClassSelection[playerid]) {
- return 1;
- }
- // Probably fake death
- if (killerid != INVALID_PLAYER_ID && !IsPlayerStreamedIn(killerid, playerid)) {
- killerid = INVALID_PLAYER_ID;
- }
- DebugMessageRedAll("OnPlayerDeath(%d died by %d from %d)", playerid, reason, killerid);
- if (s_DeathTimer[playerid] != -1) {
- KillTimer(s_DeathTimer[playerid]);
- }
- if (s_IsDying[playerid]) {
- DebugMessageRedAll("death while dying %d", playerid);
- return 1;
- }
- // WEAPON_UNKNOWN
- if (reason < 0 || reason > 55) {
- reason = 55;
- }
- new vehicleid = GetPlayerVehicleID(playerid);
- // Let's assume they died from an exploading vehicle
- if (vehicleid) {
- reason = WEAPON_EXPLOSION;
- killerid = INVALID_PLAYER_ID;
- if (!HasSameTeam(playerid, s_LastVehicleShooter[vehicleid])) {
- killerid = s_LastVehicleShooter[vehicleid];
- }
- }
- new Float:amount = 0.0;
- new bodypart = BODY_PART_UNKNOWN;
- if (reason == WEAPON_PARACHUTE) {
- reason = WEAPON_COLLISION;
- }
- if (OnPlayerDamage(playerid, amount, killerid, reason, bodypart)) {
- if (reason < 0 || reason > WEAPON_UNKNOWN) {
- reason = WEAPON_UNKNOWN;
- }
- if (amount == 0.0) {
- amount = s_PlayerHealth[playerid] + s_PlayerArmour[playerid];
- }
- if (reason == WEAPON_COLLISION || reason == WEAPON_DROWN || reason == WEAPON_CARPARK) {
- if (amount <= 0.0) {
- amount = s_PlayerHealth[playerid];
- }
- s_PlayerHealth[playerid] -= amount;
- } else {
- if (amount <= 0.0) {
- amount = s_PlayerHealth[playerid] + s_PlayerArmour[playerid];
- }
- s_PlayerArmour[playerid] -= amount;
- }
- if (s_PlayerArmour[playerid] < 0.0) {
- s_DamageDoneArmour[playerid] = amount + s_PlayerArmour[playerid];
- s_DamageDoneHealth[playerid] = -s_PlayerArmour[playerid];
- s_PlayerHealth[playerid] += s_PlayerArmour[playerid];
- s_PlayerArmour[playerid] = 0.0;
- } else {
- s_DamageDoneArmour[playerid] = amount;
- s_DamageDoneHealth[playerid] = 0.0;
- }
- if (s_PlayerHealth[playerid] <= 0.0) {
- amount += s_PlayerHealth[playerid];
- s_DamageDoneHealth[playerid] += s_PlayerHealth[playerid];
- s_PlayerHealth[playerid] = 0.0;
- }
- OnPlayerDamageDone(playerid, amount, killerid, reason, bodypart);
- }
- if (s_PlayerHealth[playerid] <= 0.0005) {
- s_PlayerHealth[playerid] = 0.0;
- s_IsDying[playerid] = true;
- new animlib[32], animname[32], anim_lock, respawn_time;
- OnPlayerPrepareDeath(playerid, animlib, animname, anim_lock, respawn_time);
- #if defined WC_OnPlayerDeath
- WC_OnPlayerDeath(playerid, killerid, reason);
- #endif
- OnPlayerDeathFinished(playerid, false);
- } else {
- if (vehicleid || WasPlayerInVehicle(playerid, 10000)) {
- new Float:x, Float:y, Float:z, Float:r;
- GetPlayerPos(playerid, x, y, z);
- SetPlayerPos(playerid, x, y, z);
- SaveSyncData(playerid);
- if (vehicleid) {
- GetVehicleZAngle(vehicleid, r);
- } else {
- GetPlayerFacingAngle(playerid, r);
- }
- s_DeathSkip[playerid] = 2;
- ForceClassSelection(playerid);
- SetSpawnInfo(playerid, 0xFE, GetPlayerSkin(playerid), x, y, z, r, 0, 0, 0, 0, 0, 0);
- TogglePlayerSpectating(playerid, true);
- TogglePlayerSpectating(playerid, false);
- SetSpawnInfo(playerid, 0xFE, GetPlayerSkin(playerid), x, y, z, r, 0, 0, 0, 0, 0, 0);
- TogglePlayerControllable(playerid, true);
- GivePlayerWeapon(playerid, 1, 1);
- } else {
- SpawnPlayerInPlace(playerid);
- }
- }
- UpdateHealthBar(playerid);
- return 1;
- }
- static Float:AngleBetweenPoints(Float:x1, Float:y1, Float:x2, Float:y2);
- forward WC_CbugPunishment(playerid, weapon);
- public WC_CbugPunishment(playerid, weapon) {
- FreezeSyncData(playerid, false);
- ClearAnimations(playerid, 1);
- GivePlayerWeapon(playerid, weapon, 0);
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if (!s_CbugAllowed && !IsPlayerDying(playerid) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
- if (newkeys & KEY_CROUCH) {
- new tick = GetTickCount();
- new diff = tick - s_LastShot[playerid][e_Tick];
- if (s_LastShot[playerid][e_Tick] && diff < 1200 && !s_CbugFroze[playerid]) {
- PlayerPlaySound(playerid, 1055, 0.0, 0.0, 0.0);
- if (s_LastShot[playerid][e_Valid] && floatabs(s_LastShot[playerid][e_HX]) > 1.0 && floatabs(s_LastShot[playerid][e_HY]) > 1.0) {
- SetPlayerFacingAngle(playerid, AngleBetweenPoints(
- s_LastShot[playerid][e_HX],
- s_LastShot[playerid][e_HY],
- s_LastShot[playerid][e_OX],
- s_LastShot[playerid][e_OY]
- ));
- }
- new w, a;
- GetPlayerWeaponData(playerid, 0, w, a);
- ClearAnimations(playerid, 1);
- ApplyAnimation(playerid, "PED", "IDLE_stance", 4.1, 1, 0, 0, 0, 0, 1);
- FreezeSyncData(playerid, true);
- GivePlayerWeapon(playerid, w, 0);
- SetTimerEx("WC_CbugPunishment", 600, false, "ii", playerid, GetPlayerWeapon(playerid));
- s_CbugFroze[playerid] = tick;
- for (new i = 0; i < MAX_PLAYERS; i++) {
- if (!IsPlayerConnected(i) && !IsPlayerDying(i)) {
- continue;
- }
- for (new j = 0; j < sizeof(s_PreviousHits[]); j++) {
- if (s_PreviousHits[i][j][e_Issuer] == playerid && tick - s_PreviousHits[i][j][e_Tick] <= 1200) {
- s_PreviousHits[i][j][e_Issuer] = INVALID_PLAYER_ID;
- new Float:health = WC_GetPlayerHealth(i);
- new Float:armour = WC_GetPlayerArmour(i);
- if (s_IsDying[i]) {
- if (s_DelayedDeathTimer[i] == -1) {
- continue;
- }
- KillTimer(s_DelayedDeathTimer[i]);
- s_DelayedDeathTimer[i] = -1;
- ClearAnimations(i, 1);
- SetFakeFacingAngle(i, _);
- FreezeSyncData(i, false);
- s_IsDying[i] = false;
- if (s_DeathTimer[i] != -1) {
- KillTimer(s_DeathTimer[i]);
- s_DeathTimer[i] = -1;
- }
- }
- health += s_PreviousHits[i][j][e_Health];
- armour += s_PreviousHits[i][j][e_Armour];
- WC_SetPlayerHealth(i, health, armour);
- }
- }
- }
- }
- }
- }
- if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
- #if WC_CUSTOM_VENDING_MACHINES
- if (s_CustomVendingMachines
- && newkeys == KEY_SECONDARY_ATTACK
- && !oldkeys
- && s_VendingUseTimer[playerid] == -1
- && GetPlayerAnimationIndex(playerid) != 1660) {
- new bool:failed = false;
- if (GetPlayerMoney(playerid) <= 0 || s_PlayerHealth[playerid] >= s_PlayerMaxHealth[playerid]) {
- failed = true;
- }
- new Float:z;
- GetPlayerPos(playerid, z, z, z);
- for (new i = 0; i < sizeof(sc_VendingMachines); i++) {
- if (floatabs(z - sc_VendingMachines[i][e_PosZ]) > 1.5) {
- continue;
- }
- if (IsPlayerInRangeOfPoint(playerid, 0.5, sc_VendingMachines[i][e_FrontX], sc_VendingMachines[i][e_FrontY], z)) {
- if (failed) {
- PlayerPlaySound(playerid, 1055, 0.0, 0.0, 0.0);
- break;
- }
- new Float:health_given = 35.0;
- if (OnPlayerUseVendingMachine(playerid, health_given)) {
- s_VendingUseTimer[playerid] = SetTimerEx("WC_VendingMachineUsed", 2500, false, "if", playerid, health_given);
- SetPlayerFacingAngle(playerid, sc_VendingMachines[i][e_RotZ]);
- SetPlayerPos(playerid, sc_VendingMachines[i][e_FrontX], sc_VendingMachines[i][e_FrontY], z);
- ApplyAnimation(playerid, "VENDING", "VEND_USE", 4.1, 0, 0, 1, 0, 0, 1);
- PlayerPlaySound(playerid, 42600, 0.0, 0.0, 0.0);
- } else {
- PlayerPlaySound(playerid, 1055, 0.0, 0.0, 0.0);
- }
- break;
- }
- }
- }
- #endif
- if (newkeys & KEY_FIRE) {
- new weap = GetPlayerWeapon(playerid);
- switch (weap) {
- case WEAPON_BOMB, WEAPON_SATCHEL: {
- s_LastExplosive[playerid] = WEAPON_SATCHEL;
- }
- case WEAPON_ROCKETLAUNCHER, WEAPON_HEATSEEKER, WEAPON_GRENADE: {
- s_LastExplosive[playerid] = weap;
- }
- }
- }
- }
- #if defined WC_OnPlayerKeyStateChange
- return WC_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
- #else
- return 1;
- #endif
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- // Send ped floor_hit_f
- if (s_IsDying[playerid]) {
- SendLastSyncData(playerid, forplayerid, 0x2e040000 + 1150);
- }
- #if defined WC_OnPlayerStreamIn
- return WC_OnPlayerStreamIn(playerid, forplayerid);
- #else
- return 1;
- #endif
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- #if WC_CUSTOM_VENDING_MACHINES
- if (s_VendingUseTimer[playerid] != -1) {
- KillTimer(s_VendingUseTimer[playerid]);
- s_VendingUseTimer[playerid] = -1;
- }
- #endif
- s_LastVehicleEnterTime[playerid] = gettime();
- s_LastVehicleTick[playerid] = GetTickCount();
- #if defined WC_OnPlayerEnterVehicle
- return WC_OnPlayerEnterVehicle(playerid, vehicleid, ispassenger);
- #else
- return 1;
- #endif
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- s_LastVehicleTick[playerid] = GetTickCount();
- #if defined WC_OnPlayerExitVehicle
- return WC_OnPlayerExitVehicle(playerid, vehicleid);
- #else
- return 1;
- #endif
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if (s_Spectating[playerid] != INVALID_PLAYER_ID && newstate != PLAYER_STATE_SPECTATING) {
- s_Spectating[playerid] = INVALID_PLAYER_ID;
- }
- #if WC_CUSTOM_VENDING_MACHINES
- if (s_VendingUseTimer[playerid] != -1) {
- KillTimer(s_VendingUseTimer[playerid]);
- s_VendingUseTimer[playerid] = -1;
- }
- #endif
- if (s_IsDying[playerid] && (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)) {
- TogglePlayerControllable(playerid, false);
- }
- if (oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) {
- s_LastVehicleTick[playerid] = GetTickCount();
- if (newstate == PLAYER_STATE_ONFOOT) {
- new Float:vx, Float:vy, Float:vz;
- GetPlayerVelocity(playerid, vx, vy, vz);
- if (vx*vx + vy*vy + vz*vz <= 0.05) {
- for (new i = 0; i < MAX_PLAYERS; i++) {
- if (i != playerid && IsPlayerConnected(i) && IsPlayerStreamedIn(playerid, i)) {
- SendLastSyncData(playerid, i);
- ClearAnimationsForPlayer(playerid, i);
- }
- }
- }
- }
- }
- switch (newstate) {
- case PLAYER_STATE_ONFOOT,
- PLAYER_STATE_DRIVER,
- PLAYER_STATE_PASSENGER: {
- SetHealthBarVisible(playerid, true);
- }
- default: {
- SetHealthBarVisible(playerid, false);
- }
- }
- #if defined WC_OnPlayerStateChange
- return WC_OnPlayerStateChange(playerid, newstate, oldstate);
- #else
- return 1;
- #endif
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if (!IsPlayerSpawned(playerid)) {
- return 0;
- }
- #if defined WC_OnPlayerPickUpPickup
- return WC_OnPlayerPickUpPickup(playerid, pickupid);
- #else
- return 1;
- #endif
- }
- public OnPlayerUpdate(playerid)
- {
- if (s_IsDying[playerid]) {
- return 1;
- }
- if (s_DeathSkip[playerid] == 1) {
- if (s_DeathSkipTick[playerid]) {
- if (GetTickCount() - s_DeathSkipTick[playerid] > 1000) {
- new Float:x, Float:y, Float:z, Float:r;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, r);
- SetSpawnInfo(playerid, 0xFE, GetPlayerSkin(playerid), x, y, z, r, 0, 0, 0, 0, 0, 0);
- s_DeathSkipTick[playerid] = 0;
- ApplyAnimation(playerid, "PED", "IDLE_stance", 4.1, 1, 0, 0, 0, 1, 1);
- }
- } else {
- if (GetPlayerAnimationIndex(playerid) != 1189) {
- s_DeathSkip[playerid] = 0;
- WC_DeathSkipEnd(playerid);
- DebugMessage(playerid, "Death skip end");
- }
- }
- }
- if (s_SpawnForStreamedIn[playerid]) {
- WC_SpawnForStreamedIn(playerid);
- s_SpawnForStreamedIn[playerid] = false;
- }
- new tick = GetTickCount();
- s_LastUpdate[playerid] = tick;
- // Detect fall damage based on velocity and animation
- if (s_CustomFallDamage) {
- new Float:vz, Float:z;
- GetPlayerVelocity(playerid, vz, vz, vz);
- GetPlayerPos(playerid, z, z, z);
- new surfing = GetPlayerSurfingVehicleID(playerid);
- if (surfing && surfing == INVALID_VEHICLE_ID) {
- surfing = GetPlayerSurfingObjectID(playerid) != INVALID_OBJECT_ID;
- } else {
- surfing = 1;
- }
- if (surfing || tick - s_LastStop[playerid] < 2000) {
- vz = 0.0;
- s_LastZVelo[playerid] = 0.0;
- } else {
- if (vz != 0.0) {
- s_LastZVelo[playerid] = vz;
- }
- if (z - s_LastZ[playerid] > 1.0) {
- s_LastZVelo[playerid] = 0.1;
- vz = 0.1;
- }
- }
- s_LastZ[playerid] = z;
- new anim = GetPlayerAnimationIndex(playerid);
- if (anim != s_LastAnim[playerid]) {
- new prev = s_LastAnim[playerid];
- s_LastAnim[playerid] = anim;
- if (((prev == 1130 && vz == 0.0) || 1128 <= anim <= 1134 || anim == 1208)) {
- new Float:amount = -1.0;
- DebugMessage(playerid, "vz: %f anim: %d prev: %d", vz, anim, prev);
- vz = s_LastZVelo[playerid];
- if (vz <= s_FallDeathVelocity) {
- amount = 0.0;
- } else if (vz <= -0.2) {
- if (vz == -0.2) {
- amount = s_WeaponDamage[WEAPON_COLLISION] * 0.2;
- } else {
- amount = (vz + 0.2) / (s_FallDeathVelocity + 0.2);
- amount *= s_WeaponDamage[WEAPON_COLLISION];
- }
- }
- if (GetPlayerWeapon(playerid) == WEAPON_PARACHUTE && anim == 1134) {
- amount = -1.0;
- }
- if (amount >= 0.0) {
- DebugMessage(playerid, "fall dmg: %.5f (vz: %f, anim: %d, prev: %d)", amount, vz, anim, prev);
- InflictDamage(playerid, amount, INVALID_PLAYER_ID, WEAPON_COLLISION, 3);
- if (amount == 0.0) {
- amount = s_PlayerHealth[playerid];
- }
- }
- }
- }
- }
- #if defined WC_OnPlayerUpdate
- return WC_OnPlayerUpdate(playerid);
- #else
- return 1;
- #endif
- }
- public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart)
- {
- if (!IsHighRateWeapon(weaponid)) {
- DebugMessage(playerid, "OnPlayerGiveDamage(%d gave %f to %d using %d on bodypart %d)", playerid, amount, damagedid, weaponid, bodypart);
- }
- // Nobody got damaged
- if (damagedid == INVALID_PLAYER_ID) {
- #if defined OnInvalidWeaponDamage
- OnInvalidWeaponDamage(playerid, damagedid, amount, weaponid, bodypart, WC_NO_DAMAGED, true);
- #endif
- AddRejectedHit(playerid, damagedid, HIT_NO_DAMAGEDID, weaponid);
- return 0;
- }
- if (s_IsDying[damagedid]) {
- AddRejectedHit(playerid, damagedid, HIT_DYING_PLAYER, weaponid);
- return 0;
- }
- if (!s_LagCompMode) {
- new npc = IsPlayerNPC(damagedid);
- if (weaponid == WEAPON_KNIFE && _:amount == _:0.0) {
- if (s_KnifeTimeout[damagedid] != -1) {
- KillTimer(s_KnifeTimeout[damagedid]);
- }
- s_KnifeTimeout[damagedid] = SetTimerEx("WC_SetSpawnForStreamedIn", 2500, false, "i", damagedid);
- }
- if (!npc) {
- return 0;
- }
- }
- // Ignore unreliable and invalid damage
- if (weaponid < 0 || weaponid >= sizeof(s_ValidDamageGiven) || !s_ValidDamageGiven[weaponid]) {
- // Fire is synced as taken damage (because it's not reliable as given), so no need to show a rejected hit.
- // Vehicle damage is also synced as taken, so no need to show that either.
- if (weaponid != WEAPON_FLAMETHROWER && weaponid != WEAPON_VEHICLE) {
- AddRejectedHit(playerid, damagedid, HIT_INVALID_WEAPON, weaponid);
- }
- return 0;
- }
- if (!IsPlayerSpawned(playerid)) {
- // Make sure the rejected hit wasn't added in OnPlayerWeaponShot
- if (!IsBulletWeapon(weaponid) || s_LastShot[playerid][e_Valid]) {
- AddRejectedHit(playerid, damagedid, HIT_NOT_SPAWNED, weaponid);
- }
- return 0;
- }
- new npc = IsPlayerNPC(damagedid);
- // From stealth knife, can be any weapon
- if (_:amount == _:1833.33154296875) {
- return 0;
- }
- if (weaponid == WEAPON_KNIFE) {
- if (_:amount == _:0.0) {
- // Resync without bothering the player being knifed
- if (npc || HasSameTeam(playerid, damagedid)) {
- if (s_KnifeTimeout[damagedid] != -1) {
- KillTimer(s_KnifeTimeout[damagedid]);
- }
- s_KnifeTimeout[damagedid] = SetTimerEx("WC_SpawnForStreamedIn", 150, false, "i", damagedid);
- ClearAnimations(playerid, 1);
- SetPlayerArmedWeapon(playerid, 0);
- return 0;
- }
- if (!OnPlayerDamage(damagedid, amount, playerid, weaponid, bodypart)) {
- if (s_KnifeTimeout[damagedid] != -1) {
- KillTimer(s_KnifeTimeout[damagedid]);
- }
- s_KnifeTimeout[damagedid] = SetTimerEx("WC_SpawnForStreamedIn", 150, false, "i", damagedid);
- ClearAnimations(playerid, 1);
- SetPlayerArmedWeapon(playerid, 0);
- return 0;
- }
- s_DamageDoneHealth[playerid] = s_PlayerHealth[playerid];
- s_DamageDoneArmour[playerid] = s_PlayerArmour[playerid];
- OnPlayerDamageDone(damagedid, s_PlayerHealth[damagedid] + s_PlayerArmour[damagedid], playerid, weaponid, bodypart);
- ClearAnimations(damagedid, 1);
- PlayerDeath(damagedid, "KNIFE", "KILL_Knife_Ped_Damage", _, 5200);
- SetTimerEx("WC_SecondKnifeAnim", 2200, false, "i", damagedid);
- #if defined WC_OnPlayerDeath
- WC_OnPlayerDeath(damagedid, playerid, weaponid);
- #endif
- DebugMessage(damagedid, "being knifed by %d", playerid);
- DebugMessage(playerid, "knifing %d", damagedid);
- new Float:x, Float:y, Float:z, Float:a;
- GetPlayerFacingAngle(damagedid, a);
- SetPlayerFacingAngle(playerid, a);
- PosInFront(damagedid, -1.0, x, y, z);
- SetPlayerVelocity(damagedid, 0.0, 0.0, 0.0);
- SetPlayerVelocity(playerid, 0.0, 0.0, 0.0);
- new forcesync = 2;
- if (747 < GetPlayerAnimationIndex(playerid) > 748) {
- DebugMessageRed(playerid, "applying knife anim for you too (current: %d)", GetPlayerAnimationIndex(playerid));
- forcesync = 1;
- }
- ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Player", 4.1, 0, 1, 1, 0, 1800, forcesync);
- return 0;
- }
- }
- if (HasSameTeam(playerid, damagedid)) {
- AddRejectedHit(playerid, damagedid, HIT_SAME_TEAM, weaponid);
- return 0;
- }
- // Both players should see eachother
- if ((!IsPlayerStreamedIn(playerid, damagedid) && !IsPlayerPaused(damagedid)) || !IsPlayerStreamedIn(damagedid, playerid)) {
- AddRejectedHit(playerid, damagedid, HIT_UNSTREAMED, weaponid, damagedid);
- return 0;
- }
- new Float:bullets, err;
- if ((err = ProcessDamage(damagedid, playerid, amount, weaponid, bodypart, bullets))) {
- if (err == WC_INVALID_DAMAGE) {
- AddRejectedHit(playerid, damagedid, HIT_INVALID_DAMAGE, weaponid, _:amount);
- }
- if (err != WC_INVALID_DISTANCE) {
- #if defined OnInvalidWeaponDamage
- OnInvalidWeaponDamage(playerid, damagedid, amount, weaponid, bodypart, err, true);
- #endif
- }
- return 0;
- }
- new tick = GetTickCount();
- if (tick == 0) tick = 1;
- new idx = (s_LastHitIdx[playerid] + 1) % sizeof(s_LastHitTicks[]);
- // JIT plugin fix
- if (idx < 0) {
- idx += sizeof(s_LastHitTicks[]);
- }
- s_LastHitIdx[playerid] = idx;
- s_LastHitTicks[playerid][idx] = tick;
- s_LastHitWeapons[playerid][idx] = weaponid;
- s_HitsIssued[playerid] += 1;
- #if WC_DEBUG
- if (s_HitsIssued[playerid] > 1) {
- new prev_tick_idx = (idx - 1) % sizeof(s_LastHitTicks[]);
- // JIT plugin fix
- if (prev_tick_idx < 0) {
- prev_tick_idx += sizeof(s_LastHitTicks[]);
- }
- new prev_tick = s_LastHitTicks[playerid][prev_tick_idx];
- DebugMessage(playerid, "(hit) last: %d last 3: %d", tick - prev_tick, AverageHitRate(playerid, 3));
- }
- #endif
- new multiple_weapons;
- new avg_rate = AverageHitRate(playerid, s_MaxHitRateSamples, multiple_weapons);
- // Hit issue flood?
- // Could be either a cheat or just lag
- if (avg_rate != -1) {
- if (multiple_weapons) {
- if (avg_rate < 100) {
- AddRejectedHit(playerid, damagedid, HIT_RATE_TOO_FAST_MULTIPLE, weaponid, avg_rate, s_MaxHitRateSamples);
- return 0;
- }
- } else if (s_MaxWeaponShootRate[weaponid] - avg_rate > 20) {
- AddRejectedHit(playerid, damagedid, HIT_RATE_TOO_FAST, weaponid, avg_rate, s_MaxHitRateSamples, s_MaxWeaponShootRate[weaponid]);
- return 0;
- }
- }
- if (IsBulletWeapon(weaponid) && _:amount != _:2.6400001049041748046875 && !(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) == 0)) {
- new valid = true;
- if (!s_LastShot[playerid][e_Valid]) {
- //AddRejectedHit(playerid, damagedid, HIT_LAST_SHOT_INVALID, weaponid);
- valid = false;
- DebugMessageRed(playerid, "last shot not valid");
- } else if (WEAPON_SHOTGUN <= weaponid <= WEAPON_SHOTGSPA) {
- // Let's assume someone won't hit 3 players with 1 shotgun shot, and that one OnPlayerWeaponShot can be out of sync
- if (s_LastShot[playerid][e_Hits] >= 3) {
- valid = false;
- AddRejectedHit(playerid, damagedid, HIT_MULTIPLE_PLAYERS_SHOTGUN, weaponid, s_LastShot[playerid][e_Hits] + 1);
- }
- } else if (s_LastShot[playerid][e_Hits] > 0) {
- // Sniper doesn't always send OnPlayerWeaponShot
- if (s_LastShot[playerid][e_Hits] > 4 && weaponid != WEAPON_SNIPER) {
- valid = false;
- AddRejectedHit(playerid, damagedid, HIT_MULTIPLE_PLAYERS, weaponid, s_LastShot[playerid][e_Hits] + 1);
- } else {
- DebugMessageRed(playerid, "hit %d players with 1 shot", s_LastShot[playerid][e_Hits] + 1);
- }
- }
- s_LastShot[playerid][e_Hits] += 1;
- if (!valid) {
- return 0;
- }
- }
- if (npc) {
- OnPlayerDamageDone(damagedid, amount, playerid, weaponid, bodypart);
- } else {
- InflictDamage(damagedid, amount, playerid, weaponid, bodypart);
- }
- // Don't send OnPlayerGiveDamage to the rest of the script, since it should not be used
- return 0;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
- {
- UpdateHealthBar(playerid, true);
- if (s_IsDying[playerid]) {
- return 0;
- }
- if (s_BeingResynced[playerid]) {
- return 0;
- }
- if (!IsHighRateWeapon(weaponid)) {
- DebugMessage(playerid, "OnPlayerTakeDamage(%d took %f from %d by %d on bodypart %d)", playerid, amount, issuerid, weaponid, bodypart);
- }
- // Ignore unreliable and invalid damage
- if (weaponid < 0 || weaponid >= sizeof(s_ValidDamageTaken) || !s_ValidDamageTaken[weaponid]) {
- return 0;
- }
- if (playerid == INVALID_PLAYER_ID || IsPlayerNPC(playerid)) {
- return 0;
- }
- // Carjack damage
- if (weaponid == 54 && _:amount == _:0.0) {
- return 0;
- }
- // From stealth knife, can be any weaponid
- if (_:amount == _:1833.33154296875) {
- return 0;
- }
- // Climb bug
- if (weaponid == WEAPON_COLLISION) {
- if (s_CustomFallDamage) {
- return 0;
- }
- new anim = GetPlayerAnimationIndex(playerid);
- if (1061 <= anim <= 1067) {
- DebugMessage(playerid, "climb bug prevented");
- return 0;
- }
- }
- // Being knifed client-side
- if (weaponid == WEAPON_KNIFE) {
- if (s_IsDying[playerid]) {
- return 0;
- }
- // With the plugin, this part is never actually used (it can't happen)
- if (_:amount == _:0.0) {
- if (s_KnifeTimeout[playerid] != -1) {
- KillTimer(s_KnifeTimeout[playerid]);
- s_KnifeTimeout[playerid] = -1;
- }
- if (issuerid == INVALID_PLAYER_ID || HasSameTeam(playerid, issuerid)) {
- ResyncPlayer(playerid);
- return 0;
- }
- if (!OnPlayerDamage(playerid, amount, issuerid, weaponid, bodypart)) {
- ResyncPlayer(playerid);
- return 0;
- }
- // Make sure the values were not modified
- weaponid = WEAPON_KNIFE;
- amount = 0.0;
- s_DamageDoneHealth[playerid] = s_PlayerHealth[playerid];
- s_DamageDoneArmour[playerid] = s_PlayerArmour[playerid];
- OnPlayerDamageDone(playerid, s_PlayerHealth[playerid] + s_PlayerArmour[playerid], issuerid, weaponid, bodypart);
- PlayerDeath(playerid, "KNIFE", "KILL_Knife_Ped_Die", _, 4000 - GetPlayerPing(playerid));
- #if defined WC_OnPlayerDeath
- WC_OnPlayerDeath(playerid, issuerid, weaponid);
- #endif
- SetPlayerHealth(playerid, Float:0x7f7fffff);
- DebugMessage(playerid, "being knifed by %d", issuerid);
- DebugMessage(issuerid, "knifing %d", playerid);
- new Float:x, Float:y, Float:z, Float:a;
- GetPlayerFacingAngle(playerid, a);
- SetPlayerFacingAngle(issuerid, a);
- PosInFront(playerid, -1.0, x, y, z);
- SetPlayerVelocity(playerid, 0.0, 0.0, 0.0);
- SetPlayerVelocity(issuerid, 0.0, 0.0, 0.0);
- new forcesync = 2;
- if (GetPlayerAnimationIndex(issuerid) != 747) {
- DebugMessageRed(issuerid, "applying knife anim for you too (current: %d)", GetPlayerAnimationIndex(issuerid));
- forcesync = 1;
- }
- ApplyAnimation(issuerid, "KNIFE", "KILL_Knife_Player", 4.1, 0, 1, 1, 0, 1800, forcesync);
- return 0;
- }
- }
- // If it's lagcomp, only allow damage that's valid for both modes
- if (s_LagCompMode && s_ValidDamageTaken[weaponid] != 2) {
- if (issuerid != INVALID_PLAYER_ID && IsPlayerInAnyVehicle(issuerid) && GetPlayerVehicleSeat(issuerid) == 0 && (weaponid == WEAPON_M4 || weaponid == WEAPON_MINIGUN)) {
- weaponid = weaponid == WEAPON_M4 ? WEAPON_VEHICLE_M4 : WEAPON_VEHICLE_MINIGUN;
- } else {
- return 0;
- }
- }
- // Should still be damaged by grenades or fire after someone has died
- if (issuerid != INVALID_PLAYER_ID) {
- if (HasSameTeam(playerid, issuerid)) {
- return 0;
- }
- if (s_IsDying[issuerid] && (IsBulletWeapon(weaponid) || IsMeleeWeapon(weaponid))) {
- DebugMessageRed(playerid, "shot/punched by dead player (%d)", issuerid);
- return 0;
- }
- if (s_BeingResynced[issuerid]) {
- return 0;
- }
- }
- new Float:bullets = 0.0, err;
- if ((err = ProcessDamage(playerid, issuerid, amount, weaponid, bodypart, bullets))) {
- if (err == WC_INVALID_DAMAGE) {
- AddRejectedHit(issuerid, playerid, HIT_INVALID_DAMAGE, weaponid, _:amount);
- }
- if (err != WC_INVALID_DISTANCE) {
- #if defined OnInvalidWeaponDamage
- OnInvalidWeaponDamage(issuerid, playerid, amount, weaponid, bodypart, err, false);
- #endif
- }
- return 0;
- }
- if (IsBulletWeapon(weaponid)) {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(issuerid, x, y, z);
- new Float:dist = GetPlayerDistanceFromPoint(playerid, x, y, z);
- if (dist > s_WeaponRange[weaponid] + 2.0) {
- AddRejectedHit(issuerid, playerid, HIT_OUT_OF_RANGE, weaponid, _:dist, _:s_WeaponRange[weaponid]);
- return 0;
- }
- }
- InflictDamage(playerid, amount, issuerid, weaponid, bodypart);
- return 0;
- }
- public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
- {
- #if WC_CUSTOM_VENDING_MACHINES
- if (s_VendingUseTimer[playerid] != -1) {
- KillTimer(s_VendingUseTimer[playerid]);
- s_VendingUseTimer[playerid] = -1;
- }
- #endif
- s_LastShot[playerid][e_Valid] = false;
- s_LastShot[playerid][e_Hits] = false;
- if (s_CbugFroze[playerid] && GetTickCount() - s_CbugFroze[playerid] < 900) {
- return 0;
- }
- s_CbugFroze[playerid] = 0;
- new damagedid = INVALID_PLAYER_ID;
- if (hittype == BULLET_HIT_TYPE_PLAYER && hitid != INVALID_PLAYER_ID) {
- if (!IsPlayerConnected(hitid)) {
- AddRejectedHit(playerid, hitid, HIT_DISCONNECTED, weaponid, hitid);
- return 0;
- }
- damagedid = hitid;
- }
- if (hittype < 0 || hittype > 5) {
- AddRejectedHit(playerid, damagedid, HIT_INVALID_HITTYPE, weaponid, hittype);
- return 0;
- }
- #if WC_DEBUG
- if (hittype == BULLET_HIT_TYPE_PLAYER) {
- DebugMessage(playerid, "OnPlayerWeaponShot(%d shot %d with %d at %f, %f, %f)", playerid, hitid, weaponid, fX, fY, fZ);
- } else if (hittype) {
- DebugMessage(playerid, "OnPlayerWeaponShot(%d shot %d %d with %d at %f, %f, %f)", playerid, hittype, hitid, weaponid, fX, fY, fZ);
- } else {
- DebugMessage(playerid, "OnPlayerWeaponShot(%d shot with %d at %f, %f, %f)", playerid, weaponid, fX, fY, fZ);
- }
- #endif
- if (s_BeingResynced[playerid]) {
- AddRejectedHit(playerid, damagedid, HIT_BEING_RESYNCED, weaponid);
- return 0;
- }
- if (!IsPlayerSpawned(playerid)) {
- AddRejectedHit(playerid, damagedid, HIT_NOT_SPAWNED, weaponid);
- return 0;
- }
- if (!IsBulletWeapon(weaponid)) {
- AddRejectedHit(playerid, damagedid, HIT_INVALID_WEAPON, weaponid);
- return 0;
- }
- new Float:fOriginX, Float:fOriginY, Float:fOriginZ, Float:fHitPosX, Float:fHitPosY, Float:fHitPosZ;
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerLastShotVectors(playerid, fOriginX, fOriginY, fOriginZ, fHitPosX, fHitPosY, fHitPosZ);
- new Float:length = VectorSize(fOriginX - fHitPosX, fOriginY - fHitPosY, fOriginZ - fHitPosZ);
- new Float:origin_dist = VectorSize(fOriginX - x, fOriginY - y, fOriginZ - z);
- if (origin_dist > 15.0) {
- new in_veh = IsPlayerInAnyVehicle(hitid) || GetPlayerSurfingVehicleID(playerid);
- if ((!in_veh && GetPlayerSurfingVehicleID(playerid) == INVALID_VEHICLE_ID) || origin_dist > 50.0) {
- AddRejectedHit(playerid, damagedid, HIT_TOO_FAR_FROM_ORIGIN, weaponid, _:origin_dist);
- return 0;
- }
- }
- // Shot exceeding the max range?
- if (hittype != BULLET_HIT_TYPE_NONE) {
- if (length > s_WeaponRange[weaponid]) {
- if (hittype == BULLET_HIT_TYPE_PLAYER) {
- AddRejectedHit(playerid, damagedid, HIT_OUT_OF_RANGE, weaponid, _:length, _:s_WeaponRange[weaponid]);
- }
- return 0;
- }
- if (hittype == BULLET_HIT_TYPE_PLAYER) {
- if (IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleID(playerid) == GetPlayerVehicleID(hitid)) {
- AddRejectedHit(playerid, damagedid, HIT_SAME_VEHICLE, weaponid);
- return 0;
- }
- new Float:dist = GetPlayerDistanceFromPoint(hitid, fHitPosX, fHitPosY, fHitPosZ);
- new in_veh = IsPlayerInAnyVehicle(hitid);
- if ((!in_veh && dist > 20.0) || dist > 50.0) {
- AddRejectedHit(playerid, damagedid, HIT_TOO_FAR_FROM_SHOT, weaponid, _:dist);
- return 0;
- }
- }
- }
- new tick = GetTickCount();
- if (tick == 0) tick = 1;
- new idx = (s_LastShotIdx[playerid] + 1) % sizeof(s_LastShotTicks[]);
- // JIT plugin fix
- if (idx < 0) {
- idx += sizeof(s_LastShotTicks[]);
- }
- s_LastShotIdx[playerid] = idx;
- s_LastShotTicks[playerid][idx] = tick;
- s_LastShotWeapons[playerid][idx] = weaponid;
- s_ShotsFired[playerid] += 1;
- #if WC_DEBUG
- if (s_ShotsFired[playerid] > 1) {
- new prev_tick_idx = (idx - 1) % sizeof(s_LastShotTicks[]);
- // JIT plugin fix
- if (prev_tick_idx < 0) {
- prev_tick_idx += sizeof(s_LastShotTicks[]);
- }
- new prev_tick = s_LastShotTicks[playerid][prev_tick_idx];
- DebugMessage(playerid, "(shot) last: %d last 3: %d", tick - prev_tick, AverageShootRate(playerid, 3));
- }
- #endif
- s_LastShot[playerid][e_Tick] = tick;
- s_LastShot[playerid][e_Weapon] = weaponid;
- s_LastShot[playerid][e_HitType] = hittype;
- s_LastShot[playerid][e_HitId] = hitid;
- s_LastShot[playerid][e_X] = fX;
- s_LastShot[playerid][e_Y] = fY;
- s_LastShot[playerid][e_Z] = fZ;
- s_LastShot[playerid][e_OX] = fOriginX;
- s_LastShot[playerid][e_OY] = fOriginY;
- s_LastShot[playerid][e_OZ] = fOriginZ;
- s_LastShot[playerid][e_HX] = fHitPosX;
- s_LastShot[playerid][e_HY] = fHitPosY;
- s_LastShot[playerid][e_HZ] = fHitPosZ;
- s_LastShot[playerid][e_Length] = length;
- s_LastShot[playerid][e_Hits] = 0;
- new multiple_weapons;
- new avg_rate = AverageShootRate(playerid, s_MaxShootRateSamples, multiple_weapons);
- // Bullet flood?
- // Could be either a cheat or just lag
- if (avg_rate != -1) {
- if (multiple_weapons) {
- if (avg_rate < 100) {
- AddRejectedHit(playerid, damagedid, SHOOTING_RATE_TOO_FAST_MULTIPLE, weaponid, avg_rate, s_MaxShootRateSamples);
- return 0;
- }
- } else if (s_MaxWeaponShootRate[weaponid] - avg_rate > 20) {
- AddRejectedHit(playerid, damagedid, SHOOTING_RATE_TOO_FAST, weaponid, avg_rate, s_MaxShootRateSamples, s_MaxWeaponShootRate[weaponid]);
- return 0;
- }
- }
- // Destroy vehicles with passengers in them
- if (hittype == BULLET_HIT_TYPE_VEHICLE) {
- if (hitid < 0 || hitid > MAX_VEHICLES || !WC_IsValidVehicle(hitid)) {
- AddRejectedHit(playerid, damagedid, HIT_INVALID_VEHICLE, weaponid, hitid);
- return 0;
- }
- new vehicleid = GetPlayerVehicleID(playerid);
- // Shouldn't be possible to damage the vehicle you're in
- if (hitid == vehicleid) {
- AddRejectedHit(playerid, damagedid, HIT_OWN_VEHICLE, weaponid);
- return 0;
- }
- if (s_VehiclePassengerDamage) {
- new has_driver = false;
- new has_passenger = false;
- for (new otherid = 0; otherid < MAX_PLAYERS; otherid++) {
- if (otherid == playerid || !IsPlayerConnected(otherid)) {
- continue;
- }
- if (GetPlayerVehicleID(otherid) != hitid) {
- continue;
- }
- new seat = GetPlayerVehicleSeat(otherid);
- if (seat == 0) {
- has_driver = true;
- } else {
- has_passenger = true;
- }
- }
- if (!has_driver && has_passenger) {
- new Float:health;
- GetVehicleHealth(hitid, health);
- if (WEAPON_SHOTGUN <= weaponid <= WEAPON_SHOTGSPA) {
- health -= 120.0;
- } else {
- health -= s_WeaponDamage[weaponid] * 3.0;
- }
- if (health <= 0.0) {
- health = 0.0;
- }
- SetVehicleHealth(hitid, health);
- }
- }
- if (s_VehicleUnoccupiedDamage) {
- new has_occupent = false;
- for (new otherid = 0; otherid < MAX_PLAYERS; otherid++) {
- if (otherid == playerid || !IsPlayerConnected(otherid)) {
- continue;
- }
- if (GetPlayerVehicleID(otherid) != hitid) {
- continue;
- }
- has_occupent = true;
- }
- if (!has_occupent) {
- new Float:health;
- GetVehicleHealth(hitid, health);
- if (health >= 249.0) { //vehicles start on fire at 249 or under so theres no need to check once the vehicle is at or below 250
- if (WEAPON_SHOTGUN <= weaponid <= WEAPON_SHOTGSPA) {
- health -= 120.0;
- } else {
- health -= s_WeaponDamage[weaponid] * 3.0;
- }
- if (health <= 249.0) {
- if (s_VehicleRespawnTimer[hitid] == -1) {
- health = 249.0;
- s_VehicleRespawnTimer[hitid] = SetTimerEx("WC_KillVehicle", 6000, false, "ii", hitid, playerid);
- }
- }
- SetVehicleHealth(hitid, health);
- }
- }
- }
- }
- new retval = 1;
- #if defined WC_OnPlayerWeaponShot
- retval = WC_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, fX, fY, fZ);
- #else
- retval = 1;
- #endif
- s_LastShot[playerid][e_Valid] = !!retval;
- // Valid shot?
- if (retval) {
- if (hittype == BULLET_HIT_TYPE_VEHICLE) {
- s_LastVehicleShooter[hitid] = playerid;
- }
- }
- return retval;
- }
- forward WC_KillVehicle(vehicleid, killerid);
- public WC_KillVehicle(vehicleid, killerid)
- {
- OnVehicleDeath(vehicleid, killerid);
- s_VehicleRespawnTimer[vehicleid] = SetTimerEx("WC_OnDeadVehicleSpawn", 10000, false, "i", vehicleid);
- return 1;
- }
- forward WC_OnDeadVehicleSpawn(vehicleid);
- public WC_OnDeadVehicleSpawn(vehicleid)
- {
- s_VehicleRespawnTimer[vehicleid] = -1;
- return SetVehicleToRespawn(vehicleid);
- }
- public OnVehicleSpawn(vehicleid)
- {
- if (s_VehicleRespawnTimer[vehicleid] != -1) {
- KillTimer(s_VehicleRespawnTimer[vehicleid]);
- s_VehicleRespawnTimer[vehicleid] = -1;
- }
- s_VehicleAlive[vehicleid] = true;
- #if defined WC_OnVehicleSpawn
- return WC_OnVehicleSpawn(vehicleid);
- #else
- return 1;
- #endif
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- if (s_VehicleRespawnTimer[vehicleid] != -1) {
- KillTimer(s_VehicleRespawnTimer[vehicleid]);
- s_VehicleRespawnTimer[vehicleid] = -1;
- }
- if (s_VehicleAlive[vehicleid]) {
- s_VehicleAlive[vehicleid] = false;
- #if defined WC_OnVehicleDeath
- return WC_OnVehicleDeath(vehicleid, killerid);
- #else
- return 1;
- #endif
- }
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- if (!IsPlayerSpawned(playerid)) {
- return 1;
- }
- #if defined WC_OnPlayerEnterCheckpoint
- return WC_OnPlayerEnterCheckpoint(playerid);
- #else
- return 1;
- #endif
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- // If they're dying, it will be called in PlayerDeath (when the death anim begins)
- if (s_IsDying[playerid]) {
- return 1;
- }
- #if defined WC_OnPlayerLeaveCheckpoint
- return WC_OnPlayerLeaveCheckpoint(playerid);
- #else
- return 1;
- #endif
- }
- /*
- * Internal functions
- */
- static ScriptInit()
- {
- s_LagCompMode = GetServerVarAsInt("lagcompmode");
- if (s_LagCompMode) {
- SetKnifeSync(false);
- } else {
- s_DamageTakenSound = 0;
- SetKnifeSync(true);
- }
- for (new i = 0; i < sizeof(s_ClassSpawnInfo); i++) {
- s_ClassSpawnInfo[i][e_Skin] = -1;
- }
- s_HealthBarBorder = TextDrawCreate(610.01, 68.25, "\1");
- if (s_HealthBarBorder == Text:INVALID_TEXT_DRAW) {
- printf("(wc) WARN: Unable to create healthbar border textdraw");
- } else {
- s_InternalTextDraw[s_HealthBarBorder] = true;
- TextDrawUseBox (s_HealthBarBorder, 1);
- TextDrawLetterSize(s_HealthBarBorder, 0.0, 0.64);
- TextDrawTextSize (s_HealthBarBorder, 543.75, 0.0);
- TextDrawBoxColor (s_HealthBarBorder, 0x000000FF);
- }
- s_HealthBarBackground = TextDrawCreate(608.01, 70.25, "\1");
- if (s_HealthBarBackground == Text:INVALID_TEXT_DRAW) {
- printf("(wc) WARN: Unable to create healthbar background textdraw");
- } else {
- s_InternalTextDraw[s_HealthBarBackground] = true;
- TextDrawUseBox (s_HealthBarBackground, 1);
- TextDrawLetterSize(s_HealthBarBackground, 0.0, 0.2);
- TextDrawTextSize (s_HealthBarBackground, 545.75, 0.0);
- TextDrawBoxColor (s_HealthBarBackground, 0x5A0C10FF);
- }
- #if WC_CUSTOM_VENDING_MACHINES
- if (s_CustomVendingMachines) {
- CreateVendingMachines();
- }
- #endif
- new tick = GetTickCount();
- for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) {
- if (!IsPlayerConnected(playerid)) {
- continue;
- }
- new team = GetPlayerTeam(playerid);
- if (team == 0xFE) {
- s_PlayerTeam[playerid] = NO_TEAM;
- } else {
- s_PlayerTeam[playerid] = team;
- }
- SetPlayerTeam(playerid, 0xFE);
- DamageFeedUpdate(playerid);
- new worldid = GetPlayerVirtualWorld(playerid);
- if (worldid == WC_DEATH_WORLD) {
- worldid = 0;
- SetPlayerVirtualWorld(playerid, worldid);
- }
- s_World[playerid] = worldid;
- s_LastUpdate[playerid] = tick;
- s_DamageFeedLastUpdate[playerid] = tick;
- s_LastStop[playerid] = tick;
- s_LastVehicleEnterTime[playerid] = 0;
- s_TrueDeath[playerid] = true;
- s_InClassSelection[playerid] = true;
- s_PlayerFallbackSpawnInfo[playerid][e_Skin] = -1;
- s_AlreadyConnected[playerid] = true;
- #if WC_CUSTOM_VENDING_MACHINES
- RemoveDefaultVendingMachines(playerid);
- #endif
- if (PLAYER_STATE_ONFOOT <= GetPlayerState(playerid) <= PLAYER_STATE_PASSENGER) {
- GetPlayerHealth(playerid, s_PlayerHealth[playerid]);
- GetPlayerArmour(playerid, s_PlayerArmour[playerid]);
- if (s_PlayerHealth[playerid] == 0.0) {
- s_PlayerHealth[playerid] = s_PlayerMaxHealth[playerid];
- }
- UpdateHealthBar(playerid);
- }
- switch (GetPlayerState(playerid)) {
- case PLAYER_STATE_ONFOOT,
- PLAYER_STATE_DRIVER,
- PLAYER_STATE_PASSENGER,
- PLAYER_STATE_SPAWNED: {
- SetHealthBarVisible(playerid, true);
- }
- default: {
- SetHealthBarVisible(playerid, false);
- }
- }
- }
- }
- static ScriptExit()
- {
- SetKnifeSync(true);
- #if WC_CUSTOM_VENDING_MACHINES
- DestroyVendingMachines();
- #endif
- for (new playerid = 0; playerid < MAX_PLAYERS; playerid++) {
- #if WC_CUSTOM_VENDING_MACHINES
- if (s_VendingUseTimer[playerid] != -1) {
- KillTimer(s_VendingUseTimer[playerid]);
- s_VendingUseTimer[playerid] = -1;
- }
- #endif
- if (!IsPlayerConnected(playerid)) {
- continue;
- }
- // Put things back the way they were
- SetPlayerTeam(playerid, s_PlayerTeam[playerid]);
- if (PLAYER_STATE_ONFOOT <= GetPlayerState(playerid) <= PLAYER_STATE_PASSENGER) {
- new Float:health = s_PlayerHealth[playerid];
- if (health == 0.0) {
- health = s_PlayerMaxHealth[playerid];
- }
- SetPlayerHealth(playerid, health);
- SetPlayerArmour(playerid, s_PlayerArmour[playerid]);
- }
- SetFakeHealth(playerid, 255);
- SetFakeArmour(playerid, 255);
- FreezeSyncData(playerid, false);
- SetFakeFacingAngle(playerid, _);
- SetHealthBarVisible(playerid, false);
- if (s_HealthBarForeground[playerid] != PlayerText:INVALID_TEXT_DRAW) {
- PlayerTextDrawDestroy(playerid, s_HealthBarForeground[playerid]);
- s_InternalPlayerTextDraw[playerid][s_HealthBarForeground[playerid]] = false;
- s_HealthBarForeground[playerid] = PlayerText:INVALID_TEXT_DRAW;
- }
- if (s_DamageFeedGiven[playerid] != PlayerText:INVALID_TEXT_DRAW) {
- PlayerTextDrawDestroy(playerid, s_DamageFeedGiven[playerid]);
- s_InternalPlayerTextDraw[playerid][s_DamageFeedGiven[playerid]] = false;
- s_DamageFeedGiven[playerid] = PlayerText:INVALID_TEXT_DRAW;
- }
- if (s_DamageFeedTaken[playerid] != PlayerText:INVALID_TEXT_DRAW) {
- PlayerTextDrawDestroy(playerid, s_DamageFeedTaken[playerid]);
- s_InternalPlayerTextDraw[playerid][s_DamageFeedTaken[playerid]] = false;
- s_DamageFeedTaken[playerid] = PlayerText:INVALID_TEXT_DRAW;
- }
- }
- if (s_HealthBarBorder != Text:INVALID_TEXT_DRAW) {
- TextDrawDestroy(s_HealthBarBorder);
- s_InternalTextDraw[s_HealthBarBorder] = false;
- }
- if (s_HealthBarBackground != Text:INVALID_TEXT_DRAW) {
- TextDrawDestroy(s_HealthBarBackground);
- s_InternalTextDraw[s_HealthBarBackground] = false;
- }
- }
- static UpdatePlayerVirtualWorld(playerid)
- {
- new worldid = GetPlayerVirtualWorld(playerid);
- if (worldid == WC_DEATH_WORLD) {
- worldid = s_World[playerid];
- } else if (worldid != s_World[playerid]) {
- s_World[playerid] = worldid;
- }
- SetPlayerVirtualWorld(playerid, worldid);
- }
- static HasSameTeam(playerid, otherid)
- {
- if (otherid < 0 || otherid >= MAX_PLAYERS || playerid < 0 || playerid >= MAX_PLAYERS) {
- return 0;
- }
- if (s_PlayerTeam[playerid] == NO_TEAM || s_PlayerTeam[otherid] == NO_TEAM) {
- return 0;
- }
- return (s_PlayerTeam[playerid] == s_PlayerTeam[otherid]);
- }
- static IsPlayerPaused(playerid)
- {
- return (GetTickCount() - s_LastUpdate[playerid] > 2000);
- }
- static UpdateHealthBar(playerid, bool:force = false)
- {
- if (s_BeingResynced[playerid] || s_ForceClassSelection[playerid]) {
- return;
- }
- new health = floatround(s_PlayerHealth[playerid] / s_PlayerMaxHealth[playerid] * 100.0, floatround_ceil);
- new armour = floatround(s_PlayerArmour[playerid] / s_PlayerMaxArmour[playerid] * 100.0, floatround_ceil);
- // Make the values reflect what the client should see
- if (s_IsDying[playerid]) {
- health = 0;
- armour = 0;
- } else {
- if (health > 100) {
- health = 100;
- }
- if (armour > 100) {
- armour = 100;
- }
- }
- if (force) {
- s_LastSentHealth[playerid] = -1;
- s_LastSentArmour[playerid] = -1;
- } else if (s_HealthBarVisible[playerid] && s_HealthBarForeground[playerid] == PlayerText:INVALID_TEXT_DRAW && !s_IsDying[playerid]) {
- s_LastSentHealth[playerid] = -1;
- } else if (health == s_LastSentHealth[playerid] && armour == s_LastSentArmour[playerid]) {
- return;
- }
- SetFakeHealth(playerid, health);
- SetFakeArmour(playerid, armour);
- UpdateSyncData(playerid);
- if (health != s_LastSentHealth[playerid]) {
- s_LastSentHealth[playerid] = health;
- SetPlayerHealth(playerid, 8000000.0 + float(health));
- if (s_HealthBarVisible[playerid] && !s_IsDying[playerid]) {
- if (s_HealthBarForeground[playerid] == PlayerText:INVALID_TEXT_DRAW) {
- s_HealthBarForeground[playerid] = CreatePlayerTextDraw(
- playerid,
- 551.5 + float(health) * 0.5651,
- 70.25,
- "\1"
- );
- if (s_HealthBarForeground[playerid] == PlayerText:INVALID_TEXT_DRAW) {
- printf("(wc) WARN: Unable to create player healthbar foreground");
- } else {
- s_InternalPlayerTextDraw[playerid][s_HealthBarForeground[playerid]] = true;
- PlayerTextDrawUseBox (playerid, s_HealthBarForeground[playerid], 1);
- PlayerTextDrawLetterSize(playerid, s_HealthBarForeground[playerid], 0.0, 0.2);
- PlayerTextDrawTextSize (playerid, s_HealthBarForeground[playerid], 545.75, 0.0);
- PlayerTextDrawBoxColor (playerid, s_HealthBarForeground[playerid], 0xB51821FF);
- PlayerTextDrawShow(playerid, s_HealthBarForeground[playerid]);
- }
- } else {
- PlayerTextDrawSetPosition(playerid, s_HealthBarForeground[playerid], 551.5 + float(health) * 0.5651, 70.25);
- PlayerTextDrawShow(playerid, s_HealthBarForeground[playerid]);
- }
- } else if (s_HealthBarForeground[playerid] != PlayerText:INVALID_TEXT_DRAW) {
- PlayerTextDrawDestroy(playerid, s_HealthBarForeground[playerid]);
- s_InternalPlayerTextDraw[playerid][s_HealthBarForeground[playerid]] = false;
- s_HealthBarForeground[playerid] = PlayerText:INVALID_TEXT_DRAW;
- }
- }
- if (armour != s_LastSentArmour[playerid]) {
- s_LastSentArmour[playerid] = armour;
- SetPlayerArmour(playerid, float(armour));
- }
- }
- static SetHealthBarVisible(playerid, bool:toggle)
- {
- if (s_HealthBarVisible[playerid] == toggle) {
- return;
- }
- s_HealthBarVisible[playerid] = toggle;
- if (toggle) {
- if (s_HealthBarBorder != Text:INVALID_TEXT_DRAW) {
- TextDrawShowForPlayer(playerid, s_HealthBarBorder);
- }
- if (s_HealthBarBackground != Text:INVALID_TEXT_DRAW) {
- TextDrawShowForPlayer(playerid, s_HealthBarBackground);
- }
- UpdateHealthBar(playerid, true);
- } else {
- if (s_HealthBarForeground[playerid] != PlayerText:INVALID_TEXT_DRAW) {
- PlayerTextDrawHide(playerid, s_HealthBarForeground[playerid]);
- }
- if (s_HealthBarBorder != Text:INVALID_TEXT_DRAW) {
- TextDrawHideForPlayer(playerid, s_HealthBarBorder);
- }
- if (s_HealthBarBackground != Text:INVALID_TEXT_DRAW) {
- TextDrawHideForPlayer(playerid, s_HealthBarBackground);
- }
- }
- }
- static SpawnPlayerInPlace(playerid) {
- new Float:x, Float:y, Float:z, Float:r;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, r);
- SetSpawnInfo(playerid, 0xFE, GetPlayerSkin(playerid), x, y, z, r, 0, 0, 0, 0, 0, 0);
- s_SpawnInfoModified[playerid] = true;
- SpawnPlayer(playerid);
- }
- static PosInFront(playerid, Float:distance, &Float:x, &Float:y, &Float:z)
- {
- new Float:a;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, a);
- x += (distance * floatsin(-a, degrees));
- y += (distance * floatcos(-a, degrees));
- }
- static Float:AngleBetweenPoints(Float:x1, Float:y1, Float:x2, Float:y2)
- {
- return -(90.0 - atan2(y1 - y2, x1 - x2));
- }
- static UpdateSyncData(playerid)
- {
- // Currently re-sending onfoot data is only supported
- if (!IsPlayerConnected(playerid) || GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) {
- return;
- }
- for (new i = 0; i < MAX_PLAYERS; i++) {
- if (i != playerid && IsPlayerConnected(i) && IsPlayerStreamedIn(playerid, i)) {
- SendLastSyncData(playerid, i);
- }
- }
- }
- static WasPlayerInVehicle(playerid, time) {
- if (!s_LastVehicleTick[playerid]) {
- return 0;
- }
- if (GetTickCount() - time < s_LastVehicleTick[playerid]) {
- return 1;
- }
- return 0;
- }
- #if WC_CUSTOM_VENDING_MACHINES
- static RemoveDefaultVendingMachines(playerid)
- {
- RemoveBuildingForPlayer(playerid, 955, 0.0, 0.0, 0.0, 20000.0); // CJ_EXT_SPRUNK
- RemoveBuildingForPlayer(playerid, 956, 0.0, 0.0, 0.0, 20000.0); // CJ_EXT_CANDY
- RemoveBuildingForPlayer(playerid, 1209, 0.0, 0.0, 0.0, 20000.0); // vendmach
- RemoveBuildingForPlayer(playerid, 1302, 0.0, 0.0, 0.0, 20000.0); // vendmachfd
- RemoveBuildingForPlayer(playerid, 1775, 0.0, 0.0, 0.0, 20000.0); // CJ_SPRUNK1
- RemoveBuildingForPlayer(playerid, 1776, 0.0, 0.0, 0.0, 20000.0); // CJ_CANDYVENDOR
- RemoveBuildingForPlayer(playerid, 1977, 0.0, 0.0, 0.0, 20000.0); // vendin3
- // Make sure they're all gone..
- for (new i = 0; i < sizeof(sc_VendingMachines); i++) {
- RemoveBuildingForPlayer(
- playerid,
- sc_VendingMachines[i][e_Model],
- sc_VendingMachines[i][e_PosX],
- sc_VendingMachines[i][e_PosY],
- sc_VendingMachines[i][e_PosZ],
- 1.0
- );
- }
- }
- static CreateVendingMachines()
- {
- DestroyVendingMachines();
- for (new i = 0; i < sizeof(sc_VendingMachines); i++) {
- #if WC_USE_STREAMER
- s_VendingMachineObject[i] = CreateDynamicObject(
- sc_VendingMachines[i][e_Model],
- sc_VendingMachines[i][e_PosX],
- sc_VendingMachines[i][e_PosY],
- sc_VendingMachines[i][e_PosZ],
- sc_VendingMachines[i][e_RotX],
- sc_VendingMachines[i][e_RotY],
- sc_VendingMachines[i][e_RotZ],
- .interiorid = sc_VendingMachines[i][e_Interior]
- );
- #else
- s_VendingMachineObject[i] = CreateObject(
- sc_VendingMachines[i][e_Model],
- sc_VendingMachines[i][e_PosX],
- sc_VendingMachines[i][e_PosY],
- sc_VendingMachines[i][e_PosZ],
- sc_VendingMachines[i][e_RotX],
- sc_VendingMachines[i][e_RotY],
- sc_VendingMachines[i][e_RotZ]
- );
- #endif
- }
- }
- static DestroyVendingMachines()
- {
- for (new i = 0; i < sizeof(s_VendingMachineObject); i++) {
- if (s_VendingMachineObject[i] != -1) {
- #if WC_USE_STREAMER
- DestroyDynamicObject(s_VendingMachineObject[i]);
- #else
- DestroyObject(s_VendingMachineObject[i]);
- #endif
- s_VendingMachineObject[i] = -1;
- }
- }
- }
- #endif
- forward WC_DeathSkipEnd(playerid);
- public WC_DeathSkipEnd(playerid)
- {
- TogglePlayerControllable(playerid, true);
- ResetPlayerWeapons(playerid);
- for (new i = 0; i < 13; i++) {
- if (s_SyncData[playerid][e_WeaponId][i]) {
- GivePlayerWeapon(playerid, s_SyncData[playerid][e_WeaponId][i], s_SyncData[playerid][e_WeaponAmmo][i]);
- }
- }
- GivePlayerWeapon(playerid, s_SyncData[playerid][e_Weapon], 0);
- SetPlayerSpecialAction(playerid, 0);
- }
- forward WC_SpawnForStreamedIn(playerid);
- public WC_SpawnForStreamedIn(playerid)
- {
- if (!IsPlayerConnected(playerid)) {
- return;
- }
- SpawnPlayerForWorld(playerid);
- for (new i = 0; i < MAX_PLAYERS; i++) {
- if (i != playerid && IsPlayerConnected(i) && IsPlayerStreamedIn(playerid, i)) {
- SendLastSyncData(playerid, i);
- ClearAnimationsForPlayer(playerid, i);
- }
- }
- }
- forward WC_SetSpawnForStreamedIn(playerid);
- public WC_SetSpawnForStreamedIn(playerid)
- {
- s_SpawnForStreamedIn[playerid] = true;
- }
- forward WC_SpawnPlayerInPlace(playerid);
- public WC_SpawnPlayerInPlace(playerid)
- {
- SpawnPlayerInPlace(playerid);
- }
- static ProcessDamage(&playerid, &issuerid, &Float:amount, &weaponid, &bodypart, &Float:bullets)
- {
- if (amount < 0.0) {
- return WC_INVALID_DAMAGE;
- }
- // Adjust invalid amounts caused by an animation bug
- switch (amount) {
- case 3.63000011444091796875,
- 5.940000057220458984375,
- 5.610000133514404296875: {
- amount = 2.6400001049041748046875;
- }
- case 3.30000019073486328125: {
- if (weaponid != WEAPON_SHOTGUN && weaponid != WEAPON_SAWEDOFF) {
- amount = 2.6400001049041748046875;
- }
- }
- case 4.950000286102294921875: {
- if (IsMeleeWeapon(weaponid)) {
- amount = 2.6400001049041748046875;
- }
- }
- case 6.270000457763671875,
- 6.93000030517578125,
- 7.2600002288818359375,
- 7.9200000762939453125,
- 8.5799999237060546875,
- 9.24000072479248046875,
- 11.88000011444091796875,
- 11.22000026702880859375: {
- amount = 2.6400001049041748046875;
- }
- case 9.90000057220458984375: {
- switch (weaponid) {
- case WEAPON_VEHICLE, WEAPON_VEHICLE_M4, WEAPON_AK47,
- WEAPON_M4, WEAPON_SHOTGUN, WEAPON_SAWEDOFF, WEAPON_SHOTGSPA: {}
- default: {
- amount = 6.6000003814697265625;
- }
- }
- }
- }
- // Car parking
- if (weaponid == WEAPON_HELIBLADES && _:amount != _:330.0) {
- weaponid = WEAPON_CARPARK;
- }
- // Finish processing drown/fire/carpark quickly, since they are sent at very high rates
- if (IsHighRateWeapon(weaponid)) {
- // Apply reasonable bounds
- if (weaponid == WEAPON_DROWN) {
- if (amount > 10.0) amount = 10.0;
- } else if (amount > 1.0) {
- amount = 1.0;
- }
- // Adjust the damage if the multiplier is not 1.0
- if (_:s_WeaponDamage[weaponid] != _:1.0) {
- amount *= s_WeaponDamage[weaponid];
- }
- // Make sure the distance and issuer is valid; carpark can be self-inflicted so it doesn't require an issuer
- if (weaponid == WEAPON_SPRAYCAN || weaponid == WEAPON_FIREEXTINGUISHER || (weaponid == WEAPON_CARPARK && issuerid != INVALID_PLAYER_ID)) {
- if (issuerid == INVALID_PLAYER_ID) {
- return WC_NO_ISSUER;
- }
- new Float:x, Float:y, Float:z, Float:dist;
- GetPlayerPos(issuerid, x, y, z);
- dist = GetPlayerDistanceFromPoint(playerid, x, y, z);
- if (dist > 15.0) {
- AddRejectedHit(issuerid, playerid, HIT_TOO_FAR_FROM_ORIGIN, weaponid, _:dist);
- return WC_INVALID_DISTANCE;
- }
- }
- return WC_NO_ERROR;
- }
- // Bullet or melee damage must have an issuerid, otherwise something has gone wrong (e.g. sniper bug)
- if (issuerid == INVALID_PLAYER_ID && (IsBulletWeapon(weaponid) || IsMeleeWeapon(weaponid))) {
- return WC_NO_ISSUER;
- }
- // Punching with a parachute
- if (weaponid == WEAPON_PARACHUTE) {
- weaponid = WEAPON_UNARMED;
- }
- // Collision damage should never be above 165
- if (weaponid == WEAPON_COLLISION) {
- if (amount > 165.0) {
- amount = 1.0;
- } else {
- amount /= 165.0;
- }
- }
- if (weaponid == WEAPON_EXPLOSION) {
- // Explosions do at most 82.5 damage. This will later be multipled by the damage value
- amount /= 82.5;
- // Figure out what caused the explosion
- if (issuerid != INVALID_PLAYER_ID && s_LastExplosive[issuerid]) {
- weaponid = s_LastExplosive[issuerid];
- }
- }
- // Check for pistol whip
- switch (weaponid) {
- case WEAPON_COLT45 .. WEAPON_SNIPER,
- WEAPON_MINIGUN, WEAPON_SPRAYCAN, WEAPON_FIREEXTINGUISHER: {
- // A pistol whip inflicts 2.64 damage
- if (_:amount == _:2.6400001049041748046875) {
- // Save the weapon in the bodypart argument (it's always BODY_PART_TORSO)
- bodypart = weaponid;
- weaponid = WEAPON_PISTOLWHIP;
- }
- }
- }
- new melee = IsMeleeWeapon(weaponid);
- // Can't punch from a vehicle
- if (melee && IsPlayerInAnyVehicle(issuerid)) {
- return WC_INVALID_DAMAGE;
- }
- if (weaponid != WEAPON_PISTOLWHIP) {
- switch (amount) {
- case 1.32000005245208740234375,
- 1.650000095367431640625,
- 1.980000019073486328125,
- 2.3100001811981201171875,
- 2.6400001049041748046875,
- 2.9700000286102294921875,
- 3.96000003814697265625,
- 4.28999996185302734375,
- 4.62000036239624023437,
- 5.280000209808349609375: {
- // Damage is most likely from punching and switching weapon quickly
- if (!melee) {
- DebugMessage(issuerid, "weapon changed from %d to melee (punch & swap)", weaponid);
- weaponid = WEAPON_UNARMED;
- melee = true;
- }
- }
- case 6.6000003814697265625: {
- if (!melee) {
- switch (weaponid) {
- case WEAPON_UZI, WEAPON_TEC9, WEAPON_CHAINSAW,
- WEAPON_SHOTGUN, WEAPON_SAWEDOFF: {}
- default: {
- DebugMessage(issuerid, "weapon changed from %d to melee (punch & swap)", weaponid);
- weaponid = WEAPON_UNARMED;
- melee = true;
- }
- }
- }
- }
- case 54.12000274658203125: {
- if (!melee) {
- DebugMessage(issuerid, "weapon changed from %d to melee (punch & swap)", weaponid);
- melee = true;
- weaponid = WEAPON_UNARMED;
- amount = 1.32000005245208740234375;
- }
- // Be extra sure about this one
- if (GetPlayerFightingStyle(issuerid) != FIGHT_STYLE_KNEEHEAD) {
- return WC_INVALID_DAMAGE;
- }
- }
- // Melee damage has been tampered with
- default: {
- if (melee) {
- return WC_INVALID_DAMAGE;
- }
- }
- }
- }
- if (melee) {
- new Float:x, Float:y, Float:z, Float:dist;
- GetPlayerPos(issuerid, x, y, z);
- dist = GetPlayerDistanceFromPoint(playerid, x, y, z);
- if (dist > 15.0) {
- AddRejectedHit(issuerid, playerid, HIT_TOO_FAR_FROM_ORIGIN, weaponid, _:dist);
- return WC_INVALID_DISTANCE;
- }
- }
- switch (weaponid) {
- // The spas shotguns shoot 8 bullets, each inflicting 4.95 damage
- case WEAPON_SHOTGSPA: {
- bullets = amount / 4.950000286102294921875;
- if (8.0 - bullets < -0.05) {
- return WC_INVALID_DAMAGE;
- }
- }
- // Shotguns and sawed-off shotguns shoot 15 bullets, each inflicting 3.3 damage
- case WEAPON_SHOTGUN, WEAPON_SAWEDOFF: {
- bullets = amount / 3.30000019073486328125;
- if (15.0 - bullets < -0.05) {
- return WC_INVALID_DAMAGE;
- }
- }
- }
- if (_:bullets) {
- new Float:f = floatfract(bullets);
- // The damage for each bullet has been tampered with
- if (f > 0.01 && f < 0.99) {
- return WC_INVALID_DAMAGE;
- }
- // Divide the damage amount by the number of bullets
- amount /= bullets;
- }
- // Check chainsaw damage
- if (weaponid == WEAPON_CHAINSAW) {
- switch (amount) {
- case 6.6000003814697265625,
- 13.5300006866455078125,
- 16.1700000762939453125,
- 26.40000152587890625,
- 27.060001373291015625: {}
- default: {
- return WC_INVALID_DAMAGE;
- }
- }
- }
-
- // Check deagle damage
- if (weaponid == WEAPON_DEAGLE) {
- switch (amount) {
- case 46.200000762939453125,
- 23.1000003814697265625: {}
- default: {
- return WC_INVALID_DAMAGE;
- }
- }
- }
- // Check gun damage
- new Float:def_amount = 0.0;
- switch (weaponid) {
- case WEAPON_COLT45,
- WEAPON_MP5: def_amount = 8.25;
- case WEAPON_SILENCED: def_amount = 13.200000762939453125;
- case WEAPON_UZI,
- WEAPON_TEC9: def_amount = 6.6000003814697265625;
- case WEAPON_AK47,
- WEAPON_M4,
- WEAPON_VEHICLE_M4: def_amount = 9.90000057220458984375;
- case WEAPON_RIFLE: def_amount = 24.7500019073486328125;
- case WEAPON_SNIPER: def_amount = 41.25;
- case WEAPON_MINIGUN,
- WEAPON_VEHICLE_MINIGUN: def_amount = 46.200000762939453125;
- case WEAPON_VEHICLE: def_amount = 9.90000057220458984375;
- }
- if (_:def_amount && _:def_amount != _:amount) {
- return WC_INVALID_DAMAGE;
- }
- // Adjust the damage
- switch (s_DamageType[weaponid]) {
- case DAMAGE_TYPE_MULTIPLIER: {
- if (_:s_WeaponDamage[weaponid] != _:1.0) {
- amount *= s_WeaponDamage[weaponid];
- }
- }
- case DAMAGE_TYPE_STATIC: {
- if (_:bullets) {
- amount = s_WeaponDamage[weaponid] * bullets;
- } else {
- amount = s_WeaponDamage[weaponid];
- }
- }
- case DAMAGE_TYPE_RANGE,
- DAMAGE_TYPE_RANGE_MULTIPLIER: {
- new Float:length = s_LastShot[issuerid][e_Length];
- for (new i = s_DamageRangeSteps[weaponid] - 1; i >= 0; i--) {
- if (i == 0 || length >= s_DamageRangeRanges[weaponid][i]) {
- if (s_DamageType[weaponid] == DAMAGE_TYPE_RANGE_MULTIPLIER) {
- if (_:s_DamageRangeValues[weaponid][i] != _:1.0) {
- amount *= s_DamageRangeValues[weaponid][i];
- }
- } else {
- if (_:bullets) {
- amount = s_DamageRangeValues[weaponid][i] * bullets;
- } else {
- amount = s_DamageRangeValues[weaponid][i];
- }
- }
- break;
- }
- }
- }
- }
- return WC_NO_ERROR;
- }
- static InflictDamage(playerid, Float:amount, issuerid = INVALID_PLAYER_ID, weaponid = WEAPON_UNKNOWN, bodypart = BODY_PART_UNKNOWN, bool:ignore_armour = false)
- {
- if (!IsPlayerSpawned(playerid) || amount < 0.0) {
- return;
- }
- if (!OnPlayerDamage(playerid, amount, issuerid, weaponid, bodypart)) {
- UpdateHealthBar(playerid);
- if (weaponid < 0 || weaponid > WEAPON_UNKNOWN) {
- weaponid = WEAPON_UNKNOWN;
- }
- #if WC_DEBUG
- new Float:length = 0.0;
- if (issuerid != INVALID_PLAYER_ID) {
- if (IsBulletWeapon(weaponid)) {
- length = s_LastShot[issuerid][e_Length];
- }
- }
- if (!IsHighRateWeapon(weaponid)) {
- DebugMessageAll("!InflictDamage(%d, %.4f, %d, %d, %d) length = %f", playerid, amount, issuerid, weaponid, bodypart, length);
- }
- #endif
- return;
- }
- if (weaponid < 0 || weaponid > WEAPON_UNKNOWN) {
- weaponid = WEAPON_UNKNOWN;
- }
- #if WC_DEBUG
- new Float:length = 0.0;
- if (issuerid != INVALID_PLAYER_ID) {
- if (IsBulletWeapon(weaponid)) {
- length = s_LastShot[issuerid][e_Length];
- }
- }
- if (!IsHighRateWeapon(weaponid)) {
- DebugMessageAll("InflictDamage(%d, %.4f, %d, %d, %d) length = %f", playerid, amount, issuerid, weaponid, bodypart, length);
- }
- #endif
- if (!ignore_armour && weaponid != WEAPON_COLLISION && weaponid != WEAPON_DROWN && weaponid != WEAPON_CARPARK && (!s_DamageArmourToggle[0] || (s_DamageArmour[weaponid][0] && (!s_DamageArmourToggle[1] || ((s_DamageArmour[weaponid][1] && bodypart == 3) || (!s_DamageArmour[weaponid][1])))))) {
- if (amount <= 0.0) {
- amount = s_PlayerHealth[playerid] + s_PlayerArmour[playerid];
- }
- s_PlayerArmour[playerid] -= amount;
- } else {
- if (amount <= 0.0) {
- amount = s_PlayerHealth[playerid];
- }
- s_PlayerHealth[playerid] -= amount;
- }
- if (s_PlayerArmour[playerid] < 0.0) {
- s_DamageDoneArmour[playerid] = amount + s_PlayerArmour[playerid];
- s_DamageDoneHealth[playerid] = -s_PlayerArmour[playerid];
- s_PlayerHealth[playerid] += s_PlayerArmour[playerid];
- s_PlayerArmour[playerid] = 0.0;
- } else {
- s_DamageDoneArmour[playerid] = amount;
- s_DamageDoneHealth[playerid] = 0.0;
- }
- if (s_PlayerHealth[playerid] <= 0.0) {
- amount += s_PlayerHealth[playerid];
- s_DamageDoneHealth[playerid] += s_PlayerHealth[playerid];
- s_PlayerHealth[playerid] = 0.0;
- }
- OnPlayerDamageDone(playerid, amount, issuerid, weaponid, bodypart);
- if (s_PlayerHealth[playerid] <= 0.0005) {
- new vehicleid = GetPlayerVehicleID(playerid);
- if (vehicleid) {
- new modelid = GetVehicleModel(vehicleid);
- new seat = GetPlayerVehicleSeat(playerid);
- TogglePlayerControllable(playerid, false);
- switch (modelid) {
- case 509, 481, 510, 462, 448, 581, 522,
- 461, 521, 523, 463, 586, 468, 471: {
- new Float:vx, Float:vy, Float:vz;
- GetVehicleVelocity(vehicleid, vx, vy, vz);
- if (vx*vx + vy*vy + vz*vz >= 0.4) {
- PlayerDeath(playerid, "PED", "BIKE_fallR", 0);
- } else {
- PlayerDeath(playerid, "PED", "BIKE_fall_off", 0);
- }
- }
- default: {
- if (seat & 1) {
- PlayerDeath(playerid, "PED", "CAR_dead_LHS");
- } else {
- PlayerDeath(playerid, "PED", "CAR_dead_RHS");
- }
- }
- }
- } else if (GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK) {
- PlayerDeath(playerid, "PED", "KO_skid_back", .freeze_sync = false);
- } else {
- if (gettime() - s_LastVehicleEnterTime[playerid] < 10) {
- TogglePlayerControllable(playerid, false);
- }
- new anim = GetPlayerAnimationIndex(playerid);
- if (anim == 1250 || (1538 <= anim <= 1544) || weaponid == WEAPON_DROWN) {
- // In water
- PlayerDeath(playerid, "PED", "Drown");
- } else if (1195 <= anim <= 1198) {
- // Jumping animation
- PlayerDeath(playerid, "PED", "KO_skid_back");
- } else if (WEAPON_SHOTGUN <= weaponid <= WEAPON_SHOTGSPA) {
- if (IsPlayerBehindPlayer(issuerid, playerid)) {
- MakePlayerFacePlayer(playerid, issuerid, true);
- PlayerDeath(playerid, "PED", "KO_shot_front");
- } else {
- MakePlayerFacePlayer(playerid, issuerid);
- PlayerDeath(playerid, "PED", "BIKE_fall_off");
- }
- } else if (WEAPON_RIFLE <= weaponid <= WEAPON_SNIPER) {
- if (bodypart == 9) {
- PlayerDeath(playerid, "PED", "KO_shot_face");
- } else if (IsPlayerBehindPlayer(issuerid, playerid)) {
- PlayerDeath(playerid, "PED", "KO_shot_front");
- } else {
- PlayerDeath(playerid, "PED", "KO_shot_stom");
- }
- } else if (IsBulletWeapon(weaponid)) {
- if (bodypart == 9) {
- PlayerDeath(playerid, "PED", "KO_shot_face");
- } else {
- PlayerDeath(playerid, "PED", "KO_shot_front");
- }
- } else if (weaponid == WEAPON_PISTOLWHIP) {
- PlayerDeath(playerid, "PED", "KO_spin_R");
- } else if (IsMeleeWeapon(weaponid) || weaponid == WEAPON_CARPARK) {
- PlayerDeath(playerid, "PED", "KO_skid_front");
- } else if (weaponid == WEAPON_SPRAYCAN || weaponid == WEAPON_FIREEXTINGUISHER) {
- PlayerDeath(playerid, "KNIFE", "KILL_Knife_Ped_Die");
- } else {
- PlayerDeath(playerid, "PED", "KO_skid_back");
- }
- }
- #if defined WC_OnPlayerDeath
- if (s_CbugAllowed) {
- WC_OnPlayerDeath(playerid, issuerid, weaponid);
- } else {
- s_DelayedDeathTimer[playerid] = SetTimerEx(#WC_DelayedDeath, 1200, false, "iii", playerid, issuerid, weaponid);
- }
- #endif
- }
- UpdateHealthBar(playerid);
- }
- forward WC_DelayedDeath(playerid, issuerid, reason);
- public WC_DelayedDeath(playerid, issuerid, reason) {
- s_DelayedDeathTimer[playerid] = -1;
- #if defined WC_OnPlayerDeath
- WC_OnPlayerDeath(playerid, issuerid, reason);
- #endif
- }
- static PlayerDeath(playerid, animlib[32], animname[32], anim_lock = 0, respawn_time = -1, bool:freeze_sync = true, anim_freeze = 1)
- {
- s_PlayerHealth[playerid] = 0.0;
- s_PlayerArmour[playerid] = 0.0;
- s_IsDying[playerid] = true;
- new action = GetPlayerSpecialAction(playerid);
- if (action && action != SPECIAL_ACTION_DUCK) {
- if (action == SPECIAL_ACTION_USEJETPACK) {
- ClearAnimations(playerid);
- }
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- if (action == SPECIAL_ACTION_USEJETPACK) {
- new Float:vx, Float:vy, Float:vz;
- GetPlayerVelocity(playerid, vx, vy, vz);
- SetPlayerVelocity(playerid, vx, vy, vz);
- }
- }
- OnPlayerPrepareDeath(playerid, animlib, animname, anim_lock, respawn_time);
- UpdateHealthBar(playerid);
- FreezeSyncData(playerid, freeze_sync);
- if (respawn_time == -1) {
- respawn_time = s_RespawnTime;
- }
- if (animlib[0] && animname[0]) {
- ApplyAnimation(playerid, animlib, animname, 4.1, 0, anim_lock, anim_lock, anim_freeze, 0, 1);
- }
- if (s_DeathTimer[playerid] != -1) {
- KillTimer(s_DeathTimer[playerid]);
- }
- s_DeathTimer[playerid] = SetTimerEx("WC_PlayerDeathRespawn", respawn_time, false, "i", playerid);
- if (s_HealthBarForeground[playerid] != PlayerText:INVALID_TEXT_DRAW) {
- PlayerTextDrawHide(playerid, s_HealthBarForeground[playerid]);
- }
- #if defined WC_OnPlayerLeaveCheckpoint
- if (IsPlayerInCheckpoint(playerid)) {
- WC_OnPlayerLeaveCheckpoint(playerid);
- }
- #endif
- }
- public OnPlayerPrepareDeath(playerid, animlib[32], animname[32], &anim_lock, &respawn_time)
- {
- #if defined WC_OnPlayerPrepareDeath
- WC_OnPlayerPrepareDeath(playerid, animlib, animname, anim_lock, respawn_time);
- #endif
- }
- public OnRejectedHit(playerid, hit[E_REJECTED_HIT])
- {
- #if WC_DEBUG
- new output[256];
- new reason = hit[e_Reason];
- new i1 = hit[e_Info1];
- new i2 = hit[e_Info2];
- new i3 = hit[e_Info3];
- new weapon = hit[e_Weapon];
- new weapon_name[32];
- WC_GetWeaponName(weapon, weapon_name);
- format(output, sizeof(output), "(%s -> %s) %s", weapon_name, hit[e_Name], g_HitRejectReasons[reason]);
- format(output, sizeof(output), output, i1, i2, i3);
- DebugMessageRed(playerid, "Rejected hit: %s", output);
- #endif
- #if defined WC_OnRejectedHit
- WC_OnRejectedHit(playerid, hit);
- #endif
- }
- public OnPlayerDeathFinished(playerid, bool:cancelable)
- {
- if (s_PlayerHealth[playerid] == 0.0) {
- s_PlayerHealth[playerid] = s_PlayerMaxHealth[playerid];
- }
- if (s_DeathTimer[playerid] != -1) {
- KillTimer(s_DeathTimer[playerid]);
- s_DeathTimer[playerid] = -1;
- }
- #if defined WC_OnPlayerDeathFinished
- new retval = WC_OnPlayerDeathFinished(playerid, cancelable);
- if (!retval && cancelable) {
- return 0;
- }
- #endif
- ResetPlayerWeapons(playerid);
- return 1;
- }
- #if WC_CUSTOM_VENDING_MACHINES
- public OnPlayerUseVendingMachine(playerid, &Float:health_given) {
- #if defined WC_OnPlayerUseVendingMachine
- return WC_OnPlayerUseVendingMachine(playerid, health_given);
- #else
- if (GetPlayerMoney(playerid) > 0) {
- GivePlayerMoney(playerid, -1);
- return 1;
- } else {
- return 0;
- }
- #endif
- }
- forward WC_VendingMachineUsed(playerid, Float:health_given);
- public WC_VendingMachineUsed(playerid, Float:health_given)
- {
- s_VendingUseTimer[playerid] = -1;
- if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && !s_IsDying[playerid]) {
- new Float:health = s_PlayerHealth[playerid];
- health += health_given;
- if (health > s_PlayerMaxHealth[playerid]) {
- health = s_PlayerMaxHealth[playerid];
- }
- WC_SetPlayerHealth(playerid, health);
- }
- }
- #endif
- forward WC_DamageFeedUpdate(playerid);
- public WC_DamageFeedUpdate(playerid)
- {
- s_DamageFeedTimer[playerid] = -1;
- if (IsPlayerConnected(playerid) && IsDamageFeedActive(playerid)) {
- DamageFeedUpdate(playerid, true);
- }
- }
- static DamageFeedUpdate(playerid, bool:modified = false)
- {
- if (!IsDamageFeedActive(playerid)) {
- if (s_DamageFeedGiven[playerid] != PlayerText:INVALID_TEXT_DRAW) {
- PlayerTextDrawDestroy(playerid, s_DamageFeedGiven[playerid]);
- s_InternalPlayerTextDraw[playerid][s_DamageFeedGiven[playerid]] = false;
- s_DamageFeedGiven[playerid] = PlayerText:INVALID_TEXT_DRAW;
- }
- if (s_DamageFeedTaken[playerid] != PlayerText:INVALID_TEXT_DRAW) {
- PlayerTextDrawDestroy(playerid, s_DamageFeedTaken[playerid]);
- s_InternalPlayerTextDraw[playerid][s_DamageFeedTaken[playerid]] = false;
- s_DamageFeedTaken[playerid] = PlayerText:INVALID_TEXT_DRAW;
- }
- return;
- }
- if (s_DamageFeedGiven[playerid] == PlayerText:INVALID_TEXT_DRAW) {
- new PlayerText:td = CreatePlayerTextDraw(playerid, 200.0, 365.0, "_");
- if (td == PlayerText:INVALID_TEXT_DRAW) {
- printf("(wc) WARN: Unable to create damage feed textdraw");
- } else {
- s_InternalPlayerTextDraw[playerid][td] = true;
- PlayerTextDrawLetterSize(playerid, td, 0.2, 0.9);
- PlayerTextDrawColor(playerid, td, 0x30FF50FF);
- PlayerTextDrawFont(playerid, td, 1);
- PlayerTextDrawSetShadow(playerid, td, 0);
- PlayerTextDrawAlignment(playerid, td, 2);
- PlayerTextDrawSetOutline(playerid, td, 1);
- PlayerTextDrawBackgroundColor(playerid, td, 0x0000001A);
- s_DamageFeedGiven[playerid] = td;
- }
- }
- if (s_DamageFeedTaken[playerid] == PlayerText:INVALID_TEXT_DRAW) {
- new PlayerText:td = CreatePlayerTextDraw(playerid, 440.0, 365.0, "_");
- if (td == PlayerText:INVALID_TEXT_DRAW) {
- printf("(wc) WARN: Unable to create damage feed textdraw");
- } else {
- s_InternalPlayerTextDraw[playerid][td] = true;
- PlayerTextDrawLetterSize(playerid, td, 0.2, 0.9);
- PlayerTextDrawColor(playerid, td, 0x33CCFFFF);
- PlayerTextDrawFont(playerid, td, 1);
- PlayerTextDrawSetShadow(playerid, td, 0);
- PlayerTextDrawAlignment(playerid, td, 2);
- PlayerTextDrawSetOutline(playerid, td, 1);
- PlayerTextDrawBackgroundColor(playerid, td, 0x0000001A);
- s_DamageFeedTaken[playerid] = td;
- }
- }
- new tick = GetTickCount();
- if (tick == 0) tick = 1;
- new lowest_tick = tick + 1;
- for (new i = 0; i < sizeof(s_DamageFeedHitsGiven[]) - 1; i++) {
- if (!s_DamageFeedHitsGiven[playerid][i][e_Tick]) {
- break;
- }
- if (tick - s_DamageFeedHitsGiven[playerid][i][e_Tick] >= s_DamageFeedHideDelay) {
- modified = true;
- for (new j = i; j < sizeof(s_DamageFeedHitsGiven[]) - 1; j++) {
- s_DamageFeedHitsGiven[playerid][j][e_Tick] = 0;
- }
- break;
- }
- if (s_DamageFeedHitsGiven[playerid][i][e_Tick] < lowest_tick) {
- lowest_tick = s_DamageFeedHitsGiven[playerid][i][e_Tick];
- }
- }
- for (new i = 0; i < sizeof(s_DamageFeedHitsTaken[]) - 1; i++) {
- if (!s_DamageFeedHitsTaken[playerid][i][e_Tick]) {
- break;
- }
- if (tick - s_DamageFeedHitsTaken[playerid][i][e_Tick] >= s_DamageFeedHideDelay) {
- modified = true;
- for (new j = i; j < sizeof(s_DamageFeedHitsTaken[]) - 1; j++) {
- s_DamageFeedHitsTaken[playerid][j][e_Tick] = 0;
- }
- break;
- }
- if (s_DamageFeedHitsTaken[playerid][i][e_Tick] < lowest_tick) {
- lowest_tick = s_DamageFeedHitsTaken[playerid][i][e_Tick];
- }
- }
- if (s_DamageFeedTimer[playerid] != -1) {
- KillTimer(s_DamageFeedTimer[playerid]);
- }
- if (tick - s_DamageFeedLastUpdate[playerid] < s_DamageFeedMaxUpdateRate && modified) {
- s_DamageFeedTimer[playerid] = SetTimerEx("WC_DamageFeedUpdate", s_DamageFeedMaxUpdateRate - (tick - s_DamageFeedLastUpdate[playerid]), false, "i", playerid);
- } else {
- if (lowest_tick == tick + 1) {
- s_DamageFeedTimer[playerid] = -1;
- modified = true;
- } else {
- s_DamageFeedTimer[playerid] = SetTimerEx("WC_DamageFeedUpdate", s_DamageFeedHideDelay - (tick - lowest_tick) + 10, false, "i", playerid);
- }
- if (modified) {
- DamageFeedUpdateText(playerid);
- s_DamageFeedLastUpdate[playerid] = tick;
- }
- }
- }
- static DamageFeedUpdateText(playerid)
- {
- new buf[64 * WC_FEED_HEIGHT] = "";
- for (new i = 0; i < sizeof(s_DamageFeedHitsGiven[]) - 1; i++) {
- if (!s_DamageFeedHitsGiven[playerid][i][e_Tick]) {
- break;
- }
- new weapon[32];
- if (s_DamageFeedHitsGiven[playerid][i][e_Weapon] == -1) {
- weapon = "Multiple";
- } else {
- WC_GetWeaponName(s_DamageFeedHitsGiven[playerid][i][e_Weapon], weapon);
- }
- if (s_DamageFeedHitsGiven[playerid][i][e_Issuer] == INVALID_PLAYER_ID) {
- format(
- buf,
- sizeof(buf),
- "%s%s +%.2f~n~",
- buf,
- weapon,
- s_DamageFeedHitsGiven[playerid][i][e_Amount] + 0.009
- );
- } else {
- format(
- buf,
- sizeof(buf),
- "%s%s - %s +%.2f~n~",
- buf,
- s_DamageFeedHitsGiven[playerid][i][e_Name],
- weapon,
- s_DamageFeedHitsGiven[playerid][i][e_Amount] + 0.009
- );
- }
- }
- if (s_DamageFeedGiven[playerid] == PlayerText:INVALID_TEXT_DRAW) {
- printf("(wc) WARN: Doesn't have feed textdraw when needed");
- } else {
- if (buf[0]) {
- PlayerTextDrawSetString(playerid, s_DamageFeedGiven[playerid], buf);
- PlayerTextDrawShow(playerid, s_DamageFeedGiven[playerid]);
- } else {
- PlayerTextDrawHide(playerid, s_DamageFeedGiven[playerid]);
- }
- }
- buf = "";
- for (new i = 0; i < sizeof(s_DamageFeedHitsTaken[]) - 1; i++) {
- if (!s_DamageFeedHitsTaken[playerid][i][e_Tick]) {
- break;
- }
- new weapon[32];
- if (s_DamageFeedHitsTaken[playerid][i][e_Weapon] == -1) {
- weapon = "Multiple";
- } else {
- WC_GetWeaponName(s_DamageFeedHitsTaken[playerid][i][e_Weapon], weapon);
- }
- if (s_DamageFeedHitsTaken[playerid][i][e_Issuer] == INVALID_PLAYER_ID) {
- format(
- buf,
- sizeof(buf),
- "%s%s -%.2f~n~",
- buf,
- weapon,
- s_DamageFeedHitsTaken[playerid][i][e_Amount] + 0.009
- );
- } else {
- format(
- buf,
- sizeof(buf),
- "%s%s - %s -%.2f~n~",
- buf,
- s_DamageFeedHitsTaken[playerid][i][e_Name],
- weapon,
- s_DamageFeedHitsTaken[playerid][i][e_Amount] + 0.009
- );
- }
- }
- if (s_DamageFeedTaken[playerid] == PlayerText:INVALID_TEXT_DRAW) {
- printf("(wc) WARN: Doesn't have feed textdraw when needed");
- } else {
- if (buf[0]) {
- PlayerTextDrawSetString(playerid, s_DamageFeedTaken[playerid], buf);
- PlayerTextDrawShow(playerid, s_DamageFeedTaken[playerid]);
- } else {
- PlayerTextDrawHide(playerid, s_DamageFeedTaken[playerid]);
- }
- }
- }
- static DamageFeedAddHitGiven(playerid, issuerid, Float:amount, weapon)
- {
- for (new i = 0; i < MAX_PLAYERS; i++) {
- if (s_Spectating[i] == playerid && i != playerid) {
- DamageFeedAddHit(s_DamageFeedHitsGiven[i], i, issuerid, amount, weapon);
- }
- }
- DamageFeedAddHit(s_DamageFeedHitsGiven[playerid], playerid, issuerid, amount, weapon);
- }
- static DamageFeedAddHitTaken(playerid, issuerid, Float:amount, weapon)
- {
- for (new i = 0; i < MAX_PLAYERS; i++) {
- if (s_Spectating[i] == playerid && i != playerid) {
- DamageFeedAddHit(s_DamageFeedHitsTaken[i], i, issuerid, amount, weapon);
- }
- }
- DamageFeedAddHit(s_DamageFeedHitsTaken[playerid], playerid, issuerid, amount, weapon);
- }
- static DamageFeedAddHit(arr[WC_FEED_HEIGHT][E_DAMAGE_FEED_HIT], playerid, issuerid, Float:amount, weapon)
- {
- if (!IsDamageFeedActive(playerid)) {
- return;
- }
- new tick = GetTickCount();
- if (tick == 0) tick = 1;
- new idx = -1;
- for (new i = 0; i < sizeof(arr) - 1; i++) {
- if (!arr[i][e_Tick]) {
- break;
- }
- if (tick - arr[i][e_Tick] >= s_DamageFeedHideDelay) {
- DamageFeedRemoveHit(arr, i);
- break;
- }
- // Remove it and add it on top below
- if (arr[i][e_Issuer] == issuerid) {
- // Multiple weapons
- if (arr[i][e_Weapon] != weapon) {
- //weapon = -1;
- }
- amount += arr[i][e_Amount];
- idx = i;
- break;
- }
- }
- if (idx == -1) {
- idx = 0;
- // Insert it at the top
- for (new i = sizeof(arr) - 1; i >= 1; i--) {
- arr[i] = arr[i - 1];
- }
- }
- arr[idx][e_Tick] = tick;
- arr[idx][e_Amount] = amount;
- arr[idx][e_Issuer] = issuerid;
- arr[idx][e_Weapon] = weapon;
- GetPlayerName(issuerid, arr[idx][e_Name], MAX_PLAYER_NAME);
- DamageFeedUpdate(playerid, true);
- }
- static DamageFeedRemoveHit(arr[WC_FEED_HEIGHT][E_DAMAGE_FEED_HIT], idx)
- {
- for (new i = 0; i < WC_FEED_HEIGHT; i++) {
- if (i >= idx) {
- arr[i][e_Tick] = 0;
- }
- }
- }
- static SaveSyncData(playerid)
- {
- GetPlayerHealth(playerid, s_SyncData[playerid][e_Health]);
- GetPlayerArmour(playerid, s_SyncData[playerid][e_Armour]);
- GetPlayerPos(playerid, s_SyncData[playerid][e_PosX], s_SyncData[playerid][e_PosY], s_SyncData[playerid][e_PosZ]);
- GetPlayerFacingAngle(playerid, s_SyncData[playerid][e_PosA]);
- s_SyncData[playerid][e_Skin] = GetPlayerSkin(playerid);
- s_SyncData[playerid][e_Team] = GetPlayerTeam(playerid);
- s_SyncData[playerid][e_Weapon] = GetPlayerWeapon(playerid);
- for (new i = 0; i < 13; i++) {
- GetPlayerWeaponData(playerid, i, s_SyncData[playerid][e_WeaponId][i], s_SyncData[playerid][e_WeaponAmmo][i]);
- }
- }
- static MakePlayerFacePlayer(playerid, targetid, opposite = false, forcesync = true)
- {
- new Float:x1, Float:y1, Float:z1;
- new Float:x2, Float:y2, Float:z2;
- GetPlayerPos(playerid, x1, y1, z1);
- GetPlayerPos(targetid, x2, y2, z2);
- new Float:angle = AngleBetweenPoints(x2, y2, x1, y1);
- if (opposite) {
- angle += 180.0;
- if (angle > 360.0) angle -= 360.0;
- }
- if (angle < 0.0) angle += 360.0;
- if (angle > 360.0) angle -= 360.0;
- SetPlayerFacingAngle(playerid, angle);
- if (forcesync) {
- SetFakeFacingAngle(playerid, angle);
- UpdateSyncData(playerid);
- }
- }
- static IsPlayerBehindPlayer(playerid, targetid, Float:diff = 90.0)
- {
- new Float:x1, Float:y1, Float:z1;
- new Float:x2, Float:y2, Float:z2;
- new Float:ang, Float:angdiff;
- GetPlayerPos(playerid, x1, y1, z1);
- GetPlayerPos(targetid, x2, y2, z2);
- GetPlayerFacingAngle(targetid, ang);
- angdiff = AngleBetweenPoints(x1, y1, x2, y2);
- if (angdiff < 0.0) angdiff += 360.0;
- if (angdiff > 360.0) angdiff -= 360.0;
- ang = ang - angdiff;
- if (ang > 180.0) ang -= 360.0;
- if (ang < -180.0) ang += 360.0;
- return floatabs(ang) > diff;
- }
- static AddRejectedHit(playerid, damagedid, reason, weapon, i1 = 0, i2 = 0, i3 = 0)
- {
- new idx = s_RejectedHitsIdx[playerid];
- if (s_RejectedHits[playerid][idx][e_Time]) {
- idx += 1;
- if (idx >= sizeof(s_RejectedHits[])) {
- idx = 0;
- }
- s_RejectedHitsIdx[playerid] = idx;
- }
- new time, hour, minute, second;
- time = gettime(hour, minute, second);
- s_RejectedHits[playerid][idx][e_Reason] = reason;
- s_RejectedHits[playerid][idx][e_Time] = time;
- s_RejectedHits[playerid][idx][e_Weapon] = weapon;
- s_RejectedHits[playerid][idx][e_Hour] = hour;
- s_RejectedHits[playerid][idx][e_Minute] = minute;
- s_RejectedHits[playerid][idx][e_Second] = second;
- s_RejectedHits[playerid][idx][e_Info1] = _:i1;
- s_RejectedHits[playerid][idx][e_Info2] = _:i2;
- s_RejectedHits[playerid][idx][e_Info3] = _:i3;
- if (damagedid != INVALID_PLAYER_ID) {
- GetPlayerName(damagedid, s_RejectedHits[playerid][idx][e_Name], MAX_PLAYER_NAME);
- } else {
- s_RejectedHits[playerid][idx][e_Name][0] = '#';
- s_RejectedHits[playerid][idx][e_Name][1] = '\0';
- }
- OnRejectedHit(playerid, s_RejectedHits[playerid][idx]);
- }
- forward WC_SecondKnifeAnim(playerid);
- public WC_SecondKnifeAnim(playerid)
- {
- ApplyAnimation(playerid, "KNIFE", "KILL_Knife_Ped_Die", 4.1, 0, 1, 1, 1, 3000, 1);
- }
- forward WC_PlayerDeathRespawn(playerid);
- public WC_PlayerDeathRespawn(playerid)
- {
- if (!s_IsDying[playerid]) {
- return;
- }
- s_IsDying[playerid] = false;
- if (!OnPlayerDeathFinished(playerid, true)) {
- UpdateHealthBar(playerid);
- SetFakeFacingAngle(playerid, _);
- FreezeSyncData(playerid, false);
- return;
- }
- s_IsDying[playerid] = true;
- s_TrueDeath[playerid] = false;
- if (IsPlayerInAnyVehicle(playerid)) {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- SetPlayerPos(playerid, x, y, z);
- }
- SetPlayerVirtualWorld(playerid, WC_DEATH_WORLD);
- SetFakeFacingAngle(playerid, _);
- TogglePlayerSpectating(playerid, true);
- TogglePlayerSpectating(playerid, false);
- }
- public OnInvalidWeaponDamage(playerid, damagedid, Float:amount, weaponid, bodypart, error, bool:given)
- {
- DebugMessageRedAll("OnInvalidWeaponDamage(%d, %d, %f, %d, %d, %d, %d)", playerid, damagedid, amount, weaponid, bodypart, error, given);
- #if defined WC_OnInvalidWeaponDamage
- WC_OnInvalidWeaponDamage(playerid, damagedid, Float:amount, weaponid, bodypart, error, bool:given);
- #endif
- }
- public OnPlayerDamageDone(playerid, Float:amount, issuerid, weapon, bodypart)
- {
- new idx = s_PreviousHitI[playerid];
- s_PreviousHitI[playerid] = (s_PreviousHitI[playerid] - 1) % sizeof(s_PreviousHits[]);
- // JIT plugin fix
- if (s_PreviousHitI[playerid] < 0) {
- s_PreviousHitI[playerid] += sizeof(s_PreviousHits[]);
- }
- s_PreviousHits[playerid][idx][e_Tick] = GetTickCount();
- s_PreviousHits[playerid][idx][e_Issuer] = issuerid;
- s_PreviousHits[playerid][idx][e_Weapon] = weapon;
- s_PreviousHits[playerid][idx][e_Amount] = amount;
- s_PreviousHits[playerid][idx][e_Bodypart] = bodypart;
- s_PreviousHits[playerid][idx][e_Health] = GetLastDamageHealth(playerid);
- s_PreviousHits[playerid][idx][e_Armour] = GetLastDamageArmour(playerid);
- if (!IsHighRateWeapon(weapon)) {
- DebugMessageAll("OnPlayerDamageDone(%d did %f to %d with %d on bodypart %d)", issuerid, amount, playerid, weapon, bodypart);
- if (s_DamageTakenSound) {
- PlayerPlaySound(playerid, s_DamageTakenSound, 0.0, 0.0, 0.0);
- for (new i = 0; i < MAX_PLAYERS; i++) {
- if (s_Spectating[i] == playerid && i != playerid) {
- PlayerPlaySound(i, s_DamageTakenSound, 0.0, 0.0, 0.0);
- }
- }
- }
- if (s_DamageGivenSound && issuerid != INVALID_PLAYER_ID) {
- PlayerPlaySound(issuerid, s_DamageGivenSound, 0.0, 0.0, 0.0);
- for (new i = 0; i < MAX_PLAYERS; i++) {
- if (s_Spectating[i] == issuerid && i != issuerid) {
- PlayerPlaySound(i, s_DamageGivenSound, 0.0, 0.0, 0.0);
- }
- }
- }
- }
- if (issuerid != INVALID_PLAYER_ID) {
- DamageFeedAddHitGiven(issuerid, playerid, amount, weapon);
- }
- DamageFeedAddHitTaken(playerid, issuerid, amount, weapon);
- #if defined WC_OnPlayerDamageDone
- WC_OnPlayerDamageDone(playerid, amount, issuerid, weapon, bodypart);
- #endif
- }
- public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
- {
- #if defined WC_OnPlayerDamage
- return WC_OnPlayerDamage(playerid, amount, issuerid, weapon, bodypart);
- #else
- return 1;
- #endif
- }
- /*
- * ALS callbacks
- */
- #if defined _ALS_OnGameModeInit
- #undef OnGameModeInit
- #else
- #define _ALS_OnGameModeInit
- #endif
- #define OnGameModeInit WC_OnGameModeInit
- #if defined WC_OnGameModeInit
- forward WC_OnGameModeInit();
- #endif
- #if defined _ALS_OnGameModeExit
- #undef OnGameModeExit
- #else
- #define _ALS_OnGameModeExit
- #endif
- #define OnGameModeExit WC_OnGameModeExit
- #if defined WC_OnGameModeExit
- forward WC_OnGameModeExit();
- #endif
- #if defined _ALS_OnFilterScriptInit
- #undef OnFilterScriptInit
- #else
- #define _ALS_OnFilterScriptInit
- #endif
- #define OnFilterScriptInit WC_OnFilterScriptInit
- #if defined WC_OnFilterScriptInit
- forward WC_OnFilterScriptInit();
- #endif
- #if defined _ALS_OnFilterScriptExit
- #undef OnFilterScriptExit
- #else
- #define _ALS_OnFilterScriptExit
- #endif
- #define OnFilterScriptExit WC_OnFilterScriptExit
- #if defined WC_OnFilterScriptExit
- forward WC_OnFilterScriptExit();
- #endif
- #if defined _ALS_OnPlayerConnect
- #undef OnPlayerConnect
- #else
- #define _ALS_OnPlayerConnect
- #endif
- #define OnPlayerConnect WC_OnPlayerConnect
- #if defined WC_OnPlayerConnect
- forward WC_OnPlayerConnect(playerid);
- #endif
- #if defined _ALS_OnPlayerDisconnect
- #undef OnPlayerDisconnect
- #else
- #define _ALS_OnPlayerDisconnect
- #endif
- #define OnPlayerDisconnect WC_OnPlayerDisconnect
- #if defined WC_OnPlayerDisconnect
- forward WC_OnPlayerDisconnect(playerid, reason);
- #endif
- #if defined _ALS_OnPlayerStreamIn
- #undef OnPlayerStreamIn
- #else
- #define _ALS_OnPlayerStreamIn
- #endif
- #define OnPlayerStreamIn WC_OnPlayerStreamIn
- #if defined WC_OnPlayerStreamIn
- forward WC_OnPlayerStreamIn(playerid, forplayerid);
- #endif
- #if defined _ALS_OnVehicleDeath
- #undef OnVehicleDeath
- #else
- #define _ALS_OnVehicleDeath
- #endif
- #define OnVehicleDeath WC_OnVehicleDeath
- #if defined WC_OnVehicleDeath
- forward WC_OnVehicleDeath(vehicleid, killerid);
- #endif
- #if defined _ALS_OnVehicleSpawn
- #undef OnVehicleSpawn
- #else
- #define _ALS_OnVehicleSpawn
- #endif
- #define OnVehicleSpawn WC_OnVehicleSpawn
- #if defined WC_OnVehicleSpawn
- forward WC_OnVehicleSpawn(vehicleid);
- #endif
- #if defined _ALS_OnPlayerEnterVehicle
- #undef OnPlayerEnterVehicle
- #else
- #define _ALS_OnPlayerEnterVehicle
- #endif
- #define OnPlayerEnterVehicle WC_OnPlayerEnterVehicle
- #if defined WC_OnPlayerEnterVehicle
- forward WC_OnPlayerEnterVehicle(playerid, vehicleid, ispassenger);
- #endif
- #if defined _ALS_OnPlayerExitVehicle
- #undef OnPlayerExitVehicle
- #else
- #define _ALS_OnPlayerExitVehicle
- #endif
- #define OnPlayerExitVehicle WC_OnPlayerExitVehicle
- #if defined WC_OnPlayerExitVehicle
- forward WC_OnPlayerExitVehicle(playerid, vehicleid);
- #endif
- #if defined _ALS_OnPlayerStateChange
- #undef OnPlayerStateChange
- #else
- #define _ALS_OnPlayerStateChange
- #endif
- #define OnPlayerStateChange WC_OnPlayerStateChange
- #if defined WC_OnPlayerStateChange
- forward WC_OnPlayerStateChange(playerid, newstate, oldstate);
- #endif
- #if defined _ALS_OnPlayerPickUpPickup
- #undef OnPlayerPickUpPickup
- #else
- #define _ALS_OnPlayerPickUpPickup
- #endif
- #define OnPlayerPickUpPickup WC_OnPlayerPickUpPickup
- #if defined WC_OnPlayerPickUpPickup
- forward WC_OnPlayerPickUpPickup(playerid, pickupid);
- #endif
- #if defined _ALS_OnPlayerUpdate
- #undef OnPlayerUpdate
- #else
- #define _ALS_OnPlayerUpdate
- #endif
- #define OnPlayerUpdate WC_OnPlayerUpdate
- #if defined WC_OnPlayerUpdate
- forward WC_OnPlayerUpdate(playerid);
- #endif
- #if defined _ALS_OnPlayerSpawn
- #undef OnPlayerSpawn
- #else
- #define _ALS_OnPlayerSpawn
- #endif
- #define OnPlayerSpawn WC_OnPlayerSpawn
- #if defined WC_OnPlayerSpawn
- forward WC_OnPlayerSpawn(playerid);
- #endif
- #if defined _ALS_OnPlayerRequestClass
- #undef OnPlayerRequestClass
- #else
- #define _ALS_OnPlayerRequestClass
- #endif
- #define OnPlayerRequestClass WC_OnPlayerRequestClass
- #if defined WC_OnPlayerRequestClass
- forward WC_OnPlayerRequestClass(playerid, classid);
- #endif
- #if defined _ALS_OnPlayerDeath
- #undef OnPlayerDeath
- #else
- #define _ALS_OnPlayerDeath
- #endif
- #define OnPlayerDeath WC_OnPlayerDeath
- #if defined WC_OnPlayerDeath
- forward WC_OnPlayerDeath(playerid, killerid, reason);
- #endif
- #if defined _ALS_OnPlayerKeyStateChange
- #undef OnPlayerKeyStateChange
- #else
- #define _ALS_OnPlayerKeyStateChange
- #endif
- #define OnPlayerKeyStateChange WC_OnPlayerKeyStateChange
- #if defined WC_OnPlayerKeyStateChange
- forward WC_OnPlayerKeyStateChange(playerid, newkeys, oldkeys);
- #endif
- #if defined _ALS_OnPlayerWeaponShot
- #undef OnPlayerWeaponShot
- #else
- #define _ALS_OnPlayerWeaponShot
- #endif
- #define OnPlayerWeaponShot WC_OnPlayerWeaponShot
- #if defined WC_OnPlayerWeaponShot
- forward WC_OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
- #endif
- #if defined _ALS_OnPlayerEnterCheckpoint
- #undef OnPlayerEnterCheckpoint
- #else
- #define _ALS_OnPlayerEnterCheckpoint
- #endif
- #define OnPlayerEnterCheckpoint WC_OnPlayerEnterCheckpoint
- #if defined WC_OnPlayerEnterCheckpoint
- forward WC_OnPlayerEnterCheckpoint(playerid);
- #endif
- #if defined _ALS_OnPlayerLeaveCheckpoint
- #undef OnPlayerLeaveCheckpoint
- #else
- #define _ALS_OnPlayerLeaveCheckpoint
- #endif
- #define OnPlayerLeaveCheckpoint WC_OnPlayerLeaveCheckpoint
- #if defined WC_OnPlayerLeaveCheckpoint
- forward WC_OnPlayerLeaveCheckpoint(playerid);
- #endif
- #if defined _ALS_OnInvalidWeaponDamage
- #undef OnInvalidWeaponDamage
- #else
- #define _ALS_OnInvalidWeaponDamage
- #endif
- #define OnInvalidWeaponDamage WC_OnInvalidWeaponDamage
- #if defined WC_OnInvalidWeaponDamage
- forward WC_OnInvalidWeaponDamage(playerid, damagedid, Float:amount, weaponid, bodypart, error, bool:given);
- #endif
- #if defined _ALS_OnPlayerDamageDone
- #undef OnPlayerDamageDone
- #else
- #define _ALS_OnPlayerDamageDone
- #endif
- #define OnPlayerDamageDone WC_OnPlayerDamageDone
- #if defined WC_OnPlayerDamageDone
- forward WC_OnPlayerDamageDone(playerid, Float:amount, issuerid, weapon, bodypart);
- #endif
- #if defined _ALS_OnPlayerDamage
- #undef OnPlayerDamage
- #else
- #define _ALS_OnPlayerDamage
- #endif
- #define OnPlayerDamage WC_OnPlayerDamage
- #if defined WC_OnPlayerDamage
- forward WC_OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart);
- #endif
- #if defined _ALS_OnPlayerPrepareDeath
- #undef OnPlayerPrepareDeath
- #else
- #define _ALS_OnPlayerPrepareDeath
- #endif
- #define OnPlayerPrepareDeath WC_OnPlayerPrepareDeath
- #if defined WC_OnPlayerPrepareDeath
- forward WC_OnPlayerPrepareDeath(playerid, animlib[32], animname[32], &anim_lock, &respawn_time);
- #endif
- #if defined _ALS_OnRejectedHit
- #undef OnRejectedHit
- #else
- #define _ALS_OnRejectedHit
- #endif
- #define OnRejectedHit WC_OnRejectedHit
- #if defined WC_OnRejectedHit
- forward WC_OnRejectedHit(playerid, hit[E_REJECTED_HIT]);
- #endif
- #if WC_CUSTOM_VENDING_MACHINES
- #if defined _ALS_OnPlayerUseVendingMachine
- #undef OnPlayerUseVendingMachine
- #else
- #define _ALS_OnPlayerUseVendingMachine
- #endif
- #define OnPlayerUseVendingMachine WC_OnPlayerUseVendingMachine
- #if defined WC_OnPlayerUseVendingMachine
- forward WC_OnPlayerUseVendingMachine(playerid, &Float:health_given);
- #endif
- #endif
- #if defined _ALS_OnPlayerDeathFinished
- #undef OnPlayerDeathFinished
- #else
- #define _ALS_OnPlayerDeathFinished
- #endif
- #define OnPlayerDeathFinished WC_OnPlayerDeathFinished
- #if defined WC_OnPlayerDeathFinished
- forward WC_OnPlayerDeathFinished(playerid, bool:cancelable);
- #endif
- /*
- * ALS functions
- */
- #if defined _ALS_SpawnPlayer
- #undef SpawnPlayer
- #else
- #define _ALS_SpawnPlayer
- #endif
- #define SpawnPlayer WC_SpawnPlayer
- #if defined _ALS_SetPlayerHealth
- #undef SetPlayerHealth
- #else
- #define _ALS_SetPlayerHealth
- #endif
- #define SetPlayerHealth WC_SetPlayerHealth
- #if defined _ALS_GetPlayerState
- #undef GetPlayerState
- #else
- #define _ALS_GetPlayerState
- #endif
- #define GetPlayerState WC_GetPlayerState
- #if defined _ALS_GetPlayerHealth
- #undef GetPlayerHealth
- #else
- #define _ALS_GetPlayerHealth
- #endif
- #define GetPlayerHealth WC_GetPlayerHealth
- #if defined _ALS_SetPlayerArmour
- #undef SetPlayerArmour
- #else
- #define _ALS_SetPlayerArmour
- #endif
- #define SetPlayerArmour WC_SetPlayerArmour
- #if defined _ALS_GetPlayerArmour
- #undef GetPlayerArmour
- #else
- #define _ALS_GetPlayerArmour
- #endif
- #define GetPlayerArmour WC_GetPlayerArmour
- #if defined _ALS_GetPlayerTeam
- #undef GetPlayerTeam
- #else
- #define _ALS_GetPlayerTeam
- #endif
- #define GetPlayerTeam WC_GetPlayerTeam
- #if defined _ALS_SetPlayerTeam
- #undef SetPlayerTeam
- #else
- #define _ALS_SetPlayerTeam
- #endif
- #define SetPlayerTeam WC_SetPlayerTeam
- #if defined _ALS_SendDeathMessage
- #undef SendDeathMessage
- #else
- #define _ALS_SendDeathMessage
- #endif
- #define SendDeathMessage WC_SendDeathMessage
- #if defined _ALS_GetWeaponName
- #undef GetWeaponName
- #else
- #define _ALS_GetWeaponName
- #endif
- #define GetWeaponName WC_GetWeaponName
- #if defined _ALS_ApplyAnimation
- #undef ApplyAnimation
- #else
- #define _ALS_ApplyAnimation
- #endif
- #define ApplyAnimation WC_ApplyAnimation
- #if defined _ALS_ClearAnimations
- #undef ClearAnimations
- #else
- #define _ALS_ClearAnimations
- #endif
- #define ClearAnimations WC_ClearAnimations
- #if defined _ALS_AddPlayerClass
- #undef AddPlayerClass
- #else
- #define _ALS_AddPlayerClass
- #endif
- #define AddPlayerClass WC_AddPlayerClass
- #if defined _ALS_AddPlayerClassEx
- #undef AddPlayerClassEx
- #else
- #define _ALS_AddPlayerClassEx
- #endif
- #define AddPlayerClassEx WC_AddPlayerClassEx
- #if defined _ALS_SetSpawnInfo
- #undef SetSpawnInfo
- #else
- #define _ALS_SetSpawnInfo
- #endif
- #define SetSpawnInfo WC_SetSpawnInfo
- #if defined _ALS_TogglePlayerSpectating
- #undef TogglePlayerSpectating
- #else
- #define _ALS_TogglePlayerSpectating
- #endif
- #define TogglePlayerSpectating WC_TogglePlayerSpectating
- #if defined _ALS_TogglePlayerControllable
- #undef TogglePlayerControllable
- #else
- #define _ALS_TogglePlayerControllable
- #endif
- #define TogglePlayerControllable WC_TogglePlayerControllable
- #if defined _ALS_SetPlayerPos
- #undef SetPlayerPos
- #else
- #define _ALS_SetPlayerPos
- #endif
- #define SetPlayerPos WC_SetPlayerPos
- #if defined _ALS_SetPlayerPosFindZ
- #undef SetPlayerPosFindZ
- #else
- #define _ALS_SetPlayerPosFindZ
- #endif
- #define SetPlayerPosFindZ WC_SetPlayerPosFindZ
- #if defined _ALS_SetPlayerVelocity
- #undef SetPlayerVelocity
- #else
- #define _ALS_SetPlayerVelocity
- #endif
- #define SetPlayerVelocity WC_SetPlayerVelocity
- #if defined _ALS_SetPlayerVirtualWorld
- #undef SetPlayerVirtualWorld
- #else
- #define _ALS_SetPlayerVirtualWorld
- #endif
- #define SetPlayerVirtualWorld wc_SetPlayerVirtualWorld
- #if defined _ALS_GetPlayerVirtualWorld
- #undef GetPlayerVirtualWorld
- #else
- #define _ALS_GetPlayerVirtualWorld
- #endif
- #define GetPlayerVirtualWorld WC_GetPlayerVirtualWorld
- #if defined _ALS_PlayerSpectatePlayer
- #undef PlayerSpectatePlayer
- #else
- #define _ALS_PlayerSpectatePlayer
- #endif
- #define PlayerSpectatePlayer WC_PlayerSpectatePlayer
- #if defined _ALS_DestroyVehicle
- #undef DestroyVehicle
- #else
- #define _ALS_DestroyVehicle
- #endif
- #define DestroyVehicle WC_DestroyVehicle
- #if defined _ALS_CreateVehicle
- #undef CreateVehicle
- #else
- #define _ALS_CreateVehicle
- #endif
- #define CreateVehicle WC_CreateVehicle
- #if defined _ALS_AddStaticVehicle
- #undef AddStaticVehicle
- #else
- #define _ALS_AddStaticVehicle
- #endif
- #define AddStaticVehicle WC_AddStaticVehicle
- #if defined _ALS_AddStaticVehicleEx
- #undef AddStaticVehicleEx
- #else
- #define _ALS_AddStaticVehicleEx
- #endif
- #define AddStaticVehicleEx WC_AddStaticVehicleEx
- #if defined _ALS_IsPlayerInCheckpoint
- #undef IsPlayerInCheckpoint
- #else
- #define _ALS_IsPlayerInCheckpoint
- #endif
- #define IsPlayerInCheckpoint WC_IsPlayerInCheckpoint
- #if defined _ALS_SetPlayerSpecialAction
- #undef SetPlayerSpecialAction
- #else
- #define _ALS_SetPlayerSpecialAction
- #endif
- #define SetPlayerSpecialAction WC_SetPlayerSpecialAction
- #if defined _ALS_TextDrawCreate
- #undef TextDrawCreate
- #else
- #define _ALS_TextDrawCreate
- #endif
- #define TextDrawCreate WC_TextDrawCreate
- #if defined _ALS_TextDrawDestroy
- #undef TextDrawDestroy
- #else
- #define _ALS_TextDrawDestroy
- #endif
- #define TextDrawDestroy WC_TextDrawDestroy
- #if defined _ALS_TextDrawLetterSize
- #undef TextDrawLetterSize
- #else
- #define _ALS_TextDrawLetterSize
- #endif
- #define TextDrawLetterSize WC_TextDrawLetterSize
- #if defined _ALS_TextDrawTextSize
- #undef TextDrawTextSize
- #else
- #define _ALS_TextDrawTextSize
- #endif
- #define TextDrawTextSize WC_TextDrawTextSize
- #if defined _ALS_TextDrawAlignment
- #undef TextDrawAlignment
- #else
- #define _ALS_TextDrawAlignment
- #endif
- #define TextDrawAlignment WC_TextDrawAlignment
- #if defined _ALS_TextDrawColor
- #undef TextDrawColor
- #else
- #define _ALS_TextDrawColor
- #endif
- #define TextDrawColor WC_TextDrawColor
- #if defined _ALS_TextDrawUseBox
- #undef TextDrawUseBox
- #else
- #define _ALS_TextDrawUseBox
- #endif
- #define TextDrawUseBox WC_TextDrawUseBox
- #if defined _ALS_TextDrawBoxColor
- #undef TextDrawBoxColor
- #else
- #define _ALS_TextDrawBoxColor
- #endif
- #define TextDrawBoxColor WC_TextDrawBoxColor
- #if defined _ALS_TextDrawSetShadow
- #undef TextDrawSetShadow
- #else
- #define _ALS_TextDrawSetShadow
- #endif
- #define TextDrawSetShadow WC_TextDrawSetShadow
- #if defined _ALS_TextDrawSetOutline
- #undef TextDrawSetOutline
- #else
- #define _ALS_TextDrawSetOutline
- #endif
- #define TextDrawSetOutline WC_TextDrawSetOutline
- #if defined _ALS_TextDrawBackgroundColor
- #undef TextDrawBackgroundColor
- #else
- #define _ALS_TextDrawBackgroundColor
- #endif
- #define TextDrawBackgroundColor WC_TextDrawBackgroundColor
- #if defined _ALS_TextDrawFont
- #undef TextDrawFont
- #else
- #define _ALS_TextDrawFont
- #endif
- #define TextDrawFont WC_TextDrawFont
- #if defined _ALS_TextDrawSetProportional
- #undef TextDrawSetProportional
- #else
- #define _ALS_TextDrawSetProportional
- #endif
- #define TextDrawSetProportional WC_TextDrawSetProportional
- #if defined _ALS_TextDrawSetSelectable
- #undef TextDrawSetSelectable
- #else
- #define _ALS_TextDrawSetSelectable
- #endif
- #define TextDrawSetSelectable WC_TextDrawSetSelectable
- #if defined _ALS_TextDrawShowForPlayer
- #undef TextDrawShowForPlayer
- #else
- #define _ALS_TextDrawShowForPlayer
- #endif
- #define TextDrawShowForPlayer WC_TextDrawShowForPlayer
- #if defined _ALS_TextDrawHideForPlayer
- #undef TextDrawHideForPlayer
- #else
- #define _ALS_TextDrawHideForPlayer
- #endif
- #define TextDrawHideForPlayer WC_TextDrawHideForPlayer
- #if defined _ALS_TextDrawShowForAll
- #undef TextDrawShowForAll
- #else
- #define _ALS_TextDrawShowForAll
- #endif
- #define TextDrawShowForAll WC_TextDrawShowForAll
- #if defined _ALS_TextDrawHideForAll
- #undef TextDrawHideForAll
- #else
- #define _ALS_TextDrawHideForAll
- #endif
- #define TextDrawHideForAll WC_TextDrawHideForAll
- #if defined _ALS_TextDrawSetString
- #undef TextDrawSetString
- #else
- #define _ALS_TextDrawSetString
- #endif
- #define TextDrawSetString WC_TextDrawSetString
- #if defined _ALS_TextDrawSetPreviewModel
- #undef TextDrawSetPreviewModel
- #else
- #define _ALS_TextDrawSetPreviewModel
- #endif
- #define TextDrawSetPreviewModel WC_TextDrawSetPreviewModel
- #if defined _ALS_TextDrawSetPreviewRot
- #undef TextDrawSetPreviewRot
- #else
- #define _ALS_TextDrawSetPreviewRot
- #endif
- #define TextDrawSetPreviewRot WC_TextDrawSetPreviewRot
- #if defined _ALS_TextDrawSetPreviewVehCol
- #undef TextDrawSetPreviewVehCol
- #else
- #define _ALS_TextDrawSetPreviewVehCol
- #endif
- #define TextDrawSetPreviewVehCol WC_TextDrawSetPreviewVehCol
- #if defined _ALS_CreatePlayerTextDraw
- #undef CreatePlayerTextDraw
- #else
- #define _ALS_CreatePlayerTextDraw
- #endif
- #define CreatePlayerTextDraw WC_CreatePlayerTextDraw
- #if defined _ALS_PlayerTextDrawDestroy
- #undef PlayerTextDrawDestroy
- #else
- #define _ALS_PlayerTextDrawDestroy
- #endif
- #define PlayerTextDrawDestroy WC_PlayerTextDrawDestroy
- #if defined _ALS_PlayerTextDrawLetterSize
- #undef PlayerTextDrawLetterSize
- #else
- #define _ALS_PlayerTextDrawLetterSize
- #endif
- #define PlayerTextDrawLetterSize WC_PlayerTextDrawLetterSize
- #if defined _ALS_PlayerTextDrawTextSize
- #undef PlayerTextDrawTextSize
- #else
- #define _ALS_PlayerTextDrawTextSize
- #endif
- #define PlayerTextDrawTextSize WC_PlayerTextDrawTextSize
- #if defined _ALS_PlayerTextDrawAlignment
- #undef PlayerTextDrawAlignment
- #else
- #define _ALS_PlayerTextDrawAlignment
- #endif
- #define PlayerTextDrawAlignment WC_PlayerTextDrawAlignment
- #if defined _ALS_PlayerTextDrawColor
- #undef PlayerTextDrawColor
- #else
- #define _ALS_PlayerTextDrawColor
- #endif
- #define PlayerTextDrawColor WC_PlayerTextDrawColor
- #if defined _ALS_PlayerTextDrawUseBox
- #undef PlayerTextDrawUseBox
- #else
- #define _ALS_PlayerTextDrawUseBox
- #endif
- #define PlayerTextDrawUseBox WC_PlayerTextDrawUseBox
- #if defined _ALS_PlayerTextDrawBoxColor
- #undef PlayerTextDrawBoxColor
- #else
- #define _ALS_PlayerTextDrawBoxColor
- #endif
- #define PlayerTextDrawBoxColor WC_PlayerTextDrawBoxColor
- #if defined _ALS_PlayerTextDrawSetShadow
- #undef PlayerTextDrawSetShadow
- #else
- #define _ALS_PlayerTextDrawSetShadow
- #endif
- #define PlayerTextDrawSetShadow WC_PlayerTextDrawSetShadow
- #if defined _ALS_PlayerTextDrawSetOutline
- #undef PlayerTextDrawSetOutline
- #else
- #define _ALS_PlayerTextDrawSetOutline
- #endif
- #define PlayerTextDrawSetOutline WC_PlayerTextDrawSetOutline
- #if defined _ALS_PlayerTextDrawBackgroundCo
- #undef PlayerTextDrawBackgroundColor
- #else
- #define _ALS_PlayerTextDrawBackgroundCo
- #endif
- #define PlayerTextDrawBackgroundColor WC_PlayerTextDrawBackgroundColo
- #if defined _ALS_PlayerTextDrawFont
- #undef PlayerTextDrawFont
- #else
- #define _ALS_PlayerTextDrawFont
- #endif
- #define PlayerTextDrawFont WC_PlayerTextDrawFont
- #if defined _ALS_PlayerTextDrawSetProportio
- #undef PlayerTextDrawSetProportional
- #else
- #define _ALS_PlayerTextDrawSetProportio
- #endif
- #define PlayerTextDrawSetProportional WC_PlayerTextDrawSetProportiona
- #if defined _ALS_PlayerTextDrawSetSelectabl
- #undef PlayerTextDrawSetSelectable
- #else
- #define _ALS_PlayerTextDrawSetSelectabl
- #endif
- #define PlayerTextDrawSetSelectable WC_PlayerTextDrawSetSelectable
- #if defined _ALS_PlayerTextDrawShow
- #undef PlayerTextDrawShow
- #else
- #define _ALS_PlayerTextDrawShow
- #endif
- #define PlayerTextDrawShow WC_PlayerTextDrawShow
- #if defined _ALS_PlayerTextDrawHide
- #undef PlayerTextDrawHide
- #else
- #define _ALS_PlayerTextDrawHide
- #endif
- #define PlayerTextDrawHide WC_PlayerTextDrawHide
- #if defined _ALS_PlayerTextDrawSetString
- #undef PlayerTextDrawSetString
- #else
- #define _ALS_PlayerTextDrawSetString
- #endif
- #define PlayerTextDrawSetString WC_PlayerTextDrawSetString
- #if defined _ALS_PlayerTextDrawSetPreviewMo
- #undef PlayerTextDrawSetPreviewModel
- #else
- #define _ALS_PlayerTextDrawSetPreviewMo
- #endif
- #define PlayerTextDrawSetPreviewModel WC_PlayerTextDrawSetPreviewMode
- #if defined _ALS_PlayerTextDrawSetPreviewRo
- #undef PlayerTextDrawSetPreviewRot
- #else
- #define _ALS_PlayerTextDrawSetPreviewRo
- #endif
- #define PlayerTextDrawSetPreviewRot WC_PlayerTextDrawSetPreviewRot
- #if defined _ALS_PlayerTextDrawSetPreviewVe
- #undef PlayerTextDrawSetPreviewVehCol
- #else
- #define _ALS_PlayerTextDrawSetPreviewVe
- #endif
- #define PlayerTextDrawSetPreviewVehCol WC_PlayerTextDrawSetPreviewVehC
|