1
0

PPC_PlayerCommands.inc 169 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939
  1. // This is just a joke command
  2. COMMAND:me(playerid,params[])
  3. {
  4. // Setup local variables
  5. new Msg[128], Message[128], Name[24];
  6. // Send the command to all admins so they can see it
  7. SendAdminText(playerid, "/me", params);
  8. // Check if the player has logged in
  9. if (APlayerData[playerid][LoggedIn] == true)
  10. {
  11. if (sscanf(params, "s[128]", Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/me <action>\"");
  12. else
  13. {
  14. // Check if the player isn't muted
  15. if (APlayerData[playerid][Muted] == false)
  16. {
  17. GetPlayerName(playerid, Name, sizeof(Name));
  18. format(Msg, sizeof(Msg), "* %s: %s", Name, Message);
  19. SendClientMessageToAll(0xFFFF00AA, Msg);
  20. }
  21. else
  22. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You are still muted");
  23. }
  24. }
  25. else
  26. return 0;
  27. // Let the server know that this was a valid command
  28. return 1;
  29. }
  30. // This commands allows the player to send a private message to another player
  31. COMMAND:pm(playerid, params[])
  32. {
  33. // Setup local variables
  34. new OtherPlayer, Message[128], Msg1[128], Msg2[128], YourName[24], OtherPlayerName[24];
  35. // Send the command to all admins so they can see it
  36. SendAdminText(playerid, "/pm", params);
  37. // Check if the player has logged in
  38. if (APlayerData[playerid][LoggedIn] == true)
  39. {
  40. if (sscanf(params, "us[128]", OtherPlayer, Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/pm <OtherPlayer> <Message>\"");
  41. else
  42. {
  43. // Check if that other player is online
  44. if (IsPlayerConnected(OtherPlayer))
  45. {
  46. // Check if the player isn't muted
  47. if (APlayerData[playerid][Muted] == false)
  48. {
  49. // Get both names
  50. GetPlayerName(playerid, YourName, sizeof(YourName));
  51. GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName));
  52. // Construct the message that is sent to yourself
  53. format(Msg1, 128, "{808080}PM to %s{FFFFFF}: %s", OtherPlayerName, Message);
  54. // Construct the message that is sent to the other player
  55. format(Msg2, 128, "{A0A0A0}PM by %s{FFFFFF}: %s", YourName, Message);
  56. // Send the messages
  57. SendClientMessage(playerid, 0xFFFFFFFF, Msg1);
  58. SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg2);
  59. }
  60. else
  61. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You are still muted");
  62. }
  63. else
  64. SendClientMessage(playerid, 0xFF0000FF, "Player is not online");
  65. }
  66. }
  67. else
  68. return 0;
  69. // Let the server know that this was a valid command
  70. return 1;
  71. }
  72. // Lets the player add new houses
  73. COMMAND:createhouse(playerid, params[])
  74. {
  75. // Setup local variables
  76. new HPrice, MaxLevel, HouseID;
  77. // Send the command to all admins so they can see it
  78. SendAdminText(playerid, "/createhouse", params);
  79. // Check if the player has logged in
  80. if (APlayerData[playerid][LoggedIn] == true)
  81. {
  82. // Check if the player's admin-level is at least 5
  83. if (APlayerData[playerid][PlayerLevel] >= 5)
  84. {
  85. // Check if the player isn't inside a vehicle
  86. if (GetPlayerVehicleSeat(playerid) == -1)
  87. {
  88. if (sscanf(params, "ii", HPrice, MaxLevel)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/createhouse <price> <maxlevel (1-10)>\"");
  89. else
  90. {
  91. // Check if the player entered a proper maxlevel
  92. if ((MaxLevel >= 1) && (MaxLevel <= 10))
  93. {
  94. // Find the first free HouseID
  95. for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
  96. if (AHouseData[HouseID][PickupID] == 0) // Check if an empty house-index has been found (PickupID is 0)
  97. break; // Stop searching, the first free HouseID has been found now
  98. // Check if the house-limit hasn't been reached yet
  99. if (HouseID < MAX_HOUSES)
  100. {
  101. // Setup some local variables
  102. new Float:x, Float:y, Float:z, Msg[128];
  103. // Get the player's position
  104. GetPlayerPos(playerid, x, y, z);
  105. // Set some default data
  106. AHouseData[HouseID][HouseX] = x;
  107. AHouseData[HouseID][HouseY] = y;
  108. AHouseData[HouseID][HouseZ] = z;
  109. AHouseData[HouseID][HouseLevel] = 1;
  110. AHouseData[HouseID][HouseMaxLevel] = MaxLevel;
  111. AHouseData[HouseID][HousePrice] = HPrice;
  112. AHouseData[HouseID][Owned] = false;
  113. // Add the pickup and 3DText at the location of the house-entrance (where the player is standing when he creates the house)
  114. House_CreateEntrance(HouseID);
  115. // Save the house
  116. HouseFile_Save(HouseID);
  117. // Inform the player that he created a new house
  118. format(Msg, 128, "{00FF00}You've succesfully created house {FF00FF}%i{00FF00}", HouseID);
  119. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  120. }
  121. else
  122. SendClientMessage(playerid, 0xFF0000FF, "The maximum amount of houses has been reached");
  123. }
  124. else
  125. SendClientMessage(playerid, 0xFF0000FF, "You have to use a max-level from 1 to 10");
  126. }
  127. }
  128. else
  129. SendClientMessage(playerid, 0xFF0000FF, "You can't be inside a vehicle to create a house");
  130. }
  131. }
  132. else
  133. return 0;
  134. // Let the server know that this was a valid command
  135. return 1;
  136. }
  137. // This command lets the player delete a house
  138. COMMAND:delhouse(playerid, params[])
  139. {
  140. // Setup local variables
  141. new file[100], Msg[128];
  142. // Send the command to all admins so they can see it
  143. SendAdminText(playerid, "/delhouse", params);
  144. // Check if the player has logged in
  145. if (APlayerData[playerid][LoggedIn] == true)
  146. {
  147. // Check if the player's admin-level is at least 5
  148. if (APlayerData[playerid][PlayerLevel] >= 5)
  149. {
  150. // Make sure the player isn't inside a vehicle
  151. if (GetPlayerVehicleID(playerid) == 0)
  152. {
  153. // Loop through all player-owned houses
  154. for (new HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
  155. {
  156. // Check if the house exists
  157. if (AHouseData[HouseID][PickupID] != 0)
  158. {
  159. // Check if the house has no owner
  160. if (AHouseData[HouseID][Owned] == false)
  161. {
  162. // Check if the player is in range of the house-pickup
  163. if (IsPlayerInRangeOfPoint(playerid, 2.5, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
  164. {
  165. // Clear all data of the house
  166. AHouseData[HouseID][HouseName] = 0;
  167. AHouseData[HouseID][Insurance] = 0;
  168. AHouseData[HouseID][HouseX] = 0.0;
  169. AHouseData[HouseID][HouseY] = 0.0;
  170. AHouseData[HouseID][HouseZ] = 0.0;
  171. AHouseData[HouseID][HouseLevel] = 0;
  172. AHouseData[HouseID][HouseMaxLevel] = 0;
  173. AHouseData[HouseID][HousePrice] = 0;
  174. AHouseData[HouseID][Owned] = false;
  175. AHouseData[HouseID][Owner] = 0;
  176. AHouseData[HouseID][HouseName] = 0;
  177. AHouseData[HouseID][HouseName] = 0;
  178. AHouseData[HouseID][HouseName] = 0;
  179. // Destroy the mapicon, 3DText and pickup for the house
  180. DestroyDynamicPickup(AHouseData[HouseID][PickupID]);
  181. DestroyDynamicMapIcon(AHouseData[HouseID][MapIconID]);
  182. DestroyDynamic3DTextLabel(AHouseData[HouseID][DoorText]);
  183. AHouseData[HouseID][PickupID] = 0;
  184. AHouseData[HouseID][MapIconID] = 0;
  185. // Delete the House-file
  186. format(file, sizeof(file), HouseFile, HouseID); // Construct the complete filename for this house-file
  187. if (fexist(file)) // Make sure the file exists
  188. fremove(file); // Delete the file
  189. // Also let the player know he deleted the house
  190. format(Msg, 128, "{00FF00}You have deleted the house with ID: {FFFF00}%i", HouseID);
  191. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  192. // Exit the function
  193. return 1;
  194. }
  195. }
  196. }
  197. }
  198. // There was no house in range, so let the player know about it
  199. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}No house in range to delete");
  200. }
  201. else
  202. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You can't be inside a vehicle to delete a house");
  203. }
  204. else
  205. return 0;
  206. }
  207. else
  208. return 0;
  209. // Let the server know that this was a valid command
  210. return 1;
  211. }
  212. // This command lets the player buy a house when he's standing in range of a house that isn't owned yet
  213. COMMAND:buyhouse(playerid, params[])
  214. {
  215. // Setup local variables
  216. new Msg[128];
  217. // Send the command to all admins so they can see it
  218. SendAdminText(playerid, "/buyhouse", params);
  219. // Check if the player has logged in
  220. if (APlayerData[playerid][LoggedIn] == true)
  221. {
  222. // Make sure the player isn't inside a vehicle
  223. if (GetPlayerVehicleID(playerid) == 0)
  224. {
  225. // Check if the player is near a house-pickup
  226. for (new i = 1; i < sizeof(AHouseData); i++)
  227. {
  228. // Check if this house is created (it would have a valid pickup in front of the door)
  229. if (AHouseData[i][PickupID] != 0)
  230. {
  231. // Check if the player is in range of the house-pickup
  232. if (IsPlayerInRangeOfPoint(playerid, 2.5, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ]))
  233. {
  234. // Check if the house isn't owned yet
  235. if (AHouseData[i][Owned] == false)
  236. {
  237. // Check if the player can afford this house
  238. if (APlayerData[playerid][PlayerMoney] >= AHouseData[i][HousePrice])
  239. House_SetOwner(playerid, i); // Give ownership of the house to the player
  240. else
  241. SendClientMessage(playerid, 0xFF0000FF, "You cannot afford this house"); // The player cannot afford this house
  242. }
  243. else
  244. {
  245. // Let the player know that this house is already owned by a player
  246. format(Msg, 128, "{FF0000}This house is already owned by {00FF00}%s{FFFFFF}", AHouseData[i][Owner]);
  247. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  248. }
  249. // The player was in range of a house-pickup, so stop searching for the other house pickups
  250. return 1;
  251. }
  252. }
  253. }
  254. // All houses have been processed, but the player wasn't in range of any house-pickup, let him know about it
  255. SendClientMessage(playerid, 0xFF0000FF, "To buy a house, you have to be near a house-pickup");
  256. }
  257. else
  258. SendClientMessage(playerid, 0xFF0000FF, "You can't buy a house when you're inside a vehicle");
  259. }
  260. else
  261. return 0;
  262. // Let the server know that this was a valid command
  263. return 1;
  264. }
  265. // This command lets the player enter the house/business if he's the owner
  266. COMMAND:enter(playerid, params[])
  267. {
  268. // Setup local variables
  269. new HouseID, hLevel, BusID, BusType;
  270. // Send the command to all admins so they can see it
  271. SendAdminText(playerid, "/enter", params);
  272. // Check if the player has logged in
  273. if (APlayerData[playerid][LoggedIn] == true)
  274. {
  275. // Make sure the player isn't inside a vehicle
  276. if (GetPlayerVehicleID(playerid) == 0)
  277. {
  278. // Loop through all houses
  279. for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
  280. {
  281. // Check if this house exists
  282. if (AHouseData[HouseID][PickupID] != 0)
  283. {
  284. // Check if the player is in range of the house-pickup
  285. if (IsPlayerInRangeOfPoint(playerid, 2.5, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
  286. {
  287. // Check if the house is closed to the public
  288. if (AHouseData[HouseID][HouseOpened] == false)
  289. {
  290. // The house isn't open to the public, so keep anyone out who isn't the owner of the house
  291. if (House_PlayerIsOwner(playerid, HouseID) == 0)
  292. {
  293. // Let the player know that this house isn't open to the public and he can't enter it
  294. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}This house isn't open to the public, you can't enter it");
  295. return 1;
  296. }
  297. }
  298. // The house is open to the public, or the player trying to enter is the owner, so let the player inside the house
  299. // Get the level of the house
  300. hLevel = AHouseData[HouseID][HouseLevel];
  301. // Set the worldid so other players cannot see him anymore
  302. SetPlayerVirtualWorld(playerid, 5000 + HouseID);
  303. // Set the player inside the interior of the house
  304. SetPlayerInterior(playerid, AHouseInteriors[hLevel][InteriorID]);
  305. // Set the position of the player at the spawn-location of the house's interior
  306. SetPlayerPos(playerid, AHouseInteriors[hLevel][IntX], AHouseInteriors[hLevel][IntY], AHouseInteriors[hLevel][IntZ]);
  307. // Also set a tracking-variable to enable /housemenu to track in which house the player is
  308. APlayerData[playerid][CurrentHouse] = HouseID;
  309. // Also let the player know he can use /housemenu to upgrade/exit his house
  310. SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Use {FFFF00}/housemenu{00FF00} to change options for your house");
  311. // Exit the function
  312. return 1;
  313. }
  314. }
  315. }
  316. // Loop through all player-owned businesses
  317. for (new i; i < MAX_BUSINESSPERPLAYER; i++)
  318. {
  319. // Get the business-id at the selected slot from the player
  320. BusID = APlayerData[playerid][Business][i];
  321. // Check if the player has owned a business in this slot
  322. if (BusID != 0)
  323. {
  324. // Check if the player is in range of the business-pickup
  325. if (IsPlayerInRangeOfPoint(playerid, 2.5, ABusinessData[BusID][BusinessX], ABusinessData[BusID][BusinessY], ABusinessData[BusID][BusinessZ]))
  326. {
  327. // Get the business-type
  328. BusType = ABusinessData[BusID][BusinessType];
  329. // Set the worldid so other players cannot see him anymore
  330. SetPlayerVirtualWorld(playerid, 1000 + playerid);
  331. // Set the player inside the interior of the business
  332. SetPlayerInterior(playerid, ABusinessInteriors[BusType][InteriorID]);
  333. // Set the position of the player at the spawn-location of the business's interior
  334. SetPlayerPos(playerid, ABusinessInteriors[BusType][IntX], ABusinessInteriors[BusType][IntY], ABusinessInteriors[BusType][IntZ]);
  335. // Also set a tracking-variable to enable /busmenu to track in which business the player is
  336. APlayerData[playerid][CurrentBusiness] = BusID;
  337. // Also let the player know he can use /busmenu to upgrade/exit his business
  338. SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Use {FFFF00}/busmenu{00FF00} to change options for your business");
  339. // Exit the function
  340. return 1;
  341. }
  342. }
  343. }
  344. }
  345. }
  346. else
  347. return 0;
  348. // Let the server know that this was a valid command
  349. return 1;
  350. }
  351. // This command opens a menu when you're inside your house to allow to access the options of your house
  352. COMMAND:housemenu(playerid, params[])
  353. {
  354. // Setup local variables
  355. new OptionsList[200], DialogTitle[200];
  356. // Send the command to all admins so they can see it
  357. SendAdminText(playerid, "/housemenu", params);
  358. // Check if the player has logged in
  359. if (APlayerData[playerid][LoggedIn] == true)
  360. {
  361. // Check if the player is inside a house
  362. if (APlayerData[playerid][CurrentHouse] != 0)
  363. {
  364. format(DialogTitle, sizeof(DialogTitle), "Select option for %s", AHouseData[APlayerData[playerid][CurrentHouse]][HouseName]);
  365. format(OptionsList, sizeof(OptionsList), "%sChange house-name\n", OptionsList);
  366. format(OptionsList, sizeof(OptionsList), "%sUpgrade house\n", OptionsList);
  367. format(OptionsList, sizeof(OptionsList), "%sBuy house-car\n", OptionsList);
  368. format(OptionsList, sizeof(OptionsList), "%sBuy house-car insurance\n", OptionsList);
  369. format(OptionsList, sizeof(OptionsList), "%sSell house-car\n", OptionsList);
  370. format(OptionsList, sizeof(OptionsList), "%sSell house\n", OptionsList);
  371. format(OptionsList, sizeof(OptionsList), "%sOpen house to the public\n", OptionsList);
  372. format(OptionsList, sizeof(OptionsList), "%sClose house to the public\n", OptionsList);
  373. format(OptionsList, sizeof(OptionsList), "%sExit house\n", OptionsList);
  374. // Show the housemenu
  375. ShowPlayerDialog(playerid, DialogHouseMenu, DIALOG_STYLE_LIST, DialogTitle, OptionsList, "Select", "Cancel");
  376. }
  377. else
  378. SendClientMessage(playerid, 0xFF0000FF, "You're not inside a house");
  379. }
  380. else
  381. return 0;
  382. // Let the server know that this was a valid command
  383. return 1;
  384. }
  385. // This command allows you to port a vehicle from your house to your location
  386. COMMAND:getcar(playerid, params[])
  387. {
  388. // Setup local variables
  389. new HouseList[1000];
  390. // Send the command to all admins so they can see it
  391. SendAdminText(playerid, "/getcar", params);
  392. // Check if the player has logged in
  393. if (APlayerData[playerid][LoggedIn] == true)
  394. {
  395. // Check if the player is not jailed
  396. if (APlayerData[playerid][PlayerJailed] == 0)
  397. {
  398. // Check if the player is not inside a vehicle
  399. if (GetPlayerVehicleID(playerid) == 0)
  400. {
  401. // Ask to which house the player wants to add his vehicle
  402. for (new i; i < MAX_HOUSESPERPLAYER; i++)
  403. {
  404. // Check if this houseindex is occupied
  405. if (APlayerData[playerid][Houses][i] != 0)
  406. format(HouseList, 1000, "%s{00FF00}%s{FFFFFF}\n", HouseList, AHouseData[APlayerData[playerid][Houses][i]][HouseName]);
  407. else
  408. format(HouseList, 1000, "%s{FFFFFF}%s{FFFFFF}\n", HouseList, "Empty house-slot");
  409. }
  410. ShowPlayerDialog(playerid, DialogGetCarSelectHouse, DIALOG_STYLE_LIST, "Choose the house to get a car from:", HouseList, "Select", "Cancel");
  411. }
  412. else
  413. SendClientMessage(playerid, 0xFF0000FF, "You need to be on-foot to port a vehicle to your location");
  414. }
  415. else
  416. SendClientMessage(playerid, 0xFF0000FF, "You cannot use /getcar when you're in jail");
  417. }
  418. else
  419. return 0;
  420. // Let the server know that this was a valid command
  421. return 1;
  422. }
  423. // This command checks if the player is inside a vehicle that he owns and if he's in range of the house where the vehicle is assigned to
  424. COMMAND:park(playerid, params[])
  425. {
  426. // Setup local variables
  427. new Float:x, Float:y, Float:z, Float:rot, vid, HouseID, Msg[128];
  428. new engine,lights,alarm,doors,bonnet,boot,objective;
  429. // Send the command to all admins so they can see it
  430. SendAdminText(playerid, "/park", params);
  431. // Check if the player has logged in
  432. if (APlayerData[playerid][LoggedIn] == true)
  433. {
  434. // Check if the player is inside a vehicle (he must be the driver)
  435. if (GetPlayerVehicleSeat(playerid) == 0)
  436. {
  437. // Get the vehicle-id
  438. vid = GetPlayerVehicleID(playerid);
  439. // Get the HouseID to which this vehicle belongs
  440. HouseID = AVehicleData[vid][BelongsToHouse];
  441. // Check if the vehicle is owned (owner-check is not really required, as another player would get kicked out very fast)
  442. // AND it must belong to a house that the player owns
  443. if ((AVehicleData[vid][Owned] == true) && (HouseID != 0))
  444. {
  445. // Check if the vehicle is in range of the house-entrance (you cannot park a vehicle further away from your house than 150m)
  446. if (IsPlayerInRangeOfPoint(playerid, ParkRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
  447. {
  448. // Get the player's position and angle
  449. GetVehiclePos(vid, x, y, z);
  450. GetVehicleZAngle(vid, rot);
  451. // Save those values for the vehicle
  452. AVehicleData[vid][SpawnX] = x;
  453. AVehicleData[vid][SpawnY] = y;
  454. AVehicleData[vid][SpawnZ] = z;
  455. AVehicleData[vid][SpawnRot] = rot;
  456. // Find the vehicle in the player's houses
  457. for (new i; i < MAX_HOUSESPERPLAYER; i++)
  458. {
  459. // Get the HouseID of the current house
  460. HouseID = APlayerData[playerid][Houses][i];
  461. // Loop through all carslots of this house to find the vehicle-id
  462. for (new CarSlot; CarSlot < 10; CarSlot++)
  463. {
  464. // Check if this carslot holds the same vehicle-id
  465. if (AHouseData[HouseID][VehicleIDs][CarSlot] == vid)
  466. {
  467. House_ReplaceVehicle(HouseID, CarSlot); // Re-create the vehicle at the same spot the player wants to park his vehicle
  468. PutPlayerInVehicle(playerid, AHouseData[HouseID][VehicleIDs][CarSlot], 0);
  469. // Turn on the engine
  470. GetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], engine, lights, alarm, doors, bonnet, boot, objective);
  471. SetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], 1, lights, alarm, doors, bonnet, boot, objective);
  472. break; // Stop the for-loop
  473. }
  474. }
  475. }
  476. // Let the player know he parked his vehicle
  477. SendClientMessage(playerid, 0x00FF00FF, "You've parked your vehicle");
  478. // Save the player-file (and his houses)
  479. PlayerFile_Save(playerid);
  480. }
  481. else
  482. {
  483. format(Msg, 128, "{FF0000}You need to be within %im of your house to park this vehicle", ParkRange);
  484. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  485. }
  486. }
  487. else
  488. SendClientMessage(playerid, 0xFF0000FF, "You cannot park a vehicle that's not owned by you");
  489. }
  490. else
  491. SendClientMessage(playerid, 0xFF0000FF, "You must be driving a vehicle you own to park it");
  492. }
  493. else
  494. return 0;
  495. // Let the server know that this was a valid command
  496. return 1;
  497. }
  498. // Lets the player rent a vehicle
  499. COMMAND:rentcar(playerid, params[])
  500. {
  501. // Setup local variables
  502. new VehicleClassList[1000];
  503. // Send the command to all admins so they can see it
  504. SendAdminText(playerid, "/rentcar", params);
  505. // Check if the player has logged in
  506. if (APlayerData[playerid][LoggedIn] == true)
  507. {
  508. // Make sure the player isn't inside a vehicle
  509. if (GetPlayerVehicleID(playerid) == 0)
  510. {
  511. // Check if the player is near a cardealerpickup
  512. for (new i; i < sizeof(ACarDealerPickups); i++)
  513. {
  514. // Check if a valid cardealerpickup is found
  515. if (ACarDealerPickups[i][PickupID] != 0)
  516. {
  517. // Check if the player is in range of the cardealerpickup
  518. if(IsPlayerInRangeOfPoint(playerid, 2.5, ACarDealerPickups[i][pux], ACarDealerPickups[i][puy], ACarDealerPickups[i][puz]))
  519. {
  520. // Let the player choose a vehicle-class
  521. format(VehicleClassList, 1000, "%s{00FF00}%s{FFFFFF}\n", VehicleClassList, "Bikes");
  522. format(VehicleClassList, 1000, "%s{40FF00}%s{FFFFFF}\n", VehicleClassList, "Boats");
  523. format(VehicleClassList, 1000, "%s{80FF00}%s{FFFFFF}\n", VehicleClassList, "Convertibles");
  524. format(VehicleClassList, 1000, "%s{B0FF00}%s{FFFFFF}\n", VehicleClassList, "Helicopters");
  525. format(VehicleClassList, 1000, "%s{FFFF00}%s{FFFFFF}\n", VehicleClassList, "Industrial vehicles");
  526. format(VehicleClassList, 1000, "%s{B0FF40}%s{FFFFFF}\n", VehicleClassList, "Low-riders");
  527. format(VehicleClassList, 1000, "%s{80FF80}%s{FFFFFF}\n", VehicleClassList, "Off-Road vehicles");
  528. format(VehicleClassList, 1000, "%s{40FFB0}%s{FFFFFF}\n", VehicleClassList, "Planes");
  529. format(VehicleClassList, 1000, "%s{00FFFF}%s{FFFFFF}\n", VehicleClassList, "Public Service vehicles");
  530. format(VehicleClassList, 1000, "%s{00B0FF}%s{FFFFFF}\n", VehicleClassList, "RC vehicles");
  531. format(VehicleClassList, 1000, "%s{0080FF}%s{FFFFFF}\n", VehicleClassList, "Saloon vehicles");
  532. format(VehicleClassList, 1000, "%s{0040FF}%s{FFFFFF}\n", VehicleClassList, "Sport vehicles");
  533. format(VehicleClassList, 1000, "%s{0000FF}%s{FFFFFF}\n", VehicleClassList, "Station wagons");
  534. format(VehicleClassList, 1000, "%s{4000FF}%s{FFFFFF}\n", VehicleClassList, "Trailers");
  535. format(VehicleClassList, 1000, "%s{8000FF}%s{FFFFFF}\n", VehicleClassList, "Unique vehicles");
  536. // Ask which vehicle class the player wants to see to buy a vehicle
  537. ShowPlayerDialog(playerid, DialogRentCarClass, DIALOG_STYLE_LIST, "Select vehicle class:", VehicleClassList, "Select", "Cancel");
  538. // Exit the function
  539. return 1;
  540. }
  541. }
  542. }
  543. // The player wasn't in range of a cardealer
  544. SendClientMessage(playerid, 0xFF0000FF, "You cannot rent a vehicle when you're not close to a cardealer");
  545. }
  546. else
  547. SendClientMessage(playerid, 0xFF0000FF, "You cannot rent a vehicle when you're inside a car");
  548. }
  549. else
  550. return 0;
  551. // Let the server know that this was a valid command
  552. return 1;
  553. }
  554. // This command teleports you to your selected house
  555. COMMAND:gohome(playerid, params[])
  556. {
  557. // Setup local variables
  558. new HouseList[1000];
  559. // Send the command to all admins so they can see it
  560. SendAdminText(playerid, "/gohome", params);
  561. // Check if the player has logged in
  562. if (APlayerData[playerid][LoggedIn] == true)
  563. {
  564. // Check if the player has a wanted level of less than 3
  565. if (GetPlayerWantedLevel(playerid) < 3)
  566. {
  567. // Check if the player is not jailed
  568. if (APlayerData[playerid][PlayerJailed] == 0)
  569. {
  570. // Check if the player is not inside a vehicle
  571. if (GetPlayerVehicleID(playerid) == 0)
  572. {
  573. // Ask to which house the player wants to add his vehicle
  574. for (new i; i < MAX_HOUSESPERPLAYER; i++)
  575. {
  576. // Check if this houseindex is occupied
  577. if (APlayerData[playerid][Houses][i] != 0)
  578. format(HouseList, 1000, "%s{00FF00}%s{FFFFFF}\n", HouseList, AHouseData[APlayerData[playerid][Houses][i]][HouseName]);
  579. else
  580. format(HouseList, 1000, "%s{FFFFFF}%s{FFFFFF}\n", HouseList, "Empty house-slot");
  581. }
  582. ShowPlayerDialog(playerid, DialogGoHome, DIALOG_STYLE_LIST, "Choose the house to go to:", HouseList, "Select", "Cancel");
  583. }
  584. else
  585. SendClientMessage(playerid, 0xFF0000FF, "You need to be on-foot to port to your house");
  586. }
  587. else
  588. SendClientMessage(playerid, 0xFF0000FF, "You cannot use /gohome when you're in jail");
  589. }
  590. else
  591. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /gohome when you're wanted");
  592. }
  593. else
  594. return 0;
  595. // Let the server know that this was a valid command
  596. return 1;
  597. }
  598. // Gives the player the cash he requests
  599. COMMAND:cash(playerid, params[])
  600. {
  601. new Amount, Msg[128];
  602. // Send the command to all admins so they can see it
  603. SendAdminText(playerid, "/cash", params);
  604. // Check if the player has logged in
  605. if (APlayerData[playerid][LoggedIn] == true)
  606. {
  607. // Check if the player's admin-level is at least 4
  608. if (APlayerData[playerid][PlayerLevel] >= 4)
  609. {
  610. if (sscanf(params, "i", Amount)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/cash <amount>\"");
  611. else
  612. {
  613. // Check if the player gave himself too much at once
  614. if (Amount > 10000000)
  615. {
  616. // Inform the player and quit the command
  617. SendClientMessage(playerid, 0xFF0000AA, "You cannot give yourself more than 10M at once");
  618. return 1;
  619. }
  620. // Reward the player (give cash and points)
  621. RewardPlayer(playerid, Amount, 0);
  622. format(Msg, 128, "You have earned $%i", Amount);
  623. SendClientMessage(playerid, 0x00FF00AA, Msg);
  624. }
  625. }
  626. else
  627. return 0;
  628. }
  629. else
  630. return 0;
  631. return 1;
  632. }
  633. // Gives the player the cash he requests
  634. COMMAND:score(playerid, params[])
  635. {
  636. new Amount, Msg[128];
  637. // Send the command to all admins so they can see it
  638. SendAdminText(playerid, "/score", params);
  639. // Check if the player has logged in
  640. if (APlayerData[playerid][LoggedIn] == true)
  641. {
  642. // Check if the player's admin-level is at least 4
  643. if (APlayerData[playerid][PlayerLevel] >= 4)
  644. {
  645. if (sscanf(params, "i", Amount)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/score <amount>\"");
  646. else
  647. {
  648. // Reward the player (give cash and points)
  649. RewardPlayer(playerid, 0, Amount);
  650. format(Msg, 128, "You have earned %i scorepoints", Amount);
  651. SendClientMessage(playerid, 0x00FF00AA, Msg);
  652. }
  653. }
  654. else
  655. return 0;
  656. }
  657. else
  658. return 0;
  659. return 1;
  660. }
  661. // Detaches the trailer from the vehicle
  662. COMMAND:detach(playerid, params[])
  663. {
  664. // Send the command to all admins so they can see it
  665. SendAdminText(playerid, "/detach", params);
  666. // Check if the player has logged in
  667. if (APlayerData[playerid][LoggedIn] == true)
  668. {
  669. // Detach the trailer from the vehicle
  670. DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
  671. // Send the player a message that the trailer has been detached
  672. SendClientMessage(playerid, 0x0000FFFF, "Your trailer is detached");
  673. }
  674. else
  675. return 0;
  676. // Let the server know that this was a valid command
  677. return 1;
  678. }
  679. // Puts the player's vehicle back onto his wheels
  680. COMMAND:flip(playerid, params[])
  681. {
  682. // Send the command to all admins so they can see it
  683. SendAdminText(playerid, "/flip", params);
  684. // Check if the player has logged in
  685. if (APlayerData[playerid][LoggedIn] == true)
  686. {
  687. // Setup some local variables
  688. new Float:x = 0.0, Float:y = 0.0, Float:z = 0.0;
  689. // Check if the player is inside a vehicle
  690. if(IsPlayerInAnyVehicle(playerid))
  691. SetCameraBehindPlayer(playerid);
  692. // Get the player's position
  693. GetPlayerPos(playerid, x, y, z);
  694. // Set the vehicle on the player's coordinates
  695. SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
  696. // Let the vehicle point north
  697. SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
  698. }
  699. else
  700. return 0;
  701. // Let the server know that this was a valid command
  702. return 1;
  703. }
  704. // Repairs the player's vehicle
  705. COMMAND:repair(playerid, params[])
  706. {
  707. // Send the command to all admins so they can see it
  708. SendAdminText(playerid, "/repair", params);
  709. // Check if the player has logged in
  710. if (APlayerData[playerid][LoggedIn] == true)
  711. {
  712. // Check if the player's admin-level is at least 1
  713. if (APlayerData[playerid][PlayerLevel] >= 1)
  714. {
  715. // Check if the player is inside a vehicle
  716. if(!IsPlayerInAnyVehicle(playerid))
  717. return SendClientMessage(playerid, 0xFF0000FF, "You are not in a vehicle!"); // Let the player know he's not inside a vehicle and let the server know that this was a valid command
  718. // Fully repair the vehicle (damage value and bodywork)
  719. RepairVehicle(GetPlayerVehicleID(playerid));
  720. // Send the player a message to inform him that his vehicle has been repaired
  721. SendClientMessage(playerid, 0x00FF00FF, "Your vehicle has been successfully repaired!");
  722. }
  723. else
  724. return 0;
  725. }
  726. else
  727. return 0;
  728. // Let the server know that this was a valid command
  729. return 1;
  730. }
  731. // Repairs all vehicles
  732. COMMAND:repairall(playerid, params[])
  733. {
  734. // Send the command to all admins so they can see it
  735. SendAdminText(playerid, "/repairall", params);
  736. // Check if the player has logged in
  737. if (APlayerData[playerid][LoggedIn] == true)
  738. {
  739. // Check if the player's admin-level is at least 3
  740. if (APlayerData[playerid][PlayerLevel] >= 3)
  741. {
  742. // Loop through all vehicles
  743. for (new i; i < 2000; i++)
  744. RepairVehicle(i); // Fully repair the vehicle (damage value and bodywork)
  745. // Send all players a message to inform them that all vehicles have been repaired
  746. SendClientMessageToAll(0x00FF00FF, "All vehicles have been successfully repaired!");
  747. }
  748. else
  749. return 0;
  750. }
  751. else
  752. return 0;
  753. // Let the server know that this was a valid command
  754. return 1;
  755. }
  756. // Heals all players
  757. COMMAND:healall(playerid, params[])
  758. {
  759. // Send the command to all admins so they can see it
  760. SendAdminText(playerid, "/healall", params);
  761. // Check if the player has logged in
  762. if (APlayerData[playerid][LoggedIn] == true)
  763. {
  764. // Check if the player's admin-level is at least 3
  765. if (APlayerData[playerid][PlayerLevel] >= 3)
  766. {
  767. // Loop through all players
  768. for (new i; i < MAX_PLAYERS; i++)
  769. if (IsPlayerConnected(i)) // Check if the player is connected
  770. if (IsPlayerInAnyVehicle(i) == 0) // Check if the player isn't inside a vehicle
  771. SetPlayerHealth(i, 100.0); // Heal the player
  772. // Send all players a message to inform them that all players have been healed
  773. SendClientMessageToAll(0x00FF00FF, "All players have been healed!");
  774. }
  775. else
  776. return 0;
  777. }
  778. else
  779. return 0;
  780. // Let the server know that this was a valid command
  781. return 1;
  782. }
  783. // Kills the player
  784. COMMAND:kill(playerid, params[])
  785. {
  786. // Send the command to all admins so they can see it
  787. SendAdminText(playerid, "/kill", params);
  788. // Check if the player has logged in
  789. if (APlayerData[playerid][LoggedIn] == true)
  790. {
  791. // Check if the player has a wanted level of less than 3
  792. if (GetPlayerWantedLevel(playerid) < 3)
  793. {
  794. // Check if the player isn't in jail
  795. if (APlayerData[playerid][PlayerJailed] == 0)
  796. {
  797. // Force the player back into class-selection
  798. ForceClassSelection(playerid);
  799. // Kill the player (required after ForceClassSelection)
  800. SetPlayerHealth(playerid, 0.0);
  801. }
  802. else
  803. SendClientMessage(playerid, 0xFF0000FF, "You cannot use /kill when you're in jail");
  804. }
  805. else
  806. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /kill when you're wanted");
  807. }
  808. else
  809. return 0;
  810. // Let the server know that this was a valid command
  811. return 1;
  812. }
  813. // Lets the player choose another class
  814. COMMAND:reclass(playerid, params[])
  815. {
  816. // Send the command to all admins so they can see it
  817. SendAdminText(playerid, "/reclass", params);
  818. // Check if the player has logged in
  819. if (APlayerData[playerid][LoggedIn] == true)
  820. {
  821. // Check if the player has a wanted level of less than 3
  822. if (GetPlayerWantedLevel(playerid) < 3)
  823. {
  824. // Check if the player isn't in jail
  825. if (APlayerData[playerid][PlayerJailed] == 0)
  826. {
  827. // Force the player back into class-selection
  828. ForceClassSelection(playerid);
  829. // Kill the player (required after ForceClassSelection)
  830. SetPlayerHealth(playerid, 0.0);
  831. }
  832. else
  833. SendClientMessage(playerid, 0xFF0000FF, "You cannot use /reclass when you're in jail");
  834. }
  835. else
  836. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /reclass when you're wanted");
  837. }
  838. else
  839. return 0;
  840. // Let the server know that this was a valid command
  841. return 1;
  842. }
  843. // Starts a job
  844. COMMAND:work(playerid, params[])
  845. {
  846. // Send the command to all admins so they can see it
  847. SendAdminText(playerid, "/work", params);
  848. // Check if the player has logged in
  849. if (APlayerData[playerid][LoggedIn] == true)
  850. {
  851. // First check if the player already has a job
  852. if (APlayerData[playerid][JobStarted] == false)
  853. {
  854. // Check the player's class
  855. switch (APlayerData[playerid][PlayerClass])
  856. {
  857. case ClassTruckDriver:
  858. {
  859. // Get the id of the convoy (if the player is in a convoy)
  860. new Convoy = APlayerData[playerid][ConvoyID];
  861. // Check if the player is part of a convoy AND is not the leader
  862. if ((APlayerData[playerid][InConvoy] == true) && (AConvoys[Convoy][Members][0] != playerid))
  863. {
  864. // Let the player know he's not the leader of his convoy and cannot start a job
  865. SendClientMessage(playerid, 0xFF0000FF, "You're not the leader of your convoy, you cannot start a job");
  866. // Exit the function
  867. return 1;
  868. }
  869. // A convoy-leader proceeds here, and also a normal player (no convoy-member)
  870. // Check if the player is the driver of a vehicle
  871. if (GetPlayerVehicleSeat(playerid) == 0)
  872. {
  873. // Check if the player is inside a valid trucking vehicle
  874. switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
  875. {
  876. case VehicleFlatbed, VehicleDFT30, VehicleCementTruck: // Flatbed, DFT-30, CementTruck
  877. if (APlayerData[playerid][TruckerLicense] == 1) // Check if the player has acquired a truckers license
  878. ShowPlayerDialog(playerid, DialogTruckerJobMethod, DIALOG_STYLE_LIST, "Select method:", "Setup your own load and route\r\nAuto assigned load", "Select", "Cancel");
  879. else
  880. Trucker_StartRandomJob(playerid); // Start a random job
  881. case VehicleLineRunner, VehicleTanker, VehicleRoadTrain: // Player is driving a truck which needs a trailer
  882. if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) // Check if there is a trailer attached
  883. if (APlayerData[playerid][TruckerLicense] == 1) // Check if the player has acquired a truckers license
  884. ShowPlayerDialog(playerid, DialogTruckerJobMethod, DIALOG_STYLE_LIST, "Select method:", "Setup your own load and route\r\nAuto assigned load", "Select", "Cancel");
  885. else
  886. Trucker_StartRandomJob(playerid); // Start a random job
  887. else
  888. SendClientMessage(playerid, 0xFF0000FF, "You need a trailer to start a job");
  889. default: SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a trucking vehicle to start a job");
  890. }
  891. }
  892. else
  893. SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a trucking vehicle to start a job");
  894. }
  895. case ClassBusDriver:
  896. {
  897. // Check if the player is the driver of a vehicle
  898. if (GetPlayerVehicleSeat(playerid) == 0)
  899. if (GetVehicleModel(GetPlayerVehicleID(playerid)) == VehicleCoach) // Check if the player is inside a valid busdriver vehicle
  900. if (APlayerData[playerid][BusLicense] == 1) // Check if the player has acquired a busdriver license
  901. ShowPlayerDialog(playerid, DialogBusJobMethod, DIALOG_STYLE_LIST, "Select method:", "Choose your own busroute\r\nAuto assigned busroute", "Select", "Cancel");
  902. else
  903. BusDriver_StartJob(playerid, random(sizeof(ABusRoutes))); // Start a random job
  904. else
  905. SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a bus to start a job");
  906. else
  907. SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a bus to start a job");
  908. }
  909. case ClassPilot:
  910. {
  911. // Check if the player is the driver of a vehicle
  912. if (GetPlayerVehicleSeat(playerid) == 0)
  913. {
  914. // Check if the player is inside a valid piloting vehicle
  915. switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
  916. {
  917. case VehicleShamal, VehicleNevada, VehicleMaverick, VehicleCargobob: // Plane (Shamal), Plane (Nevada), helicopter (Maverick)
  918. Pilot_StartRandomJob(playerid); // Start a random piloting job
  919. default: SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a piloting vehicle to start a job");
  920. }
  921. }
  922. else
  923. SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a piloting vehicle to start a job");
  924. }
  925. case ClassMafia:
  926. {
  927. // Check if the player is the driver of a vehicle
  928. if (GetPlayerVehicleSeat(playerid) == 0)
  929. {
  930. // Check if the player is inside a valid piloting vehicle
  931. switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
  932. {
  933. case VehicleSandKing, VehicleMoonbeam: // Sangking, Moonbeam
  934. Mafia_StartRandomJob(playerid); // Start a random mafia job
  935. default: SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a mafia vehicle to start a job");
  936. }
  937. }
  938. else
  939. SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a mafia vehicle to start a job");
  940. }
  941. case ClassCourier:
  942. {
  943. // Check if the player is the driver of a vehicle
  944. if (GetPlayerVehicleSeat(playerid) == 0)
  945. {
  946. // Check if the player is inside a valid courier vehicle
  947. switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
  948. {
  949. case VehicleBurrito, VehicleFaggio, VehicleBenson: // Van (Burrito), bike (Faggio)
  950. Courier_StartJob(playerid); // Start a random courier job
  951. default: SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a courier vehicle to start a job");
  952. }
  953. }
  954. else
  955. SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a courier vehicle to start a job");
  956. }
  957. case ClassRoadWorker:
  958. {
  959. // Check if the player is the driver of a vehicle
  960. if (GetPlayerVehicleSeat(playerid) == 0)
  961. {
  962. // Check if the player is inside a valid courier vehicle
  963. switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
  964. {
  965. case VehicleUtilityVan, VehicleTowTruck: // Utility Van, Towtruck
  966. Roadworker_StartRandomJob(playerid); // Start a random roadworker job
  967. default: SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a roadworker vehicle to start a job");
  968. }
  969. }
  970. else
  971. SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a roadworker vehicle to start a job");
  972. }
  973. default: SendClientMessage(playerid, 0xFF0000FF, "Your class cannot do any jobs");
  974. }
  975. }
  976. else // Send a message to let the player know he already has a job
  977. SendClientMessage(playerid, 0xFF0000FF, "You're already doing a job");
  978. }
  979. else
  980. return 0;
  981. // Let the server know that this was a valid command
  982. return 1;
  983. }
  984. // Stops the current job
  985. COMMAND:stopwork(playerid, params[])
  986. {
  987. // Send the command to all admins so they can see it
  988. SendAdminText(playerid, "/stopwork", params);
  989. // Check if the player has logged in
  990. if (APlayerData[playerid][LoggedIn] == true)
  991. {
  992. // Check if the player has a job started
  993. if (APlayerData[playerid][JobStarted] == true)
  994. {
  995. // Check the class of the player
  996. switch (APlayerData[playerid][PlayerClass])
  997. {
  998. case ClassTruckDriver: Trucker_EndJob(playerid); // Stop any trucker job
  999. case ClassBusDriver: BusDriver_EndJob(playerid); // Stop any busdriver job
  1000. case ClassPilot: Pilot_EndJob(playerid); // Stop any pilot job
  1001. case ClassMafia: Mafia_EndJob(playerid); // Stop any mafia job
  1002. case ClassCourier: Courier_EndJob(playerid);
  1003. case ClassRoadWorker: Roadworker_EndJob(playerid);
  1004. default: SendClientMessage(playerid, 0xFF0000FF, "Your class has no job to end");
  1005. }
  1006. // Inform the player that he failed the mission
  1007. GameTextForPlayer(playerid, "~w~You ~r~failed~w~ your mission. You lost ~y~$1000~w~ to cover expenses.", 5000, 4);
  1008. // Reduce the player's cash by 1000
  1009. RewardPlayer(playerid, -1000, 0);
  1010. }
  1011. }
  1012. else
  1013. return 0;
  1014. // Let the server know that this was a valid command
  1015. return 1;
  1016. }
  1017. // Displays the player's coordinates on the map
  1018. COMMAND:loc(playerid, params[])
  1019. {
  1020. // Send the command to all admins so they can see it
  1021. SendAdminText(playerid, "/loc", params);
  1022. // Check if the player has logged in
  1023. if (APlayerData[playerid][LoggedIn] == true)
  1024. {
  1025. // Check if the player's admin-level is at least 3
  1026. if (APlayerData[playerid][PlayerLevel] >= 3)
  1027. {
  1028. // Setup some local variables
  1029. new Message[200], Float:x, Float:y, Float:z, Float:rot, Interior, World;
  1030. // Get the player's position
  1031. GetPlayerPos(playerid, x, y, z);
  1032. // Check if the player is on foot or in a vehicle
  1033. if (GetPlayerVehicleSeat(playerid) == -1)
  1034. GetPlayerFacingAngle(playerid, rot); // Get the player's angle
  1035. else
  1036. GetVehicleZAngle(GetPlayerVehicleID(playerid), rot);
  1037. // Get the interior where the player is located
  1038. Interior = GetPlayerInterior(playerid);
  1039. // Get the virtual world of the player
  1040. World = GetPlayerVirtualWorld(playerid);
  1041. // combine the position and angle into a proper message
  1042. format(Message, sizeof(Message), "Location: X=%4.2f, Y=%4.2f, Z=%4.2f, rotation=%4.2f, interior=%i, world=%i", x, y, z, rot, Interior, World);
  1043. // Send the message with the coordinates and the angle of the player
  1044. SendClientMessage(playerid, 0xFF0000AA, Message);
  1045. }
  1046. else
  1047. return 0;
  1048. }
  1049. else
  1050. return 0;
  1051. // Let the server know that this was a valid command
  1052. return 1;
  1053. }
  1054. // Saves the location into a file
  1055. COMMAND:saveloc(playerid, params[])
  1056. {
  1057. new File:LocFile, LineForFile[255], LineMsg[255];
  1058. new Float:x, Float:y, Float:z, LocName[255], ID;
  1059. // Send the command to all admins so they can see it
  1060. SendAdminText(playerid, "/saveloc", params);
  1061. // Check if the player has logged in
  1062. if (APlayerData[playerid][LoggedIn] == true)
  1063. {
  1064. // Check if the player's admin-level is at least 5
  1065. if (APlayerData[playerid][PlayerLevel] >= 5)
  1066. {
  1067. if (sscanf(params, "is[255]", ID, LocName)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/saveloc <ID> <LocationName>\"");
  1068. else
  1069. {
  1070. if (!fexist("ServerData/Locations.txt"))
  1071. {
  1072. LocFile = fopen("ServerData/Locations.txt", io_write); // Create the file
  1073. fclose(LocFile); // Close the file
  1074. }
  1075. // Get the player's position
  1076. GetPlayerPos(playerid, x, y, z);
  1077. // Combine all the data in a proper structure, so it can be used directly for setting up the ALocations array
  1078. format(LineForFile, sizeof(LineForFile), "\t{\"%s\", %4.2f, %4.2f, %4.2f}, // ID = %i", LocName, x, y, z, ID);
  1079. LocFile = fopen("ServerData/Locations.txt", io_append); // Open the locationfile for appending data to it
  1080. fwrite(LocFile, LineForFile); // Append the data to the end of the file
  1081. fwrite(LocFile, "\r\n"); // Start a new line, or all the data is saved in one line
  1082. fclose(LocFile); // Close the file
  1083. // Let the player know what data has been saved
  1084. format(LineMsg, 255, "Data has been saved: %s", LineForFile);
  1085. SendClientMessage(playerid, 0x808080FF, LineMsg);
  1086. }
  1087. }
  1088. else
  1089. return 0;
  1090. }
  1091. else
  1092. return 0;
  1093. // Let the server know that this was a valid command
  1094. return 1;
  1095. }
  1096. // Lets the player choose where he wants to respawn (costs $200)
  1097. COMMAND:rescue(playerid, params[])
  1098. {
  1099. // Send the command to all admins so they can see it
  1100. SendAdminText(playerid, "/rescue", params);
  1101. // Check if the player has logged in
  1102. if (APlayerData[playerid][LoggedIn] == true)
  1103. {
  1104. // Check if the player has a wanted level of less than 3
  1105. if (GetPlayerWantedLevel(playerid) < 3)
  1106. {
  1107. // Check if the player isn't in jail
  1108. if (APlayerData[playerid][PlayerJailed] == 0)
  1109. {
  1110. if (APlayerData[playerid][JobStarted] == false)
  1111. {
  1112. // Make sure you can't use "/rescue" when you're inside a vehicle (doesn't respawn you at the requested coords
  1113. // and puts a random item (bottle, sigarette, ...) in the player's hands
  1114. if (GetPlayerVehicleID(playerid) == 0)
  1115. {
  1116. // Create a dialog based on the player's class
  1117. switch (APlayerData[playerid][PlayerClass])
  1118. {
  1119. case ClassTruckDriver: // Ask where the trucker player wants to respawn
  1120. ShowPlayerDialog(playerid, DialogRescue, DIALOG_STYLE_LIST, "Choose trucker spawn point:", "Fallen Tree Depot\r\nFlint Trucking Depot\r\nLVA Freight Depot\r\nDoherty Depot\r\nEl Corona Depot\r\nLas Payasdas Depot\r\nQuarry Top\r\nShady Creek Depot", "Spawn", "Cancel");
  1121. case ClassBusDriver: // Ask where the busdriver wants to respawn
  1122. ShowPlayerDialog(playerid, DialogRescue, DIALOG_STYLE_LIST, "Choose busdriver spawn point:", "Los Santos\r\nSan Fierro\r\nLas Venturas", "Spawn", "Cancel");
  1123. case ClassPilot: // Ask where the pilot wants to respawn
  1124. ShowPlayerDialog(playerid, DialogRescue, DIALOG_STYLE_LIST, "Choose pilot spawn point:", "Los Santos\r\nSan Fierro\r\nLas Venturas", "Spawn", "Cancel");
  1125. case ClassPolice: // Ask where the police player wants to respawn
  1126. ShowPlayerDialog(playerid, DialogRescue, DIALOG_STYLE_LIST, "Choose police spawn point:", "Los Santos\r\nSan Fierro\r\nLas Venturas", "Spawn", "Cancel");
  1127. case ClassCourier: // Ask where the courier player wants to respawn
  1128. ShowPlayerDialog(playerid, DialogRescue, DIALOG_STYLE_LIST, "Choose courier spawn point:", "Los Santos\r\nSan Fierro\r\nLas Venturas", "Spawn", "Cancel");
  1129. }
  1130. }
  1131. else
  1132. SendClientMessage(playerid, 0xFF0000FF, "You cannot use '/rescue' when you're inside a vehicle"); // "/rescue" doesn't work inside a vehicle
  1133. }
  1134. else
  1135. SendClientMessage(playerid, 0xFF0000FF, "You cannot use rescue when doing a job"); // "/rescue" doesn't work during a job
  1136. }
  1137. else
  1138. SendClientMessage(playerid, 0xFF0000FF, "You cannot use /rescue when you're in jail");
  1139. }
  1140. else
  1141. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /rescue when you're wanted");
  1142. }
  1143. else
  1144. return 0;
  1145. // Let the server know that this was a valid command
  1146. return 1;
  1147. }
  1148. // Increases the player's wanted level by 1
  1149. COMMAND:wanted(playerid, params[])
  1150. {
  1151. new OtherPlayer, Stars;
  1152. // Send the command to all admins so they can see it
  1153. SendAdminText(playerid, "/wanted", params);
  1154. // Check if the player has logged in
  1155. if (APlayerData[playerid][LoggedIn] == true)
  1156. {
  1157. // Check if the player's admin-level is at least 2
  1158. if (APlayerData[playerid][PlayerLevel] >= 2)
  1159. {
  1160. if (sscanf(params, "ui", OtherPlayer, Stars)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/wanted <OtherPlayer> <Stars>\"");
  1161. else
  1162. if (IsPlayerConnected(OtherPlayer)) // If the player is a valid playerid (he's connected)
  1163. SetPlayerWantedLevel(OtherPlayer, Stars);
  1164. else
  1165. SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
  1166. }
  1167. else
  1168. return 0;
  1169. }
  1170. else
  1171. return 0;
  1172. // Let the server know that this was a valid command
  1173. return 1;
  1174. }
  1175. // Lets the player choose a motorcycle to spawn
  1176. COMMAND:bike(playerid, params[])
  1177. {
  1178. // Send the command to all admins so they can see it
  1179. SendAdminText(playerid, "/bike", params);
  1180. // Check if the player has logged in
  1181. if (APlayerData[playerid][LoggedIn] == true)
  1182. {
  1183. // Check if the player's admin-level is at least 1
  1184. if (APlayerData[playerid][PlayerLevel] >= 1)
  1185. {
  1186. // Make sure the player isn't inside a vehicle
  1187. if (GetPlayerVehicleID(playerid) == 0)
  1188. {
  1189. // Ask which motorcycle the player wants to have
  1190. ShowPlayerDialog(playerid, DialogBike, DIALOG_STYLE_LIST, "Choose a motorcycle:", "Bike\r\nBMX\r\nMountain Bike\r\nFaggio\r\nPizzaboy\r\nBF-400\r\nNRG-500\r\nPCJ-600\r\nFCR-900\r\nFreeway\r\nWayfarer\r\nSanchez\r\nQuad", "Spawn", "Cancel");
  1191. // Let the server know that this was a valid command
  1192. return 1;
  1193. }
  1194. }
  1195. else
  1196. return 0;
  1197. }
  1198. else
  1199. return 0;
  1200. // Let the server know that this was a valid command
  1201. return 1;
  1202. }
  1203. // Lets the player choose a car to spawn (in a split list which shows only 10 cars at a time)
  1204. COMMAND:car(playerid, params[])
  1205. {
  1206. // Send the command to all admins so they can see it
  1207. SendAdminText(playerid, "/car", params);
  1208. // Check if the player has logged in
  1209. if (APlayerData[playerid][LoggedIn] == true)
  1210. {
  1211. // Check if the player's admin-level is at least 1
  1212. if (APlayerData[playerid][PlayerLevel] >= 1)
  1213. {
  1214. // Make sure the player isn't inside a vehicle
  1215. if (GetPlayerVehicleID(playerid) == 0)
  1216. CarList_Create(playerid); // Create a list of cars (only the first 10 cars) and show the dialog so the player can choose a car
  1217. }
  1218. else
  1219. return 0;
  1220. }
  1221. else
  1222. return 0;
  1223. // Let the server know that this was a valid command
  1224. return 1;
  1225. }
  1226. // Lets the player choose a plane to spawn (in a split list which shows only 10 planes at a time)
  1227. COMMAND:plane(playerid, params[])
  1228. {
  1229. // Send the command to all admins so they can see it
  1230. SendAdminText(playerid, "/plane", params);
  1231. // Check if the player has logged in
  1232. if (APlayerData[playerid][LoggedIn] == true)
  1233. {
  1234. // Check if the player's admin-level is at least 1
  1235. if (APlayerData[playerid][PlayerLevel] >= 1)
  1236. {
  1237. // Make sure the player isn't inside a vehicle
  1238. if (GetPlayerVehicleID(playerid) == 0)
  1239. PlaneList_Create(playerid); // Create a list of planes (only the first 10 planes) and show the dialog so the player can choose a plane
  1240. }
  1241. else
  1242. return 0;
  1243. }
  1244. else
  1245. return 0;
  1246. // Let the server know that this was a valid command
  1247. return 1;
  1248. }
  1249. // Lets the player choose a trailer to spawn (in a split list which shows only 10 trailers at a time)
  1250. COMMAND:trailer(playerid, params[])
  1251. {
  1252. // Send the command to all admins so they can see it
  1253. SendAdminText(playerid, "/trailer", params);
  1254. // Check if the player has logged in
  1255. if (APlayerData[playerid][LoggedIn] == true)
  1256. {
  1257. // Check if the player's admin-level is at least 1
  1258. if (APlayerData[playerid][PlayerLevel] >= 1)
  1259. {
  1260. // Make sure the player isn't inside a vehicle
  1261. if (GetPlayerVehicleID(playerid) == 0)
  1262. TrailerList_Create(playerid); // Create a list of trailers (only the first 10 trailers) and show the dialog so the player can choose a trailer
  1263. }
  1264. else
  1265. return 0;
  1266. }
  1267. else
  1268. return 0;
  1269. // Let the server know that this was a valid command
  1270. return 1;
  1271. }
  1272. // Lets the player choose a boat to spawn
  1273. COMMAND:boat(playerid, params[])
  1274. {
  1275. // Send the command to all admins so they can see it
  1276. SendAdminText(playerid, "/boat", params);
  1277. // Check if the player has logged in
  1278. if (APlayerData[playerid][LoggedIn] == true)
  1279. {
  1280. // Check if the player's admin-level is at least 1
  1281. if (APlayerData[playerid][PlayerLevel] >= 1)
  1282. {
  1283. // Make sure the player isn't inside a vehicle
  1284. if (GetPlayerVehicleID(playerid) == 0)
  1285. {
  1286. // Ask which motorcycle the player wants to have
  1287. ShowPlayerDialog(playerid, DialogBoat, DIALOG_STYLE_LIST, "Choose a boat:", "Coastguard\nDinghy\nJetmax\nLaunch\nMarquis\nPredator\nReefer\nSpeeder\nSquallo\nTropic", "Spawn", "Cancel");
  1288. // Let the server know that this was a valid command
  1289. return 1;
  1290. }
  1291. }
  1292. else
  1293. return 0;
  1294. }
  1295. else
  1296. return 0;
  1297. // Let the server know that this was a valid command
  1298. return 1;
  1299. }
  1300. // Jail a player
  1301. COMMAND:jail(playerid, params[])
  1302. {
  1303. new PlayerToJail, JailTime, Reason[128], Msg[128], Name[24], AdminName[24];
  1304. // Send the command to all admins so they can see it
  1305. SendAdminText(playerid, "/jail", params);
  1306. // Check if the player has logged in
  1307. if (APlayerData[playerid][LoggedIn] == true)
  1308. {
  1309. // Check if the player's admin-level is at least 1
  1310. if (APlayerData[playerid][PlayerLevel] >= 1)
  1311. {
  1312. if (sscanf(params, "uis[128]", PlayerToJail, JailTime, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/jail <PlayerToJail> <JailTime> <Reason>\"");
  1313. else
  1314. if (IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)
  1315. {
  1316. // Jail the player
  1317. Police_JailPlayer(PlayerToJail, JailTime);
  1318. // Get the name of the player who jailed the player
  1319. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  1320. // Get the name of the player who's being sent to jail
  1321. GetPlayerName(PlayerToJail, Name, sizeof(Name));
  1322. // Send the jailed player a message who jailed him, why he's been jailed and how long
  1323. format(Msg, 128, "You have been jailed by %s %s for %i seconds", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime);
  1324. SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
  1325. format(Msg, 128, "Reason: %s", Reason);
  1326. SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
  1327. format(Msg, 128, "{00FF00}You have jailed {FFFF00}%s{00FF00} for {FFFF00}%i{00FF00} seconds", Name, JailTime);
  1328. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  1329. }
  1330. else
  1331. SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
  1332. }
  1333. else
  1334. return 0;
  1335. }
  1336. else
  1337. return 0;
  1338. // Let the server know that this was a valid command
  1339. return 1;
  1340. }
  1341. // Warn a player
  1342. COMMAND:warn(playerid, params[])
  1343. {
  1344. new PlayerToWarn, Reason[128], ReasonMsg[128], Name[24];
  1345. // Send the command to all admins so they can see it
  1346. SendAdminText(playerid, "/warn", params);
  1347. // Check if the player has logged in
  1348. if (APlayerData[playerid][LoggedIn] == true)
  1349. {
  1350. // Check if the player's admin-level is at least 1
  1351. if (APlayerData[playerid][PlayerLevel] >= 1)
  1352. {
  1353. if (sscanf(params, "us[128]", PlayerToWarn, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/warn <PlayerToWarn> <Reason>\"");
  1354. else
  1355. if (IsPlayerConnected(PlayerToWarn)) // If the player is a valid playerid (he's connected)
  1356. {
  1357. // Increase the number of warnings
  1358. APlayerData[PlayerToWarn][Warnings]++;
  1359. // Get the name of the player who warned the player
  1360. GetPlayerName(playerid, Name, sizeof(Name));
  1361. // Send the warned player a message who warned him and why he's been warned
  1362. format(ReasonMsg, 128, "You have been warned by %s %s", AdminLevelName[APlayerData[playerid][PlayerLevel]], Name);
  1363. SendClientMessage(PlayerToWarn, 0xFF0000FF, ReasonMsg);
  1364. format(ReasonMsg, 128, "Reason: %s", Reason);
  1365. SendClientMessage(PlayerToWarn, 0xFF0000FF, ReasonMsg);
  1366. format(ReasonMsg, 128, "~w~Warning %i/%i: ~r~%s~w~", APlayerData[PlayerToWarn][Warnings], AutoKickWarnings, Reason);
  1367. GameTextForPlayer(PlayerToWarn, ReasonMsg, 5000, 4);
  1368. // Get the name of the warned player
  1369. GetPlayerName(PlayerToWarn, Name, sizeof(Name));
  1370. // Let the admin know who has been warned and why
  1371. format(ReasonMsg, 128, "You have warned %s (warnings: %i/%i)", Name, APlayerData[PlayerToWarn][Warnings], AutoKickWarnings);
  1372. SendClientMessage(playerid, 0x00FF00FF, ReasonMsg);
  1373. format(ReasonMsg, 128, "Reason: %s", Reason);
  1374. SendClientMessage(playerid, 0xFF0000FF, ReasonMsg);
  1375. // Automatically kick the player if he got 3 warnings (if autokick is enabled)
  1376. if ((APlayerData[PlayerToWarn][Warnings] == AutoKickWarnings) && (AutoKickAfterWarn == 1))
  1377. Kick(PlayerToWarn);
  1378. }
  1379. else
  1380. SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
  1381. }
  1382. else
  1383. return 0;
  1384. }
  1385. else
  1386. return 0;
  1387. // Let the server know that this was a valid command
  1388. return 1;
  1389. }
  1390. // Kicks a player with a reason
  1391. COMMAND:kick(playerid, params[])
  1392. {
  1393. new PlayerToKick, Reason[128], ReasonMsg[128], Name[24];
  1394. // Send the command to all admins so they can see it
  1395. SendAdminText(playerid, "/kick", params);
  1396. // Check if the player has logged in
  1397. if (APlayerData[playerid][LoggedIn] == true)
  1398. {
  1399. // Check if the player's admin-level is at least 1
  1400. if (APlayerData[playerid][PlayerLevel] >= 1)
  1401. {
  1402. if (sscanf(params, "us[128]", PlayerToKick, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/kick <PlayerToKick> <Reason>\"");
  1403. else
  1404. if (IsPlayerConnected(PlayerToKick)) // If the player is a valid playerid (he's connected)
  1405. {
  1406. // Get the name of the player who warned the player
  1407. GetPlayerName(playerid, Name, sizeof(Name));
  1408. // Send the warned player a message who kicked him and why he's been kicked
  1409. format(ReasonMsg, 128, "You have been kicked by %s %s", AdminLevelName[APlayerData[playerid][PlayerLevel]], Name);
  1410. SendClientMessage(PlayerToKick, 0xFF0000FF, ReasonMsg);
  1411. format(ReasonMsg, 128, "Reason: %s", Reason);
  1412. SendClientMessage(PlayerToKick, 0xFF0000FF, ReasonMsg);
  1413. // Kick the player
  1414. Kick(PlayerToKick);
  1415. }
  1416. else
  1417. SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
  1418. }
  1419. else
  1420. return 0;
  1421. }
  1422. else
  1423. return 0;
  1424. // Let the server know that this was a valid command
  1425. return 1;
  1426. }
  1427. // Bans a player for (days, hours, minutes, seconds)
  1428. COMMAND:ban(playerid, params[])
  1429. {
  1430. // Setup local variables
  1431. new PlayerToBan, Days, Hours, Reason[128], TotalBanTime, Msg[128], Name[24], AdminName[24];
  1432. // Send the command to all admins so they can see it
  1433. SendAdminText(playerid, "/ban", params);
  1434. // Check if the player has logged in
  1435. if (APlayerData[playerid][LoggedIn] == true)
  1436. {
  1437. // Check if the player's admin-level is at least 3
  1438. if (APlayerData[playerid][PlayerLevel] >= 3)
  1439. {
  1440. if (sscanf(params, "uiis[128]", PlayerToBan, Days, Hours, Reason))
  1441. SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/ban <PlayerToBan> <Days> <Hours> <Reason>\"");
  1442. else
  1443. {
  1444. if (IsPlayerConnected(PlayerToBan))
  1445. {
  1446. // Get the names of the player and the admin who executed the ban
  1447. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  1448. GetPlayerName(PlayerToBan, Name, sizeof(Name));
  1449. // Increase the number of bans
  1450. APlayerData[PlayerToBan][Bans]++;
  1451. // Calculate the total bantime (when the player can login again)
  1452. TotalBanTime = (Days * 86400) + (Hours * 3600) + gettime();
  1453. // Check if this is the player's 5th ban
  1454. if (APlayerData[PlayerToBan][Bans] == 5)
  1455. APlayerData[PlayerToBan][BanTime] = 2147483640; // Make the ban permanent (as high as it can go)
  1456. else
  1457. APlayerData[PlayerToBan][BanTime] = TotalBanTime; // Store this value for the player
  1458. // Inform the player about his ban
  1459. // Check if this is the player's 5th ban
  1460. if (APlayerData[PlayerToBan][Bans] == 5)
  1461. {
  1462. format(Msg, 128, "You have been banned permanently by %s, this was your 5th ban", AdminName);
  1463. SendClientMessage(PlayerToBan, 0x808080FF, Msg);
  1464. }
  1465. else
  1466. {
  1467. format(Msg, 128, "You have been banned by %s for %i days and %i hours", AdminName, Days, Hours);
  1468. SendClientMessage(PlayerToBan, 0x808080FF, Msg);
  1469. format(Msg, 128, "Reason: %s", Reason);
  1470. SendClientMessage(PlayerToBan, 0x808080FF, Msg);
  1471. format(Msg, 128, "You've been banned %i times now, 5th time is permament", APlayerData[PlayerToBan][Bans]);
  1472. SendClientMessage(PlayerToBan, 0x808080FF, Msg);
  1473. }
  1474. // Kick the player (his data will be saved)
  1475. Kick(PlayerToBan);
  1476. // Inform everybody else which player was banned and for how long
  1477. format(Msg, 128, "%s %s has banned %s for %i days and %i hours", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name, Days, Hours);
  1478. SendClientMessageToAll(0x808080FF, Msg);
  1479. }
  1480. }
  1481. }
  1482. else
  1483. return 0;
  1484. }
  1485. else
  1486. return 0;
  1487. return 1;
  1488. }
  1489. // Unbans a player (cleares the ban-time)
  1490. COMMAND:unban(playerid, params[])
  1491. {
  1492. // Setup local variables
  1493. new PlayerToUnban[24], Msg[128], Name[24];
  1494. new file[100], File:PFile, LineForFile[100];
  1495. // Send the command to all admins so they can see it
  1496. SendAdminText(playerid, "/unban", params);
  1497. // Check if the player has logged in
  1498. if (APlayerData[playerid][LoggedIn] == true)
  1499. {
  1500. // Check if the player's admin-level is at least 3
  1501. if (APlayerData[playerid][PlayerLevel] >= 3)
  1502. {
  1503. if (sscanf(params, "s[128]", PlayerToUnban))
  1504. SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/unban <PlayerToUnban>\"");
  1505. else
  1506. {
  1507. // Get the name of the admin
  1508. GetPlayerName(playerid, Name, sizeof(Name));
  1509. // Construct the complete filename for this player's account
  1510. format(file, sizeof(file), PlayerFile, PlayerToUnban);
  1511. // Check if the file exists
  1512. if (fexist(file))
  1513. {
  1514. PFile = fopen(file, io_append); // Open the playerfile for appending (this command only appends a new line to overwrite the bantime)
  1515. format(LineForFile, 100, "BanTime 0\r\n"); // Construct the line: "BanTime <0>"
  1516. fwrite(PFile, LineForFile); // And save it to the file
  1517. fclose(PFile); // Close the file
  1518. // Inform everybody else which player was unbanned
  1519. format(Msg, 128, "%s %s has un-banned %s", AdminLevelName[APlayerData[playerid][PlayerLevel]], Name, PlayerToUnban);
  1520. SendClientMessageToAll(0x808080FF, Msg);
  1521. }
  1522. else
  1523. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}There is no account with that playername");
  1524. }
  1525. }
  1526. else
  1527. return 0;
  1528. }
  1529. else
  1530. return 0;
  1531. return 1;
  1532. }
  1533. // Spawns the object at the location given by the player
  1534. COMMAND:object(playerid, params[])
  1535. {
  1536. // Setup local variables
  1537. new ObjectModel, ObjID, Msg[128], Float:x, Float:y, Float:z, Float:Angle;
  1538. // Send the command to all admins so they can see it
  1539. SendAdminText(playerid, "/object", params);
  1540. // Check if the player has logged in
  1541. if (APlayerData[playerid][LoggedIn] == true)
  1542. {
  1543. // Check if the player's admin-level is at least 5
  1544. if (APlayerData[playerid][PlayerLevel] >= 5)
  1545. {
  1546. if (sscanf(params, "iffff", ObjectModel, x, y, z, Angle)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/object <ObjectModel> <x> <y> <z> <Angle>\"");
  1547. else
  1548. {
  1549. // Spawn the object 5 units north of the player
  1550. ObjID = CreateObject(ObjectModel, x, y, z, 0.0, 0.0, Angle, 250.0);
  1551. // Inform the player about it
  1552. format(Msg, 128, "You spawned object-id %i (model-id = %i) at coords: x=%4.2f, y=%4.2f, z=%4.2f", ObjID, ObjectModel, x, y, z);
  1553. SendClientMessage(playerid, 0x00FF00FF, Msg);
  1554. }
  1555. }
  1556. else
  1557. return 0;
  1558. }
  1559. else
  1560. return 0;
  1561. // Let the server know that this was a valid command
  1562. return 1;
  1563. }
  1564. // Spawns the pickup at the location given by the player
  1565. COMMAND:pickup(playerid, params[])
  1566. {
  1567. // Setup local variables
  1568. new PickupModel, PickID, Msg[128], Float:x, Float:y, Float:z, PickupType;
  1569. // Send the command to all admins so they can see it
  1570. SendAdminText(playerid, "/pickup", params);
  1571. // Check if the player has logged in
  1572. if (APlayerData[playerid][LoggedIn] == true)
  1573. {
  1574. // Check if the player's admin-level is at least 5
  1575. if (APlayerData[playerid][PlayerLevel] >= 5)
  1576. {
  1577. if (sscanf(params, "ifffi", PickupModel, x, y, z, PickupType)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/pickup <PickupModel> <x> <y> <z> <PickupType>\"");
  1578. else
  1579. {
  1580. // Spawn the pickup
  1581. PickID = CreatePickup(PickupModel, PickupType, x, y, z, -1);
  1582. // Inform the player about it
  1583. format(Msg, 128, "You spawned pickup-id %i (model-id = %i) at coords: x=%4.2f, y=%4.2f, z=%4.2f", PickID, PickupModel, x, y, z);
  1584. SendClientMessage(playerid, 0x00FF00FF, Msg);
  1585. }
  1586. }
  1587. else
  1588. return 0;
  1589. }
  1590. else
  1591. return 0;
  1592. // Let the server know that this was a valid command
  1593. return 1;
  1594. }
  1595. // Spawns the vehicle at the location given by the player
  1596. COMMAND:vehicle(playerid, params[])
  1597. {
  1598. // Setup local variables
  1599. new VehicleModel, vID, Msg[128], Float:x, Float:y, Float:z, Float:Angle, SpawnDelay;
  1600. // Send the command to all admins so they can see it
  1601. SendAdminText(playerid, "/vehicle", params);
  1602. // Check if the player has logged in
  1603. if (APlayerData[playerid][LoggedIn] == true)
  1604. {
  1605. // Check if the player's admin-level is at least 5
  1606. if (APlayerData[playerid][PlayerLevel] >= 5)
  1607. {
  1608. if (sscanf(params, "iffffi", VehicleModel, x, y, z, Angle, SpawnDelay)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/vehicle <VehicleModel> <x> <y> <z> <Angle> <SpawnDelay>\"");
  1609. else
  1610. {
  1611. // Spawn the vehicle at the location specified by the player (also set max-fuel and save the model for the vehicle)
  1612. vID = Vehicle_Create(VehicleModel, x, y, z, Angle, random(126), random(126), SpawnDelay);
  1613. // Inform the player about it
  1614. format(Msg, 128, "You spawned vehicle-id %i (model-id = %i) at coords: x=%4.2f, y=%4.2f, z=%4.2f", vID, VehicleModel, x, y, z);
  1615. SendClientMessage(playerid, 0x00FF00FF, Msg);
  1616. }
  1617. }
  1618. else
  1619. return 0;
  1620. }
  1621. else
  1622. return 0;
  1623. // Let the server know that this was a valid command
  1624. return 1;
  1625. }
  1626. // Deletes the given vehicle from the game
  1627. COMMAND:delvehicle(playerid, params[])
  1628. {
  1629. // Setup local variables
  1630. new vID, Msg[128];
  1631. // Send the command to all admins so they can see it
  1632. SendAdminText(playerid, "/delvehicle", params);
  1633. // Check if the player has logged in
  1634. if (APlayerData[playerid][LoggedIn] == true)
  1635. {
  1636. // Check if the player's admin-level is at least 5
  1637. if (APlayerData[playerid][PlayerLevel] >= 5)
  1638. {
  1639. if (sscanf(params, "i", vID)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/delvehicle <VehicleID>\"");
  1640. else
  1641. {
  1642. // Destroy the given vehicle
  1643. DestroyVehicle(vID);
  1644. // Inform the player about it
  1645. format(Msg, 128, "You deleted vehicle-id %i", vID);
  1646. SendClientMessage(playerid, 0x00FF00FF, Msg);
  1647. }
  1648. }
  1649. else
  1650. return 0;
  1651. }
  1652. else
  1653. return 0;
  1654. // Let the server know that this was a valid command
  1655. return 1;
  1656. }
  1657. // Deletes the given vehicle from the game
  1658. COMMAND:delobject(playerid, params[])
  1659. {
  1660. // Setup local variables
  1661. new oID, Msg[128];
  1662. // Send the command to all admins so they can see it
  1663. SendAdminText(playerid, "/delobject", params);
  1664. // Check if the player has logged in
  1665. if (APlayerData[playerid][LoggedIn] == true)
  1666. {
  1667. // Check if the player's admin-level is at least 5
  1668. if (APlayerData[playerid][PlayerLevel] >= 5)
  1669. {
  1670. if (sscanf(params, "i", oID)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/delobject <ObjectID>\"");
  1671. else
  1672. {
  1673. // Destroy the given vehicle
  1674. DestroyObject(oID);
  1675. // Inform the player about it
  1676. format(Msg, 128, "You deleted object-id %i", oID);
  1677. SendClientMessage(playerid, 0x00FF00FF, Msg);
  1678. }
  1679. }
  1680. else
  1681. return 0;
  1682. }
  1683. else
  1684. return 0;
  1685. // Let the server know that this was a valid command
  1686. return 1;
  1687. }
  1688. // Ports the player to the given coordinates
  1689. COMMAND:portloc(playerid, params[])
  1690. {
  1691. // Setup local variables
  1692. new Float:x, Float:y, Float:z, PortMsg[128];
  1693. // Send the command to all admins so they can see it
  1694. SendAdminText(playerid, "/portloc", params);
  1695. // Check if the player has logged in
  1696. if (APlayerData[playerid][LoggedIn] == true)
  1697. {
  1698. // Check if the player's admin-level is at least 1
  1699. if (APlayerData[playerid][PlayerLevel] >= 1)
  1700. {
  1701. // Check if the player has a wanted level of less than 3
  1702. if (GetPlayerWantedLevel(playerid) < 3)
  1703. {
  1704. // Check if the player is not jailed
  1705. if (APlayerData[playerid][PlayerJailed] == 0)
  1706. {
  1707. if (sscanf(params, "fff", x, y, z)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/portloc <x> <y> <z>\"");
  1708. else
  1709. {
  1710. // Port the player to the given location
  1711. SetPlayerPos(playerid, x, y, z);
  1712. // Let the player know about it
  1713. format(PortMsg, 128, "You have been ported to location: %4.2f, %4.2f, %4.2f", x, y, z);
  1714. SendClientMessage(playerid, 0x00FF00FF, PortMsg);
  1715. }
  1716. }
  1717. else
  1718. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /portloc when you're in jail");
  1719. }
  1720. else
  1721. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /portloc when you're wanted");
  1722. }
  1723. else
  1724. return 0;
  1725. }
  1726. else
  1727. return 0;
  1728. // Let the server know that this was a valid command
  1729. return 1;
  1730. }
  1731. // Ports the player to the given player
  1732. COMMAND:port(playerid, params[])
  1733. {
  1734. // Setup local variables
  1735. new OtherPlayer, Float:x, Float:y, Float:z, PortMsg[128], IntID, WorldID;
  1736. // Send the command to all admins so they can see it
  1737. SendAdminText(playerid, "/port", params);
  1738. // Check if the player has logged in
  1739. if (APlayerData[playerid][LoggedIn] == true)
  1740. {
  1741. // Check if the player's admin-level is at least 1
  1742. if (APlayerData[playerid][PlayerLevel] >= 1)
  1743. {
  1744. // Check if the player has a wanted level of less than 3
  1745. if (GetPlayerWantedLevel(playerid) < 3)
  1746. {
  1747. // Check if the player is not jailed
  1748. if (APlayerData[playerid][PlayerJailed] == 0)
  1749. {
  1750. if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/port <OtherPlayer>\"");
  1751. else
  1752. {
  1753. // Check if that other player is online
  1754. if (IsPlayerConnected(OtherPlayer))
  1755. {
  1756. // Get the location of the other player
  1757. GetPlayerPos(OtherPlayer, x, y, z);
  1758. IntID = GetPlayerInterior(OtherPlayer);
  1759. WorldID = GetPlayerVirtualWorld(OtherPlayer);
  1760. // Port the player to the given location
  1761. SetPlayerVirtualWorld(playerid, WorldID);
  1762. SetPlayerInterior(playerid, IntID);
  1763. SetPlayerPos(playerid, x, y, z + 3.0);
  1764. // Let the player know about it
  1765. format(PortMsg, 128, "You have been ported to location: %4.2f, %4.2f, %4.2f", x, y, z + 3.0);
  1766. SendClientMessage(playerid, 0x00FF00FF, PortMsg);
  1767. }
  1768. else
  1769. SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
  1770. }
  1771. }
  1772. else
  1773. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /port when you're in jail");
  1774. }
  1775. else
  1776. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /port when you're wanted");
  1777. }
  1778. else
  1779. return 0;
  1780. }
  1781. else
  1782. return 0;
  1783. // Let the server know that this was a valid command
  1784. return 1;
  1785. }
  1786. // Ports one player to another player
  1787. COMMAND:tele(playerid, params[])
  1788. {
  1789. // Setup local variables
  1790. new Player1, Player2, Float:x, Float:y, Float:z, PortMsg[128], IntID, WorldID, Name[24], AdminName[24];
  1791. // Send the command to all admins so they can see it
  1792. SendAdminText(playerid, "/tele", params);
  1793. // Check if the player has logged in
  1794. if (APlayerData[playerid][LoggedIn] == true)
  1795. {
  1796. // Check if the player's admin-level is at least 1
  1797. if (APlayerData[playerid][PlayerLevel] >= 1)
  1798. {
  1799. if (sscanf(params, "uu", Player1, Player2)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/tele <PlayerToPort> <TargetPlayer>\"");
  1800. else
  1801. {
  1802. // Check if player1 is online
  1803. if (APlayerData[Player1][LoggedIn] == true)
  1804. {
  1805. // Check if player2 is online
  1806. if (APlayerData[Player2][LoggedIn] == true)
  1807. {
  1808. // Get the name of the admin and the second player
  1809. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  1810. GetPlayerName(Player2, Name, sizeof(Name));
  1811. // Get the location of the second player
  1812. GetPlayerPos(Player2, x, y, z);
  1813. IntID = GetPlayerInterior(Player2);
  1814. WorldID = GetPlayerVirtualWorld(Player2);
  1815. // Port the first player to player2's location
  1816. SetPlayerVirtualWorld(Player1, WorldID);
  1817. SetPlayerInterior(Player1, IntID);
  1818. SetPlayerPos(Player1, x, y, z + 3.0);
  1819. // Let the first player know he's been ported
  1820. format(PortMsg, 128, "{00FF00}You have been ported to player {FFFF00}%s{00FF00} by {FFFF00}%s", Name, AdminName);
  1821. SendClientMessage(Player1, 0xFFFFFFFF, PortMsg);
  1822. }
  1823. else
  1824. SendClientMessage(playerid, 0xFF0000FF, "Player2 isn't online");
  1825. }
  1826. else
  1827. SendClientMessage(playerid, 0xFF0000FF, "Player1 isn't online");
  1828. }
  1829. }
  1830. else
  1831. return 0;
  1832. }
  1833. else
  1834. return 0;
  1835. // Let the server know that this was a valid command
  1836. return 1;
  1837. }
  1838. // Ports the player to the given vehicle
  1839. COMMAND:portvehicle(playerid, params[])
  1840. {
  1841. // Setup local variables
  1842. new Car, Float:x, Float:y, Float:z, PortMsg[128];
  1843. // Send the command to all admins so they can see it
  1844. SendAdminText(playerid, "/portvehicle", params);
  1845. // Check if the player has logged in
  1846. if (APlayerData[playerid][LoggedIn] == true)
  1847. {
  1848. // Check if the player's admin-level is at least 1
  1849. if (APlayerData[playerid][PlayerLevel] >= 1)
  1850. {
  1851. // Check if the player has a wanted level of less than 3
  1852. if (GetPlayerWantedLevel(playerid) < 3)
  1853. {
  1854. // Check if the player is not jailed
  1855. if (APlayerData[playerid][PlayerJailed] == 0)
  1856. {
  1857. if (sscanf(params, "i", Car)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/portvehicle <CarID>\"");
  1858. else
  1859. {
  1860. // Get the location of the car
  1861. GetVehiclePos(Car, x, y, z);
  1862. // Port the player to the given location
  1863. SetPlayerPos(playerid, x, y, z + 3.0);
  1864. // Let the player know about it
  1865. format(PortMsg, 128, "You have been ported to location: %4.2f, %4.2f, %4.2f", x, y, z + 3.0);
  1866. SendClientMessage(playerid, 0x00FF00FF, PortMsg);
  1867. }
  1868. }
  1869. else
  1870. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /portvehicle when you're in jail");
  1871. }
  1872. else
  1873. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /portvehicle when you're wanted");
  1874. }
  1875. else
  1876. return 0;
  1877. }
  1878. else
  1879. return 0;
  1880. // Let the server know that this was a valid command
  1881. return 1;
  1882. }
  1883. // Sets the admin-level of another player
  1884. COMMAND:setlevel(playerid, params[])
  1885. {
  1886. // Setup local variables
  1887. new OtherPlayer, Level, Msg[128], Name[24], AdminName[24], OldLevel;
  1888. // Send the command to all admins so they can see it
  1889. SendAdminText(playerid, "/setlevel", params);
  1890. // Check if the player has logged in
  1891. if (APlayerData[playerid][LoggedIn] == true)
  1892. {
  1893. // Check if the player's admin-level is at least 5
  1894. if (APlayerData[playerid][PlayerLevel] >= 5)
  1895. {
  1896. if (sscanf(params, "ui", OtherPlayer, Level)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/setlevel <OtherPlayer> <AdminLevel>\"");
  1897. else
  1898. {
  1899. // Check if that other player is online
  1900. if (IsPlayerConnected(OtherPlayer))
  1901. {
  1902. // Get the old level of the other player
  1903. OldLevel = APlayerData[OtherPlayer][PlayerLevel];
  1904. // Get the playername of the admin
  1905. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  1906. // Also get the name of the player that has been promoted
  1907. GetPlayerName(OtherPlayer, Name, sizeof(Name));
  1908. // Store the level of the player
  1909. APlayerData[OtherPlayer][PlayerLevel] = Level;
  1910. // Let all players know about it
  1911. if (OldLevel != Level)
  1912. {
  1913. // Check if the player has been promoted or demoted
  1914. if (OldLevel < Level)
  1915. format(Msg, 128, "Player %s has been promoted to %s by %s", Name, AdminLevelName[Level], AdminName);
  1916. if (OldLevel > Level)
  1917. format(Msg, 128, "Player %s has been demoted to %s by %s", Name, AdminLevelName[Level], AdminName);
  1918. SendClientMessageToAll(0x00FF00FF, Msg);
  1919. }
  1920. else
  1921. SendClientMessage(playerid, 0xFF0000FF, "Other player's level hasn't been changed");
  1922. }
  1923. else
  1924. SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
  1925. }
  1926. }
  1927. else
  1928. return 0;
  1929. }
  1930. else
  1931. return 0;
  1932. // Let the server know that this was a valid command
  1933. return 1;
  1934. }
  1935. // Refuel the player's vehicle
  1936. COMMAND:fuel(playerid, params[])
  1937. {
  1938. // Setup local variables
  1939. new vID;
  1940. // Send the command to all admins so they can see it
  1941. SendAdminText(playerid, "/fuel", params);
  1942. // Check if the player has logged in
  1943. if (APlayerData[playerid][LoggedIn] == true)
  1944. {
  1945. // Check if the player's admin-level is at least 1
  1946. if (APlayerData[playerid][PlayerLevel] >= 1)
  1947. {
  1948. // Check if the player is inside a vehicle
  1949. if (IsPlayerInAnyVehicle(playerid))
  1950. {
  1951. // Get the vehicleid
  1952. vID = GetPlayerVehicleID(playerid);
  1953. // Refuel the vehicle
  1954. AVehicleData[vID][Fuel] = MaxFuel;
  1955. // Let the player know about it
  1956. SendClientMessage(playerid, 0x00FF00FF, "Your vehicle is refuelled");
  1957. }
  1958. else
  1959. SendClientMessage(playerid, 0x00FF00FF, "You're not driving a vehicle");
  1960. }
  1961. else
  1962. return 0;
  1963. }
  1964. else
  1965. return 0;
  1966. // Let the server know that this was a valid command
  1967. return 1;
  1968. }
  1969. // Let the player use a jetpack
  1970. COMMAND:fly(playerid, params[])
  1971. {
  1972. // Send the command to all admins so they can see it
  1973. SendAdminText(playerid, "/fly", params);
  1974. // Check if the player has logged in
  1975. if (APlayerData[playerid][LoggedIn] == true)
  1976. {
  1977. // Check if the player's admin-level is at least 3
  1978. if (APlayerData[playerid][PlayerLevel] >= 3)
  1979. {
  1980. // Equip the player with a jetpack
  1981. SetPlayerSpecialAction(playerid, 2);
  1982. }
  1983. else
  1984. return 0;
  1985. }
  1986. else
  1987. return 0;
  1988. // Let the server know that this was a valid command
  1989. return 1;
  1990. }
  1991. // Paints a car with a paintjob
  1992. COMMAND:paint(playerid, params[])
  1993. {
  1994. // Setup local variables
  1995. new paintjobid, vid;
  1996. // Send the command to all admins so they can see it
  1997. SendAdminText(playerid, "/paint", params);
  1998. // Check if the player has logged in
  1999. if (APlayerData[playerid][LoggedIn] == true)
  2000. {
  2001. // Check if the player is the driver of the vehicle
  2002. if (GetPlayerVehicleSeat(playerid) == 0)
  2003. {
  2004. if (sscanf(params, "i", paintjobid)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/paint <paintjobid (0-2)>\"");
  2005. else
  2006. {
  2007. // Check if the player entered a correct paintjob-id
  2008. if ((paintjobid >= 0) && (paintjobid <= 2))
  2009. {
  2010. // Get the vehicle-id
  2011. vid = GetPlayerVehicleID(playerid);
  2012. // Check if the player is the owner of the vehicle
  2013. if (AVehicleData[vid][Owned] == true)
  2014. {
  2015. // Change the paintjob of the player's vehicle
  2016. ChangeVehiclePaintjob(vid, paintjobid);
  2017. // Also save the paintjob for the vehicle
  2018. AVehicleData[vid][PaintJob] = paintjobid + 1;
  2019. // Also set the vehiclecolor to 1 (white), so the paintjob has it's full color
  2020. ChangeVehicleColor(vid, 1, 1);
  2021. // Also save the colors for the vehicle
  2022. AVehicleData[vid][Color1] = 1;
  2023. AVehicleData[vid][Color2] = 1;
  2024. // Let the player pay for the paintjob
  2025. RewardPlayer(playerid, -500, 0);
  2026. // Inform the player about it
  2027. SendClientMessage(playerid, 0x00FF00FF, "You repainted your vehicle for $500");
  2028. // Save the player-file (along with the houses and businesses)
  2029. PlayerFile_Save(playerid);
  2030. }
  2031. else
  2032. SendClientMessage(playerid, 0xFFFFFFFF, "You're not the owner of the vehicle");
  2033. }
  2034. else
  2035. SendClientMessage(playerid, 0xFF0000AA, "You need to enter a paintjob-id from 0 to 2");
  2036. }
  2037. }
  2038. else
  2039. SendClientMessage(playerid, 0xFF0000FF, "You must be inside a vehicle you own to apply a paintjob");
  2040. }
  2041. else
  2042. return 0;
  2043. // Let the server know that this was a valid command
  2044. return 1;
  2045. }
  2046. // Re-colors the given vehicle (lets you choose the first color)
  2047. COMMAND:color1(playerid, params[])
  2048. {
  2049. // Setup local variables
  2050. new ColorList[1000];
  2051. // Send the command to all admins so they can see it
  2052. SendAdminText(playerid, "/color1", params);
  2053. // Check if the player has logged in
  2054. if (APlayerData[playerid][LoggedIn] == true)
  2055. {
  2056. // Check if the player is the driver of the vehicle
  2057. if (GetPlayerVehicleSeat(playerid) == 0)
  2058. {
  2059. // Check if the player is the owner of the vehicle
  2060. if (AVehicleData[GetPlayerVehicleID(playerid)][Owned] == true)
  2061. {
  2062. // Construct the colorlist
  2063. format(ColorList, sizeof(ColorList), "%s{FFFFFF}%s\n", ColorList, "Black (removes paintjob)"); // Color 0
  2064. format(ColorList, sizeof(ColorList), "%s{FFFFFF}%s\n", ColorList, "White"); // Color 1
  2065. for (new i = 2; i < sizeof(AVehicleColors); i++)
  2066. format(ColorList, sizeof(ColorList), "%s%s%s\n", ColorList, AVehicleColors[i], "CarColor");
  2067. // Show the dialog with all the colors
  2068. ShowPlayerDialog(playerid, DialogPrimaryCarColor, DIALOG_STYLE_LIST, "Choose a primary color:", ColorList, "Select", "Cancel");
  2069. }
  2070. else
  2071. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You're not the owner of the vehicle");
  2072. }
  2073. else
  2074. SendClientMessage(playerid, 0xFF0000FF, "You must be inside a vehicle to apply a color");
  2075. }
  2076. else
  2077. return 0;
  2078. // Let the server know that this was a valid command
  2079. return 1;
  2080. }
  2081. // Re-colors the given vehicle (lets you choose the first color)
  2082. COMMAND:color2(playerid, params[])
  2083. {
  2084. // Setup local variables
  2085. new ColorList[1000];
  2086. // Send the command to all admins so they can see it
  2087. SendAdminText(playerid, "/color2", params);
  2088. // Check if the player has logged in
  2089. if (APlayerData[playerid][LoggedIn] == true)
  2090. {
  2091. // Check if the player is the driver of the vehicle
  2092. if (GetPlayerVehicleSeat(playerid) == 0)
  2093. {
  2094. // Check if the player is the owner of the vehicle
  2095. if (AVehicleData[GetPlayerVehicleID(playerid)][Owned] == true)
  2096. {
  2097. // Construct the colorlist
  2098. format(ColorList, sizeof(ColorList), "%s{FFFFFF}%s\n", ColorList, "Black"); // Color 0
  2099. format(ColorList, sizeof(ColorList), "%s{FFFFFF}%s\n", ColorList, "White"); // Color 1
  2100. for (new i = 2; i < sizeof(AVehicleColors); i++)
  2101. format(ColorList, sizeof(ColorList), "%s%s%s\n", ColorList, AVehicleColors[i], "CarColor");
  2102. // Show the dialog with all the colors
  2103. ShowPlayerDialog(playerid, DialogSedundaryCarColor, DIALOG_STYLE_LIST, "Choose a secundary color:", ColorList, "Select", "Cancel");
  2104. }
  2105. else
  2106. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You're not the owner of the vehicle");
  2107. }
  2108. else
  2109. SendClientMessage(playerid, 0x00FF00FF, "You must be inside a vehicle to apply a color");
  2110. }
  2111. else
  2112. return 0;
  2113. // Let the server know that this was a valid command
  2114. return 1;
  2115. }
  2116. // Starts or stops the engine of your vehicle
  2117. COMMAND:engine(playerid, params[])
  2118. {
  2119. // Setup local variables
  2120. new vehicleid, engine,lights,alarm,doors,bonnet,boot,objective;
  2121. // Send the command to all admins so they can see it
  2122. SendAdminText(playerid, "/engine", params);
  2123. // Check if the player has logged in
  2124. if (APlayerData[playerid][LoggedIn] == true)
  2125. {
  2126. // Check if the player's admin-level is at least 1
  2127. if (APlayerData[playerid][PlayerLevel] >= 1)
  2128. {
  2129. // Get the player's vehicle
  2130. vehicleid = GetPlayerVehicleID(playerid);
  2131. // Get the current status of the vehicle
  2132. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  2133. // Check if the player is inside a vehicle
  2134. if (vehicleid != 0)
  2135. {
  2136. if (sscanf(params, "i", engine)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/engine <EngineStatus (0/1)>\"");
  2137. else
  2138. {
  2139. // Set the engine to the value that was passed by the player and leave all other parameters alone
  2140. SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  2141. }
  2142. }
  2143. else
  2144. SendClientMessage(playerid, 0x00FF00FF, "You must be inside a vehicle to toggle your engine");
  2145. }
  2146. else
  2147. return 0;
  2148. }
  2149. else
  2150. return 0;
  2151. // Let the server know that this was a valid command
  2152. return 1;
  2153. }
  2154. // Sets your numberplate
  2155. COMMAND:plate(playerid, params[])
  2156. {
  2157. // Setup local variables
  2158. new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective, Plate[32];
  2159. // Send the command to all admins so they can see it
  2160. SendAdminText(playerid, "/plate", params);
  2161. // Check if the player has logged in
  2162. if (APlayerData[playerid][LoggedIn] == true)
  2163. {
  2164. // Check if the player's admin-level is at least 3
  2165. if (APlayerData[playerid][PlayerLevel] >= 3)
  2166. {
  2167. // Get the player's vehicle
  2168. vehicleid = GetPlayerVehicleID(playerid);
  2169. if (vehicleid != 0)
  2170. {
  2171. if (sscanf(params, "s[32]", Plate)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/plate <NumberPlate>\"");
  2172. else
  2173. {
  2174. // Set the numberplate
  2175. SetVehicleNumberPlate(vehicleid, Plate);
  2176. // Remove the player from the vehicle
  2177. RemovePlayerFromVehicle(playerid);
  2178. // Respawn the vehicle
  2179. SetVehicleToRespawn(vehicleid);
  2180. // Put the player back in the vehicle
  2181. PutPlayerInVehicle(playerid, vehicleid, 0);
  2182. // Turn on the engine and lights the current status of the vehicle
  2183. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  2184. SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
  2185. }
  2186. }
  2187. else
  2188. SendClientMessage(playerid, 0x00FF00FF, "You must be inside a vehicle to change your numberplate");
  2189. }
  2190. else
  2191. return 0;
  2192. }
  2193. else
  2194. return 0;
  2195. // Let the server know that this was a valid command
  2196. return 1;
  2197. }
  2198. // Asks which vehicle parameter you wanna toggle
  2199. COMMAND:caroption(playerid, params[])
  2200. {
  2201. // Send the command to all admins so they can see it
  2202. SendAdminText(playerid, "/caroption", params);
  2203. // Check if the player has logged in
  2204. if (APlayerData[playerid][LoggedIn] == true)
  2205. {
  2206. // Check if the player's admin-level is at least 3
  2207. if (APlayerData[playerid][PlayerLevel] >= 3)
  2208. {
  2209. // Let the player select a weather-type
  2210. ShowPlayerDialog(playerid, DialogCarOption, DIALOG_STYLE_LIST, "Select option for your vehicle:", "Engine\nLights\nAlarm\nDoors\nBonnet\nBoot\nObjective", "Toggle", "Cancel");
  2211. }
  2212. else
  2213. return 0;
  2214. }
  2215. else
  2216. return 0;
  2217. // Let the server know that this was a valid command
  2218. return 1;
  2219. }
  2220. // Sets the global weather
  2221. COMMAND:weather(playerid, params[])
  2222. {
  2223. // Send the command to all admins so they can see it
  2224. SendAdminText(playerid, "/weather", params);
  2225. // Check if the player has logged in
  2226. if (APlayerData[playerid][LoggedIn] == true)
  2227. {
  2228. // Check if the player's admin-level is at least 4
  2229. if (APlayerData[playerid][PlayerLevel] >= 4)
  2230. {
  2231. // Let the player select a weather-type
  2232. ShowPlayerDialog(playerid, DialogWeather, DIALOG_STYLE_LIST, "Select weather type:", "Normal\nStormy\nFoggy\nScorching Hot\nDull, cloudy, rainy\nSandstorm\nGreen Fog\nDark, cloudy, brown\nExtremely bright\nDark toxic clouds\nBlack & white sky", "Select", "Cancel");
  2233. }
  2234. else
  2235. return 0;
  2236. }
  2237. else
  2238. return 0;
  2239. // Let the server know that this was a valid command
  2240. return 1;
  2241. }
  2242. // This command lists all online admins
  2243. COMMAND:admins(playerid, params[])
  2244. {
  2245. // Setup local variables
  2246. new AdminList[500], Name[24];
  2247. // Send the command to all admins so they can see it
  2248. SendAdminText(playerid, "/admins", params);
  2249. // Check if the player has logged in
  2250. if (APlayerData[playerid][LoggedIn] == true)
  2251. {
  2252. // Scan through all players
  2253. for (new i; i < MAX_PLAYERS; i++)
  2254. {
  2255. // Check if this player is connected
  2256. if (IsPlayerConnected(i))
  2257. {
  2258. // Get the name of the player
  2259. GetPlayerName(i, Name, sizeof(Name));
  2260. // Check if this player is an RCON admin
  2261. if (IsPlayerAdmin(i))
  2262. {
  2263. // Add all admin players to the list
  2264. format(AdminList, 500, "%s%s: %s (id: %i), admin-level: %i (RCON admin)\n", AdminList, AdminLevelName[APlayerData[i][PlayerLevel]], Name, i, APlayerData[i][PlayerLevel]); // Add the name of the admin-player to the list
  2265. // Re-start the for loop (skipping the remaining code for this iteration)
  2266. continue;
  2267. }
  2268. //Check if that player is an admin (using the PlayerLevel)
  2269. if (APlayerData[i][PlayerLevel] > 0)
  2270. {
  2271. // Add all admin players to the list
  2272. format(AdminList, 500, "%s%s: %s (id: %i), admin-level: %i\n", AdminList, AdminLevelName[APlayerData[i][PlayerLevel]], Name, i, APlayerData[i][PlayerLevel]); // Add the name of the admin-player to the list
  2273. }
  2274. }
  2275. }
  2276. // Check if there were admin-names added to the list
  2277. if (strlen(AdminList) > 0)
  2278. ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Online admins:", AdminList, "OK", "Cancel");
  2279. else
  2280. SendClientMessage(playerid, 0xFF0000FF, "No admin online"); // No admins are online
  2281. }
  2282. else
  2283. return 0;
  2284. // Let the server know that this was a valid command
  2285. return 1;
  2286. }
  2287. // This command lists all commands for normal players (admin-level 0)
  2288. COMMAND:cmds(playerid, params[])
  2289. {
  2290. // Send the command to all admins so they can see it
  2291. SendAdminText(playerid, "/cmds", params);
  2292. // Check if the player has logged in
  2293. if (APlayerData[playerid][LoggedIn] == true)
  2294. {
  2295. CommandList_Create(playerid); // Create a list of commands (only the first 4 commands) and show the dialog
  2296. }
  2297. else
  2298. return 0;
  2299. // Let the server know that this was a valid command
  2300. return 1;
  2301. }
  2302. COMMAND:convoy(playerid, params[])
  2303. {
  2304. // Setup local variables
  2305. new ConvoyList[750], Name[24], NumMembers, ConvoyStatus[10];
  2306. // Send the command to all admins so they can see it
  2307. SendAdminText(playerid, "/convoy", params);
  2308. // Check if the player has logged in
  2309. if (APlayerData[playerid][LoggedIn] == true)
  2310. {
  2311. // Create the list of convoys with all their data
  2312. for (new i; i < MAX_CONVOYS; i++)
  2313. {
  2314. // Check if this is an empty convoy (not created yet by a player)
  2315. if (AConvoys[i][Status] == CONVOY_EMPTY)
  2316. {
  2317. // Setup data for an empty convoy (one which hasn't been chosen yet)
  2318. NumMembers = 0;
  2319. format(Name, 24, "None");
  2320. format(ConvoyStatus, 10, "Empty");
  2321. }
  2322. else
  2323. {
  2324. // Get the name of the convoy-leader
  2325. GetPlayerName(AConvoys[i][Members][0], Name, sizeof(Name));
  2326. // Calculate the members in the convoy
  2327. NumMembers = Convoy_CountMembers(i);
  2328. // Set the status of the convoy
  2329. switch (AConvoys[i][Status])
  2330. {
  2331. case CONVOY_OPEN: format(ConvoyStatus, 10, "Open");
  2332. case CONVOY_FULL: format(ConvoyStatus, 10, "Full");
  2333. case CONVOY_CLOSED: format(ConvoyStatus, 10, "Closed");
  2334. }
  2335. }
  2336. // Put all data together to form the content of the entire dialog
  2337. format(ConvoyList, sizeof(ConvoyList), "%sLeader: {00FF00}%s{FFFFFF}, members: {FF0000}%i{FFFFFF}, Status: {00FF00}%s{FFFFFF}\n", ConvoyList, Name, NumMembers, ConvoyStatus);
  2338. }
  2339. // Show the dialog
  2340. ShowPlayerDialog(playerid, DialogSelectConvoy, DIALOG_STYLE_LIST, "Select convoy:", ConvoyList, "Select", "Cancel");
  2341. }
  2342. else
  2343. return 0;
  2344. // Let the server know that this was a valid command
  2345. return 1;
  2346. }
  2347. // Allows the leader to kick a member from the convoy
  2348. COMMAND:convoykick(playerid, params[])
  2349. {
  2350. // Setup local variables
  2351. new Convoy, LeaderID, OtherPlayer, LeaderName[24], MemberName[24], Msg[128];
  2352. // Send the command to all admins so they can see it
  2353. SendAdminText(playerid, "/convoykick", params);
  2354. // Check if the player has logged in
  2355. if (APlayerData[playerid][LoggedIn] == true)
  2356. {
  2357. Convoy = APlayerData[playerid][ConvoyID]; // Get the convoy of the player
  2358. LeaderID = AConvoys[Convoy][Members][0]; // Get the leader of his convoy
  2359. // Check if this player is part of a convoy
  2360. if (APlayerData[playerid][InConvoy] == true)
  2361. {
  2362. // Check if this player is the leader of the convoy
  2363. if (LeaderID == playerid)
  2364. {
  2365. if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/convoykick <OtherPlayerID>\"");
  2366. else
  2367. {
  2368. // Check if that other player is part of the convoy
  2369. if ((APlayerData[OtherPlayer][InConvoy] == true) && (APlayerData[OtherPlayer][ConvoyID] == Convoy))
  2370. {
  2371. // Kick the other player from the convoy
  2372. Convoy_Leave(OtherPlayer);
  2373. // Get the names of the leader and member
  2374. GetPlayerName(playerid, LeaderName, sizeof(LeaderName));
  2375. GetPlayerName(OtherPlayer, MemberName, sizeof(MemberName));
  2376. // Inform the leader that he has kicked the other player
  2377. format(Msg, 128, "You've kicked {0000FF}%s{00FF00} from the convoy", MemberName);
  2378. SendClientMessage(playerid, 0x00FF00FF, Msg);
  2379. // Inform the leader that he has kicked the other player
  2380. format(Msg, 128, "Leader {0000FF}%s{00FF00} kicked you from the convoy", LeaderName);
  2381. SendClientMessage(OtherPlayer, 0x00FF00FF, Msg);
  2382. }
  2383. else
  2384. SendClientMessage(playerid, 0xFF0000FF, "You cannot kick a player that's not part of your convoy");
  2385. }
  2386. }
  2387. else
  2388. SendClientMessage(playerid, 0xFF0000FF, "You need to be the leader of a convoy to kick another convoy-member");
  2389. }
  2390. else
  2391. SendClientMessage(playerid, 0xFF0000FF, "You need to be the leader of a convoy to kick another convoy-member");
  2392. }
  2393. else
  2394. return 0;
  2395. // Let the server know that this was a valid command
  2396. return 1;
  2397. }
  2398. // Allows a convoy-member to leave the convoy
  2399. COMMAND:convoyleave(playerid, params[])
  2400. {
  2401. // Send the command to all admins so they can see it
  2402. SendAdminText(playerid, "/convoyleave", params);
  2403. // Check if the player has logged in
  2404. if (APlayerData[playerid][LoggedIn] == true)
  2405. {
  2406. // Check if this player is part of a convoy
  2407. if (APlayerData[playerid][InConvoy] == true)
  2408. {
  2409. // Kick the other player from the convoy
  2410. Convoy_Leave(playerid);
  2411. // Inform the player that he left the convoy
  2412. SendClientMessage(playerid, 0x00FF00FF, "You left the convoy");
  2413. }
  2414. }
  2415. else
  2416. return 0;
  2417. // Let the server know that this was a valid command
  2418. return 1;
  2419. }
  2420. // Allows the leader to cancel a convoy
  2421. COMMAND:convoycancel(playerid, params[])
  2422. {
  2423. // Setup local variables
  2424. new Convoy, LeaderID;
  2425. // Send the command to all admins so they can see it
  2426. SendAdminText(playerid, "/convoycancel", params);
  2427. // Check if the player has logged in
  2428. if (APlayerData[playerid][LoggedIn] == true)
  2429. {
  2430. Convoy = APlayerData[playerid][ConvoyID]; // Get the convoy of the player
  2431. LeaderID = AConvoys[Convoy][Members][0]; // Get the leader of his convoy
  2432. // Check if this player is part of a convoy
  2433. if (APlayerData[playerid][InConvoy] == true)
  2434. {
  2435. // Check if this player is the leader of the convoy
  2436. if (LeaderID == playerid)
  2437. Convoy_Cancel(Convoy); // Cancel the convoy, kicking every other member from it
  2438. else
  2439. SendClientMessage(playerid, 0xFF0000FF, "You need to be the leader of a convoy to cancel it");
  2440. }
  2441. else
  2442. SendClientMessage(playerid, 0xFF0000FF, "You need to be the leader of a convoy to cancel it");
  2443. }
  2444. else
  2445. return 0;
  2446. // Let the server know that this was a valid command
  2447. return 1;
  2448. }
  2449. // Displays all members in the convoy
  2450. COMMAND:convoymembers(playerid, params[])
  2451. {
  2452. // Setup local variables
  2453. new Name[24], MemberList[1000], Convoy;
  2454. // Send the command to all admins so they can see it
  2455. SendAdminText(playerid, "/convoymembers", params);
  2456. // Check if the player has logged in
  2457. if (APlayerData[playerid][LoggedIn] == true)
  2458. {
  2459. // Check if the member is in a convoy
  2460. if (APlayerData[playerid][InConvoy] == true)
  2461. {
  2462. // Get the convoyID of the member
  2463. Convoy = APlayerData[playerid][ConvoyID];
  2464. // Loop through all members
  2465. for (new i; i < CONVOY_MAX_MEMBERS; i++)
  2466. {
  2467. if (AConvoys[Convoy][Members][i] != -1) // Check if this member-spot is occupied
  2468. {
  2469. // Get the name of the member
  2470. GetPlayerName(AConvoys[Convoy][Members][i], Name, sizeof(Name));
  2471. // Add the membernames to the list
  2472. format(MemberList, 1000, "%s%s\n", MemberList, Name);
  2473. }
  2474. }
  2475. // Show the dialog
  2476. ShowPlayerDialog(playerid, DialogConvoyMembers, DIALOG_STYLE_LIST, "Convoy-members", MemberList, "OK", "Cancel");
  2477. }
  2478. else
  2479. SendClientMessage(playerid, 0xFF0000FF, "You're not a member of a convoy");
  2480. }
  2481. else
  2482. return 0;
  2483. // Let the server know that this was a valid command
  2484. return 1;
  2485. }
  2486. // Displays the statictics of the player
  2487. COMMAND:stats(playerid, params[])
  2488. {
  2489. // Setup local variables
  2490. new StatsMsg[1000], Name[24], TitleMsg[128];
  2491. // Send the command to all admins so they can see it
  2492. SendAdminText(playerid, "/stats", params);
  2493. // Check if the player has logged in
  2494. if (APlayerData[playerid][LoggedIn] == true)
  2495. {
  2496. // Construct the stats
  2497. format(StatsMsg, 1000, "Kilometers driven: {00FF00}%f{FFFFFF}\n", (APlayerData[playerid][StatsMetersDriven] / 1000));
  2498. format(StatsMsg, 1000, "%sFinished trucker jobs: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsTruckerJobs]);
  2499. format(StatsMsg, 1000, "%sFinished convoy jobs: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsConvoyJobs]);
  2500. format(StatsMsg, 1000, "%sFinished busdriver routes: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsBusDriverJobs]);
  2501. format(StatsMsg, 1000, "%sFinished pilot jobs: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsPilotJobs]);
  2502. format(StatsMsg, 1000, "%sFinished courier jobs: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsCourierJobs]);
  2503. format(StatsMsg, 1000, "%sFinished roadworker jobs: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsRoadworkerJobs]);
  2504. format(StatsMsg, 1000, "%sFixed vehicles for assistance: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsAssistance]);
  2505. format(StatsMsg, 1000, "%sFinished mafia jobs: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsMafiaJobs]);
  2506. format(StatsMsg, 1000, "%sDelivered stolen mafia-loads: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsMafiaStolen]);
  2507. format(StatsMsg, 1000, "%sFined players: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsPoliceFined]);
  2508. format(StatsMsg, 1000, "%sJailed players: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsPoliceJailed]);
  2509. // Get the player's name
  2510. GetPlayerName(playerid, Name, sizeof(Name));
  2511. // Construct the title for the dialog
  2512. format(TitleMsg, 128, "Statistics for %s:", Name);
  2513. // Show the dialog
  2514. ShowPlayerDialog(playerid, DialogStats, DIALOG_STYLE_LIST, TitleMsg, StatsMsg, "OK", "Cancel");
  2515. }
  2516. else
  2517. return 0;
  2518. // Let the server know that this was a valid command
  2519. return 1;
  2520. }
  2521. // Restarts the server
  2522. COMMAND:restart(playerid, params[])
  2523. {
  2524. // Send the command to all admins so they can see it
  2525. SendAdminText(playerid, "/restart", params);
  2526. // Check if the player has logged in
  2527. if (APlayerData[playerid][LoggedIn] == true)
  2528. {
  2529. // Check if the player's admin-level is at least 5
  2530. if (APlayerData[playerid][PlayerLevel] >= 5)
  2531. {
  2532. // Let everyone know that the server will be restarted in 2 minutes
  2533. GameTextForAll("Server restart in 2 minutes!", 5000, 3);
  2534. SendClientMessageToAll(0xA0A0A0, "Server restart in 2 minutes!");
  2535. // Start the next timer which warns the players again that server will be restarted in 1 minute
  2536. SetTimer("Timer_Restart_WarnPlayers", 1000 * 60, false);
  2537. }
  2538. else
  2539. return 0;
  2540. }
  2541. else
  2542. return 0;
  2543. // Let the server know that this was a valid command
  2544. return 1;
  2545. }
  2546. forward Timer_Restart_WarnPlayers();
  2547. public Timer_Restart_WarnPlayers()
  2548. {
  2549. // Let everyone know that the server will be restarted in 1 minutes
  2550. GameTextForAll("Server restart in 1 minute!", 5000, 3);
  2551. SendClientMessageToAll(0xA0A0A0, "Server restart in 1 minutes!");
  2552. // Start the next timer
  2553. SetTimer("Timer_Restart_Kick", 1000 * 60, false);
  2554. // Change the hostname of the server and it's password
  2555. SendRconCommand("hostname Pending Restart");
  2556. SendRconCommand("password loafkagakggoagka");
  2557. return 1;
  2558. }
  2559. forward Timer_Restart_Kick();
  2560. public Timer_Restart_Kick()
  2561. {
  2562. // Let everyone know that the server is kicking all players before restarting
  2563. GameTextForAll("Server restarting:Kicking all players!", 5000, 3);
  2564. // Kick all players
  2565. for(new i; i < MAX_PLAYERS; i++)
  2566. Kick(i);
  2567. // Start the next timer that will restart the server
  2568. SetTimer("Timer_Restart_Reboot", 1000 * 5, false);
  2569. return 1;
  2570. }
  2571. forward Timer_Restart_Reboot();
  2572. public Timer_Restart_Reboot()
  2573. {
  2574. new HostCommand[128];
  2575. // Restart the server
  2576. SendRconCommand("gmx");
  2577. // Change the hostname and password again
  2578. format(HostCommand, 128, "hostname %s", GameModeName);
  2579. SendRconCommand(HostCommand);
  2580. SendRconCommand("password 0");
  2581. return 1;
  2582. }
  2583. // This command allows you to create a speedcamera
  2584. COMMAND:createcamera(playerid, params[])
  2585. {
  2586. // Setup local variables
  2587. new Float:x, Float:y, Float:z, Float:Angle, MaxSpeed, file[100], File:PFile, LineForFile[100], Msg[128];
  2588. // Send the command to all admins so they can see it
  2589. SendAdminText(playerid, "/createcamera", params);
  2590. // Check if the player has logged in
  2591. if (APlayerData[playerid][LoggedIn] == true)
  2592. {
  2593. // Check if the player's admin-level is at least 5
  2594. if (APlayerData[playerid][PlayerLevel] >= 5)
  2595. {
  2596. if (sscanf(params, "i", MaxSpeed)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/createcamera <max_speed>\"");
  2597. else
  2598. {
  2599. // Get player's position and facing angle
  2600. GetPlayerPos(playerid, x, y, z);
  2601. GetPlayerFacingAngle(playerid, Angle);
  2602. z = z - 1.0; // Adjust camera Z-coordinate 1m lower than normal (otherwise the camera floats in the air)
  2603. // Move the player a bit, otherwise he could get stuck inside the camera-object
  2604. SetPlayerPos(playerid, x, y + 1.0, z + 1.0);
  2605. // Save the camera to a file
  2606. for (new CamID; CamID < MAX_CAMERAS; CamID++)
  2607. {
  2608. // Check if this index is free
  2609. if (ACameras[CamID][CamSpeed] == 0)
  2610. {
  2611. // Setup this camera (create the objects and store the data)
  2612. SetupSpeedCamera(CamID, x, y, z, Angle, MaxSpeed);
  2613. // Save the file
  2614. format(file, sizeof(file), CameraFile, CamID); // Construct the complete filename for this camera-file
  2615. PFile = fopen(file, io_write); // Open the camera-file for writing
  2616. format(LineForFile, 100, "CamX %f\r\n", x);
  2617. fwrite(PFile, LineForFile); // And save it to the file
  2618. format(LineForFile, 100, "CamY %f\r\n", y);
  2619. fwrite(PFile, LineForFile); // And save it to the file
  2620. format(LineForFile, 100, "CamZ %f\r\n", z);
  2621. fwrite(PFile, LineForFile); // And save it to the file
  2622. format(LineForFile, 100, "CamAngle %f\r\n", Angle);
  2623. fwrite(PFile, LineForFile); // And save it to the file
  2624. format(LineForFile, 100, "CamSpeed %i\r\n", MaxSpeed);
  2625. fwrite(PFile, LineForFile); // And save it to the file
  2626. fclose(PFile); // Close the file
  2627. // Let the player know he created a new camera
  2628. format(Msg, 128, "You've created a speed-camera with ID: %i", CamID);
  2629. SendClientMessage(playerid, 0x00FF00FF, Msg);
  2630. // Exit the function
  2631. return 1;
  2632. }
  2633. }
  2634. // In case all camera-slots are occupied (100 camera's have been created already), let the player know about it
  2635. format(Msg, 128, "{FF0000}You cannot create more than %i speedcamera's", MAX_CAMERAS);
  2636. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  2637. }
  2638. }
  2639. else
  2640. return 0;
  2641. }
  2642. else
  2643. return 0;
  2644. // Let the server know that this was a valid command
  2645. return 1;
  2646. }
  2647. // This command allows you to delete a speedcamera
  2648. COMMAND:delcamera(playerid, params[])
  2649. {
  2650. // Setup local variables
  2651. new file[100], Msg[128];
  2652. // Send the command to all admins so they can see it
  2653. SendAdminText(playerid, "/delcamera", params);
  2654. // Check if the player has logged in
  2655. if (APlayerData[playerid][LoggedIn] == true)
  2656. {
  2657. // Check if the player's admin-level is at least 5
  2658. if (APlayerData[playerid][PlayerLevel] >= 5)
  2659. {
  2660. // Loop through all camera's
  2661. for (new CamID; CamID < MAX_CAMERAS; CamID++)
  2662. {
  2663. // Check if this index is used
  2664. if (ACameras[CamID][CamSpeed] != 0)
  2665. {
  2666. // Check if the player is in range of the camera
  2667. if (IsPlayerInRangeOfPoint(playerid, 5.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
  2668. {
  2669. // Delete the file
  2670. format(file, sizeof(file), CameraFile, CamID); // Construct the complete filename for this camera-file
  2671. if (fexist(file)) // Make sure the file exists
  2672. fremove(file); // Delete the file
  2673. // Delete both camera objects
  2674. DestroyObject(ACameras[CamID][CamObj1]);
  2675. DestroyObject(ACameras[CamID][CamObj2]);
  2676. // Also clear the data from memory
  2677. ACameras[CamID][CamX] = 0.0;
  2678. ACameras[CamID][CamY] = 0.0;
  2679. ACameras[CamID][CamZ] = 0.0;
  2680. ACameras[CamID][CamAngle] = 0.0;
  2681. ACameras[CamID][CamSpeed] = 0;
  2682. ACameras[CamID][CamObj1] = 0;
  2683. ACameras[CamID][CamObj2] = 0;
  2684. // Let the player know he deleted a camera
  2685. format(Msg, 128, "You've deleted speed-camera %i", CamID);
  2686. SendClientMessage(playerid, 0x00FF00FF, Msg);
  2687. // Exit the function
  2688. return 1;
  2689. }
  2690. }
  2691. }
  2692. // In case the player wasn't near a speedcamera, inform him about it
  2693. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You must be near a speedcamera to delete it");
  2694. }
  2695. else
  2696. return 0;
  2697. }
  2698. else
  2699. return 0;
  2700. // Let the server know that this was a valid command
  2701. return 1;
  2702. }
  2703. // This command ports a player to the player who executed the command
  2704. COMMAND:get(playerid, params[])
  2705. {
  2706. // Setup local variables
  2707. new OtherPlayer, Float:x, Float:y, Float:z, PortMsg[128], IntID, WorldID, Name[24];
  2708. // Send the command to all admins so they can see it
  2709. SendAdminText(playerid, "/get", params);
  2710. // Check if the player has logged in
  2711. if (APlayerData[playerid][LoggedIn] == true)
  2712. {
  2713. // Check if the player's admin-level is at least 1
  2714. if (APlayerData[playerid][PlayerLevel] >= 1)
  2715. {
  2716. if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/get <OtherPlayer>\"");
  2717. else
  2718. {
  2719. // Check if that other player is online
  2720. if (IsPlayerConnected(OtherPlayer))
  2721. {
  2722. // Get the name of the other player
  2723. GetPlayerName(OtherPlayer, Name, sizeof(Name));
  2724. // Get the location of the player
  2725. GetPlayerPos(playerid, x, y, z);
  2726. IntID = GetPlayerInterior(playerid);
  2727. WorldID = GetPlayerVirtualWorld(playerid);
  2728. // Port the other player to this player
  2729. SetPlayerVirtualWorld(OtherPlayer, WorldID);
  2730. SetPlayerInterior(OtherPlayer, IntID);
  2731. SetPlayerPos(OtherPlayer, x, y, z + 3.0);
  2732. // Let the player know about it
  2733. format(PortMsg, 128, "{00FF00}You have ported {FFFF00}%s{00FF00} to your location", Name);
  2734. SendClientMessage(playerid, 0xFFFFFFFF, PortMsg);
  2735. }
  2736. else
  2737. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
  2738. }
  2739. }
  2740. else
  2741. return 0;
  2742. }
  2743. else
  2744. return 0;
  2745. // Let the server know that this was a valid command
  2746. return 1;
  2747. }
  2748. // This command deleted all vehicles that are spawned using /car, /plane, /bike, /trailer
  2749. COMMAND:cleanupcars(playerid, params[])
  2750. {
  2751. // Setup local variables
  2752. new CarsDeleted, Msg[128];
  2753. // Send the command to all admins so they can see it
  2754. SendAdminText(playerid, "/cleanupcars", params);
  2755. // Check if the player has logged in
  2756. if (APlayerData[playerid][LoggedIn] == true)
  2757. {
  2758. // Check if the player's admin-level is at least 3
  2759. if (APlayerData[playerid][PlayerLevel] >= 3)
  2760. {
  2761. // Loop through all vehicles
  2762. for (new vid; vid < 2000; vid++)
  2763. {
  2764. // Check if this vehicle exists (check the model), otherwise all empty slots are processed as well
  2765. if (AVehicleData[vid][Model] != 0)
  2766. {
  2767. // Check if the vehicle is NOT a static vehicle
  2768. if (AVehicleData[vid][StaticVehicle] == false)
  2769. {
  2770. // Check if the vehicle is NOT owned by anybody (this leaves all vehicles spawned with /car, /trailer, /plane)
  2771. if (AVehicleData[vid][Owned] == false)
  2772. {
  2773. // Count the cars that have been deleted
  2774. CarsDeleted++;
  2775. // Delete the vehicle and clear the data
  2776. DestroyVehicle(vid);
  2777. AVehicleData[vid][Owned] = false;
  2778. AVehicleData[vid][Owner] = 0;
  2779. AVehicleData[vid][Model] = 0;
  2780. AVehicleData[vid][PaintJob] = 0;
  2781. for (new i; i < 14; i++)
  2782. AVehicleData[vid][Components][i] = 0;
  2783. AVehicleData[vid][SpawnX] = 0.0;
  2784. AVehicleData[vid][SpawnY] = 0.0;
  2785. AVehicleData[vid][SpawnZ] = 0.0;
  2786. AVehicleData[vid][SpawnRot] = 0.0;
  2787. AVehicleData[vid][BelongsToHouse] = 0;
  2788. }
  2789. }
  2790. }
  2791. }
  2792. // Let the player know how many vehicles have been cleaned up
  2793. format(Msg, 128, "{00FF00}Total number of vehicles cleaned up: {FFFF00}%i", CarsDeleted);
  2794. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  2795. }
  2796. else
  2797. return 0;
  2798. }
  2799. else
  2800. return 0;
  2801. // Let the server know that this was a valid command
  2802. return 1;
  2803. }
  2804. // This command allows the player to call for assistance
  2805. COMMAND:assist(playerid, params[])
  2806. {
  2807. // Setup local variables
  2808. new bool:AssistOnline = false, Msg[128], Name[24];
  2809. // Send the command to all admins so they can see it
  2810. SendAdminText(playerid, "/assist", params);
  2811. // Check if the player has logged in
  2812. if (APlayerData[playerid][LoggedIn] == true)
  2813. {
  2814. // Get the player's name
  2815. GetPlayerName(playerid, Name, sizeof(Name));
  2816. // Preset the message that needs to be sent to assistance players
  2817. format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} needs assistance, go help him", Name);
  2818. // Check if there is at least one assistance player online
  2819. for (new i; i < MAX_PLAYERS; i++)
  2820. {
  2821. // Check if this player is connected
  2822. if (IsPlayerConnected(i))
  2823. {
  2824. // Check if this player is assistance class
  2825. if (APlayerData[i][PlayerClass] == ClassAssistance)
  2826. {
  2827. // Set the flag to indicate that at least one assistance player is online
  2828. AssistOnline = true;
  2829. // Send the assistance player a message to inform him who needs assistance
  2830. SendClientMessage(i, 0xFFFFFFFF, Msg);
  2831. }
  2832. }
  2833. }
  2834. // Check if there is at least one assistance player online
  2835. if (AssistOnline == true)
  2836. {
  2837. // Set yourself as "AssistanceNeeded"
  2838. APlayerData[playerid][AssistanceNeeded] = true;
  2839. // Let the player know he called for assistance
  2840. SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}You've called for assistance");
  2841. }
  2842. else // No assistance is online
  2843. {
  2844. // Check if the player is the driver of a vehicle
  2845. if (GetPlayerVehicleSeat(playerid) == 0)
  2846. {
  2847. // Fully repair the vehicle (damage value and bodywork)
  2848. RepairVehicle(GetPlayerVehicleID(playerid));
  2849. // Also re-fuel the vehicle
  2850. AVehicleData[GetPlayerVehicleID(playerid)][Fuel] = MaxFuel;
  2851. // Let the player pay for the repairs and refuel (default $2000)
  2852. RewardPlayer(playerid, -2000, 0);
  2853. // Let the player know he spent $2000 for auto-repair because there were no assistance players online
  2854. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Your vehicle has been auto-repaired and refuelled for $2000");
  2855. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}because there is no assistance player online");
  2856. }
  2857. }
  2858. }
  2859. else
  2860. return 0;
  2861. // Let the server know that this was a valid command
  2862. return 1;
  2863. }
  2864. // This command adds nitro to the player's vehicle
  2865. COMMAND:nos(playerid, params[])
  2866. {
  2867. // Send the command to all admins so they can see it
  2868. SendAdminText(playerid, "/nos", params);
  2869. // Check if the player has logged in
  2870. if (APlayerData[playerid][LoggedIn] == true)
  2871. {
  2872. // Check if the player's admin-level is at least 1
  2873. if (APlayerData[playerid][PlayerLevel] >= 1)
  2874. {
  2875. // Check if the player is the driver of a vehicle
  2876. if (GetPlayerVehicleSeat(playerid) == 0)
  2877. {
  2878. // Check if the vehicle isn't owned (owned vehicle's need to buy nitro at mod garages)
  2879. if (AVehicleData[GetPlayerVehicleID(playerid)][Owned] == false)
  2880. AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); // Add nitro to the player's vehicle
  2881. }
  2882. }
  2883. else
  2884. return 0;
  2885. }
  2886. else
  2887. return 0;
  2888. // Let the server know that this was a valid command
  2889. return 1;
  2890. }
  2891. // This command let's an admin spectate another player
  2892. COMMAND:spec(playerid, params[])
  2893. {
  2894. // Setup local variables
  2895. new OtherPlayer, Name[24], Msg[128];
  2896. // Send the command to all admins so they can see it
  2897. SendAdminText(playerid, "/spec", params);
  2898. // Check if the player has logged in
  2899. if (APlayerData[playerid][LoggedIn] == true)
  2900. {
  2901. // Check if the player's admin-level is at least 1
  2902. if (APlayerData[playerid][PlayerLevel] >= 1)
  2903. {
  2904. if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/spec <OtherPlayer>\"");
  2905. else
  2906. {
  2907. // Check if that other player is online
  2908. if (IsPlayerConnected(OtherPlayer))
  2909. {
  2910. // Get the player's name
  2911. GetPlayerName(OtherPlayer, Name, sizeof(Name));
  2912. // Turn spectating on
  2913. TogglePlayerSpectating(playerid, 1);
  2914. // Check if the other player is driving a vehicle
  2915. if (GetPlayerVehicleSeat(OtherPlayer) == -1)
  2916. {
  2917. // The other player is on foot, so spectate him
  2918. PlayerSpectatePlayer(playerid, OtherPlayer);
  2919. SetPlayerInterior(playerid, GetPlayerInterior(OtherPlayer));
  2920. APlayerData[playerid][SpectateID] = OtherPlayer;
  2921. APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_PLAYER;
  2922. }
  2923. else
  2924. {
  2925. // The other player is in a vehicle, so spectate the vehicle
  2926. PlayerSpectateVehicle(playerid, GetPlayerVehicleID(OtherPlayer));
  2927. APlayerData[playerid][SpectateID] = OtherPlayer;
  2928. APlayerData[playerid][SpectateVehicle] = GetPlayerVehicleID(OtherPlayer);
  2929. APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_VEHICLE;
  2930. }
  2931. format(Msg, 128, "{00FF00}You're spectating {FFFF00}%s", Name);
  2932. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  2933. }
  2934. else
  2935. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
  2936. }
  2937. }
  2938. else
  2939. return 0;
  2940. }
  2941. else
  2942. return 0;
  2943. // Let the server know that this was a valid command
  2944. return 1;
  2945. }
  2946. // This command ends the spectate mode
  2947. COMMAND:endspec(playerid, params[])
  2948. {
  2949. // Send the command to all admins so they can see it
  2950. SendAdminText(playerid, "/endspec", params);
  2951. // Check if the player has logged in
  2952. if (APlayerData[playerid][LoggedIn] == true)
  2953. {
  2954. // Check if the player's admin-level is at least 1
  2955. if (APlayerData[playerid][PlayerLevel] >= 1)
  2956. {
  2957. // Check if the player is spectating
  2958. if (GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
  2959. {
  2960. TogglePlayerSpectating(playerid, 0);
  2961. APlayerData[playerid][SpectateID] = -1;
  2962. APlayerData[playerid][SpectateVehicle] = -1;
  2963. APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_NONE;
  2964. }
  2965. else
  2966. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You are not spectating");
  2967. }
  2968. else
  2969. return 0;
  2970. }
  2971. else
  2972. return 0;
  2973. // Let the server know that this was a valid command
  2974. return 1;
  2975. }
  2976. // Lets the player add new businesses
  2977. COMMAND:createbusiness(playerid, params[])
  2978. {
  2979. // Setup local variables
  2980. new BusinessList[2000];
  2981. // Send the command to all admins so they can see it
  2982. SendAdminText(playerid, "/createbusiness", params);
  2983. // Check if the player has logged in
  2984. if (APlayerData[playerid][LoggedIn] == true)
  2985. {
  2986. // Check if the player's admin-level is at least 5
  2987. if (APlayerData[playerid][PlayerLevel] >= 5)
  2988. {
  2989. // Check if the player isn't inside a vehicle
  2990. if (GetPlayerVehicleSeat(playerid) == -1)
  2991. {
  2992. // Construct the list of businesses
  2993. for (new BusType = 1; BusType < sizeof(ABusinessInteriors); BusType++)
  2994. {
  2995. format(BusinessList, sizeof(BusinessList), "%s%s\n", BusinessList, ABusinessInteriors[BusType][InteriorName]);
  2996. }
  2997. // Let the player choose a business-type via a dialog
  2998. ShowPlayerDialog(playerid, DialogCreateBusSelType, DIALOG_STYLE_LIST, "Choose business-type:", BusinessList, "Select", "Cancel");
  2999. }
  3000. else
  3001. SendClientMessage(playerid, 0xFF0000FF, "You can't be inside a vehicle to create a business");
  3002. }
  3003. }
  3004. else
  3005. return 0;
  3006. // Let the server know that this was a valid command
  3007. return 1;
  3008. }
  3009. // This command lets the player delete a business
  3010. COMMAND:delbusiness(playerid, params[])
  3011. {
  3012. // Setup local variables
  3013. new file[100], Msg[128];
  3014. // Send the command to all admins so they can see it
  3015. SendAdminText(playerid, "/delbusiness", params);
  3016. // Check if the player has logged in
  3017. if (APlayerData[playerid][LoggedIn] == true)
  3018. {
  3019. // Check if the player's admin-level is at least 5
  3020. if (APlayerData[playerid][PlayerLevel] >= 5)
  3021. {
  3022. // Make sure the player isn't inside a vehicle
  3023. if (GetPlayerVehicleID(playerid) == 0)
  3024. {
  3025. // Loop through all player-owned businesses
  3026. for (new BusID = 1; BusID < MAX_BUSINESS; BusID++)
  3027. {
  3028. // Check if the business exists
  3029. if (ABusinessData[BusID][PickupID] != 0)
  3030. {
  3031. // Check if the business has no owner
  3032. if (ABusinessData[BusID][Owned] == false)
  3033. {
  3034. // Check if the player is in range of the business-pickup
  3035. if (IsPlayerInRangeOfPoint(playerid, 2.5, ABusinessData[BusID][BusinessX], ABusinessData[BusID][BusinessY], ABusinessData[BusID][BusinessZ]))
  3036. {
  3037. // Clear all data of the business
  3038. ABusinessData[BusID][BusinessName] = 0;
  3039. ABusinessData[BusID][BusinessX] = 0.0;
  3040. ABusinessData[BusID][BusinessY] = 0.0;
  3041. ABusinessData[BusID][BusinessZ] = 0.0;
  3042. ABusinessData[BusID][BusinessType] = 0;
  3043. ABusinessData[BusID][BusinessLevel] = 0;
  3044. ABusinessData[BusID][LastTransaction] = 0;
  3045. ABusinessData[BusID][Owned] = false;
  3046. ABusinessData[BusID][Owner] = 0;
  3047. // Destroy the mapicon, 3DText and pickup for the house
  3048. DestroyDynamicPickup(ABusinessData[BusID][PickupID]);
  3049. DestroyDynamicMapIcon(ABusinessData[BusID][MapIconID]);
  3050. DestroyDynamic3DTextLabel(ABusinessData[BusID][DoorText]);
  3051. ABusinessData[BusID][PickupID] = 0;
  3052. ABusinessData[BusID][MapIconID] = 0;
  3053. // Delete the business-file
  3054. format(file, sizeof(file), BusinessFile, BusID); // Construct the complete filename for this business-file
  3055. if (fexist(file)) // Make sure the file exists
  3056. fremove(file); // Delete the file
  3057. // Also let the player know he deleted the business
  3058. format(Msg, 128, "{00FF00}You have deleted the business with ID: {FFFF00}%i", BusID);
  3059. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  3060. // Exit the function
  3061. return 1;
  3062. }
  3063. }
  3064. }
  3065. }
  3066. // There was no house in range, so let the player know about it
  3067. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}No business in range to delete");
  3068. }
  3069. else
  3070. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You can't be inside a vehicle to delete a business");
  3071. }
  3072. else
  3073. return 0;
  3074. }
  3075. else
  3076. return 0;
  3077. // Let the server know that this was a valid command
  3078. return 1;
  3079. }
  3080. // This command lets the player buy a business when he's standing in range of a business that isn't owned yet
  3081. COMMAND:buybus(playerid, params[])
  3082. {
  3083. // Setup local variables
  3084. new Msg[128], BusType;
  3085. // Send the command to all admins so they can see it
  3086. SendAdminText(playerid, "/buybus", params);
  3087. // Check if the player has logged in
  3088. if (APlayerData[playerid][LoggedIn] == true)
  3089. {
  3090. // Make sure the player isn't inside a vehicle
  3091. if (GetPlayerVehicleID(playerid) == 0)
  3092. {
  3093. // Check if the player is near a business-pickup
  3094. for (new i = 1; i < sizeof(ABusinessData); i++)
  3095. {
  3096. // Check if this business is created (it would have a valid pickup in front of the door)
  3097. if (ABusinessData[i][PickupID] != 0)
  3098. {
  3099. // Check if the player is in range of the business-pickup
  3100. if (IsPlayerInRangeOfPoint(playerid, 2.5, ABusinessData[i][BusinessX], ABusinessData[i][BusinessY], ABusinessData[i][BusinessZ]))
  3101. {
  3102. // Check if the business isn't owned yet
  3103. if (ABusinessData[i][Owned] == false)
  3104. {
  3105. // Get the type of business
  3106. BusType = ABusinessData[i][BusinessType];
  3107. // Check if the player can afford this type of business business
  3108. if (APlayerData[playerid][PlayerMoney] >= ABusinessInteriors[BusType][BusPrice])
  3109. Business_SetOwner(playerid, i); // Give ownership of the business to the player
  3110. else
  3111. SendClientMessage(playerid, 0xFF0000FF, "You cannot afford this business"); // The player cannot afford this business
  3112. }
  3113. else
  3114. {
  3115. // Let the player know that this business is already owned by a player
  3116. format(Msg, 128, "{FF0000}This business is already owned by {00FF00}%s{FFFFFF}", ABusinessData[i][Owner]);
  3117. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  3118. }
  3119. // The player was in range of a business-pickup, so stop searching for the other business pickups
  3120. return 1;
  3121. }
  3122. }
  3123. else
  3124. return 1; // If there are no more houses (no more pickup-id's found), stop searching
  3125. }
  3126. // All businesses have been processed, but the player wasn't in range of any business-pickup, let him know about it
  3127. SendClientMessage(playerid, 0xFF0000FF, "To buy a business, you have to be near a business-pickup");
  3128. }
  3129. else
  3130. SendClientMessage(playerid, 0xFF0000FF, "You can't buy a business when you're inside a vehicle");
  3131. }
  3132. else
  3133. return 0;
  3134. // Let the server know that this was a valid command
  3135. return 1;
  3136. }
  3137. // This command opens a menu when you're inside your business to allow to access the options of your business
  3138. COMMAND:busmenu(playerid, params[])
  3139. {
  3140. // Setup local variables
  3141. new OptionsList[200], DialogTitle[200];
  3142. // Send the command to all admins so they can see it
  3143. SendAdminText(playerid, "/busmenu", params);
  3144. // Check if the player has logged in
  3145. if (APlayerData[playerid][LoggedIn] == true)
  3146. {
  3147. // Check if the player is inside a business
  3148. if (APlayerData[playerid][CurrentBusiness] != 0)
  3149. {
  3150. format(DialogTitle, sizeof(DialogTitle), "Select option for %s", ABusinessData[APlayerData[playerid][CurrentBusiness]][BusinessName]);
  3151. format(OptionsList, sizeof(OptionsList), "%sChange business-name\n", OptionsList);
  3152. format(OptionsList, sizeof(OptionsList), "%sUpgrade business\n", OptionsList);
  3153. format(OptionsList, sizeof(OptionsList), "%sRetrieve business earnings\n", OptionsList);
  3154. format(OptionsList, sizeof(OptionsList), "%sSell business\n", OptionsList);
  3155. format(OptionsList, sizeof(OptionsList), "%sExit business\n", OptionsList);
  3156. // Show the businessmenu
  3157. ShowPlayerDialog(playerid, DialogBusinessMenu, DIALOG_STYLE_LIST, DialogTitle, OptionsList, "Select", "Cancel");
  3158. }
  3159. else
  3160. SendClientMessage(playerid, 0xFF0000FF, "You're not inside a business");
  3161. }
  3162. else
  3163. return 0;
  3164. // Let the server know that this was a valid command
  3165. return 1;
  3166. }
  3167. // This command teleports you to your selected business
  3168. COMMAND:gobus(playerid, params[])
  3169. {
  3170. // Setup local variables
  3171. new BusinessList[1000], BusID, BusType, Earnings;
  3172. // Send the command to all admins so they can see it
  3173. SendAdminText(playerid, "/gobus", params);
  3174. // Check if the player has logged in
  3175. if (APlayerData[playerid][LoggedIn] == true)
  3176. {
  3177. // Check if the player is not jailed
  3178. if (APlayerData[playerid][PlayerJailed] == 0)
  3179. {
  3180. // Check if the player has a wanted level of less than 3
  3181. if (GetPlayerWantedLevel(playerid) < 3)
  3182. {
  3183. // Check if the player is not inside a vehicle
  3184. if (GetPlayerVehicleID(playerid) == 0)
  3185. {
  3186. // Ask to which business the player wants to port
  3187. for (new i; i < MAX_BUSINESSPERPLAYER; i++)
  3188. {
  3189. // Get the business-id
  3190. BusID = APlayerData[playerid][Business][i];
  3191. // Check if this businessindex is occupied
  3192. if (BusID != 0)
  3193. {
  3194. // Get the business-type
  3195. BusType = ABusinessData[BusID][BusinessType];
  3196. Earnings = (BusinessTransactionTime - ABusinessData[BusID][LastTransaction]) * ABusinessInteriors[BusType][BusEarnings] * ABusinessData[BusID][BusinessLevel];
  3197. format(BusinessList, 1000, "%s{00FF00}%s{FFFFFF} (earnings: $%i)\n", BusinessList, ABusinessData[BusID][BusinessName], Earnings);
  3198. }
  3199. else
  3200. format(BusinessList, 1000, "%s{FFFFFF}%s{FFFFFF}\n", BusinessList, "Empty business-slot");
  3201. }
  3202. ShowPlayerDialog(playerid, DialogGoBusiness, DIALOG_STYLE_LIST, "Choose the business to go to:", BusinessList, "Select", "Cancel");
  3203. }
  3204. else
  3205. SendClientMessage(playerid, 0xFF0000FF, "You need to be on-foot to port to your business");
  3206. }
  3207. else
  3208. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /gobus when you're wanted");
  3209. }
  3210. else
  3211. SendClientMessage(playerid, 0xFF0000FF, "You cannot use /gobus when you're in jail");
  3212. }
  3213. else
  3214. return 0;
  3215. // Let the server know that this was a valid command
  3216. return 1;
  3217. }
  3218. // Mutes a player (he cannot talk anymore)
  3219. COMMAND:mute(playerid, params[])
  3220. {
  3221. // Setup local variables
  3222. new Msg[128], Name[24], AdminName[24], Reason[128], OtherPlayer;
  3223. // Send the command to all admins so they can see it
  3224. SendAdminText(playerid, "/mute", params);
  3225. // Check if the player has logged in
  3226. if (APlayerData[playerid][LoggedIn] == true)
  3227. {
  3228. // Check if the player's admin-level is at least 1
  3229. if (APlayerData[playerid][PlayerLevel] >= 1)
  3230. {
  3231. if (sscanf(params, "us[128]", OtherPlayer, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/mute <OtherPlayer> <Reason>\"");
  3232. else
  3233. {
  3234. // Check if the otherplayer is online
  3235. if (IsPlayerConnected(OtherPlayer))
  3236. {
  3237. // Get the player-names
  3238. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  3239. GetPlayerName(OtherPlayer, Name, sizeof(Name));
  3240. // Mute the other player
  3241. APlayerData[OtherPlayer][Muted] = true;
  3242. // Let the other player know that he has been muted
  3243. format(Msg, 128, "{FF0000}You have been muted by {FFFF00}%s {FF0000}for {FFFF00}%s", AdminName, Reason);
  3244. SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
  3245. // Let the admin know who he has muted
  3246. format(Msg, 128, "{00FF00}You have muted {FFFF00}%s", Name);
  3247. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  3248. // Save the player-stats
  3249. PlayerFile_Save(OtherPlayer);
  3250. }
  3251. else
  3252. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
  3253. }
  3254. }
  3255. else
  3256. return 0;
  3257. }
  3258. else
  3259. return 0;
  3260. // Let the server know that this was a valid command
  3261. return 1;
  3262. }
  3263. // Un-mutes a player (he cannot talk anymore)
  3264. COMMAND:unmute(playerid, params[])
  3265. {
  3266. // Setup local variables
  3267. new Msg[128], Name[24], AdminName[24], OtherPlayer;
  3268. // Send the command to all admins so they can see it
  3269. SendAdminText(playerid, "/unmute", params);
  3270. // Check if the player has logged in
  3271. if (APlayerData[playerid][LoggedIn] == true)
  3272. {
  3273. // Check if the player's admin-level is at least 1
  3274. if (APlayerData[playerid][PlayerLevel] >= 1)
  3275. {
  3276. if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/unmute <OtherPlayer>\"");
  3277. else
  3278. {
  3279. // Check if the otherplayer is online
  3280. if (IsPlayerConnected(OtherPlayer))
  3281. {
  3282. // Get the player-names
  3283. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  3284. GetPlayerName(OtherPlayer, Name, sizeof(Name));
  3285. // Un-mute the other player
  3286. APlayerData[OtherPlayer][Muted] = false;
  3287. // Let the other player know that he has been un-muted
  3288. format(Msg, 128, "{FF0000}You have been un-muted by {FFFF00}%s", AdminName);
  3289. SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
  3290. // Let the admin know who he has un-muted
  3291. format(Msg, 128, "{00FF00}You have un-muted {FFFF00}%s", Name);
  3292. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  3293. // Save the player-stats
  3294. PlayerFile_Save(OtherPlayer);
  3295. }
  3296. else
  3297. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
  3298. }
  3299. }
  3300. else
  3301. return 0;
  3302. }
  3303. else
  3304. return 0;
  3305. // Let the server know that this was a valid command
  3306. return 1;
  3307. }
  3308. // Let's the admins see which players are still muted
  3309. COMMAND:mutes(playerid, params[])
  3310. {
  3311. // Setup local variables
  3312. new PlayerList[1000], Name[24];
  3313. // Send the command to all admins so they can see it
  3314. SendAdminText(playerid, "/mutes", params);
  3315. // Check if the player has logged in
  3316. if (APlayerData[playerid][LoggedIn] == true)
  3317. {
  3318. // Check if the player's admin-level is at least 1
  3319. if (APlayerData[playerid][PlayerLevel] >= 1)
  3320. {
  3321. // Loop through all players
  3322. for (new i; i < MAX_PLAYERS; i++)
  3323. {
  3324. // Check if that player is online
  3325. if (IsPlayerConnected(i))
  3326. {
  3327. if (APlayerData[i][Muted] == true)
  3328. {
  3329. // Get the player's name
  3330. GetPlayerName(i, Name, sizeof(Name));
  3331. // Add his name and ID to the list
  3332. format(PlayerList, sizeof(PlayerList), "%s%s (ID: %i)\n", PlayerList, Name, i);
  3333. }
  3334. }
  3335. }
  3336. // Show the list of muted players to the admin
  3337. if (strlen(PlayerList) != 0)
  3338. ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Muted players:", PlayerList, "OK", "Cancel");
  3339. else
  3340. SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}There are no muted players");
  3341. }
  3342. else
  3343. return 0;
  3344. }
  3345. else
  3346. return 0;
  3347. // Let the server know that this was a valid command
  3348. return 1;
  3349. }
  3350. // Freeze a player (he cannot move anymore)
  3351. COMMAND:freeze(playerid, params[])
  3352. {
  3353. // Setup local variables
  3354. new Msg[128], Name[24], AdminName[24], Reason[128], OtherPlayer, Duration;
  3355. // Send the command to all admins so they can see it
  3356. SendAdminText(playerid, "/freeze", params);
  3357. // Check if the player has logged in
  3358. if (APlayerData[playerid][LoggedIn] == true)
  3359. {
  3360. // Check if the player's admin-level is at least 1
  3361. if (APlayerData[playerid][PlayerLevel] >= 1)
  3362. {
  3363. if (sscanf(params, "uis[128]", OtherPlayer, Duration, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/freeze <OtherPlayer> <Duration> <Reason>\"");
  3364. else
  3365. {
  3366. // Check if the otherplayer is online
  3367. if (IsPlayerConnected(OtherPlayer))
  3368. {
  3369. // Get the player-names
  3370. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  3371. GetPlayerName(OtherPlayer, Name, sizeof(Name));
  3372. // Store the duration for the freeze, freeze him and start the frozentimer
  3373. APlayerData[OtherPlayer][PlayerFrozen] = Duration;
  3374. TogglePlayerControllable(OtherPlayer, 0);
  3375. SetTimerEx("Player_FreezeTimer", 1000, true, "i", OtherPlayer);
  3376. // Let the other player know that he has been muted
  3377. format(Msg, 128, "{FF0000}You have been frozen by {FFFF00}%s {FF0000}for {FFFF00}%s", AdminName, Reason);
  3378. SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
  3379. // Let the admin know who he has muted
  3380. format(Msg, 128, "{00FF00}You have frozen {FFFF00}%s", Name);
  3381. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  3382. // Save the player-stats
  3383. PlayerFile_Save(OtherPlayer);
  3384. }
  3385. else
  3386. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
  3387. }
  3388. }
  3389. else
  3390. return 0;
  3391. }
  3392. else
  3393. return 0;
  3394. // Let the server know that this was a valid command
  3395. return 1;
  3396. }
  3397. // Transfer money to another player
  3398. COMMAND:givecash(playerid, params[])
  3399. {
  3400. // Setup local variables
  3401. new Msg[128], Name[24], OtherName[24], OtherPlayer, Money;
  3402. // Send the command to all admins so they can see it
  3403. SendAdminText(playerid, "/givecash", params);
  3404. // Check if the player has logged in
  3405. if (APlayerData[playerid][LoggedIn] == true)
  3406. {
  3407. if (sscanf(params, "ui", OtherPlayer, Money)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/givecash <OtherPlayer> <Money>\"");
  3408. else
  3409. {
  3410. // Check if the otherplayer is online
  3411. if (IsPlayerConnected(OtherPlayer))
  3412. {
  3413. // Get the player-names
  3414. GetPlayerName(playerid, Name, sizeof(Name));
  3415. GetPlayerName(OtherPlayer, OtherName, sizeof(OtherName));
  3416. // Check if the money has a positive value (to prevent stealing money using negative values)
  3417. if (Money > 0)
  3418. {
  3419. // Check if the player has enough money
  3420. if (APlayerData[playerid][PlayerMoney] >= Money)
  3421. {
  3422. // Transfer the money
  3423. RewardPlayer(playerid, -Money, 0);
  3424. RewardPlayer(OtherPlayer, Money, 0);
  3425. // Let the other player know that he has received money
  3426. format(Msg, 128, "{00FF00}You have received {FFFF00}$%i{00FF00} from {FFFF00}%s", Money, Name);
  3427. SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
  3428. // Let the player know he gave money to somebody else
  3429. format(Msg, 128, "{00FF00}You gave {FFFF00}$%i{00FF00} to {FFFF00}%s", Money, OtherName);
  3430. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  3431. // Save the player-stats
  3432. PlayerFile_Save(playerid);
  3433. PlayerFile_Save(OtherPlayer);
  3434. }
  3435. else
  3436. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You don't have enough money");
  3437. }
  3438. else
  3439. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You must use values higher than 0");
  3440. }
  3441. else
  3442. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
  3443. }
  3444. }
  3445. else
  3446. return 0;
  3447. // Let the server know that this was a valid command
  3448. return 1;
  3449. }
  3450. // Respawns the given vehicle
  3451. COMMAND:respawn(playerid, params[])
  3452. {
  3453. // Setup local variables
  3454. new vid, Msg[128];
  3455. // Send the command to all admins so they can see it
  3456. SendAdminText(playerid, "/respawn", params);
  3457. // Check if the player has logged in
  3458. if (APlayerData[playerid][LoggedIn] == true)
  3459. {
  3460. // Check if the player's admin-level is at least 1
  3461. if (APlayerData[playerid][PlayerLevel] >= 1)
  3462. {
  3463. if (sscanf(params, "i", vid)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/respawn <Vehicle-id>\"");
  3464. else
  3465. {
  3466. // Check if the vehicle-id is valid
  3467. if ((vid > 0) && (vid < 2000))
  3468. {
  3469. // Check if the vehicle exists
  3470. if (AVehicleData[vid][Model] != 0)
  3471. {
  3472. // Force the vehicle to respawn
  3473. SetVehicleToRespawn(vid);
  3474. // Let the player know he respawned the vehicle
  3475. format(Msg, 128, "{00FF00}You've respawned vehicle {FFFF00}%i", vid);
  3476. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  3477. }
  3478. }
  3479. else
  3480. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You have to use a vehicle-id between 1 and 1999");
  3481. }
  3482. }
  3483. else
  3484. return 0;
  3485. }
  3486. else
  3487. return 0;
  3488. // Let the server know that this was a valid command
  3489. return 1;
  3490. }
  3491. // Creates a spikestrip (can only be used by police players)
  3492. COMMAND:spike(playerid, params[])
  3493. {
  3494. // Send the command to all admins so they can see it
  3495. SendAdminText(playerid, "/spike", params);
  3496. // Check if the player has logged in
  3497. if (APlayerData[playerid][LoggedIn] == true)
  3498. {
  3499. // Check if the player if a police player
  3500. if (APlayerData[playerid][PlayerClass] == ClassPolice)
  3501. {
  3502. // Check if the player is on foot
  3503. if (GetPlayerVehicleSeat(playerid) == -1)
  3504. {
  3505. // Try to create a spikestrip
  3506. SpikeStrip_Create(playerid);
  3507. }
  3508. else
  3509. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You must be on foot to place a spikestrip");
  3510. }
  3511. else
  3512. return 0;
  3513. }
  3514. else
  3515. return 0;
  3516. // Let the server know that this was a valid command
  3517. return 1;
  3518. }
  3519. // This command ejects a player from his vehicle
  3520. COMMAND:eject(playerid, params[])
  3521. {
  3522. // Setup local variables
  3523. new Name[24], AdminName[24], Msg[128], OtherPlayer;
  3524. // Send the command to all admins so they can see it
  3525. SendAdminText(playerid, "/eject", params);
  3526. // Check if the player has logged in
  3527. if (APlayerData[playerid][LoggedIn] == true)
  3528. {
  3529. // Check if the player's admin-level is at least 2
  3530. if (APlayerData[playerid][PlayerLevel] >= 2)
  3531. {
  3532. if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/eject <OtherPlayer>\"");
  3533. else
  3534. {
  3535. // Check if the player is logged in
  3536. if (APlayerData[OtherPlayer][LoggedIn] == true)
  3537. {
  3538. // Check if the other player is driving a vehicle
  3539. if (GetPlayerVehicleSeat(OtherPlayer) != -1)
  3540. {
  3541. // Get the names of the players
  3542. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  3543. GetPlayerName(OtherPlayer, Name, sizeof(Name));
  3544. // Eject the player from the vehicle
  3545. RemovePlayerFromVehicle(OtherPlayer);
  3546. // Let the player know he's been ejected from his vehicle
  3547. format(Msg, 128, "{FF0000}You've been ejected from your vehicle by {FFFF00}%s", AdminName);
  3548. SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
  3549. // Inform the admin that he ejected the player
  3550. format(Msg, 128, "{00FF00}You've ejected {FFFF00}%s{00FF00} from his vehicle", Name);
  3551. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  3552. }
  3553. else
  3554. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't inside a vehicle");
  3555. }
  3556. else
  3557. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't connected");
  3558. }
  3559. }
  3560. else
  3561. return 0;
  3562. }
  3563. else
  3564. return 0;
  3565. // Let the server know that this was a valid command
  3566. return 1;
  3567. }
  3568. // This command lets you talk only to players of the same class
  3569. COMMAND:say(playerid, params[])
  3570. {
  3571. // Setup local variables
  3572. new Name[24], Msg[128], Message[128];
  3573. // Send the command to all admins so they can see it
  3574. SendAdminText(playerid, "/say", params);
  3575. // Get the player's name
  3576. GetPlayerName(playerid, Name, sizeof(Name));
  3577. // Check if the player has logged in
  3578. if (APlayerData[playerid][LoggedIn] == true)
  3579. {
  3580. if (sscanf(params, "s[128]", Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/say <Your Message>\"");
  3581. else
  3582. {
  3583. // Loop through all players
  3584. for (new i; i < MAX_PLAYERS; i++)
  3585. {
  3586. // Check if the player is logged in
  3587. if (APlayerData[i][LoggedIn] == true)
  3588. {
  3589. // Check if the other player has the same class
  3590. if (APlayerData[i][PlayerClass] == APlayerData[playerid][PlayerClass])
  3591. {
  3592. format(Msg, 128, "{B0B0B0}%s said: {FFFFFF}%s", Name, Message);
  3593. SendClientMessage(i, 0xFFFFFFFF, Msg);
  3594. }
  3595. }
  3596. }
  3597. }
  3598. }
  3599. else
  3600. return 0;
  3601. // Let the server know that this was a valid command
  3602. return 1;
  3603. }
  3604. // This command lets you talk only to admin players
  3605. COMMAND:asay(playerid, params[])
  3606. {
  3607. // Setup local variables
  3608. new Name[24], Msg[128], Message[128];
  3609. // Send the command to all admins so they can see it
  3610. SendAdminText(playerid, "/asay", params);
  3611. // Get the player's name
  3612. GetPlayerName(playerid, Name, sizeof(Name));
  3613. // Check if the player has logged in
  3614. if (APlayerData[playerid][LoggedIn] == true)
  3615. {
  3616. // Check if the player is an admin
  3617. if (APlayerData[playerid][PlayerLevel] > 0)
  3618. {
  3619. if (sscanf(params, "s[128]", Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/asay <Your Message>\"");
  3620. else
  3621. {
  3622. // Loop through all players
  3623. for (new i; i < MAX_PLAYERS; i++)
  3624. {
  3625. // Check if the player is logged in
  3626. if (APlayerData[i][LoggedIn] == true)
  3627. {
  3628. // Check if the other player is also an admin
  3629. if (APlayerData[i][PlayerLevel] > 0)
  3630. {
  3631. format(Msg, 128, "{B0B0B0}%s said: {FFFFFF}%s", Name, Message);
  3632. SendClientMessage(i, 0xFFFFFFFF, Msg);
  3633. }
  3634. }
  3635. }
  3636. }
  3637. }
  3638. else
  3639. return 0;
  3640. }
  3641. else
  3642. return 0;
  3643. // Let the server know that this was a valid command
  3644. return 1;
  3645. }
  3646. // Clamp an owned vehicle (remove it completely)
  3647. COMMAND:clamp(playerid, params[])
  3648. {
  3649. // Setup local variables
  3650. new vid, Reason[128], HouseID, HouseOwner, Name[24], AdminName[24], Msg[128];
  3651. // Send the command to all admins so they can see it
  3652. SendAdminText(playerid, "/clamp", params);
  3653. // Check if the player has logged in
  3654. if (APlayerData[playerid][LoggedIn] == true)
  3655. {
  3656. // Check if the player's admin-level is at least 5
  3657. if (APlayerData[playerid][PlayerLevel] >= 5)
  3658. {
  3659. if (sscanf(params, "is[128]", vid, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/clamp <vehicleid> <reason>\"");
  3660. else
  3661. {
  3662. // Get the HouseID to which this vehicle belongs
  3663. HouseID = AVehicleData[vid][BelongsToHouse];
  3664. // Check if the vehicle belongs to a house
  3665. if (HouseID != 0)
  3666. {
  3667. //Also set the new location of the vehicle inside the KACC Military fuels hangar
  3668. AVehicleData[vid][SpawnX] = 2585.0;
  3669. AVehicleData[vid][SpawnY] = 2829.0;
  3670. AVehicleData[vid][SpawnZ] = 10.9;
  3671. AVehicleData[vid][SpawnRot] = 0.0;
  3672. // Search all the players to see who owns the house
  3673. for (new i; i < MAX_PLAYERS; i++)
  3674. {
  3675. // Loop through all the houses this player owns
  3676. for(new j; j < MAX_HOUSESPERPLAYER; j++)
  3677. {
  3678. // Check if the player owns this house
  3679. if (APlayerData[i][Houses][j] == HouseID)
  3680. {
  3681. // Store the houseowner
  3682. HouseOwner = i;
  3683. // Find the CarSlot where this vehicle exists
  3684. for (new CarSlot; CarSlot < 10; CarSlot++)
  3685. {
  3686. // Check if the vehicle is stored in this carslot
  3687. if (AHouseData[HouseID][VehicleIDs][CarSlot] == vid)
  3688. {
  3689. vid = House_ReplaceVehicle(HouseID, CarSlot); // Re-create the vehicle at the KACC Military fuels hangar
  3690. // Set the vehicle as clamped (clamping needs to be done after re-creating the vehice, otherwise the wrong id can be clamped)
  3691. AVehicleData[vid][Clamped] = true;
  3692. }
  3693. }
  3694. break;
  3695. }
  3696. }
  3697. }
  3698. // Get the name of the admin and owner of the house
  3699. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  3700. GetPlayerName(HouseOwner, Name, sizeof(Name));
  3701. // Let the admin know who's vehicle he deleted
  3702. format(Msg, 128, "{00FF00}You've clamped a vehicle that was owned by {FFFF00}%s", Name);
  3703. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  3704. // Let the player know who deleted his vehicle
  3705. format(Msg, 128, "{FF0000}A vehicle you owned was clamped by admin {FFFF00}%s", AdminName);
  3706. SendClientMessage(HouseOwner, 0xFFFFFFFF, Msg);
  3707. format(Msg, 128, "{FF0000}It belongs to house: {FFFF00}%s", AHouseData[HouseID][HouseName]);
  3708. SendClientMessage(HouseOwner, 0xFFFFFFFF, Msg);
  3709. format(Msg, 128, "{FF0000}Reason: {FFFF00}%s", Reason);
  3710. SendClientMessage(HouseOwner, 0xFFFFFFFF, Msg);
  3711. // Save the player's datafile (and his houses/businesses/vehicles)
  3712. PlayerFile_Save(HouseOwner);
  3713. }
  3714. else
  3715. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That vehicle doesn't belong to a player, you cannot clamp it");
  3716. }
  3717. }
  3718. else
  3719. return 0;
  3720. }
  3721. else
  3722. return 0;
  3723. // Let the server know that this was a valid command
  3724. return 1;
  3725. }
  3726. // This command can be used to unclamp all your vehicles at once
  3727. COMMAND:unclamp(playerid, params[])
  3728. {
  3729. // Setup local variables
  3730. new HouseID, vid, ClampedVehicles, UnclampPrice, Msg[128];
  3731. // Send the command to all admins so they can see it
  3732. SendAdminText(playerid, "/unclamp", params);
  3733. // Check if the player has logged in
  3734. if (APlayerData[playerid][LoggedIn] == true)
  3735. {
  3736. // Loop through all vehicles owned by this player
  3737. for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
  3738. {
  3739. // Get the HouseID that exists on this index
  3740. HouseID = APlayerData[playerid][Houses][HouseSlot];
  3741. // check if this house-slot is used
  3742. if (HouseID != 0)
  3743. {
  3744. // Loop through all vehicles assigned to this house
  3745. for (new CarSlot; CarSlot < 10; CarSlot++)
  3746. {
  3747. // Get the vehicle-id of the vehicle in this carslot
  3748. vid = AHouseData[HouseID][VehicleIDs][CarSlot];
  3749. // Check if this carslot is used
  3750. if (vid != 0)
  3751. {
  3752. // Check if this vehicle is clamped
  3753. if (AVehicleData[vid][Clamped] == true)
  3754. ClampedVehicles++; // Count the clamped vehicles
  3755. }
  3756. }
  3757. }
  3758. }
  3759. // Check if there were any clamped vehicles
  3760. if (ClampedVehicles > 0)
  3761. {
  3762. // Calculate the price to unclamp all the player's vehicles
  3763. UnclampPrice = ClampedVehicles * UnclampPricePerVehicle;
  3764. // Construct the message to inform the player how many vehicles have been clamped and how much it costs to un-clamp them
  3765. format(Msg, 128, "You have %i clamped vehicles, it will cost you $%i to unclamp them", ClampedVehicles, UnclampPrice);
  3766. // Show a dialog that informs the player how many vehicles have been clamped and how much it costs to un-clamp them
  3767. ShowPlayerDialog(playerid, DialogUnclampVehicles, DIALOG_STYLE_MSGBOX, TXT_AreYouSure, Msg, "Unclamp", TXT_DialogButtonCancel);
  3768. }
  3769. else
  3770. SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}You don't have any clamped vehicles");
  3771. }
  3772. else
  3773. return 0;
  3774. // Let the server know that this was a valid command
  3775. return 1;
  3776. }
  3777. // This command displays the rules of the server
  3778. COMMAND:rules(playerid, params[])
  3779. {
  3780. // Setup local variables
  3781. new Msg[2000];
  3782. // Send the command to all admins so they can see it
  3783. SendAdminText(playerid, "/rules", params);
  3784. // Check if the player has logged in
  3785. if (APlayerData[playerid][LoggedIn] == true)
  3786. {
  3787. // Construct the rules
  3788. format(Msg, 2000, "%s1. Always drive on the right side of the road\n", Msg);
  3789. format(Msg, 2000, "%s2. No flaming or disrespecting other players\n", Msg);
  3790. format(Msg, 2000, "%s3. Main language is english\n", Msg);
  3791. format(Msg, 2000, "%s4. Don't use any hacks, you'll be banned\n", Msg);
  3792. format(Msg, 2000, "%s5. No spamming on the chat\n", Msg);
  3793. format(Msg, 2000, "%s6. No car-jacking allowed\n", Msg);
  3794. // Show a dialog that shows the rules
  3795. ShowPlayerDialog(playerid, DialogRules, DIALOG_STYLE_MSGBOX, "Rules of the server:", Msg, "Accept", TXT_DialogButtonCancel);
  3796. }
  3797. else
  3798. return 0;
  3799. // Let the server know that this was a valid command
  3800. return 1;
  3801. }
  3802. // Report a player for breaking the rules
  3803. COMMAND:report(playerid, params[])
  3804. {
  3805. // Setup local variables
  3806. new OtherPlayer, Name[24], Reason[128], Msg[128];
  3807. // Send the command to all admins so they can see it
  3808. SendAdminText(playerid, "/report", params);
  3809. // Check if the player has logged in
  3810. if (APlayerData[playerid][LoggedIn] == true)
  3811. {
  3812. if (sscanf(params, "us[128]", OtherPlayer, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/report <OtherPlayer> <Your report>\"");
  3813. else
  3814. {
  3815. // Check if that other player is logged in
  3816. if (APlayerData[OtherPlayer][LoggedIn] == true)
  3817. {
  3818. // Send the report to all admins and add the report to the report-list so admins can review it
  3819. SendReportToAdmins(OtherPlayer, Reason);
  3820. // Get the name of the offender
  3821. GetPlayerName(OtherPlayer, Name, sizeof(Name));
  3822. // Let the player know he reported the other player
  3823. format(Msg, 128, "{00FF00}You've reported {FFFF00}%s", Name);
  3824. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  3825. }
  3826. else
  3827. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't connected");
  3828. }
  3829. }
  3830. else
  3831. return 0;
  3832. // Let the server know that this was a valid command
  3833. return 1;
  3834. }
  3835. // Lets the admins see the list of reports
  3836. COMMAND:rep(playerid, params[])
  3837. {
  3838. // Send the command to all admins so they can see it
  3839. SendAdminText(playerid, "/rep", params);
  3840. // Check if the player has logged in
  3841. if (APlayerData[playerid][LoggedIn] == true)
  3842. {
  3843. // Check if the player's admin-level is at least 1
  3844. if (APlayerData[playerid][PlayerLevel] >= 1)
  3845. {
  3846. // Add the first report to the list (if it exists)
  3847. if (AReports[0][ReportUsed] == true)
  3848. format(ReportList, 5000, "%s: %s\n", AReports[0][ReportName], AReports[0][ReportReason]);
  3849. // Construct the report-dialog
  3850. for (new i = 1; i < 50; i++)
  3851. {
  3852. // Check if the ReportID has been used already
  3853. if (AReports[i][ReportUsed] == true)
  3854. {
  3855. format(ReportList, 5000, "%s%s: %s\n", ReportList, AReports[i][ReportName], AReports[i][ReportReason]);
  3856. }
  3857. }
  3858. // Show all the reports
  3859. ShowPlayerDialog(playerid, DialogReports, DIALOG_STYLE_LIST, "Reports list:", ReportList, "OK", "Cancel");
  3860. }
  3861. else
  3862. return 0;
  3863. }
  3864. else
  3865. return 0;
  3866. // Let the server know that this was a valid command
  3867. return 1;
  3868. }
  3869. // Enables the trucker to overload himself
  3870. COMMAND:overload(playerid, params[])
  3871. {
  3872. // Setup local variables
  3873. new vModel, bool:ValidOverLoad = false, Float:x, Float:y, Float:z, Name[24], Msg[128];
  3874. // Send the command to all admins so they can see it
  3875. SendAdminText(playerid, "/overload", params);
  3876. // Check if the player has logged in
  3877. if (APlayerData[playerid][LoggedIn] == true)
  3878. {
  3879. // Check if the playeris a trucker
  3880. if (APlayerData[playerid][PlayerClass] == ClassTruckDriver)
  3881. {
  3882. // Check if he has already started a job
  3883. if (APlayerData[playerid][JobStarted] == true)
  3884. {
  3885. // Check if the player has already loaded his load
  3886. if (APlayerData[playerid][JobStep] == 2)
  3887. {
  3888. // Check if the player isn't overloaded already
  3889. if (APlayerData[playerid][Overloaded] == false)
  3890. {
  3891. // Get the coordinates of the loading point
  3892. x = ALocations[APlayerData[playerid][JobLoc1]][LocX];
  3893. y = ALocations[APlayerData[playerid][JobLoc1]][LocY];
  3894. z = ALocations[APlayerData[playerid][JobLoc1]][LocZ];
  3895. // Check if the player is still near the loading point
  3896. if (IsPlayerInRangeOfPoint(playerid, 25.0, x, y, z))
  3897. {
  3898. // Get the vehicle-model of the player's vehicle
  3899. vModel = GetVehicleModel(APlayerData[playerid][VehicleID]);
  3900. // Check if the trucker is driving a trucking vehicle that can be overloaded
  3901. switch (vModel)
  3902. {
  3903. case VehicleFlatbed, VehicleDFT30: ValidOverLoad = true; // Flatbed and DFT-30 can be overloaded
  3904. case VehicleLineRunner, VehicleTanker, VehicleRoadTrain:
  3905. {
  3906. switch (GetVehicleModel(APlayerData[playerid][TrailerID]))
  3907. {
  3908. case VehicleTrailerCargo, VehicleTrailerCargo2, VehicleTrailerOre: ValidOverLoad = true; // Cargo and ore trailer can be overloaded
  3909. }
  3910. }
  3911. }
  3912. // Check if the vehicle is valid for overloading
  3913. if (ValidOverLoad == true)
  3914. {
  3915. // Set overloaded for this player to True
  3916. APlayerData[playerid][Overloaded] = true;
  3917. // Add 2 to the player's wanted level
  3918. SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 2);
  3919. // Let the player know he has been overloaded now
  3920. SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}You have overloaded your truck, watch out for the police");
  3921. // Inform the police this trucker is overloaded
  3922. GetPlayerName(playerid, Name, sizeof(Name));
  3923. format(Msg, 128, "{00FF00}Trucker {FFFF00}%s{00FF00} is overloaded, pursue and fine him", Name);
  3924. Police_SendMessage(Msg);
  3925. }
  3926. else
  3927. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Your vehicle cannot be overloaded");
  3928. }
  3929. else
  3930. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You must be near the loading point to overload your truck");
  3931. }
  3932. else
  3933. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You are overloaded already");
  3934. }
  3935. else
  3936. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You must load your truck first");
  3937. }
  3938. else
  3939. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You haven't started a job yet");
  3940. }
  3941. else
  3942. return 0;
  3943. }
  3944. else
  3945. return 0;
  3946. // Let the server know that this was a valid command
  3947. return 1;
  3948. }
  3949. // This command resets a player's money, score and stats to 0 (if chosen)
  3950. COMMAND:resetplayer(playerid, params[])
  3951. {
  3952. // Setup local variables
  3953. new Name[24], AdminName[24], Reason[128], Msg[128], OtherPlayer, ClearMoney, ClearScore, ClearStats;
  3954. // Send the command to all admins so they can see it
  3955. SendAdminText(playerid, "/resetplayer", params);
  3956. // Check if the player has logged in
  3957. if (APlayerData[playerid][LoggedIn] == true)
  3958. {
  3959. // Check if the player's admin-level is at least 5
  3960. if (APlayerData[playerid][PlayerLevel] >= 5)
  3961. {
  3962. if (sscanf(params, "uiiis[128]", OtherPlayer, ClearMoney, ClearScore, ClearStats, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/resetplayer <OtherPlayer> <Money (0/1)> <Score (0/1)> <Stats (0/1)> <Reason>\"");
  3963. else
  3964. {
  3965. // Check if the other player is logged in
  3966. if (APlayerData[OtherPlayer][LoggedIn] == true)
  3967. {
  3968. // Check if there is at least one parameter given to be cleared, otherwise exit the command
  3969. if ((ClearMoney + ClearScore + ClearStats) == 0)
  3970. return 1;
  3971. // Get the names of both players
  3972. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  3973. GetPlayerName(OtherPlayer, Name, sizeof(Name));
  3974. // Reset the other player's money to 0
  3975. if (ClearMoney == 1)
  3976. {
  3977. APlayerData[OtherPlayer][PlayerMoney] = 0;
  3978. format(Msg, 128, "{FF0000}Your money has been reset by {FFFF00}%s", AdminName);
  3979. SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
  3980. format(Msg, 128, "{00FF00}You've reset the money of player {FFFF00}%s", Name);
  3981. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  3982. }
  3983. // Reset the other player's score to 0
  3984. if (ClearScore == 1)
  3985. {
  3986. APlayerData[OtherPlayer][PlayerScore] = 0;
  3987. format(Msg, 128, "{FF0000}Your score has been reset by {FFFF00}%s", AdminName);
  3988. SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
  3989. format(Msg, 128, "{00FF00}You've reset the score of player {FFFF00}%s", Name);
  3990. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  3991. }
  3992. // Reset the other player's stats to 0
  3993. if (ClearStats == 1)
  3994. {
  3995. APlayerData[OtherPlayer][StatsTruckerJobs] = 0;
  3996. APlayerData[OtherPlayer][StatsConvoyJobs] = 0;
  3997. APlayerData[OtherPlayer][StatsBusDriverJobs] = 0;
  3998. APlayerData[OtherPlayer][StatsPilotJobs] = 0;
  3999. APlayerData[OtherPlayer][StatsMafiaJobs] = 0;
  4000. APlayerData[OtherPlayer][StatsMafiaStolen] = 0;
  4001. APlayerData[OtherPlayer][StatsPoliceFined] = 0;
  4002. APlayerData[OtherPlayer][StatsPoliceJailed] = 0;
  4003. APlayerData[OtherPlayer][StatsCourierJobs] = 0;
  4004. APlayerData[OtherPlayer][StatsAssistance] = 0;
  4005. APlayerData[OtherPlayer][StatsRoadworkerJobs] = 0;
  4006. APlayerData[OtherPlayer][StatsMetersDriven] = 0.0;
  4007. format(Msg, 128, "{FF0000}Your stats have been reset by {FFFF00}%s", AdminName);
  4008. SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
  4009. format(Msg, 128, "{00FF00}You've reset the stats of player {FFFF00}%s", Name);
  4010. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  4011. }
  4012. // Let the other player know the reason too
  4013. format(Msg, 128, "{FF0000}Reason: {FFFF00}%s", Reason);
  4014. SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
  4015. // Save the other player's account
  4016. PlayerFile_Save(OtherPlayer);
  4017. }
  4018. else
  4019. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't connected");
  4020. }
  4021. }
  4022. else
  4023. return 0;
  4024. }
  4025. else
  4026. return 0;
  4027. // Let the server know that this was a valid command
  4028. return 1;
  4029. }
  4030. // This command searches every house and business that the player owns and restores the data for it in the player's account
  4031. COMMAND:fixplayer(playerid, params[])
  4032. {
  4033. // Setup local variables
  4034. new Name[24], AdminName[24], Msg[128], OtherPlayer;
  4035. // Send the command to all admins so they can see it
  4036. SendAdminText(playerid, "/fixplayer", params);
  4037. // Check if the player has logged in
  4038. if (APlayerData[playerid][LoggedIn] == true)
  4039. {
  4040. // Check if the player's admin-level is at least 5
  4041. if (APlayerData[playerid][PlayerLevel] >= 5)
  4042. {
  4043. if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/fixplayer <OtherPlayer>\"");
  4044. else
  4045. {
  4046. // Check if the other player is logged in
  4047. if (APlayerData[OtherPlayer][LoggedIn] == true)
  4048. {
  4049. // Get the names of both players
  4050. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  4051. GetPlayerName(OtherPlayer, Name, sizeof(Name));
  4052. // Clear the houses and businesses that the player owns right now
  4053. for (new i; i < MAX_HOUSESPERPLAYER; i++)
  4054. APlayerData[OtherPlayer][Houses][i] = 0;
  4055. for (new i; i < MAX_BUSINESSPERPLAYER; i++)
  4056. APlayerData[OtherPlayer][Business][i] = 0;
  4057. // Now search through all houses and re-add them to the player
  4058. for (new HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
  4059. if (AHouseData[HouseID][Owned] == true) // Check if the house is owned by somebody
  4060. if (strcmp(AHouseData[HouseID][Owner], Name, false) == 0) // Check if the player is the owner of the house
  4061. {
  4062. for (new i; i < MAX_HOUSESPERPLAYER; i++) // Loop through all houses the player owns
  4063. if (APlayerData[OtherPlayer][Houses][i] == 0) // Check if the houseslot is free
  4064. {
  4065. APlayerData[OtherPlayer][Houses][i] = HouseID; // Store the HouseID
  4066. break; // Stop searching for more free slots
  4067. }
  4068. }
  4069. // Now search through all businesses and re-add them to the player
  4070. for (new BusID = 1; BusID < MAX_BUSINESS; BusID++)
  4071. if (ABusinessData[BusID][Owned] == true) // Check if the business is owner by someone
  4072. if (strcmp(ABusinessData[BusID][Owner], Name, false) == 0) // Check if the player is the owner of the business
  4073. {
  4074. for (new i; i < MAX_BUSINESSPERPLAYER; i++) // Loop through all businesses the player owns
  4075. if (APlayerData[OtherPlayer][Business][i] == 0) // Check if the businessslot is free
  4076. {
  4077. APlayerData[OtherPlayer][Business][i] = BusID; // Store the BusID
  4078. break; // Stop searching for more free slots
  4079. }
  4080. }
  4081. // Let the other player know his property has been restored
  4082. format(Msg, 128, "{00FF00}Your property has been restored by: {FFFF00}%s", AdminName);
  4083. SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
  4084. // Save the other player's account
  4085. PlayerFile_Save(OtherPlayer);
  4086. }
  4087. else
  4088. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't connected");
  4089. }
  4090. }
  4091. else
  4092. return 0;
  4093. }
  4094. else
  4095. return 0;
  4096. // Let the server know that this was a valid command
  4097. return 1;
  4098. }
  4099. // This command sets a skin for the player
  4100. COMMAND:setskin(playerid, params[])
  4101. {
  4102. // Setup local variables
  4103. new Msg[128], Skin;
  4104. // Send the command to all admins so they can see it
  4105. SendAdminText(playerid, "/setskin", params);
  4106. // Check if the player has logged in
  4107. if (APlayerData[playerid][LoggedIn] == true)
  4108. {
  4109. // Check if the player's admin-level is at least 4
  4110. if (APlayerData[playerid][PlayerLevel] >= 4)
  4111. {
  4112. if (sscanf(params, "i", Skin)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/setskin <skin-id (0-299)>\"");
  4113. else
  4114. {
  4115. // Check if the player entered a valid skin-id
  4116. if ((Skin >= 0) && (Skin <= 299))
  4117. {
  4118. // Set the skin for the player
  4119. SetPlayerSkin(playerid, Skin);
  4120. // Let the other player know the reason too
  4121. format(Msg, 128, "{00FF00}You've chosen skin-id: {FFFF00}%i", Skin);
  4122. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  4123. }
  4124. else
  4125. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Invalid skin-id, you can only use skins 0-299");
  4126. }
  4127. }
  4128. else
  4129. return 0;
  4130. }
  4131. else
  4132. return 0;
  4133. // Let the server know that this was a valid command
  4134. return 1;
  4135. }
  4136. // Bans a player by his ip
  4137. COMMAND:ipban(playerid, params[])
  4138. {
  4139. // Setup local variables
  4140. new PlayerToBan, Reason[128], Msg[128], Name[24], AdminName[24];
  4141. // Send the command to all admins so they can see it
  4142. SendAdminText(playerid, "/ipban", params);
  4143. // Check if the player has logged in
  4144. if (APlayerData[playerid][LoggedIn] == true)
  4145. {
  4146. // Check if the player's admin-level is at least 3
  4147. if (APlayerData[playerid][PlayerLevel] >= 3)
  4148. {
  4149. if (sscanf(params, "us[128]", PlayerToBan, Reason))
  4150. SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/ipban <PlayerToBan> <Reason>\"");
  4151. else
  4152. {
  4153. if (IsPlayerConnected(PlayerToBan))
  4154. {
  4155. // Get the names of the player and the admin who executed the ban
  4156. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  4157. GetPlayerName(PlayerToBan, Name, sizeof(Name));
  4158. // Inform the player about his ban
  4159. format(Msg, 128, "{FF0000}You have been ip-banned permanently by {FFFF00}%s", AdminName);
  4160. SendClientMessage(PlayerToBan, 0xFFFFFFFF, Msg);
  4161. format(Msg, 128, "{FF0000}Reason: {FFFF00}%s", Reason);
  4162. SendClientMessage(PlayerToBan, 0xFFFFFFFF, Msg);
  4163. // Ban the player with a reason
  4164. BanEx(PlayerToBan, Reason);
  4165. // Inform everybody else which player was ip-banned
  4166. format(Msg, 128, "{808080}%s %s has ip-banned {FFFF00}%s", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name);
  4167. SendClientMessageToAll(0xFFFFFFFF, Msg);
  4168. }
  4169. }
  4170. }
  4171. else
  4172. return 0;
  4173. }
  4174. else
  4175. return 0;
  4176. return 1;
  4177. }
  4178. // Bans a player's entire range of IP addresses (the last part of the IP-address will be from 0 to 255)
  4179. COMMAND:rangeban(playerid, params[])
  4180. {
  4181. // Setup local variables
  4182. new PlayerToBan, PlayerIP[16], FirstPartsOfIP[16], BanCmd[24], Reason[128], Msg[128], Name[24], AdminName[24];
  4183. // Send the command to all admins so they can see it
  4184. SendAdminText(playerid, "/rangeban", params);
  4185. // Check if the player has logged in
  4186. if (APlayerData[playerid][LoggedIn] == true)
  4187. {
  4188. // Check if the player's admin-level is at least 3
  4189. if (APlayerData[playerid][PlayerLevel] >= 3)
  4190. {
  4191. if (sscanf(params, "us[128]", PlayerToBan, Reason))
  4192. SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/rangeban <PlayerToBan> <Reason>\"");
  4193. else
  4194. {
  4195. if (IsPlayerConnected(PlayerToBan))
  4196. {
  4197. // Get the names of the player and the admin who executed the ban
  4198. GetPlayerName(playerid, AdminName, sizeof(AdminName));
  4199. GetPlayerName(PlayerToBan, Name, sizeof(Name));
  4200. // Get the player's IP-address
  4201. GetPlayerIp(PlayerToBan, PlayerIP, 16);
  4202. // Inform the player about his ban
  4203. format(Msg, 128, "{FF0000}You have been ip-range-banned permanently by {FFFF00}%s", AdminName);
  4204. SendClientMessage(PlayerToBan, 0xFFFFFFFF, Msg);
  4205. format(Msg, 128, "{FF0000}Reason: {FFFF00}%s", Reason);
  4206. SendClientMessage(PlayerToBan, 0xFFFFFFFF, Msg);
  4207. // Get the first three digits from the player's ip, so the fourth part can be added from 0 to 255
  4208. FirstPartsOfIP = GetFirstThreeDigitsFromIP(PlayerIP);
  4209. // Ban the entire range of IP-addresses of the player
  4210. for (new i; i < 256; i++)
  4211. {
  4212. format(BanCmd, 24, "banip %s%i", FirstPartsOfIP, i); // Construct the RCon command to ban every IP
  4213. SendRconCommand(BanCmd); // Execute the command
  4214. }
  4215. // Finally kick the player (the RCon command doesn't kick you out automatically)
  4216. Kick(PlayerToBan);
  4217. // Inform everybody else which player was ip-range-banned
  4218. format(Msg, 128, "{808080}%s %s has ip-range-banned {FFFF00}%s", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name);
  4219. SendClientMessageToAll(0xFFFFFFFF, Msg);
  4220. }
  4221. }
  4222. }
  4223. else
  4224. return 0;
  4225. }
  4226. else
  4227. return 0;
  4228. return 1;
  4229. }
  4230. // Sets the score of another player
  4231. COMMAND:setscore(playerid, params[])
  4232. {
  4233. // Setup local variables
  4234. new Msg[128], Name[24], OtherName[24], OtherPlayer, pScore;
  4235. // Send the command to all admins so they can see it
  4236. SendAdminText(playerid, "/setscore", params);
  4237. // Check if the player has logged in
  4238. if (APlayerData[playerid][LoggedIn] == true)
  4239. {
  4240. // Check if the player's admin-level is at least 3
  4241. if (APlayerData[playerid][PlayerLevel] >= 3)
  4242. {
  4243. if (sscanf(params, "ui", OtherPlayer, pScore)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/setscore <OtherPlayer> <Score>\"");
  4244. else
  4245. {
  4246. // Check if the otherplayer is online
  4247. if (IsPlayerConnected(OtherPlayer))
  4248. {
  4249. // Get the player-names
  4250. GetPlayerName(playerid, Name, sizeof(Name));
  4251. GetPlayerName(OtherPlayer, OtherName, sizeof(OtherName));
  4252. // Set the other player's score
  4253. APlayerData[OtherPlayer][PlayerScore] = pScore;
  4254. // Let the other player know that his score has been changed
  4255. format(Msg, 128, "{00FF00}Your score has been set to {FFFF00}%i{00FF00} by {FFFF00}%s", pScore, Name);
  4256. SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
  4257. // Let the player know he has set the score of the other player
  4258. format(Msg, 128, "{00FF00}You've set the score of {FFFF00}%s{00FF00} to {FFFF00}%i", OtherName, pScore);
  4259. SendClientMessage(playerid, 0xFFFFFFFF, Msg);
  4260. // Save the other player's account
  4261. PlayerFile_Save(OtherPlayer);
  4262. }
  4263. else
  4264. SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
  4265. }
  4266. }
  4267. else
  4268. return 0;
  4269. }
  4270. else
  4271. return 0;
  4272. // Let the server know that this was a valid command
  4273. return 1;
  4274. }
  4275. // Allows the player to setup a bank account, login to his bank account, or use his bank account after he logged in to his bank account
  4276. COMMAND:bank(playerid, params[])
  4277. {
  4278. // Setup local variables
  4279. new file[100], Name[24];
  4280. // Send the command to all admins so they can see it
  4281. SendAdminText(playerid, "/bank", params);
  4282. // Get the playername
  4283. format(Name, sizeof(Name), APlayerData[playerid][PlayerName]);
  4284. // Construct the complete filename for this player's bank-account
  4285. format(file, sizeof(file), BankFile, Name);
  4286. // Check if the player has logged in
  4287. if (APlayerData[playerid][LoggedIn] == true)
  4288. {
  4289. // Check if the player doesn't have a bank account
  4290. if (!fexist(file))
  4291. {
  4292. // Ask for a password to setup his bank account
  4293. ShowPlayerDialog(playerid, DialogBankPasswordRegister, DIALOG_STYLE_INPUT, "Enter password", "Please enter a password to register your bank account:", TXT_DialogButtonSelect, TXT_DialogButtonCancel);
  4294. }
  4295. else // The player has a bank account
  4296. {
  4297. // If the player hasn't logged in to his bank account yet
  4298. if (APlayerData[playerid][BankLoggedIn] == false)
  4299. {
  4300. // Ask for the password to login to his bank account
  4301. ShowPlayerDialog(playerid, DialogBankPasswordLogin, DIALOG_STYLE_INPUT, "Enter password", "Please enter your password to login to your bank account:", TXT_DialogButtonSelect, TXT_DialogButtonCancel);
  4302. }
  4303. else // The player has logged in to his bank account already
  4304. {
  4305. // Show the main bank menu dialog
  4306. ShowBankMenu(playerid);
  4307. }
  4308. }
  4309. }
  4310. else
  4311. return 0;
  4312. // Let the server know that this was a valid command
  4313. return 1;
  4314. }
  4315. // This command lists all help-items for which the player can get information about it
  4316. COMMAND:help(playerid, params[])
  4317. {
  4318. // Send the command to all admins so they can see it
  4319. SendAdminText(playerid, "/help", params);
  4320. // Check if the player has logged in
  4321. if (APlayerData[playerid][LoggedIn] == true)
  4322. {
  4323. // Create the dialog that lists all help-items
  4324. HelpList_Create(playerid);
  4325. }
  4326. else
  4327. return 0;
  4328. // Let the server know that this was a valid command
  4329. return 1;
  4330. }
  4331. // This command allows you to change your password for logging in
  4332. COMMAND:changepassword(playerid, params[])
  4333. {
  4334. // Send the command to all admins so they can see it
  4335. SendAdminText(playerid, "/changepassword", params);
  4336. // Check if the player has logged in
  4337. if (APlayerData[playerid][LoggedIn] == true)
  4338. {
  4339. // Show the dialog where the player must enter his old password
  4340. ShowPlayerDialog(playerid, DialogOldPassword, DIALOG_STYLE_INPUT, "Enter old password:", "Enter your old password here:", "OK", "Cancel");
  4341. }
  4342. else
  4343. return 0;
  4344. // Let the server know that this was a valid command
  4345. return 1;
  4346. }
  4347. // This command opens a menu where you can choose neons lights for your vehicle
  4348. COMMAND:neon(playerid, params[])
  4349. {
  4350. // Setup local variables
  4351. new OptionsList[200], DialogTitle[200];
  4352. // Send the command to all admins so they can see it
  4353. SendAdminText(playerid, "/neon", params);
  4354. // Check if the player has logged in
  4355. if (APlayerData[playerid][LoggedIn] == true)
  4356. {
  4357. // Check if the player is the driver of a vehicle
  4358. if (GetPlayerVehicleSeat(playerid) == 0)
  4359. {
  4360. format(DialogTitle, sizeof(DialogTitle), "Select neon lights:");
  4361. format(OptionsList, sizeof(OptionsList), "%sPolice lights\n", OptionsList);
  4362. format(OptionsList, sizeof(OptionsList), "%sRed lights\n", OptionsList);
  4363. format(OptionsList, sizeof(OptionsList), "%sBlue lights\n", OptionsList);
  4364. format(OptionsList, sizeof(OptionsList), "%sGreen lights\n", OptionsList);
  4365. format(OptionsList, sizeof(OptionsList), "%sYellow lights\n", OptionsList);
  4366. format(OptionsList, sizeof(OptionsList), "%sPink lights\n", OptionsList);
  4367. format(OptionsList, sizeof(OptionsList), "%sWhite lights\n", OptionsList);
  4368. format(OptionsList, sizeof(OptionsList), "%sRemove neons\n", OptionsList);
  4369. // Show the neon menu
  4370. ShowPlayerDialog(playerid, DialogNeon, DIALOG_STYLE_LIST, DialogTitle, OptionsList, "Select", "Cancel");
  4371. }
  4372. else
  4373. SendClientMessage(playerid, 0xFF0000FF, "You're not the driver of a vehicle");
  4374. }
  4375. else
  4376. return 0;
  4377. // Let the server know that this was a valid command
  4378. return 1;
  4379. }