| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939 |
- // This is just a joke command
- COMMAND:me(playerid,params[])
- {
- // Setup local variables
- new Msg[128], Message[128], Name[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/me", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- if (sscanf(params, "s[128]", Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/me <action>\"");
- else
- {
- // Check if the player isn't muted
- if (APlayerData[playerid][Muted] == false)
- {
- GetPlayerName(playerid, Name, sizeof(Name));
- format(Msg, sizeof(Msg), "* %s: %s", Name, Message);
- SendClientMessageToAll(0xFFFF00AA, Msg);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You are still muted");
- }
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This commands allows the player to send a private message to another player
- COMMAND:pm(playerid, params[])
- {
- // Setup local variables
- new OtherPlayer, Message[128], Msg1[128], Msg2[128], YourName[24], OtherPlayerName[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/pm", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- if (sscanf(params, "us[128]", OtherPlayer, Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/pm <OtherPlayer> <Message>\"");
- else
- {
- // Check if that other player is online
- if (IsPlayerConnected(OtherPlayer))
- {
- // Check if the player isn't muted
- if (APlayerData[playerid][Muted] == false)
- {
- // Get both names
- GetPlayerName(playerid, YourName, sizeof(YourName));
- GetPlayerName(OtherPlayer, OtherPlayerName, sizeof(OtherPlayerName));
- // Construct the message that is sent to yourself
- format(Msg1, 128, "{808080}PM to %s{FFFFFF}: %s", OtherPlayerName, Message);
- // Construct the message that is sent to the other player
- format(Msg2, 128, "{A0A0A0}PM by %s{FFFFFF}: %s", YourName, Message);
- // Send the messages
- SendClientMessage(playerid, 0xFFFFFFFF, Msg1);
- SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg2);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You are still muted");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "Player is not online");
- }
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Lets the player add new houses
- COMMAND:createhouse(playerid, params[])
- {
- // Setup local variables
- new HPrice, MaxLevel, HouseID;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/createhouse", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- // Check if the player isn't inside a vehicle
- if (GetPlayerVehicleSeat(playerid) == -1)
- {
- if (sscanf(params, "ii", HPrice, MaxLevel)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/createhouse <price> <maxlevel (1-10)>\"");
- else
- {
- // Check if the player entered a proper maxlevel
- if ((MaxLevel >= 1) && (MaxLevel <= 10))
- {
- // Find the first free HouseID
- for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
- if (AHouseData[HouseID][PickupID] == 0) // Check if an empty house-index has been found (PickupID is 0)
- break; // Stop searching, the first free HouseID has been found now
- // Check if the house-limit hasn't been reached yet
- if (HouseID < MAX_HOUSES)
- {
- // Setup some local variables
- new Float:x, Float:y, Float:z, Msg[128];
- // Get the player's position
- GetPlayerPos(playerid, x, y, z);
- // Set some default data
- AHouseData[HouseID][HouseX] = x;
- AHouseData[HouseID][HouseY] = y;
- AHouseData[HouseID][HouseZ] = z;
- AHouseData[HouseID][HouseLevel] = 1;
- AHouseData[HouseID][HouseMaxLevel] = MaxLevel;
- AHouseData[HouseID][HousePrice] = HPrice;
- AHouseData[HouseID][Owned] = false;
- // Add the pickup and 3DText at the location of the house-entrance (where the player is standing when he creates the house)
- House_CreateEntrance(HouseID);
- // Save the house
- HouseFile_Save(HouseID);
- // Inform the player that he created a new house
- format(Msg, 128, "{00FF00}You've succesfully created house {FF00FF}%i{00FF00}", HouseID);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "The maximum amount of houses has been reached");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You have to use a max-level from 1 to 10");
- }
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You can't be inside a vehicle to create a house");
- }
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command lets the player delete a house
- COMMAND:delhouse(playerid, params[])
- {
- // Setup local variables
- new file[100], Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/delhouse", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- // Make sure the player isn't inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- {
- // Loop through all player-owned houses
- for (new HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
- {
- // Check if the house exists
- if (AHouseData[HouseID][PickupID] != 0)
- {
- // Check if the house has no owner
- if (AHouseData[HouseID][Owned] == false)
- {
- // Check if the player is in range of the house-pickup
- if (IsPlayerInRangeOfPoint(playerid, 2.5, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
- {
- // Clear all data of the house
- AHouseData[HouseID][HouseName] = 0;
- AHouseData[HouseID][Insurance] = 0;
- AHouseData[HouseID][HouseX] = 0.0;
- AHouseData[HouseID][HouseY] = 0.0;
- AHouseData[HouseID][HouseZ] = 0.0;
- AHouseData[HouseID][HouseLevel] = 0;
- AHouseData[HouseID][HouseMaxLevel] = 0;
- AHouseData[HouseID][HousePrice] = 0;
- AHouseData[HouseID][Owned] = false;
- AHouseData[HouseID][Owner] = 0;
- AHouseData[HouseID][HouseName] = 0;
- AHouseData[HouseID][HouseName] = 0;
- AHouseData[HouseID][HouseName] = 0;
- // Destroy the mapicon, 3DText and pickup for the house
- DestroyDynamicPickup(AHouseData[HouseID][PickupID]);
- DestroyDynamicMapIcon(AHouseData[HouseID][MapIconID]);
- DestroyDynamic3DTextLabel(AHouseData[HouseID][DoorText]);
- AHouseData[HouseID][PickupID] = 0;
- AHouseData[HouseID][MapIconID] = 0;
- // Delete the House-file
- format(file, sizeof(file), HouseFile, HouseID); // Construct the complete filename for this house-file
- if (fexist(file)) // Make sure the file exists
- fremove(file); // Delete the file
- // Also let the player know he deleted the house
- format(Msg, 128, "{00FF00}You have deleted the house with ID: {FFFF00}%i", HouseID);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- // Exit the function
- return 1;
- }
- }
- }
- }
- // There was no house in range, so let the player know about it
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}No house in range to delete");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You can't be inside a vehicle to delete a house");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command lets the player buy a house when he's standing in range of a house that isn't owned yet
- COMMAND:buyhouse(playerid, params[])
- {
- // Setup local variables
- new Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/buyhouse", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Make sure the player isn't inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- {
- // Check if the player is near a house-pickup
- for (new i = 1; i < sizeof(AHouseData); i++)
- {
- // Check if this house is created (it would have a valid pickup in front of the door)
- if (AHouseData[i][PickupID] != 0)
- {
- // Check if the player is in range of the house-pickup
- if (IsPlayerInRangeOfPoint(playerid, 2.5, AHouseData[i][HouseX], AHouseData[i][HouseY], AHouseData[i][HouseZ]))
- {
- // Check if the house isn't owned yet
- if (AHouseData[i][Owned] == false)
- {
- // Check if the player can afford this house
- if (APlayerData[playerid][PlayerMoney] >= AHouseData[i][HousePrice])
- House_SetOwner(playerid, i); // Give ownership of the house to the player
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot afford this house"); // The player cannot afford this house
- }
- else
- {
- // Let the player know that this house is already owned by a player
- format(Msg, 128, "{FF0000}This house is already owned by {00FF00}%s{FFFFFF}", AHouseData[i][Owner]);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- // The player was in range of a house-pickup, so stop searching for the other house pickups
- return 1;
- }
- }
- }
- // All houses have been processed, but the player wasn't in range of any house-pickup, let him know about it
- SendClientMessage(playerid, 0xFF0000FF, "To buy a house, you have to be near a house-pickup");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You can't buy a house when you're inside a vehicle");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command lets the player enter the house/business if he's the owner
- COMMAND:enter(playerid, params[])
- {
- // Setup local variables
- new HouseID, hLevel, BusID, BusType;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/enter", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Make sure the player isn't inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- {
- // Loop through all houses
- for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
- {
- // Check if this house exists
- if (AHouseData[HouseID][PickupID] != 0)
- {
- // Check if the player is in range of the house-pickup
- if (IsPlayerInRangeOfPoint(playerid, 2.5, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
- {
- // Check if the house is closed to the public
- if (AHouseData[HouseID][HouseOpened] == false)
- {
- // The house isn't open to the public, so keep anyone out who isn't the owner of the house
- if (House_PlayerIsOwner(playerid, HouseID) == 0)
- {
- // Let the player know that this house isn't open to the public and he can't enter it
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}This house isn't open to the public, you can't enter it");
- return 1;
- }
- }
- // The house is open to the public, or the player trying to enter is the owner, so let the player inside the house
- // Get the level of the house
- hLevel = AHouseData[HouseID][HouseLevel];
- // Set the worldid so other players cannot see him anymore
- SetPlayerVirtualWorld(playerid, 5000 + HouseID);
- // Set the player inside the interior of the house
- SetPlayerInterior(playerid, AHouseInteriors[hLevel][InteriorID]);
- // Set the position of the player at the spawn-location of the house's interior
- SetPlayerPos(playerid, AHouseInteriors[hLevel][IntX], AHouseInteriors[hLevel][IntY], AHouseInteriors[hLevel][IntZ]);
- // Also set a tracking-variable to enable /housemenu to track in which house the player is
- APlayerData[playerid][CurrentHouse] = HouseID;
- // Also let the player know he can use /housemenu to upgrade/exit his house
- SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Use {FFFF00}/housemenu{00FF00} to change options for your house");
- // Exit the function
- return 1;
- }
- }
- }
- // Loop through all player-owned businesses
- for (new i; i < MAX_BUSINESSPERPLAYER; i++)
- {
- // Get the business-id at the selected slot from the player
- BusID = APlayerData[playerid][Business][i];
- // Check if the player has owned a business in this slot
- if (BusID != 0)
- {
- // Check if the player is in range of the business-pickup
- if (IsPlayerInRangeOfPoint(playerid, 2.5, ABusinessData[BusID][BusinessX], ABusinessData[BusID][BusinessY], ABusinessData[BusID][BusinessZ]))
- {
- // Get the business-type
- BusType = ABusinessData[BusID][BusinessType];
- // Set the worldid so other players cannot see him anymore
- SetPlayerVirtualWorld(playerid, 1000 + playerid);
- // Set the player inside the interior of the business
- SetPlayerInterior(playerid, ABusinessInteriors[BusType][InteriorID]);
- // Set the position of the player at the spawn-location of the business's interior
- SetPlayerPos(playerid, ABusinessInteriors[BusType][IntX], ABusinessInteriors[BusType][IntY], ABusinessInteriors[BusType][IntZ]);
- // Also set a tracking-variable to enable /busmenu to track in which business the player is
- APlayerData[playerid][CurrentBusiness] = BusID;
- // Also let the player know he can use /busmenu to upgrade/exit his business
- SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}Use {FFFF00}/busmenu{00FF00} to change options for your business");
- // Exit the function
- return 1;
- }
- }
- }
- }
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command opens a menu when you're inside your house to allow to access the options of your house
- COMMAND:housemenu(playerid, params[])
- {
- // Setup local variables
- new OptionsList[200], DialogTitle[200];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/housemenu", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player is inside a house
- if (APlayerData[playerid][CurrentHouse] != 0)
- {
- format(DialogTitle, sizeof(DialogTitle), "Select option for %s", AHouseData[APlayerData[playerid][CurrentHouse]][HouseName]);
- format(OptionsList, sizeof(OptionsList), "%sChange house-name\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sUpgrade house\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sBuy house-car\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sBuy house-car insurance\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sSell house-car\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sSell house\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sOpen house to the public\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sClose house to the public\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sExit house\n", OptionsList);
- // Show the housemenu
- ShowPlayerDialog(playerid, DialogHouseMenu, DIALOG_STYLE_LIST, DialogTitle, OptionsList, "Select", "Cancel");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You're not inside a house");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command allows you to port a vehicle from your house to your location
- COMMAND:getcar(playerid, params[])
- {
- // Setup local variables
- new HouseList[1000];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/getcar", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player is not jailed
- if (APlayerData[playerid][PlayerJailed] == 0)
- {
- // Check if the player is not inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- {
- // Ask to which house the player wants to add his vehicle
- for (new i; i < MAX_HOUSESPERPLAYER; i++)
- {
- // Check if this houseindex is occupied
- if (APlayerData[playerid][Houses][i] != 0)
- format(HouseList, 1000, "%s{00FF00}%s{FFFFFF}\n", HouseList, AHouseData[APlayerData[playerid][Houses][i]][HouseName]);
- else
- format(HouseList, 1000, "%s{FFFFFF}%s{FFFFFF}\n", HouseList, "Empty house-slot");
- }
- ShowPlayerDialog(playerid, DialogGetCarSelectHouse, DIALOG_STYLE_LIST, "Choose the house to get a car from:", HouseList, "Select", "Cancel");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be on-foot to port a vehicle to your location");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot use /getcar when you're in jail");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // 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
- COMMAND:park(playerid, params[])
- {
- // Setup local variables
- new Float:x, Float:y, Float:z, Float:rot, vid, HouseID, Msg[128];
- new engine,lights,alarm,doors,bonnet,boot,objective;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/park", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player is inside a vehicle (he must be the driver)
- if (GetPlayerVehicleSeat(playerid) == 0)
- {
- // Get the vehicle-id
- vid = GetPlayerVehicleID(playerid);
- // Get the HouseID to which this vehicle belongs
- HouseID = AVehicleData[vid][BelongsToHouse];
- // Check if the vehicle is owned (owner-check is not really required, as another player would get kicked out very fast)
- // AND it must belong to a house that the player owns
- if ((AVehicleData[vid][Owned] == true) && (HouseID != 0))
- {
- // Check if the vehicle is in range of the house-entrance (you cannot park a vehicle further away from your house than 150m)
- if (IsPlayerInRangeOfPoint(playerid, ParkRange, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
- {
- // Get the player's position and angle
- GetVehiclePos(vid, x, y, z);
- GetVehicleZAngle(vid, rot);
- // Save those values for the vehicle
- AVehicleData[vid][SpawnX] = x;
- AVehicleData[vid][SpawnY] = y;
- AVehicleData[vid][SpawnZ] = z;
- AVehicleData[vid][SpawnRot] = rot;
- // Find the vehicle in the player's houses
- for (new i; i < MAX_HOUSESPERPLAYER; i++)
- {
- // Get the HouseID of the current house
- HouseID = APlayerData[playerid][Houses][i];
- // Loop through all carslots of this house to find the vehicle-id
- for (new CarSlot; CarSlot < 10; CarSlot++)
- {
- // Check if this carslot holds the same vehicle-id
- if (AHouseData[HouseID][VehicleIDs][CarSlot] == vid)
- {
- House_ReplaceVehicle(HouseID, CarSlot); // Re-create the vehicle at the same spot the player wants to park his vehicle
- PutPlayerInVehicle(playerid, AHouseData[HouseID][VehicleIDs][CarSlot], 0);
- // Turn on the engine
- GetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(AHouseData[HouseID][VehicleIDs][CarSlot], 1, lights, alarm, doors, bonnet, boot, objective);
- break; // Stop the for-loop
- }
- }
- }
- // Let the player know he parked his vehicle
- SendClientMessage(playerid, 0x00FF00FF, "You've parked your vehicle");
- // Save the player-file (and his houses)
- PlayerFile_Save(playerid);
- }
- else
- {
- format(Msg, 128, "{FF0000}You need to be within %im of your house to park this vehicle", ParkRange);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot park a vehicle that's not owned by you");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You must be driving a vehicle you own to park it");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Lets the player rent a vehicle
- COMMAND:rentcar(playerid, params[])
- {
- // Setup local variables
- new VehicleClassList[1000];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/rentcar", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Make sure the player isn't inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- {
- // Check if the player is near a cardealerpickup
- for (new i; i < sizeof(ACarDealerPickups); i++)
- {
- // Check if a valid cardealerpickup is found
- if (ACarDealerPickups[i][PickupID] != 0)
- {
- // Check if the player is in range of the cardealerpickup
- if(IsPlayerInRangeOfPoint(playerid, 2.5, ACarDealerPickups[i][pux], ACarDealerPickups[i][puy], ACarDealerPickups[i][puz]))
- {
- // Let the player choose a vehicle-class
- format(VehicleClassList, 1000, "%s{00FF00}%s{FFFFFF}\n", VehicleClassList, "Bikes");
- format(VehicleClassList, 1000, "%s{40FF00}%s{FFFFFF}\n", VehicleClassList, "Boats");
- format(VehicleClassList, 1000, "%s{80FF00}%s{FFFFFF}\n", VehicleClassList, "Convertibles");
- format(VehicleClassList, 1000, "%s{B0FF00}%s{FFFFFF}\n", VehicleClassList, "Helicopters");
- format(VehicleClassList, 1000, "%s{FFFF00}%s{FFFFFF}\n", VehicleClassList, "Industrial vehicles");
- format(VehicleClassList, 1000, "%s{B0FF40}%s{FFFFFF}\n", VehicleClassList, "Low-riders");
- format(VehicleClassList, 1000, "%s{80FF80}%s{FFFFFF}\n", VehicleClassList, "Off-Road vehicles");
- format(VehicleClassList, 1000, "%s{40FFB0}%s{FFFFFF}\n", VehicleClassList, "Planes");
- format(VehicleClassList, 1000, "%s{00FFFF}%s{FFFFFF}\n", VehicleClassList, "Public Service vehicles");
- format(VehicleClassList, 1000, "%s{00B0FF}%s{FFFFFF}\n", VehicleClassList, "RC vehicles");
- format(VehicleClassList, 1000, "%s{0080FF}%s{FFFFFF}\n", VehicleClassList, "Saloon vehicles");
- format(VehicleClassList, 1000, "%s{0040FF}%s{FFFFFF}\n", VehicleClassList, "Sport vehicles");
- format(VehicleClassList, 1000, "%s{0000FF}%s{FFFFFF}\n", VehicleClassList, "Station wagons");
- format(VehicleClassList, 1000, "%s{4000FF}%s{FFFFFF}\n", VehicleClassList, "Trailers");
- format(VehicleClassList, 1000, "%s{8000FF}%s{FFFFFF}\n", VehicleClassList, "Unique vehicles");
- // Ask which vehicle class the player wants to see to buy a vehicle
- ShowPlayerDialog(playerid, DialogRentCarClass, DIALOG_STYLE_LIST, "Select vehicle class:", VehicleClassList, "Select", "Cancel");
- // Exit the function
- return 1;
- }
- }
- }
- // The player wasn't in range of a cardealer
- SendClientMessage(playerid, 0xFF0000FF, "You cannot rent a vehicle when you're not close to a cardealer");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot rent a vehicle when you're inside a car");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command teleports you to your selected house
- COMMAND:gohome(playerid, params[])
- {
- // Setup local variables
- new HouseList[1000];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/gohome", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player has a wanted level of less than 3
- if (GetPlayerWantedLevel(playerid) < 3)
- {
- // Check if the player is not jailed
- if (APlayerData[playerid][PlayerJailed] == 0)
- {
- // Check if the player is not inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- {
- // Ask to which house the player wants to add his vehicle
- for (new i; i < MAX_HOUSESPERPLAYER; i++)
- {
- // Check if this houseindex is occupied
- if (APlayerData[playerid][Houses][i] != 0)
- format(HouseList, 1000, "%s{00FF00}%s{FFFFFF}\n", HouseList, AHouseData[APlayerData[playerid][Houses][i]][HouseName]);
- else
- format(HouseList, 1000, "%s{FFFFFF}%s{FFFFFF}\n", HouseList, "Empty house-slot");
- }
- ShowPlayerDialog(playerid, DialogGoHome, DIALOG_STYLE_LIST, "Choose the house to go to:", HouseList, "Select", "Cancel");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be on-foot to port to your house");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot use /gohome when you're in jail");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /gohome when you're wanted");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Gives the player the cash he requests
- COMMAND:cash(playerid, params[])
- {
- new Amount, Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/cash", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 4
- if (APlayerData[playerid][PlayerLevel] >= 4)
- {
- if (sscanf(params, "i", Amount)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/cash <amount>\"");
- else
- {
- // Check if the player gave himself too much at once
- if (Amount > 10000000)
- {
- // Inform the player and quit the command
- SendClientMessage(playerid, 0xFF0000AA, "You cannot give yourself more than 10M at once");
- return 1;
- }
- // Reward the player (give cash and points)
- RewardPlayer(playerid, Amount, 0);
- format(Msg, 128, "You have earned $%i", Amount);
- SendClientMessage(playerid, 0x00FF00AA, Msg);
- }
- }
- else
- return 0;
- }
- else
- return 0;
- return 1;
- }
- // Gives the player the cash he requests
- COMMAND:score(playerid, params[])
- {
- new Amount, Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/score", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 4
- if (APlayerData[playerid][PlayerLevel] >= 4)
- {
- if (sscanf(params, "i", Amount)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/score <amount>\"");
- else
- {
- // Reward the player (give cash and points)
- RewardPlayer(playerid, 0, Amount);
- format(Msg, 128, "You have earned %i scorepoints", Amount);
- SendClientMessage(playerid, 0x00FF00AA, Msg);
- }
- }
- else
- return 0;
- }
- else
- return 0;
- return 1;
- }
- // Detaches the trailer from the vehicle
- COMMAND:detach(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/detach", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Detach the trailer from the vehicle
- DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
- // Send the player a message that the trailer has been detached
- SendClientMessage(playerid, 0x0000FFFF, "Your trailer is detached");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Puts the player's vehicle back onto his wheels
- COMMAND:flip(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/flip", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Setup some local variables
- new Float:x = 0.0, Float:y = 0.0, Float:z = 0.0;
- // Check if the player is inside a vehicle
- if(IsPlayerInAnyVehicle(playerid))
- SetCameraBehindPlayer(playerid);
- // Get the player's position
- GetPlayerPos(playerid, x, y, z);
- // Set the vehicle on the player's coordinates
- SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
- // Let the vehicle point north
- SetVehicleZAngle(GetPlayerVehicleID(playerid), 0.0);
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Repairs the player's vehicle
- COMMAND:repair(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/repair", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Check if the player is inside a vehicle
- if(!IsPlayerInAnyVehicle(playerid))
- 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
- // Fully repair the vehicle (damage value and bodywork)
- RepairVehicle(GetPlayerVehicleID(playerid));
- // Send the player a message to inform him that his vehicle has been repaired
- SendClientMessage(playerid, 0x00FF00FF, "Your vehicle has been successfully repaired!");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Repairs all vehicles
- COMMAND:repairall(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/repairall", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 3
- if (APlayerData[playerid][PlayerLevel] >= 3)
- {
- // Loop through all vehicles
- for (new i; i < 2000; i++)
- RepairVehicle(i); // Fully repair the vehicle (damage value and bodywork)
- // Send all players a message to inform them that all vehicles have been repaired
- SendClientMessageToAll(0x00FF00FF, "All vehicles have been successfully repaired!");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Heals all players
- COMMAND:healall(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/healall", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 3
- if (APlayerData[playerid][PlayerLevel] >= 3)
- {
- // Loop through all players
- for (new i; i < MAX_PLAYERS; i++)
- if (IsPlayerConnected(i)) // Check if the player is connected
- if (IsPlayerInAnyVehicle(i) == 0) // Check if the player isn't inside a vehicle
- SetPlayerHealth(i, 100.0); // Heal the player
- // Send all players a message to inform them that all players have been healed
- SendClientMessageToAll(0x00FF00FF, "All players have been healed!");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Kills the player
- COMMAND:kill(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/kill", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player has a wanted level of less than 3
- if (GetPlayerWantedLevel(playerid) < 3)
- {
- // Check if the player isn't in jail
- if (APlayerData[playerid][PlayerJailed] == 0)
- {
- // Force the player back into class-selection
- ForceClassSelection(playerid);
- // Kill the player (required after ForceClassSelection)
- SetPlayerHealth(playerid, 0.0);
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot use /kill when you're in jail");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /kill when you're wanted");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Lets the player choose another class
- COMMAND:reclass(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/reclass", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player has a wanted level of less than 3
- if (GetPlayerWantedLevel(playerid) < 3)
- {
- // Check if the player isn't in jail
- if (APlayerData[playerid][PlayerJailed] == 0)
- {
- // Force the player back into class-selection
- ForceClassSelection(playerid);
- // Kill the player (required after ForceClassSelection)
- SetPlayerHealth(playerid, 0.0);
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot use /reclass when you're in jail");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /reclass when you're wanted");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Starts a job
- COMMAND:work(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/work", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // First check if the player already has a job
- if (APlayerData[playerid][JobStarted] == false)
- {
- // Check the player's class
- switch (APlayerData[playerid][PlayerClass])
- {
- case ClassTruckDriver:
- {
- // Get the id of the convoy (if the player is in a convoy)
- new Convoy = APlayerData[playerid][ConvoyID];
- // Check if the player is part of a convoy AND is not the leader
- if ((APlayerData[playerid][InConvoy] == true) && (AConvoys[Convoy][Members][0] != playerid))
- {
- // Let the player know he's not the leader of his convoy and cannot start a job
- SendClientMessage(playerid, 0xFF0000FF, "You're not the leader of your convoy, you cannot start a job");
- // Exit the function
- return 1;
- }
- // A convoy-leader proceeds here, and also a normal player (no convoy-member)
- // Check if the player is the driver of a vehicle
- if (GetPlayerVehicleSeat(playerid) == 0)
- {
- // Check if the player is inside a valid trucking vehicle
- switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
- {
- case VehicleFlatbed, VehicleDFT30, VehicleCementTruck: // Flatbed, DFT-30, CementTruck
- if (APlayerData[playerid][TruckerLicense] == 1) // Check if the player has acquired a truckers license
- ShowPlayerDialog(playerid, DialogTruckerJobMethod, DIALOG_STYLE_LIST, "Select method:", "Setup your own load and route\r\nAuto assigned load", "Select", "Cancel");
- else
- Trucker_StartRandomJob(playerid); // Start a random job
- case VehicleLineRunner, VehicleTanker, VehicleRoadTrain: // Player is driving a truck which needs a trailer
- if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid))) // Check if there is a trailer attached
- if (APlayerData[playerid][TruckerLicense] == 1) // Check if the player has acquired a truckers license
- ShowPlayerDialog(playerid, DialogTruckerJobMethod, DIALOG_STYLE_LIST, "Select method:", "Setup your own load and route\r\nAuto assigned load", "Select", "Cancel");
- else
- Trucker_StartRandomJob(playerid); // Start a random job
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need a trailer to start a job");
- default: SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a trucking vehicle to start a job");
- }
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a trucking vehicle to start a job");
- }
- case ClassBusDriver:
- {
- // Check if the player is the driver of a vehicle
- if (GetPlayerVehicleSeat(playerid) == 0)
- if (GetVehicleModel(GetPlayerVehicleID(playerid)) == VehicleCoach) // Check if the player is inside a valid busdriver vehicle
- if (APlayerData[playerid][BusLicense] == 1) // Check if the player has acquired a busdriver license
- ShowPlayerDialog(playerid, DialogBusJobMethod, DIALOG_STYLE_LIST, "Select method:", "Choose your own busroute\r\nAuto assigned busroute", "Select", "Cancel");
- else
- BusDriver_StartJob(playerid, random(sizeof(ABusRoutes))); // Start a random job
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a bus to start a job");
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a bus to start a job");
- }
- case ClassPilot:
- {
- // Check if the player is the driver of a vehicle
- if (GetPlayerVehicleSeat(playerid) == 0)
- {
- // Check if the player is inside a valid piloting vehicle
- switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
- {
- case VehicleShamal, VehicleNevada, VehicleMaverick, VehicleCargobob: // Plane (Shamal), Plane (Nevada), helicopter (Maverick)
- Pilot_StartRandomJob(playerid); // Start a random piloting job
- default: SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a piloting vehicle to start a job");
- }
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a piloting vehicle to start a job");
- }
- case ClassMafia:
- {
- // Check if the player is the driver of a vehicle
- if (GetPlayerVehicleSeat(playerid) == 0)
- {
- // Check if the player is inside a valid piloting vehicle
- switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
- {
- case VehicleSandKing, VehicleMoonbeam: // Sangking, Moonbeam
- Mafia_StartRandomJob(playerid); // Start a random mafia job
- default: SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a mafia vehicle to start a job");
- }
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a mafia vehicle to start a job");
- }
- case ClassCourier:
- {
- // Check if the player is the driver of a vehicle
- if (GetPlayerVehicleSeat(playerid) == 0)
- {
- // Check if the player is inside a valid courier vehicle
- switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
- {
- case VehicleBurrito, VehicleFaggio, VehicleBenson: // Van (Burrito), bike (Faggio)
- Courier_StartJob(playerid); // Start a random courier job
- default: SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a courier vehicle to start a job");
- }
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a courier vehicle to start a job");
- }
- case ClassRoadWorker:
- {
- // Check if the player is the driver of a vehicle
- if (GetPlayerVehicleSeat(playerid) == 0)
- {
- // Check if the player is inside a valid courier vehicle
- switch (GetVehicleModel(GetPlayerVehicleID(playerid)))
- {
- case VehicleUtilityVan, VehicleTowTruck: // Utility Van, Towtruck
- Roadworker_StartRandomJob(playerid); // Start a random roadworker job
- default: SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a roadworker vehicle to start a job");
- }
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be the driver of a roadworker vehicle to start a job");
- }
- default: SendClientMessage(playerid, 0xFF0000FF, "Your class cannot do any jobs");
- }
- }
- else // Send a message to let the player know he already has a job
- SendClientMessage(playerid, 0xFF0000FF, "You're already doing a job");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Stops the current job
- COMMAND:stopwork(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/stopwork", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player has a job started
- if (APlayerData[playerid][JobStarted] == true)
- {
- // Check the class of the player
- switch (APlayerData[playerid][PlayerClass])
- {
- case ClassTruckDriver: Trucker_EndJob(playerid); // Stop any trucker job
- case ClassBusDriver: BusDriver_EndJob(playerid); // Stop any busdriver job
- case ClassPilot: Pilot_EndJob(playerid); // Stop any pilot job
- case ClassMafia: Mafia_EndJob(playerid); // Stop any mafia job
- case ClassCourier: Courier_EndJob(playerid);
- case ClassRoadWorker: Roadworker_EndJob(playerid);
- default: SendClientMessage(playerid, 0xFF0000FF, "Your class has no job to end");
- }
- // Inform the player that he failed the mission
- GameTextForPlayer(playerid, "~w~You ~r~failed~w~ your mission. You lost ~y~$1000~w~ to cover expenses.", 5000, 4);
- // Reduce the player's cash by 1000
- RewardPlayer(playerid, -1000, 0);
- }
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Displays the player's coordinates on the map
- COMMAND:loc(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/loc", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 3
- if (APlayerData[playerid][PlayerLevel] >= 3)
- {
- // Setup some local variables
- new Message[200], Float:x, Float:y, Float:z, Float:rot, Interior, World;
- // Get the player's position
- GetPlayerPos(playerid, x, y, z);
- // Check if the player is on foot or in a vehicle
- if (GetPlayerVehicleSeat(playerid) == -1)
- GetPlayerFacingAngle(playerid, rot); // Get the player's angle
- else
- GetVehicleZAngle(GetPlayerVehicleID(playerid), rot);
- // Get the interior where the player is located
- Interior = GetPlayerInterior(playerid);
- // Get the virtual world of the player
- World = GetPlayerVirtualWorld(playerid);
- // combine the position and angle into a proper message
- 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);
- // Send the message with the coordinates and the angle of the player
- SendClientMessage(playerid, 0xFF0000AA, Message);
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Saves the location into a file
- COMMAND:saveloc(playerid, params[])
- {
- new File:LocFile, LineForFile[255], LineMsg[255];
- new Float:x, Float:y, Float:z, LocName[255], ID;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/saveloc", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- if (sscanf(params, "is[255]", ID, LocName)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/saveloc <ID> <LocationName>\"");
- else
- {
- if (!fexist("ServerData/Locations.txt"))
- {
- LocFile = fopen("ServerData/Locations.txt", io_write); // Create the file
- fclose(LocFile); // Close the file
- }
- // Get the player's position
- GetPlayerPos(playerid, x, y, z);
- // Combine all the data in a proper structure, so it can be used directly for setting up the ALocations array
- format(LineForFile, sizeof(LineForFile), "\t{\"%s\", %4.2f, %4.2f, %4.2f}, // ID = %i", LocName, x, y, z, ID);
- LocFile = fopen("ServerData/Locations.txt", io_append); // Open the locationfile for appending data to it
- fwrite(LocFile, LineForFile); // Append the data to the end of the file
- fwrite(LocFile, "\r\n"); // Start a new line, or all the data is saved in one line
- fclose(LocFile); // Close the file
- // Let the player know what data has been saved
- format(LineMsg, 255, "Data has been saved: %s", LineForFile);
- SendClientMessage(playerid, 0x808080FF, LineMsg);
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Lets the player choose where he wants to respawn (costs $200)
- COMMAND:rescue(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/rescue", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player has a wanted level of less than 3
- if (GetPlayerWantedLevel(playerid) < 3)
- {
- // Check if the player isn't in jail
- if (APlayerData[playerid][PlayerJailed] == 0)
- {
- if (APlayerData[playerid][JobStarted] == false)
- {
- // Make sure you can't use "/rescue" when you're inside a vehicle (doesn't respawn you at the requested coords
- // and puts a random item (bottle, sigarette, ...) in the player's hands
- if (GetPlayerVehicleID(playerid) == 0)
- {
- // Create a dialog based on the player's class
- switch (APlayerData[playerid][PlayerClass])
- {
- case ClassTruckDriver: // Ask where the trucker player wants to respawn
- 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");
- case ClassBusDriver: // Ask where the busdriver wants to respawn
- ShowPlayerDialog(playerid, DialogRescue, DIALOG_STYLE_LIST, "Choose busdriver spawn point:", "Los Santos\r\nSan Fierro\r\nLas Venturas", "Spawn", "Cancel");
- case ClassPilot: // Ask where the pilot wants to respawn
- ShowPlayerDialog(playerid, DialogRescue, DIALOG_STYLE_LIST, "Choose pilot spawn point:", "Los Santos\r\nSan Fierro\r\nLas Venturas", "Spawn", "Cancel");
- case ClassPolice: // Ask where the police player wants to respawn
- ShowPlayerDialog(playerid, DialogRescue, DIALOG_STYLE_LIST, "Choose police spawn point:", "Los Santos\r\nSan Fierro\r\nLas Venturas", "Spawn", "Cancel");
- case ClassCourier: // Ask where the courier player wants to respawn
- ShowPlayerDialog(playerid, DialogRescue, DIALOG_STYLE_LIST, "Choose courier spawn point:", "Los Santos\r\nSan Fierro\r\nLas Venturas", "Spawn", "Cancel");
- }
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot use '/rescue' when you're inside a vehicle"); // "/rescue" doesn't work inside a vehicle
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot use rescue when doing a job"); // "/rescue" doesn't work during a job
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot use /rescue when you're in jail");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /rescue when you're wanted");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Increases the player's wanted level by 1
- COMMAND:wanted(playerid, params[])
- {
- new OtherPlayer, Stars;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/wanted", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 2
- if (APlayerData[playerid][PlayerLevel] >= 2)
- {
- if (sscanf(params, "ui", OtherPlayer, Stars)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/wanted <OtherPlayer> <Stars>\"");
- else
- if (IsPlayerConnected(OtherPlayer)) // If the player is a valid playerid (he's connected)
- SetPlayerWantedLevel(OtherPlayer, Stars);
- else
- SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Lets the player choose a motorcycle to spawn
- COMMAND:bike(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/bike", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Make sure the player isn't inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- {
- // Ask which motorcycle the player wants to have
- 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");
- // Let the server know that this was a valid command
- return 1;
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Lets the player choose a car to spawn (in a split list which shows only 10 cars at a time)
- COMMAND:car(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/car", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Make sure the player isn't inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- CarList_Create(playerid); // Create a list of cars (only the first 10 cars) and show the dialog so the player can choose a car
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Lets the player choose a plane to spawn (in a split list which shows only 10 planes at a time)
- COMMAND:plane(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/plane", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Make sure the player isn't inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- PlaneList_Create(playerid); // Create a list of planes (only the first 10 planes) and show the dialog so the player can choose a plane
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Lets the player choose a trailer to spawn (in a split list which shows only 10 trailers at a time)
- COMMAND:trailer(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/trailer", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Make sure the player isn't inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- TrailerList_Create(playerid); // Create a list of trailers (only the first 10 trailers) and show the dialog so the player can choose a trailer
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Lets the player choose a boat to spawn
- COMMAND:boat(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/boat", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Make sure the player isn't inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- {
- // Ask which motorcycle the player wants to have
- ShowPlayerDialog(playerid, DialogBoat, DIALOG_STYLE_LIST, "Choose a boat:", "Coastguard\nDinghy\nJetmax\nLaunch\nMarquis\nPredator\nReefer\nSpeeder\nSquallo\nTropic", "Spawn", "Cancel");
- // Let the server know that this was a valid command
- return 1;
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Jail a player
- COMMAND:jail(playerid, params[])
- {
- new PlayerToJail, JailTime, Reason[128], Msg[128], Name[24], AdminName[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/jail", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- if (sscanf(params, "uis[128]", PlayerToJail, JailTime, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/jail <PlayerToJail> <JailTime> <Reason>\"");
- else
- if (IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)
- {
- // Jail the player
- Police_JailPlayer(PlayerToJail, JailTime);
- // Get the name of the player who jailed the player
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- // Get the name of the player who's being sent to jail
- GetPlayerName(PlayerToJail, Name, sizeof(Name));
- // Send the jailed player a message who jailed him, why he's been jailed and how long
- format(Msg, 128, "You have been jailed by %s %s for %i seconds", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime);
- SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
- format(Msg, 128, "Reason: %s", Reason);
- SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
- format(Msg, 128, "{00FF00}You have jailed {FFFF00}%s{00FF00} for {FFFF00}%i{00FF00} seconds", Name, JailTime);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Warn a player
- COMMAND:warn(playerid, params[])
- {
- new PlayerToWarn, Reason[128], ReasonMsg[128], Name[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/warn", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- if (sscanf(params, "us[128]", PlayerToWarn, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/warn <PlayerToWarn> <Reason>\"");
- else
- if (IsPlayerConnected(PlayerToWarn)) // If the player is a valid playerid (he's connected)
- {
- // Increase the number of warnings
- APlayerData[PlayerToWarn][Warnings]++;
- // Get the name of the player who warned the player
- GetPlayerName(playerid, Name, sizeof(Name));
- // Send the warned player a message who warned him and why he's been warned
- format(ReasonMsg, 128, "You have been warned by %s %s", AdminLevelName[APlayerData[playerid][PlayerLevel]], Name);
- SendClientMessage(PlayerToWarn, 0xFF0000FF, ReasonMsg);
- format(ReasonMsg, 128, "Reason: %s", Reason);
- SendClientMessage(PlayerToWarn, 0xFF0000FF, ReasonMsg);
- format(ReasonMsg, 128, "~w~Warning %i/%i: ~r~%s~w~", APlayerData[PlayerToWarn][Warnings], AutoKickWarnings, Reason);
- GameTextForPlayer(PlayerToWarn, ReasonMsg, 5000, 4);
- // Get the name of the warned player
- GetPlayerName(PlayerToWarn, Name, sizeof(Name));
- // Let the admin know who has been warned and why
- format(ReasonMsg, 128, "You have warned %s (warnings: %i/%i)", Name, APlayerData[PlayerToWarn][Warnings], AutoKickWarnings);
- SendClientMessage(playerid, 0x00FF00FF, ReasonMsg);
- format(ReasonMsg, 128, "Reason: %s", Reason);
- SendClientMessage(playerid, 0xFF0000FF, ReasonMsg);
- // Automatically kick the player if he got 3 warnings (if autokick is enabled)
- if ((APlayerData[PlayerToWarn][Warnings] == AutoKickWarnings) && (AutoKickAfterWarn == 1))
- Kick(PlayerToWarn);
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Kicks a player with a reason
- COMMAND:kick(playerid, params[])
- {
- new PlayerToKick, Reason[128], ReasonMsg[128], Name[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/kick", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- if (sscanf(params, "us[128]", PlayerToKick, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/kick <PlayerToKick> <Reason>\"");
- else
- if (IsPlayerConnected(PlayerToKick)) // If the player is a valid playerid (he's connected)
- {
- // Get the name of the player who warned the player
- GetPlayerName(playerid, Name, sizeof(Name));
- // Send the warned player a message who kicked him and why he's been kicked
- format(ReasonMsg, 128, "You have been kicked by %s %s", AdminLevelName[APlayerData[playerid][PlayerLevel]], Name);
- SendClientMessage(PlayerToKick, 0xFF0000FF, ReasonMsg);
- format(ReasonMsg, 128, "Reason: %s", Reason);
- SendClientMessage(PlayerToKick, 0xFF0000FF, ReasonMsg);
- // Kick the player
- Kick(PlayerToKick);
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Bans a player for (days, hours, minutes, seconds)
- COMMAND:ban(playerid, params[])
- {
- // Setup local variables
- new PlayerToBan, Days, Hours, Reason[128], TotalBanTime, Msg[128], Name[24], AdminName[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/ban", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 3
- if (APlayerData[playerid][PlayerLevel] >= 3)
- {
- if (sscanf(params, "uiis[128]", PlayerToBan, Days, Hours, Reason))
- SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/ban <PlayerToBan> <Days> <Hours> <Reason>\"");
- else
- {
- if (IsPlayerConnected(PlayerToBan))
- {
- // Get the names of the player and the admin who executed the ban
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- GetPlayerName(PlayerToBan, Name, sizeof(Name));
- // Increase the number of bans
- APlayerData[PlayerToBan][Bans]++;
- // Calculate the total bantime (when the player can login again)
- TotalBanTime = (Days * 86400) + (Hours * 3600) + gettime();
- // Check if this is the player's 5th ban
- if (APlayerData[PlayerToBan][Bans] == 5)
- APlayerData[PlayerToBan][BanTime] = 2147483640; // Make the ban permanent (as high as it can go)
- else
- APlayerData[PlayerToBan][BanTime] = TotalBanTime; // Store this value for the player
- // Inform the player about his ban
- // Check if this is the player's 5th ban
- if (APlayerData[PlayerToBan][Bans] == 5)
- {
- format(Msg, 128, "You have been banned permanently by %s, this was your 5th ban", AdminName);
- SendClientMessage(PlayerToBan, 0x808080FF, Msg);
- }
- else
- {
- format(Msg, 128, "You have been banned by %s for %i days and %i hours", AdminName, Days, Hours);
- SendClientMessage(PlayerToBan, 0x808080FF, Msg);
- format(Msg, 128, "Reason: %s", Reason);
- SendClientMessage(PlayerToBan, 0x808080FF, Msg);
- format(Msg, 128, "You've been banned %i times now, 5th time is permament", APlayerData[PlayerToBan][Bans]);
- SendClientMessage(PlayerToBan, 0x808080FF, Msg);
- }
- // Kick the player (his data will be saved)
- Kick(PlayerToBan);
- // Inform everybody else which player was banned and for how long
- format(Msg, 128, "%s %s has banned %s for %i days and %i hours", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name, Days, Hours);
- SendClientMessageToAll(0x808080FF, Msg);
- }
- }
- }
- else
- return 0;
- }
- else
- return 0;
- return 1;
- }
- // Unbans a player (cleares the ban-time)
- COMMAND:unban(playerid, params[])
- {
- // Setup local variables
- new PlayerToUnban[24], Msg[128], Name[24];
- new file[100], File:PFile, LineForFile[100];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/unban", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 3
- if (APlayerData[playerid][PlayerLevel] >= 3)
- {
- if (sscanf(params, "s[128]", PlayerToUnban))
- SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/unban <PlayerToUnban>\"");
- else
- {
- // Get the name of the admin
- GetPlayerName(playerid, Name, sizeof(Name));
- // Construct the complete filename for this player's account
- format(file, sizeof(file), PlayerFile, PlayerToUnban);
- // Check if the file exists
- if (fexist(file))
- {
- PFile = fopen(file, io_append); // Open the playerfile for appending (this command only appends a new line to overwrite the bantime)
- format(LineForFile, 100, "BanTime 0\r\n"); // Construct the line: "BanTime <0>"
- fwrite(PFile, LineForFile); // And save it to the file
- fclose(PFile); // Close the file
- // Inform everybody else which player was unbanned
- format(Msg, 128, "%s %s has un-banned %s", AdminLevelName[APlayerData[playerid][PlayerLevel]], Name, PlayerToUnban);
- SendClientMessageToAll(0x808080FF, Msg);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}There is no account with that playername");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- return 1;
- }
- // Spawns the object at the location given by the player
- COMMAND:object(playerid, params[])
- {
- // Setup local variables
- new ObjectModel, ObjID, Msg[128], Float:x, Float:y, Float:z, Float:Angle;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/object", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- if (sscanf(params, "iffff", ObjectModel, x, y, z, Angle)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/object <ObjectModel> <x> <y> <z> <Angle>\"");
- else
- {
- // Spawn the object 5 units north of the player
- ObjID = CreateObject(ObjectModel, x, y, z, 0.0, 0.0, Angle, 250.0);
- // Inform the player about it
- 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);
- SendClientMessage(playerid, 0x00FF00FF, Msg);
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Spawns the pickup at the location given by the player
- COMMAND:pickup(playerid, params[])
- {
- // Setup local variables
- new PickupModel, PickID, Msg[128], Float:x, Float:y, Float:z, PickupType;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/pickup", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- if (sscanf(params, "ifffi", PickupModel, x, y, z, PickupType)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/pickup <PickupModel> <x> <y> <z> <PickupType>\"");
- else
- {
- // Spawn the pickup
- PickID = CreatePickup(PickupModel, PickupType, x, y, z, -1);
- // Inform the player about it
- 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);
- SendClientMessage(playerid, 0x00FF00FF, Msg);
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Spawns the vehicle at the location given by the player
- COMMAND:vehicle(playerid, params[])
- {
- // Setup local variables
- new VehicleModel, vID, Msg[128], Float:x, Float:y, Float:z, Float:Angle, SpawnDelay;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/vehicle", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- if (sscanf(params, "iffffi", VehicleModel, x, y, z, Angle, SpawnDelay)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/vehicle <VehicleModel> <x> <y> <z> <Angle> <SpawnDelay>\"");
- else
- {
- // Spawn the vehicle at the location specified by the player (also set max-fuel and save the model for the vehicle)
- vID = Vehicle_Create(VehicleModel, x, y, z, Angle, random(126), random(126), SpawnDelay);
- // Inform the player about it
- 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);
- SendClientMessage(playerid, 0x00FF00FF, Msg);
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Deletes the given vehicle from the game
- COMMAND:delvehicle(playerid, params[])
- {
- // Setup local variables
- new vID, Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/delvehicle", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- if (sscanf(params, "i", vID)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/delvehicle <VehicleID>\"");
- else
- {
- // Destroy the given vehicle
- DestroyVehicle(vID);
- // Inform the player about it
- format(Msg, 128, "You deleted vehicle-id %i", vID);
- SendClientMessage(playerid, 0x00FF00FF, Msg);
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Deletes the given vehicle from the game
- COMMAND:delobject(playerid, params[])
- {
- // Setup local variables
- new oID, Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/delobject", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- if (sscanf(params, "i", oID)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/delobject <ObjectID>\"");
- else
- {
- // Destroy the given vehicle
- DestroyObject(oID);
- // Inform the player about it
- format(Msg, 128, "You deleted object-id %i", oID);
- SendClientMessage(playerid, 0x00FF00FF, Msg);
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Ports the player to the given coordinates
- COMMAND:portloc(playerid, params[])
- {
- // Setup local variables
- new Float:x, Float:y, Float:z, PortMsg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/portloc", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Check if the player has a wanted level of less than 3
- if (GetPlayerWantedLevel(playerid) < 3)
- {
- // Check if the player is not jailed
- if (APlayerData[playerid][PlayerJailed] == 0)
- {
- if (sscanf(params, "fff", x, y, z)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/portloc <x> <y> <z>\"");
- else
- {
- // Port the player to the given location
- SetPlayerPos(playerid, x, y, z);
- // Let the player know about it
- format(PortMsg, 128, "You have been ported to location: %4.2f, %4.2f, %4.2f", x, y, z);
- SendClientMessage(playerid, 0x00FF00FF, PortMsg);
- }
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /portloc when you're in jail");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /portloc when you're wanted");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Ports the player to the given player
- COMMAND:port(playerid, params[])
- {
- // Setup local variables
- new OtherPlayer, Float:x, Float:y, Float:z, PortMsg[128], IntID, WorldID;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/port", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Check if the player has a wanted level of less than 3
- if (GetPlayerWantedLevel(playerid) < 3)
- {
- // Check if the player is not jailed
- if (APlayerData[playerid][PlayerJailed] == 0)
- {
- if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/port <OtherPlayer>\"");
- else
- {
- // Check if that other player is online
- if (IsPlayerConnected(OtherPlayer))
- {
- // Get the location of the other player
- GetPlayerPos(OtherPlayer, x, y, z);
- IntID = GetPlayerInterior(OtherPlayer);
- WorldID = GetPlayerVirtualWorld(OtherPlayer);
- // Port the player to the given location
- SetPlayerVirtualWorld(playerid, WorldID);
- SetPlayerInterior(playerid, IntID);
- SetPlayerPos(playerid, x, y, z + 3.0);
- // Let the player know about it
- format(PortMsg, 128, "You have been ported to location: %4.2f, %4.2f, %4.2f", x, y, z + 3.0);
- SendClientMessage(playerid, 0x00FF00FF, PortMsg);
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
- }
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /port when you're in jail");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /port when you're wanted");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Ports one player to another player
- COMMAND:tele(playerid, params[])
- {
- // Setup local variables
- new Player1, Player2, Float:x, Float:y, Float:z, PortMsg[128], IntID, WorldID, Name[24], AdminName[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/tele", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- if (sscanf(params, "uu", Player1, Player2)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/tele <PlayerToPort> <TargetPlayer>\"");
- else
- {
- // Check if player1 is online
- if (APlayerData[Player1][LoggedIn] == true)
- {
- // Check if player2 is online
- if (APlayerData[Player2][LoggedIn] == true)
- {
- // Get the name of the admin and the second player
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- GetPlayerName(Player2, Name, sizeof(Name));
- // Get the location of the second player
- GetPlayerPos(Player2, x, y, z);
- IntID = GetPlayerInterior(Player2);
- WorldID = GetPlayerVirtualWorld(Player2);
- // Port the first player to player2's location
- SetPlayerVirtualWorld(Player1, WorldID);
- SetPlayerInterior(Player1, IntID);
- SetPlayerPos(Player1, x, y, z + 3.0);
- // Let the first player know he's been ported
- format(PortMsg, 128, "{00FF00}You have been ported to player {FFFF00}%s{00FF00} by {FFFF00}%s", Name, AdminName);
- SendClientMessage(Player1, 0xFFFFFFFF, PortMsg);
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "Player2 isn't online");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "Player1 isn't online");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Ports the player to the given vehicle
- COMMAND:portvehicle(playerid, params[])
- {
- // Setup local variables
- new Car, Float:x, Float:y, Float:z, PortMsg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/portvehicle", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Check if the player has a wanted level of less than 3
- if (GetPlayerWantedLevel(playerid) < 3)
- {
- // Check if the player is not jailed
- if (APlayerData[playerid][PlayerJailed] == 0)
- {
- if (sscanf(params, "i", Car)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/portvehicle <CarID>\"");
- else
- {
- // Get the location of the car
- GetVehiclePos(Car, x, y, z);
- // Port the player to the given location
- SetPlayerPos(playerid, x, y, z + 3.0);
- // Let the player know about it
- format(PortMsg, 128, "You have been ported to location: %4.2f, %4.2f, %4.2f", x, y, z + 3.0);
- SendClientMessage(playerid, 0x00FF00FF, PortMsg);
- }
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /portvehicle when you're in jail");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /portvehicle when you're wanted");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Sets the admin-level of another player
- COMMAND:setlevel(playerid, params[])
- {
- // Setup local variables
- new OtherPlayer, Level, Msg[128], Name[24], AdminName[24], OldLevel;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/setlevel", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- if (sscanf(params, "ui", OtherPlayer, Level)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/setlevel <OtherPlayer> <AdminLevel>\"");
- else
- {
- // Check if that other player is online
- if (IsPlayerConnected(OtherPlayer))
- {
- // Get the old level of the other player
- OldLevel = APlayerData[OtherPlayer][PlayerLevel];
- // Get the playername of the admin
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- // Also get the name of the player that has been promoted
- GetPlayerName(OtherPlayer, Name, sizeof(Name));
- // Store the level of the player
- APlayerData[OtherPlayer][PlayerLevel] = Level;
- // Let all players know about it
- if (OldLevel != Level)
- {
- // Check if the player has been promoted or demoted
- if (OldLevel < Level)
- format(Msg, 128, "Player %s has been promoted to %s by %s", Name, AdminLevelName[Level], AdminName);
- if (OldLevel > Level)
- format(Msg, 128, "Player %s has been demoted to %s by %s", Name, AdminLevelName[Level], AdminName);
- SendClientMessageToAll(0x00FF00FF, Msg);
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "Other player's level hasn't been changed");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Refuel the player's vehicle
- COMMAND:fuel(playerid, params[])
- {
- // Setup local variables
- new vID;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/fuel", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Check if the player is inside a vehicle
- if (IsPlayerInAnyVehicle(playerid))
- {
- // Get the vehicleid
- vID = GetPlayerVehicleID(playerid);
- // Refuel the vehicle
- AVehicleData[vID][Fuel] = MaxFuel;
- // Let the player know about it
- SendClientMessage(playerid, 0x00FF00FF, "Your vehicle is refuelled");
- }
- else
- SendClientMessage(playerid, 0x00FF00FF, "You're not driving a vehicle");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Let the player use a jetpack
- COMMAND:fly(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/fly", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 3
- if (APlayerData[playerid][PlayerLevel] >= 3)
- {
- // Equip the player with a jetpack
- SetPlayerSpecialAction(playerid, 2);
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Paints a car with a paintjob
- COMMAND:paint(playerid, params[])
- {
- // Setup local variables
- new paintjobid, vid;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/paint", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player is the driver of the vehicle
- if (GetPlayerVehicleSeat(playerid) == 0)
- {
- if (sscanf(params, "i", paintjobid)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/paint <paintjobid (0-2)>\"");
- else
- {
- // Check if the player entered a correct paintjob-id
- if ((paintjobid >= 0) && (paintjobid <= 2))
- {
- // Get the vehicle-id
- vid = GetPlayerVehicleID(playerid);
- // Check if the player is the owner of the vehicle
- if (AVehicleData[vid][Owned] == true)
- {
- // Change the paintjob of the player's vehicle
- ChangeVehiclePaintjob(vid, paintjobid);
- // Also save the paintjob for the vehicle
- AVehicleData[vid][PaintJob] = paintjobid + 1;
- // Also set the vehiclecolor to 1 (white), so the paintjob has it's full color
- ChangeVehicleColor(vid, 1, 1);
- // Also save the colors for the vehicle
- AVehicleData[vid][Color1] = 1;
- AVehicleData[vid][Color2] = 1;
- // Let the player pay for the paintjob
- RewardPlayer(playerid, -500, 0);
- // Inform the player about it
- SendClientMessage(playerid, 0x00FF00FF, "You repainted your vehicle for $500");
- // Save the player-file (along with the houses and businesses)
- PlayerFile_Save(playerid);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "You're not the owner of the vehicle");
- }
- else
- SendClientMessage(playerid, 0xFF0000AA, "You need to enter a paintjob-id from 0 to 2");
- }
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You must be inside a vehicle you own to apply a paintjob");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Re-colors the given vehicle (lets you choose the first color)
- COMMAND:color1(playerid, params[])
- {
- // Setup local variables
- new ColorList[1000];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/color1", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player is the driver of the vehicle
- if (GetPlayerVehicleSeat(playerid) == 0)
- {
- // Check if the player is the owner of the vehicle
- if (AVehicleData[GetPlayerVehicleID(playerid)][Owned] == true)
- {
- // Construct the colorlist
- format(ColorList, sizeof(ColorList), "%s{FFFFFF}%s\n", ColorList, "Black (removes paintjob)"); // Color 0
- format(ColorList, sizeof(ColorList), "%s{FFFFFF}%s\n", ColorList, "White"); // Color 1
- for (new i = 2; i < sizeof(AVehicleColors); i++)
- format(ColorList, sizeof(ColorList), "%s%s%s\n", ColorList, AVehicleColors[i], "CarColor");
- // Show the dialog with all the colors
- ShowPlayerDialog(playerid, DialogPrimaryCarColor, DIALOG_STYLE_LIST, "Choose a primary color:", ColorList, "Select", "Cancel");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You're not the owner of the vehicle");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You must be inside a vehicle to apply a color");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Re-colors the given vehicle (lets you choose the first color)
- COMMAND:color2(playerid, params[])
- {
- // Setup local variables
- new ColorList[1000];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/color2", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player is the driver of the vehicle
- if (GetPlayerVehicleSeat(playerid) == 0)
- {
- // Check if the player is the owner of the vehicle
- if (AVehicleData[GetPlayerVehicleID(playerid)][Owned] == true)
- {
- // Construct the colorlist
- format(ColorList, sizeof(ColorList), "%s{FFFFFF}%s\n", ColorList, "Black"); // Color 0
- format(ColorList, sizeof(ColorList), "%s{FFFFFF}%s\n", ColorList, "White"); // Color 1
- for (new i = 2; i < sizeof(AVehicleColors); i++)
- format(ColorList, sizeof(ColorList), "%s%s%s\n", ColorList, AVehicleColors[i], "CarColor");
- // Show the dialog with all the colors
- ShowPlayerDialog(playerid, DialogSedundaryCarColor, DIALOG_STYLE_LIST, "Choose a secundary color:", ColorList, "Select", "Cancel");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You're not the owner of the vehicle");
- }
- else
- SendClientMessage(playerid, 0x00FF00FF, "You must be inside a vehicle to apply a color");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Starts or stops the engine of your vehicle
- COMMAND:engine(playerid, params[])
- {
- // Setup local variables
- new vehicleid, engine,lights,alarm,doors,bonnet,boot,objective;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/engine", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Get the player's vehicle
- vehicleid = GetPlayerVehicleID(playerid);
- // Get the current status of the vehicle
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- // Check if the player is inside a vehicle
- if (vehicleid != 0)
- {
- if (sscanf(params, "i", engine)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/engine <EngineStatus (0/1)>\"");
- else
- {
- // Set the engine to the value that was passed by the player and leave all other parameters alone
- SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- }
- }
- else
- SendClientMessage(playerid, 0x00FF00FF, "You must be inside a vehicle to toggle your engine");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Sets your numberplate
- COMMAND:plate(playerid, params[])
- {
- // Setup local variables
- new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective, Plate[32];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/plate", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 3
- if (APlayerData[playerid][PlayerLevel] >= 3)
- {
- // Get the player's vehicle
- vehicleid = GetPlayerVehicleID(playerid);
- if (vehicleid != 0)
- {
- if (sscanf(params, "s[32]", Plate)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/plate <NumberPlate>\"");
- else
- {
- // Set the numberplate
- SetVehicleNumberPlate(vehicleid, Plate);
- // Remove the player from the vehicle
- RemovePlayerFromVehicle(playerid);
- // Respawn the vehicle
- SetVehicleToRespawn(vehicleid);
- // Put the player back in the vehicle
- PutPlayerInVehicle(playerid, vehicleid, 0);
- // Turn on the engine and lights the current status of the vehicle
- GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
- SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
- }
- }
- else
- SendClientMessage(playerid, 0x00FF00FF, "You must be inside a vehicle to change your numberplate");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Asks which vehicle parameter you wanna toggle
- COMMAND:caroption(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/caroption", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 3
- if (APlayerData[playerid][PlayerLevel] >= 3)
- {
- // Let the player select a weather-type
- ShowPlayerDialog(playerid, DialogCarOption, DIALOG_STYLE_LIST, "Select option for your vehicle:", "Engine\nLights\nAlarm\nDoors\nBonnet\nBoot\nObjective", "Toggle", "Cancel");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Sets the global weather
- COMMAND:weather(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/weather", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 4
- if (APlayerData[playerid][PlayerLevel] >= 4)
- {
- // Let the player select a weather-type
- 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");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command lists all online admins
- COMMAND:admins(playerid, params[])
- {
- // Setup local variables
- new AdminList[500], Name[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/admins", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Scan through all players
- for (new i; i < MAX_PLAYERS; i++)
- {
- // Check if this player is connected
- if (IsPlayerConnected(i))
- {
- // Get the name of the player
- GetPlayerName(i, Name, sizeof(Name));
- // Check if this player is an RCON admin
- if (IsPlayerAdmin(i))
- {
- // Add all admin players to the list
- 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
- // Re-start the for loop (skipping the remaining code for this iteration)
- continue;
- }
- //Check if that player is an admin (using the PlayerLevel)
- if (APlayerData[i][PlayerLevel] > 0)
- {
- // Add all admin players to the list
- 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
- }
- }
- }
- // Check if there were admin-names added to the list
- if (strlen(AdminList) > 0)
- ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Online admins:", AdminList, "OK", "Cancel");
- else
- SendClientMessage(playerid, 0xFF0000FF, "No admin online"); // No admins are online
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command lists all commands for normal players (admin-level 0)
- COMMAND:cmds(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/cmds", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- CommandList_Create(playerid); // Create a list of commands (only the first 4 commands) and show the dialog
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- COMMAND:convoy(playerid, params[])
- {
- // Setup local variables
- new ConvoyList[750], Name[24], NumMembers, ConvoyStatus[10];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/convoy", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Create the list of convoys with all their data
- for (new i; i < MAX_CONVOYS; i++)
- {
- // Check if this is an empty convoy (not created yet by a player)
- if (AConvoys[i][Status] == CONVOY_EMPTY)
- {
- // Setup data for an empty convoy (one which hasn't been chosen yet)
- NumMembers = 0;
- format(Name, 24, "None");
- format(ConvoyStatus, 10, "Empty");
- }
- else
- {
- // Get the name of the convoy-leader
- GetPlayerName(AConvoys[i][Members][0], Name, sizeof(Name));
- // Calculate the members in the convoy
- NumMembers = Convoy_CountMembers(i);
- // Set the status of the convoy
- switch (AConvoys[i][Status])
- {
- case CONVOY_OPEN: format(ConvoyStatus, 10, "Open");
- case CONVOY_FULL: format(ConvoyStatus, 10, "Full");
- case CONVOY_CLOSED: format(ConvoyStatus, 10, "Closed");
- }
- }
- // Put all data together to form the content of the entire dialog
- format(ConvoyList, sizeof(ConvoyList), "%sLeader: {00FF00}%s{FFFFFF}, members: {FF0000}%i{FFFFFF}, Status: {00FF00}%s{FFFFFF}\n", ConvoyList, Name, NumMembers, ConvoyStatus);
- }
- // Show the dialog
- ShowPlayerDialog(playerid, DialogSelectConvoy, DIALOG_STYLE_LIST, "Select convoy:", ConvoyList, "Select", "Cancel");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Allows the leader to kick a member from the convoy
- COMMAND:convoykick(playerid, params[])
- {
- // Setup local variables
- new Convoy, LeaderID, OtherPlayer, LeaderName[24], MemberName[24], Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/convoykick", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- Convoy = APlayerData[playerid][ConvoyID]; // Get the convoy of the player
- LeaderID = AConvoys[Convoy][Members][0]; // Get the leader of his convoy
- // Check if this player is part of a convoy
- if (APlayerData[playerid][InConvoy] == true)
- {
- // Check if this player is the leader of the convoy
- if (LeaderID == playerid)
- {
- if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/convoykick <OtherPlayerID>\"");
- else
- {
- // Check if that other player is part of the convoy
- if ((APlayerData[OtherPlayer][InConvoy] == true) && (APlayerData[OtherPlayer][ConvoyID] == Convoy))
- {
- // Kick the other player from the convoy
- Convoy_Leave(OtherPlayer);
- // Get the names of the leader and member
- GetPlayerName(playerid, LeaderName, sizeof(LeaderName));
- GetPlayerName(OtherPlayer, MemberName, sizeof(MemberName));
- // Inform the leader that he has kicked the other player
- format(Msg, 128, "You've kicked {0000FF}%s{00FF00} from the convoy", MemberName);
- SendClientMessage(playerid, 0x00FF00FF, Msg);
- // Inform the leader that he has kicked the other player
- format(Msg, 128, "Leader {0000FF}%s{00FF00} kicked you from the convoy", LeaderName);
- SendClientMessage(OtherPlayer, 0x00FF00FF, Msg);
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot kick a player that's not part of your convoy");
- }
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be the leader of a convoy to kick another convoy-member");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be the leader of a convoy to kick another convoy-member");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Allows a convoy-member to leave the convoy
- COMMAND:convoyleave(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/convoyleave", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if this player is part of a convoy
- if (APlayerData[playerid][InConvoy] == true)
- {
- // Kick the other player from the convoy
- Convoy_Leave(playerid);
- // Inform the player that he left the convoy
- SendClientMessage(playerid, 0x00FF00FF, "You left the convoy");
- }
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Allows the leader to cancel a convoy
- COMMAND:convoycancel(playerid, params[])
- {
- // Setup local variables
- new Convoy, LeaderID;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/convoycancel", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- Convoy = APlayerData[playerid][ConvoyID]; // Get the convoy of the player
- LeaderID = AConvoys[Convoy][Members][0]; // Get the leader of his convoy
- // Check if this player is part of a convoy
- if (APlayerData[playerid][InConvoy] == true)
- {
- // Check if this player is the leader of the convoy
- if (LeaderID == playerid)
- Convoy_Cancel(Convoy); // Cancel the convoy, kicking every other member from it
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be the leader of a convoy to cancel it");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be the leader of a convoy to cancel it");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Displays all members in the convoy
- COMMAND:convoymembers(playerid, params[])
- {
- // Setup local variables
- new Name[24], MemberList[1000], Convoy;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/convoymembers", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the member is in a convoy
- if (APlayerData[playerid][InConvoy] == true)
- {
- // Get the convoyID of the member
- Convoy = APlayerData[playerid][ConvoyID];
- // Loop through all members
- for (new i; i < CONVOY_MAX_MEMBERS; i++)
- {
- if (AConvoys[Convoy][Members][i] != -1) // Check if this member-spot is occupied
- {
- // Get the name of the member
- GetPlayerName(AConvoys[Convoy][Members][i], Name, sizeof(Name));
- // Add the membernames to the list
- format(MemberList, 1000, "%s%s\n", MemberList, Name);
- }
- }
- // Show the dialog
- ShowPlayerDialog(playerid, DialogConvoyMembers, DIALOG_STYLE_LIST, "Convoy-members", MemberList, "OK", "Cancel");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You're not a member of a convoy");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Displays the statictics of the player
- COMMAND:stats(playerid, params[])
- {
- // Setup local variables
- new StatsMsg[1000], Name[24], TitleMsg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/stats", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Construct the stats
- format(StatsMsg, 1000, "Kilometers driven: {00FF00}%f{FFFFFF}\n", (APlayerData[playerid][StatsMetersDriven] / 1000));
- format(StatsMsg, 1000, "%sFinished trucker jobs: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsTruckerJobs]);
- format(StatsMsg, 1000, "%sFinished convoy jobs: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsConvoyJobs]);
- format(StatsMsg, 1000, "%sFinished busdriver routes: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsBusDriverJobs]);
- format(StatsMsg, 1000, "%sFinished pilot jobs: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsPilotJobs]);
- format(StatsMsg, 1000, "%sFinished courier jobs: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsCourierJobs]);
- format(StatsMsg, 1000, "%sFinished roadworker jobs: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsRoadworkerJobs]);
- format(StatsMsg, 1000, "%sFixed vehicles for assistance: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsAssistance]);
- format(StatsMsg, 1000, "%sFinished mafia jobs: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsMafiaJobs]);
- format(StatsMsg, 1000, "%sDelivered stolen mafia-loads: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsMafiaStolen]);
- format(StatsMsg, 1000, "%sFined players: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsPoliceFined]);
- format(StatsMsg, 1000, "%sJailed players: {00FF00}%i{FFFFFF}\n", StatsMsg, APlayerData[playerid][StatsPoliceJailed]);
- // Get the player's name
- GetPlayerName(playerid, Name, sizeof(Name));
- // Construct the title for the dialog
- format(TitleMsg, 128, "Statistics for %s:", Name);
- // Show the dialog
- ShowPlayerDialog(playerid, DialogStats, DIALOG_STYLE_LIST, TitleMsg, StatsMsg, "OK", "Cancel");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Restarts the server
- COMMAND:restart(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/restart", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- // Let everyone know that the server will be restarted in 2 minutes
- GameTextForAll("Server restart in 2 minutes!", 5000, 3);
- SendClientMessageToAll(0xA0A0A0, "Server restart in 2 minutes!");
- // Start the next timer which warns the players again that server will be restarted in 1 minute
- SetTimer("Timer_Restart_WarnPlayers", 1000 * 60, false);
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- forward Timer_Restart_WarnPlayers();
- public Timer_Restart_WarnPlayers()
- {
- // Let everyone know that the server will be restarted in 1 minutes
- GameTextForAll("Server restart in 1 minute!", 5000, 3);
- SendClientMessageToAll(0xA0A0A0, "Server restart in 1 minutes!");
- // Start the next timer
- SetTimer("Timer_Restart_Kick", 1000 * 60, false);
- // Change the hostname of the server and it's password
- SendRconCommand("hostname Pending Restart");
- SendRconCommand("password loafkagakggoagka");
- return 1;
- }
- forward Timer_Restart_Kick();
- public Timer_Restart_Kick()
- {
- // Let everyone know that the server is kicking all players before restarting
- GameTextForAll("Server restarting:Kicking all players!", 5000, 3);
- // Kick all players
- for(new i; i < MAX_PLAYERS; i++)
- Kick(i);
- // Start the next timer that will restart the server
- SetTimer("Timer_Restart_Reboot", 1000 * 5, false);
- return 1;
- }
- forward Timer_Restart_Reboot();
- public Timer_Restart_Reboot()
- {
- new HostCommand[128];
- // Restart the server
- SendRconCommand("gmx");
- // Change the hostname and password again
- format(HostCommand, 128, "hostname %s", GameModeName);
- SendRconCommand(HostCommand);
- SendRconCommand("password 0");
- return 1;
- }
- // This command allows you to create a speedcamera
- COMMAND:createcamera(playerid, params[])
- {
- // Setup local variables
- new Float:x, Float:y, Float:z, Float:Angle, MaxSpeed, file[100], File:PFile, LineForFile[100], Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/createcamera", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- if (sscanf(params, "i", MaxSpeed)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/createcamera <max_speed>\"");
- else
- {
- // Get player's position and facing angle
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, Angle);
- z = z - 1.0; // Adjust camera Z-coordinate 1m lower than normal (otherwise the camera floats in the air)
- // Move the player a bit, otherwise he could get stuck inside the camera-object
- SetPlayerPos(playerid, x, y + 1.0, z + 1.0);
- // Save the camera to a file
- for (new CamID; CamID < MAX_CAMERAS; CamID++)
- {
- // Check if this index is free
- if (ACameras[CamID][CamSpeed] == 0)
- {
- // Setup this camera (create the objects and store the data)
- SetupSpeedCamera(CamID, x, y, z, Angle, MaxSpeed);
- // Save the file
- format(file, sizeof(file), CameraFile, CamID); // Construct the complete filename for this camera-file
- PFile = fopen(file, io_write); // Open the camera-file for writing
- format(LineForFile, 100, "CamX %f\r\n", x);
- fwrite(PFile, LineForFile); // And save it to the file
- format(LineForFile, 100, "CamY %f\r\n", y);
- fwrite(PFile, LineForFile); // And save it to the file
- format(LineForFile, 100, "CamZ %f\r\n", z);
- fwrite(PFile, LineForFile); // And save it to the file
- format(LineForFile, 100, "CamAngle %f\r\n", Angle);
- fwrite(PFile, LineForFile); // And save it to the file
- format(LineForFile, 100, "CamSpeed %i\r\n", MaxSpeed);
- fwrite(PFile, LineForFile); // And save it to the file
- fclose(PFile); // Close the file
- // Let the player know he created a new camera
- format(Msg, 128, "You've created a speed-camera with ID: %i", CamID);
- SendClientMessage(playerid, 0x00FF00FF, Msg);
- // Exit the function
- return 1;
- }
- }
- // In case all camera-slots are occupied (100 camera's have been created already), let the player know about it
- format(Msg, 128, "{FF0000}You cannot create more than %i speedcamera's", MAX_CAMERAS);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command allows you to delete a speedcamera
- COMMAND:delcamera(playerid, params[])
- {
- // Setup local variables
- new file[100], Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/delcamera", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- // Loop through all camera's
- for (new CamID; CamID < MAX_CAMERAS; CamID++)
- {
- // Check if this index is used
- if (ACameras[CamID][CamSpeed] != 0)
- {
- // Check if the player is in range of the camera
- if (IsPlayerInRangeOfPoint(playerid, 5.0, ACameras[CamID][CamX], ACameras[CamID][CamY], ACameras[CamID][CamZ]))
- {
- // Delete the file
- format(file, sizeof(file), CameraFile, CamID); // Construct the complete filename for this camera-file
- if (fexist(file)) // Make sure the file exists
- fremove(file); // Delete the file
- // Delete both camera objects
- DestroyObject(ACameras[CamID][CamObj1]);
- DestroyObject(ACameras[CamID][CamObj2]);
- // Also clear the data from memory
- ACameras[CamID][CamX] = 0.0;
- ACameras[CamID][CamY] = 0.0;
- ACameras[CamID][CamZ] = 0.0;
- ACameras[CamID][CamAngle] = 0.0;
- ACameras[CamID][CamSpeed] = 0;
- ACameras[CamID][CamObj1] = 0;
- ACameras[CamID][CamObj2] = 0;
- // Let the player know he deleted a camera
- format(Msg, 128, "You've deleted speed-camera %i", CamID);
- SendClientMessage(playerid, 0x00FF00FF, Msg);
- // Exit the function
- return 1;
- }
- }
- }
- // In case the player wasn't near a speedcamera, inform him about it
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You must be near a speedcamera to delete it");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command ports a player to the player who executed the command
- COMMAND:get(playerid, params[])
- {
- // Setup local variables
- new OtherPlayer, Float:x, Float:y, Float:z, PortMsg[128], IntID, WorldID, Name[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/get", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/get <OtherPlayer>\"");
- else
- {
- // Check if that other player is online
- if (IsPlayerConnected(OtherPlayer))
- {
- // Get the name of the other player
- GetPlayerName(OtherPlayer, Name, sizeof(Name));
- // Get the location of the player
- GetPlayerPos(playerid, x, y, z);
- IntID = GetPlayerInterior(playerid);
- WorldID = GetPlayerVirtualWorld(playerid);
- // Port the other player to this player
- SetPlayerVirtualWorld(OtherPlayer, WorldID);
- SetPlayerInterior(OtherPlayer, IntID);
- SetPlayerPos(OtherPlayer, x, y, z + 3.0);
- // Let the player know about it
- format(PortMsg, 128, "{00FF00}You have ported {FFFF00}%s{00FF00} to your location", Name);
- SendClientMessage(playerid, 0xFFFFFFFF, PortMsg);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command deleted all vehicles that are spawned using /car, /plane, /bike, /trailer
- COMMAND:cleanupcars(playerid, params[])
- {
- // Setup local variables
- new CarsDeleted, Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/cleanupcars", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 3
- if (APlayerData[playerid][PlayerLevel] >= 3)
- {
- // Loop through all vehicles
- for (new vid; vid < 2000; vid++)
- {
- // Check if this vehicle exists (check the model), otherwise all empty slots are processed as well
- if (AVehicleData[vid][Model] != 0)
- {
- // Check if the vehicle is NOT a static vehicle
- if (AVehicleData[vid][StaticVehicle] == false)
- {
- // Check if the vehicle is NOT owned by anybody (this leaves all vehicles spawned with /car, /trailer, /plane)
- if (AVehicleData[vid][Owned] == false)
- {
- // Count the cars that have been deleted
- CarsDeleted++;
- // Delete the vehicle and clear the data
- DestroyVehicle(vid);
- AVehicleData[vid][Owned] = false;
- AVehicleData[vid][Owner] = 0;
- AVehicleData[vid][Model] = 0;
- AVehicleData[vid][PaintJob] = 0;
- for (new i; i < 14; i++)
- AVehicleData[vid][Components][i] = 0;
- AVehicleData[vid][SpawnX] = 0.0;
- AVehicleData[vid][SpawnY] = 0.0;
- AVehicleData[vid][SpawnZ] = 0.0;
- AVehicleData[vid][SpawnRot] = 0.0;
- AVehicleData[vid][BelongsToHouse] = 0;
- }
- }
- }
- }
- // Let the player know how many vehicles have been cleaned up
- format(Msg, 128, "{00FF00}Total number of vehicles cleaned up: {FFFF00}%i", CarsDeleted);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command allows the player to call for assistance
- COMMAND:assist(playerid, params[])
- {
- // Setup local variables
- new bool:AssistOnline = false, Msg[128], Name[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/assist", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Get the player's name
- GetPlayerName(playerid, Name, sizeof(Name));
- // Preset the message that needs to be sent to assistance players
- format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} needs assistance, go help him", Name);
- // Check if there is at least one assistance player online
- for (new i; i < MAX_PLAYERS; i++)
- {
- // Check if this player is connected
- if (IsPlayerConnected(i))
- {
- // Check if this player is assistance class
- if (APlayerData[i][PlayerClass] == ClassAssistance)
- {
- // Set the flag to indicate that at least one assistance player is online
- AssistOnline = true;
- // Send the assistance player a message to inform him who needs assistance
- SendClientMessage(i, 0xFFFFFFFF, Msg);
- }
- }
- }
- // Check if there is at least one assistance player online
- if (AssistOnline == true)
- {
- // Set yourself as "AssistanceNeeded"
- APlayerData[playerid][AssistanceNeeded] = true;
- // Let the player know he called for assistance
- SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}You've called for assistance");
- }
- else // No assistance is online
- {
- // Check if the player is the driver of a vehicle
- if (GetPlayerVehicleSeat(playerid) == 0)
- {
- // Fully repair the vehicle (damage value and bodywork)
- RepairVehicle(GetPlayerVehicleID(playerid));
- // Also re-fuel the vehicle
- AVehicleData[GetPlayerVehicleID(playerid)][Fuel] = MaxFuel;
- // Let the player pay for the repairs and refuel (default $2000)
- RewardPlayer(playerid, -2000, 0);
- // Let the player know he spent $2000 for auto-repair because there were no assistance players online
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Your vehicle has been auto-repaired and refuelled for $2000");
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}because there is no assistance player online");
- }
- }
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command adds nitro to the player's vehicle
- COMMAND:nos(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/nos", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Check if the player is the driver of a vehicle
- if (GetPlayerVehicleSeat(playerid) == 0)
- {
- // Check if the vehicle isn't owned (owned vehicle's need to buy nitro at mod garages)
- if (AVehicleData[GetPlayerVehicleID(playerid)][Owned] == false)
- AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); // Add nitro to the player's vehicle
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command let's an admin spectate another player
- COMMAND:spec(playerid, params[])
- {
- // Setup local variables
- new OtherPlayer, Name[24], Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/spec", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/spec <OtherPlayer>\"");
- else
- {
- // Check if that other player is online
- if (IsPlayerConnected(OtherPlayer))
- {
- // Get the player's name
- GetPlayerName(OtherPlayer, Name, sizeof(Name));
- // Turn spectating on
- TogglePlayerSpectating(playerid, 1);
- // Check if the other player is driving a vehicle
- if (GetPlayerVehicleSeat(OtherPlayer) == -1)
- {
- // The other player is on foot, so spectate him
- PlayerSpectatePlayer(playerid, OtherPlayer);
- SetPlayerInterior(playerid, GetPlayerInterior(OtherPlayer));
- APlayerData[playerid][SpectateID] = OtherPlayer;
- APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_PLAYER;
- }
- else
- {
- // The other player is in a vehicle, so spectate the vehicle
- PlayerSpectateVehicle(playerid, GetPlayerVehicleID(OtherPlayer));
- APlayerData[playerid][SpectateID] = OtherPlayer;
- APlayerData[playerid][SpectateVehicle] = GetPlayerVehicleID(OtherPlayer);
- APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_VEHICLE;
- }
- format(Msg, 128, "{00FF00}You're spectating {FFFF00}%s", Name);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command ends the spectate mode
- COMMAND:endspec(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/endspec", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Check if the player is spectating
- if (GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
- {
- TogglePlayerSpectating(playerid, 0);
- APlayerData[playerid][SpectateID] = -1;
- APlayerData[playerid][SpectateVehicle] = -1;
- APlayerData[playerid][SpectateType] = ADMIN_SPEC_TYPE_NONE;
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You are not spectating");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Lets the player add new businesses
- COMMAND:createbusiness(playerid, params[])
- {
- // Setup local variables
- new BusinessList[2000];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/createbusiness", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- // Check if the player isn't inside a vehicle
- if (GetPlayerVehicleSeat(playerid) == -1)
- {
- // Construct the list of businesses
- for (new BusType = 1; BusType < sizeof(ABusinessInteriors); BusType++)
- {
- format(BusinessList, sizeof(BusinessList), "%s%s\n", BusinessList, ABusinessInteriors[BusType][InteriorName]);
- }
- // Let the player choose a business-type via a dialog
- ShowPlayerDialog(playerid, DialogCreateBusSelType, DIALOG_STYLE_LIST, "Choose business-type:", BusinessList, "Select", "Cancel");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You can't be inside a vehicle to create a business");
- }
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command lets the player delete a business
- COMMAND:delbusiness(playerid, params[])
- {
- // Setup local variables
- new file[100], Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/delbusiness", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- // Make sure the player isn't inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- {
- // Loop through all player-owned businesses
- for (new BusID = 1; BusID < MAX_BUSINESS; BusID++)
- {
- // Check if the business exists
- if (ABusinessData[BusID][PickupID] != 0)
- {
- // Check if the business has no owner
- if (ABusinessData[BusID][Owned] == false)
- {
- // Check if the player is in range of the business-pickup
- if (IsPlayerInRangeOfPoint(playerid, 2.5, ABusinessData[BusID][BusinessX], ABusinessData[BusID][BusinessY], ABusinessData[BusID][BusinessZ]))
- {
- // Clear all data of the business
- ABusinessData[BusID][BusinessName] = 0;
- ABusinessData[BusID][BusinessX] = 0.0;
- ABusinessData[BusID][BusinessY] = 0.0;
- ABusinessData[BusID][BusinessZ] = 0.0;
- ABusinessData[BusID][BusinessType] = 0;
- ABusinessData[BusID][BusinessLevel] = 0;
- ABusinessData[BusID][LastTransaction] = 0;
- ABusinessData[BusID][Owned] = false;
- ABusinessData[BusID][Owner] = 0;
- // Destroy the mapicon, 3DText and pickup for the house
- DestroyDynamicPickup(ABusinessData[BusID][PickupID]);
- DestroyDynamicMapIcon(ABusinessData[BusID][MapIconID]);
- DestroyDynamic3DTextLabel(ABusinessData[BusID][DoorText]);
- ABusinessData[BusID][PickupID] = 0;
- ABusinessData[BusID][MapIconID] = 0;
- // Delete the business-file
- format(file, sizeof(file), BusinessFile, BusID); // Construct the complete filename for this business-file
- if (fexist(file)) // Make sure the file exists
- fremove(file); // Delete the file
- // Also let the player know he deleted the business
- format(Msg, 128, "{00FF00}You have deleted the business with ID: {FFFF00}%i", BusID);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- // Exit the function
- return 1;
- }
- }
- }
- }
- // There was no house in range, so let the player know about it
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}No business in range to delete");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You can't be inside a vehicle to delete a business");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command lets the player buy a business when he's standing in range of a business that isn't owned yet
- COMMAND:buybus(playerid, params[])
- {
- // Setup local variables
- new Msg[128], BusType;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/buybus", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Make sure the player isn't inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- {
- // Check if the player is near a business-pickup
- for (new i = 1; i < sizeof(ABusinessData); i++)
- {
- // Check if this business is created (it would have a valid pickup in front of the door)
- if (ABusinessData[i][PickupID] != 0)
- {
- // Check if the player is in range of the business-pickup
- if (IsPlayerInRangeOfPoint(playerid, 2.5, ABusinessData[i][BusinessX], ABusinessData[i][BusinessY], ABusinessData[i][BusinessZ]))
- {
- // Check if the business isn't owned yet
- if (ABusinessData[i][Owned] == false)
- {
- // Get the type of business
- BusType = ABusinessData[i][BusinessType];
- // Check if the player can afford this type of business business
- if (APlayerData[playerid][PlayerMoney] >= ABusinessInteriors[BusType][BusPrice])
- Business_SetOwner(playerid, i); // Give ownership of the business to the player
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot afford this business"); // The player cannot afford this business
- }
- else
- {
- // Let the player know that this business is already owned by a player
- format(Msg, 128, "{FF0000}This business is already owned by {00FF00}%s{FFFFFF}", ABusinessData[i][Owner]);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- // The player was in range of a business-pickup, so stop searching for the other business pickups
- return 1;
- }
- }
- else
- return 1; // If there are no more houses (no more pickup-id's found), stop searching
- }
- // All businesses have been processed, but the player wasn't in range of any business-pickup, let him know about it
- SendClientMessage(playerid, 0xFF0000FF, "To buy a business, you have to be near a business-pickup");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You can't buy a business when you're inside a vehicle");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command opens a menu when you're inside your business to allow to access the options of your business
- COMMAND:busmenu(playerid, params[])
- {
- // Setup local variables
- new OptionsList[200], DialogTitle[200];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/busmenu", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player is inside a business
- if (APlayerData[playerid][CurrentBusiness] != 0)
- {
- format(DialogTitle, sizeof(DialogTitle), "Select option for %s", ABusinessData[APlayerData[playerid][CurrentBusiness]][BusinessName]);
- format(OptionsList, sizeof(OptionsList), "%sChange business-name\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sUpgrade business\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sRetrieve business earnings\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sSell business\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sExit business\n", OptionsList);
- // Show the businessmenu
- ShowPlayerDialog(playerid, DialogBusinessMenu, DIALOG_STYLE_LIST, DialogTitle, OptionsList, "Select", "Cancel");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You're not inside a business");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command teleports you to your selected business
- COMMAND:gobus(playerid, params[])
- {
- // Setup local variables
- new BusinessList[1000], BusID, BusType, Earnings;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/gobus", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player is not jailed
- if (APlayerData[playerid][PlayerJailed] == 0)
- {
- // Check if the player has a wanted level of less than 3
- if (GetPlayerWantedLevel(playerid) < 3)
- {
- // Check if the player is not inside a vehicle
- if (GetPlayerVehicleID(playerid) == 0)
- {
- // Ask to which business the player wants to port
- for (new i; i < MAX_BUSINESSPERPLAYER; i++)
- {
- // Get the business-id
- BusID = APlayerData[playerid][Business][i];
- // Check if this businessindex is occupied
- if (BusID != 0)
- {
- // Get the business-type
- BusType = ABusinessData[BusID][BusinessType];
- Earnings = (BusinessTransactionTime - ABusinessData[BusID][LastTransaction]) * ABusinessInteriors[BusType][BusEarnings] * ABusinessData[BusID][BusinessLevel];
- format(BusinessList, 1000, "%s{00FF00}%s{FFFFFF} (earnings: $%i)\n", BusinessList, ABusinessData[BusID][BusinessName], Earnings);
- }
- else
- format(BusinessList, 1000, "%s{FFFFFF}%s{FFFFFF}\n", BusinessList, "Empty business-slot");
- }
- ShowPlayerDialog(playerid, DialogGoBusiness, DIALOG_STYLE_LIST, "Choose the business to go to:", BusinessList, "Select", "Cancel");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You need to be on-foot to port to your business");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You cannot use /gobus when you're wanted");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You cannot use /gobus when you're in jail");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Mutes a player (he cannot talk anymore)
- COMMAND:mute(playerid, params[])
- {
- // Setup local variables
- new Msg[128], Name[24], AdminName[24], Reason[128], OtherPlayer;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/mute", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- if (sscanf(params, "us[128]", OtherPlayer, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/mute <OtherPlayer> <Reason>\"");
- else
- {
- // Check if the otherplayer is online
- if (IsPlayerConnected(OtherPlayer))
- {
- // Get the player-names
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- GetPlayerName(OtherPlayer, Name, sizeof(Name));
- // Mute the other player
- APlayerData[OtherPlayer][Muted] = true;
- // Let the other player know that he has been muted
- format(Msg, 128, "{FF0000}You have been muted by {FFFF00}%s {FF0000}for {FFFF00}%s", AdminName, Reason);
- SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
- // Let the admin know who he has muted
- format(Msg, 128, "{00FF00}You have muted {FFFF00}%s", Name);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- // Save the player-stats
- PlayerFile_Save(OtherPlayer);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Un-mutes a player (he cannot talk anymore)
- COMMAND:unmute(playerid, params[])
- {
- // Setup local variables
- new Msg[128], Name[24], AdminName[24], OtherPlayer;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/unmute", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/unmute <OtherPlayer>\"");
- else
- {
- // Check if the otherplayer is online
- if (IsPlayerConnected(OtherPlayer))
- {
- // Get the player-names
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- GetPlayerName(OtherPlayer, Name, sizeof(Name));
- // Un-mute the other player
- APlayerData[OtherPlayer][Muted] = false;
- // Let the other player know that he has been un-muted
- format(Msg, 128, "{FF0000}You have been un-muted by {FFFF00}%s", AdminName);
- SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
- // Let the admin know who he has un-muted
- format(Msg, 128, "{00FF00}You have un-muted {FFFF00}%s", Name);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- // Save the player-stats
- PlayerFile_Save(OtherPlayer);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Let's the admins see which players are still muted
- COMMAND:mutes(playerid, params[])
- {
- // Setup local variables
- new PlayerList[1000], Name[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/mutes", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Loop through all players
- for (new i; i < MAX_PLAYERS; i++)
- {
- // Check if that player is online
- if (IsPlayerConnected(i))
- {
- if (APlayerData[i][Muted] == true)
- {
- // Get the player's name
- GetPlayerName(i, Name, sizeof(Name));
- // Add his name and ID to the list
- format(PlayerList, sizeof(PlayerList), "%s%s (ID: %i)\n", PlayerList, Name, i);
- }
- }
- }
- // Show the list of muted players to the admin
- if (strlen(PlayerList) != 0)
- ShowPlayerDialog(playerid, DialogNoResponse, DIALOG_STYLE_LIST, "Muted players:", PlayerList, "OK", "Cancel");
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}There are no muted players");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Freeze a player (he cannot move anymore)
- COMMAND:freeze(playerid, params[])
- {
- // Setup local variables
- new Msg[128], Name[24], AdminName[24], Reason[128], OtherPlayer, Duration;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/freeze", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- if (sscanf(params, "uis[128]", OtherPlayer, Duration, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/freeze <OtherPlayer> <Duration> <Reason>\"");
- else
- {
- // Check if the otherplayer is online
- if (IsPlayerConnected(OtherPlayer))
- {
- // Get the player-names
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- GetPlayerName(OtherPlayer, Name, sizeof(Name));
- // Store the duration for the freeze, freeze him and start the frozentimer
- APlayerData[OtherPlayer][PlayerFrozen] = Duration;
- TogglePlayerControllable(OtherPlayer, 0);
- SetTimerEx("Player_FreezeTimer", 1000, true, "i", OtherPlayer);
- // Let the other player know that he has been muted
- format(Msg, 128, "{FF0000}You have been frozen by {FFFF00}%s {FF0000}for {FFFF00}%s", AdminName, Reason);
- SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
- // Let the admin know who he has muted
- format(Msg, 128, "{00FF00}You have frozen {FFFF00}%s", Name);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- // Save the player-stats
- PlayerFile_Save(OtherPlayer);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Transfer money to another player
- COMMAND:givecash(playerid, params[])
- {
- // Setup local variables
- new Msg[128], Name[24], OtherName[24], OtherPlayer, Money;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/givecash", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- if (sscanf(params, "ui", OtherPlayer, Money)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/givecash <OtherPlayer> <Money>\"");
- else
- {
- // Check if the otherplayer is online
- if (IsPlayerConnected(OtherPlayer))
- {
- // Get the player-names
- GetPlayerName(playerid, Name, sizeof(Name));
- GetPlayerName(OtherPlayer, OtherName, sizeof(OtherName));
- // Check if the money has a positive value (to prevent stealing money using negative values)
- if (Money > 0)
- {
- // Check if the player has enough money
- if (APlayerData[playerid][PlayerMoney] >= Money)
- {
- // Transfer the money
- RewardPlayer(playerid, -Money, 0);
- RewardPlayer(OtherPlayer, Money, 0);
- // Let the other player know that he has received money
- format(Msg, 128, "{00FF00}You have received {FFFF00}$%i{00FF00} from {FFFF00}%s", Money, Name);
- SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
- // Let the player know he gave money to somebody else
- format(Msg, 128, "{00FF00}You gave {FFFF00}$%i{00FF00} to {FFFF00}%s", Money, OtherName);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- // Save the player-stats
- PlayerFile_Save(playerid);
- PlayerFile_Save(OtherPlayer);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You don't have enough money");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You must use values higher than 0");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
- }
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Respawns the given vehicle
- COMMAND:respawn(playerid, params[])
- {
- // Setup local variables
- new vid, Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/respawn", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- if (sscanf(params, "i", vid)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/respawn <Vehicle-id>\"");
- else
- {
- // Check if the vehicle-id is valid
- if ((vid > 0) && (vid < 2000))
- {
- // Check if the vehicle exists
- if (AVehicleData[vid][Model] != 0)
- {
- // Force the vehicle to respawn
- SetVehicleToRespawn(vid);
- // Let the player know he respawned the vehicle
- format(Msg, 128, "{00FF00}You've respawned vehicle {FFFF00}%i", vid);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You have to use a vehicle-id between 1 and 1999");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Creates a spikestrip (can only be used by police players)
- COMMAND:spike(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/spike", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player if a police player
- if (APlayerData[playerid][PlayerClass] == ClassPolice)
- {
- // Check if the player is on foot
- if (GetPlayerVehicleSeat(playerid) == -1)
- {
- // Try to create a spikestrip
- SpikeStrip_Create(playerid);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You must be on foot to place a spikestrip");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command ejects a player from his vehicle
- COMMAND:eject(playerid, params[])
- {
- // Setup local variables
- new Name[24], AdminName[24], Msg[128], OtherPlayer;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/eject", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 2
- if (APlayerData[playerid][PlayerLevel] >= 2)
- {
- if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/eject <OtherPlayer>\"");
- else
- {
- // Check if the player is logged in
- if (APlayerData[OtherPlayer][LoggedIn] == true)
- {
- // Check if the other player is driving a vehicle
- if (GetPlayerVehicleSeat(OtherPlayer) != -1)
- {
- // Get the names of the players
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- GetPlayerName(OtherPlayer, Name, sizeof(Name));
- // Eject the player from the vehicle
- RemovePlayerFromVehicle(OtherPlayer);
- // Let the player know he's been ejected from his vehicle
- format(Msg, 128, "{FF0000}You've been ejected from your vehicle by {FFFF00}%s", AdminName);
- SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
- // Inform the admin that he ejected the player
- format(Msg, 128, "{00FF00}You've ejected {FFFF00}%s{00FF00} from his vehicle", Name);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't inside a vehicle");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't connected");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command lets you talk only to players of the same class
- COMMAND:say(playerid, params[])
- {
- // Setup local variables
- new Name[24], Msg[128], Message[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/say", params);
- // Get the player's name
- GetPlayerName(playerid, Name, sizeof(Name));
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- if (sscanf(params, "s[128]", Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/say <Your Message>\"");
- else
- {
- // Loop through all players
- for (new i; i < MAX_PLAYERS; i++)
- {
- // Check if the player is logged in
- if (APlayerData[i][LoggedIn] == true)
- {
- // Check if the other player has the same class
- if (APlayerData[i][PlayerClass] == APlayerData[playerid][PlayerClass])
- {
- format(Msg, 128, "{B0B0B0}%s said: {FFFFFF}%s", Name, Message);
- SendClientMessage(i, 0xFFFFFFFF, Msg);
- }
- }
- }
- }
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command lets you talk only to admin players
- COMMAND:asay(playerid, params[])
- {
- // Setup local variables
- new Name[24], Msg[128], Message[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/asay", params);
- // Get the player's name
- GetPlayerName(playerid, Name, sizeof(Name));
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player is an admin
- if (APlayerData[playerid][PlayerLevel] > 0)
- {
- if (sscanf(params, "s[128]", Message)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/asay <Your Message>\"");
- else
- {
- // Loop through all players
- for (new i; i < MAX_PLAYERS; i++)
- {
- // Check if the player is logged in
- if (APlayerData[i][LoggedIn] == true)
- {
- // Check if the other player is also an admin
- if (APlayerData[i][PlayerLevel] > 0)
- {
- format(Msg, 128, "{B0B0B0}%s said: {FFFFFF}%s", Name, Message);
- SendClientMessage(i, 0xFFFFFFFF, Msg);
- }
- }
- }
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Clamp an owned vehicle (remove it completely)
- COMMAND:clamp(playerid, params[])
- {
- // Setup local variables
- new vid, Reason[128], HouseID, HouseOwner, Name[24], AdminName[24], Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/clamp", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- if (sscanf(params, "is[128]", vid, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/clamp <vehicleid> <reason>\"");
- else
- {
- // Get the HouseID to which this vehicle belongs
- HouseID = AVehicleData[vid][BelongsToHouse];
- // Check if the vehicle belongs to a house
- if (HouseID != 0)
- {
- //Also set the new location of the vehicle inside the KACC Military fuels hangar
- AVehicleData[vid][SpawnX] = 2585.0;
- AVehicleData[vid][SpawnY] = 2829.0;
- AVehicleData[vid][SpawnZ] = 10.9;
- AVehicleData[vid][SpawnRot] = 0.0;
- // Search all the players to see who owns the house
- for (new i; i < MAX_PLAYERS; i++)
- {
- // Loop through all the houses this player owns
- for(new j; j < MAX_HOUSESPERPLAYER; j++)
- {
- // Check if the player owns this house
- if (APlayerData[i][Houses][j] == HouseID)
- {
- // Store the houseowner
- HouseOwner = i;
- // Find the CarSlot where this vehicle exists
- for (new CarSlot; CarSlot < 10; CarSlot++)
- {
- // Check if the vehicle is stored in this carslot
- if (AHouseData[HouseID][VehicleIDs][CarSlot] == vid)
- {
- vid = House_ReplaceVehicle(HouseID, CarSlot); // Re-create the vehicle at the KACC Military fuels hangar
- // Set the vehicle as clamped (clamping needs to be done after re-creating the vehice, otherwise the wrong id can be clamped)
- AVehicleData[vid][Clamped] = true;
- }
- }
- break;
- }
- }
- }
- // Get the name of the admin and owner of the house
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- GetPlayerName(HouseOwner, Name, sizeof(Name));
- // Let the admin know who's vehicle he deleted
- format(Msg, 128, "{00FF00}You've clamped a vehicle that was owned by {FFFF00}%s", Name);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- // Let the player know who deleted his vehicle
- format(Msg, 128, "{FF0000}A vehicle you owned was clamped by admin {FFFF00}%s", AdminName);
- SendClientMessage(HouseOwner, 0xFFFFFFFF, Msg);
- format(Msg, 128, "{FF0000}It belongs to house: {FFFF00}%s", AHouseData[HouseID][HouseName]);
- SendClientMessage(HouseOwner, 0xFFFFFFFF, Msg);
- format(Msg, 128, "{FF0000}Reason: {FFFF00}%s", Reason);
- SendClientMessage(HouseOwner, 0xFFFFFFFF, Msg);
- // Save the player's datafile (and his houses/businesses/vehicles)
- PlayerFile_Save(HouseOwner);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That vehicle doesn't belong to a player, you cannot clamp it");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command can be used to unclamp all your vehicles at once
- COMMAND:unclamp(playerid, params[])
- {
- // Setup local variables
- new HouseID, vid, ClampedVehicles, UnclampPrice, Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/unclamp", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Loop through all vehicles owned by this player
- for (new HouseSlot; HouseSlot < MAX_HOUSESPERPLAYER; HouseSlot++)
- {
- // Get the HouseID that exists on this index
- HouseID = APlayerData[playerid][Houses][HouseSlot];
- // check if this house-slot is used
- if (HouseID != 0)
- {
- // Loop through all vehicles assigned to this house
- for (new CarSlot; CarSlot < 10; CarSlot++)
- {
- // Get the vehicle-id of the vehicle in this carslot
- vid = AHouseData[HouseID][VehicleIDs][CarSlot];
- // Check if this carslot is used
- if (vid != 0)
- {
- // Check if this vehicle is clamped
- if (AVehicleData[vid][Clamped] == true)
- ClampedVehicles++; // Count the clamped vehicles
- }
- }
- }
- }
- // Check if there were any clamped vehicles
- if (ClampedVehicles > 0)
- {
- // Calculate the price to unclamp all the player's vehicles
- UnclampPrice = ClampedVehicles * UnclampPricePerVehicle;
- // Construct the message to inform the player how many vehicles have been clamped and how much it costs to un-clamp them
- format(Msg, 128, "You have %i clamped vehicles, it will cost you $%i to unclamp them", ClampedVehicles, UnclampPrice);
- // Show a dialog that informs the player how many vehicles have been clamped and how much it costs to un-clamp them
- ShowPlayerDialog(playerid, DialogUnclampVehicles, DIALOG_STYLE_MSGBOX, TXT_AreYouSure, Msg, "Unclamp", TXT_DialogButtonCancel);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}You don't have any clamped vehicles");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command displays the rules of the server
- COMMAND:rules(playerid, params[])
- {
- // Setup local variables
- new Msg[2000];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/rules", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Construct the rules
- format(Msg, 2000, "%s1. Always drive on the right side of the road\n", Msg);
- format(Msg, 2000, "%s2. No flaming or disrespecting other players\n", Msg);
- format(Msg, 2000, "%s3. Main language is english\n", Msg);
- format(Msg, 2000, "%s4. Don't use any hacks, you'll be banned\n", Msg);
- format(Msg, 2000, "%s5. No spamming on the chat\n", Msg);
- format(Msg, 2000, "%s6. No car-jacking allowed\n", Msg);
- // Show a dialog that shows the rules
- ShowPlayerDialog(playerid, DialogRules, DIALOG_STYLE_MSGBOX, "Rules of the server:", Msg, "Accept", TXT_DialogButtonCancel);
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Report a player for breaking the rules
- COMMAND:report(playerid, params[])
- {
- // Setup local variables
- new OtherPlayer, Name[24], Reason[128], Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/report", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- if (sscanf(params, "us[128]", OtherPlayer, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/report <OtherPlayer> <Your report>\"");
- else
- {
- // Check if that other player is logged in
- if (APlayerData[OtherPlayer][LoggedIn] == true)
- {
- // Send the report to all admins and add the report to the report-list so admins can review it
- SendReportToAdmins(OtherPlayer, Reason);
- // Get the name of the offender
- GetPlayerName(OtherPlayer, Name, sizeof(Name));
- // Let the player know he reported the other player
- format(Msg, 128, "{00FF00}You've reported {FFFF00}%s", Name);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't connected");
- }
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Lets the admins see the list of reports
- COMMAND:rep(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/rep", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 1
- if (APlayerData[playerid][PlayerLevel] >= 1)
- {
- // Add the first report to the list (if it exists)
- if (AReports[0][ReportUsed] == true)
- format(ReportList, 5000, "%s: %s\n", AReports[0][ReportName], AReports[0][ReportReason]);
- // Construct the report-dialog
- for (new i = 1; i < 50; i++)
- {
- // Check if the ReportID has been used already
- if (AReports[i][ReportUsed] == true)
- {
- format(ReportList, 5000, "%s%s: %s\n", ReportList, AReports[i][ReportName], AReports[i][ReportReason]);
- }
- }
- // Show all the reports
- ShowPlayerDialog(playerid, DialogReports, DIALOG_STYLE_LIST, "Reports list:", ReportList, "OK", "Cancel");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Enables the trucker to overload himself
- COMMAND:overload(playerid, params[])
- {
- // Setup local variables
- new vModel, bool:ValidOverLoad = false, Float:x, Float:y, Float:z, Name[24], Msg[128];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/overload", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the playeris a trucker
- if (APlayerData[playerid][PlayerClass] == ClassTruckDriver)
- {
- // Check if he has already started a job
- if (APlayerData[playerid][JobStarted] == true)
- {
- // Check if the player has already loaded his load
- if (APlayerData[playerid][JobStep] == 2)
- {
- // Check if the player isn't overloaded already
- if (APlayerData[playerid][Overloaded] == false)
- {
- // Get the coordinates of the loading point
- x = ALocations[APlayerData[playerid][JobLoc1]][LocX];
- y = ALocations[APlayerData[playerid][JobLoc1]][LocY];
- z = ALocations[APlayerData[playerid][JobLoc1]][LocZ];
- // Check if the player is still near the loading point
- if (IsPlayerInRangeOfPoint(playerid, 25.0, x, y, z))
- {
- // Get the vehicle-model of the player's vehicle
- vModel = GetVehicleModel(APlayerData[playerid][VehicleID]);
- // Check if the trucker is driving a trucking vehicle that can be overloaded
- switch (vModel)
- {
- case VehicleFlatbed, VehicleDFT30: ValidOverLoad = true; // Flatbed and DFT-30 can be overloaded
- case VehicleLineRunner, VehicleTanker, VehicleRoadTrain:
- {
- switch (GetVehicleModel(APlayerData[playerid][TrailerID]))
- {
- case VehicleTrailerCargo, VehicleTrailerCargo2, VehicleTrailerOre: ValidOverLoad = true; // Cargo and ore trailer can be overloaded
- }
- }
- }
- // Check if the vehicle is valid for overloading
- if (ValidOverLoad == true)
- {
- // Set overloaded for this player to True
- APlayerData[playerid][Overloaded] = true;
- // Add 2 to the player's wanted level
- SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 2);
- // Let the player know he has been overloaded now
- SendClientMessage(playerid, 0xFFFFFFFF, "{00FF00}You have overloaded your truck, watch out for the police");
- // Inform the police this trucker is overloaded
- GetPlayerName(playerid, Name, sizeof(Name));
- format(Msg, 128, "{00FF00}Trucker {FFFF00}%s{00FF00} is overloaded, pursue and fine him", Name);
- Police_SendMessage(Msg);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Your vehicle cannot be overloaded");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You must be near the loading point to overload your truck");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You are overloaded already");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You must load your truck first");
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}You haven't started a job yet");
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command resets a player's money, score and stats to 0 (if chosen)
- COMMAND:resetplayer(playerid, params[])
- {
- // Setup local variables
- new Name[24], AdminName[24], Reason[128], Msg[128], OtherPlayer, ClearMoney, ClearScore, ClearStats;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/resetplayer", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- 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>\"");
- else
- {
- // Check if the other player is logged in
- if (APlayerData[OtherPlayer][LoggedIn] == true)
- {
- // Check if there is at least one parameter given to be cleared, otherwise exit the command
- if ((ClearMoney + ClearScore + ClearStats) == 0)
- return 1;
- // Get the names of both players
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- GetPlayerName(OtherPlayer, Name, sizeof(Name));
- // Reset the other player's money to 0
- if (ClearMoney == 1)
- {
- APlayerData[OtherPlayer][PlayerMoney] = 0;
- format(Msg, 128, "{FF0000}Your money has been reset by {FFFF00}%s", AdminName);
- SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
- format(Msg, 128, "{00FF00}You've reset the money of player {FFFF00}%s", Name);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- // Reset the other player's score to 0
- if (ClearScore == 1)
- {
- APlayerData[OtherPlayer][PlayerScore] = 0;
- format(Msg, 128, "{FF0000}Your score has been reset by {FFFF00}%s", AdminName);
- SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
- format(Msg, 128, "{00FF00}You've reset the score of player {FFFF00}%s", Name);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- // Reset the other player's stats to 0
- if (ClearStats == 1)
- {
- APlayerData[OtherPlayer][StatsTruckerJobs] = 0;
- APlayerData[OtherPlayer][StatsConvoyJobs] = 0;
- APlayerData[OtherPlayer][StatsBusDriverJobs] = 0;
- APlayerData[OtherPlayer][StatsPilotJobs] = 0;
- APlayerData[OtherPlayer][StatsMafiaJobs] = 0;
- APlayerData[OtherPlayer][StatsMafiaStolen] = 0;
- APlayerData[OtherPlayer][StatsPoliceFined] = 0;
- APlayerData[OtherPlayer][StatsPoliceJailed] = 0;
- APlayerData[OtherPlayer][StatsCourierJobs] = 0;
- APlayerData[OtherPlayer][StatsAssistance] = 0;
- APlayerData[OtherPlayer][StatsRoadworkerJobs] = 0;
- APlayerData[OtherPlayer][StatsMetersDriven] = 0.0;
- format(Msg, 128, "{FF0000}Your stats have been reset by {FFFF00}%s", AdminName);
- SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
- format(Msg, 128, "{00FF00}You've reset the stats of player {FFFF00}%s", Name);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- // Let the other player know the reason too
- format(Msg, 128, "{FF0000}Reason: {FFFF00}%s", Reason);
- SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
- // Save the other player's account
- PlayerFile_Save(OtherPlayer);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't connected");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command searches every house and business that the player owns and restores the data for it in the player's account
- COMMAND:fixplayer(playerid, params[])
- {
- // Setup local variables
- new Name[24], AdminName[24], Msg[128], OtherPlayer;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/fixplayer", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 5
- if (APlayerData[playerid][PlayerLevel] >= 5)
- {
- if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/fixplayer <OtherPlayer>\"");
- else
- {
- // Check if the other player is logged in
- if (APlayerData[OtherPlayer][LoggedIn] == true)
- {
- // Get the names of both players
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- GetPlayerName(OtherPlayer, Name, sizeof(Name));
- // Clear the houses and businesses that the player owns right now
- for (new i; i < MAX_HOUSESPERPLAYER; i++)
- APlayerData[OtherPlayer][Houses][i] = 0;
- for (new i; i < MAX_BUSINESSPERPLAYER; i++)
- APlayerData[OtherPlayer][Business][i] = 0;
- // Now search through all houses and re-add them to the player
- for (new HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
- if (AHouseData[HouseID][Owned] == true) // Check if the house is owned by somebody
- if (strcmp(AHouseData[HouseID][Owner], Name, false) == 0) // Check if the player is the owner of the house
- {
- for (new i; i < MAX_HOUSESPERPLAYER; i++) // Loop through all houses the player owns
- if (APlayerData[OtherPlayer][Houses][i] == 0) // Check if the houseslot is free
- {
- APlayerData[OtherPlayer][Houses][i] = HouseID; // Store the HouseID
- break; // Stop searching for more free slots
- }
- }
- // Now search through all businesses and re-add them to the player
- for (new BusID = 1; BusID < MAX_BUSINESS; BusID++)
- if (ABusinessData[BusID][Owned] == true) // Check if the business is owner by someone
- if (strcmp(ABusinessData[BusID][Owner], Name, false) == 0) // Check if the player is the owner of the business
- {
- for (new i; i < MAX_BUSINESSPERPLAYER; i++) // Loop through all businesses the player owns
- if (APlayerData[OtherPlayer][Business][i] == 0) // Check if the businessslot is free
- {
- APlayerData[OtherPlayer][Business][i] = BusID; // Store the BusID
- break; // Stop searching for more free slots
- }
- }
- // Let the other player know his property has been restored
- format(Msg, 128, "{00FF00}Your property has been restored by: {FFFF00}%s", AdminName);
- SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
- // Save the other player's account
- PlayerFile_Save(OtherPlayer);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't connected");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command sets a skin for the player
- COMMAND:setskin(playerid, params[])
- {
- // Setup local variables
- new Msg[128], Skin;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/setskin", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 4
- if (APlayerData[playerid][PlayerLevel] >= 4)
- {
- if (sscanf(params, "i", Skin)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/setskin <skin-id (0-299)>\"");
- else
- {
- // Check if the player entered a valid skin-id
- if ((Skin >= 0) && (Skin <= 299))
- {
- // Set the skin for the player
- SetPlayerSkin(playerid, Skin);
- // Let the other player know the reason too
- format(Msg, 128, "{00FF00}You've chosen skin-id: {FFFF00}%i", Skin);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Invalid skin-id, you can only use skins 0-299");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // Bans a player by his ip
- COMMAND:ipban(playerid, params[])
- {
- // Setup local variables
- new PlayerToBan, Reason[128], Msg[128], Name[24], AdminName[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/ipban", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 3
- if (APlayerData[playerid][PlayerLevel] >= 3)
- {
- if (sscanf(params, "us[128]", PlayerToBan, Reason))
- SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/ipban <PlayerToBan> <Reason>\"");
- else
- {
- if (IsPlayerConnected(PlayerToBan))
- {
- // Get the names of the player and the admin who executed the ban
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- GetPlayerName(PlayerToBan, Name, sizeof(Name));
- // Inform the player about his ban
- format(Msg, 128, "{FF0000}You have been ip-banned permanently by {FFFF00}%s", AdminName);
- SendClientMessage(PlayerToBan, 0xFFFFFFFF, Msg);
- format(Msg, 128, "{FF0000}Reason: {FFFF00}%s", Reason);
- SendClientMessage(PlayerToBan, 0xFFFFFFFF, Msg);
- // Ban the player with a reason
- BanEx(PlayerToBan, Reason);
- // Inform everybody else which player was ip-banned
- format(Msg, 128, "{808080}%s %s has ip-banned {FFFF00}%s", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name);
- SendClientMessageToAll(0xFFFFFFFF, Msg);
- }
- }
- }
- else
- return 0;
- }
- else
- return 0;
- return 1;
- }
- // Bans a player's entire range of IP addresses (the last part of the IP-address will be from 0 to 255)
- COMMAND:rangeban(playerid, params[])
- {
- // Setup local variables
- new PlayerToBan, PlayerIP[16], FirstPartsOfIP[16], BanCmd[24], Reason[128], Msg[128], Name[24], AdminName[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/rangeban", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 3
- if (APlayerData[playerid][PlayerLevel] >= 3)
- {
- if (sscanf(params, "us[128]", PlayerToBan, Reason))
- SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/rangeban <PlayerToBan> <Reason>\"");
- else
- {
- if (IsPlayerConnected(PlayerToBan))
- {
- // Get the names of the player and the admin who executed the ban
- GetPlayerName(playerid, AdminName, sizeof(AdminName));
- GetPlayerName(PlayerToBan, Name, sizeof(Name));
- // Get the player's IP-address
- GetPlayerIp(PlayerToBan, PlayerIP, 16);
- // Inform the player about his ban
- format(Msg, 128, "{FF0000}You have been ip-range-banned permanently by {FFFF00}%s", AdminName);
- SendClientMessage(PlayerToBan, 0xFFFFFFFF, Msg);
- format(Msg, 128, "{FF0000}Reason: {FFFF00}%s", Reason);
- SendClientMessage(PlayerToBan, 0xFFFFFFFF, Msg);
- // Get the first three digits from the player's ip, so the fourth part can be added from 0 to 255
- FirstPartsOfIP = GetFirstThreeDigitsFromIP(PlayerIP);
- // Ban the entire range of IP-addresses of the player
- for (new i; i < 256; i++)
- {
- format(BanCmd, 24, "banip %s%i", FirstPartsOfIP, i); // Construct the RCon command to ban every IP
- SendRconCommand(BanCmd); // Execute the command
- }
- // Finally kick the player (the RCon command doesn't kick you out automatically)
- Kick(PlayerToBan);
- // Inform everybody else which player was ip-range-banned
- format(Msg, 128, "{808080}%s %s has ip-range-banned {FFFF00}%s", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name);
- SendClientMessageToAll(0xFFFFFFFF, Msg);
- }
- }
- }
- else
- return 0;
- }
- else
- return 0;
- return 1;
- }
- // Sets the score of another player
- COMMAND:setscore(playerid, params[])
- {
- // Setup local variables
- new Msg[128], Name[24], OtherName[24], OtherPlayer, pScore;
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/setscore", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player's admin-level is at least 3
- if (APlayerData[playerid][PlayerLevel] >= 3)
- {
- if (sscanf(params, "ui", OtherPlayer, pScore)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/setscore <OtherPlayer> <Score>\"");
- else
- {
- // Check if the otherplayer is online
- if (IsPlayerConnected(OtherPlayer))
- {
- // Get the player-names
- GetPlayerName(playerid, Name, sizeof(Name));
- GetPlayerName(OtherPlayer, OtherName, sizeof(OtherName));
- // Set the other player's score
- APlayerData[OtherPlayer][PlayerScore] = pScore;
- // Let the other player know that his score has been changed
- format(Msg, 128, "{00FF00}Your score has been set to {FFFF00}%i{00FF00} by {FFFF00}%s", pScore, Name);
- SendClientMessage(OtherPlayer, 0xFFFFFFFF, Msg);
- // Let the player know he has set the score of the other player
- format(Msg, 128, "{00FF00}You've set the score of {FFFF00}%s{00FF00} to {FFFF00}%i", OtherName, pScore);
- SendClientMessage(playerid, 0xFFFFFFFF, Msg);
- // Save the other player's account
- PlayerFile_Save(OtherPlayer);
- }
- else
- SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}That player isn't online");
- }
- }
- else
- return 0;
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // 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
- COMMAND:bank(playerid, params[])
- {
- // Setup local variables
- new file[100], Name[24];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/bank", params);
- // Get the playername
- format(Name, sizeof(Name), APlayerData[playerid][PlayerName]);
- // Construct the complete filename for this player's bank-account
- format(file, sizeof(file), BankFile, Name);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player doesn't have a bank account
- if (!fexist(file))
- {
- // Ask for a password to setup his bank account
- ShowPlayerDialog(playerid, DialogBankPasswordRegister, DIALOG_STYLE_INPUT, "Enter password", "Please enter a password to register your bank account:", TXT_DialogButtonSelect, TXT_DialogButtonCancel);
- }
- else // The player has a bank account
- {
- // If the player hasn't logged in to his bank account yet
- if (APlayerData[playerid][BankLoggedIn] == false)
- {
- // Ask for the password to login to his bank account
- ShowPlayerDialog(playerid, DialogBankPasswordLogin, DIALOG_STYLE_INPUT, "Enter password", "Please enter your password to login to your bank account:", TXT_DialogButtonSelect, TXT_DialogButtonCancel);
- }
- else // The player has logged in to his bank account already
- {
- // Show the main bank menu dialog
- ShowBankMenu(playerid);
- }
- }
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command lists all help-items for which the player can get information about it
- COMMAND:help(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/help", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Create the dialog that lists all help-items
- HelpList_Create(playerid);
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command allows you to change your password for logging in
- COMMAND:changepassword(playerid, params[])
- {
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/changepassword", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Show the dialog where the player must enter his old password
- ShowPlayerDialog(playerid, DialogOldPassword, DIALOG_STYLE_INPUT, "Enter old password:", "Enter your old password here:", "OK", "Cancel");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
- // This command opens a menu where you can choose neons lights for your vehicle
- COMMAND:neon(playerid, params[])
- {
- // Setup local variables
- new OptionsList[200], DialogTitle[200];
- // Send the command to all admins so they can see it
- SendAdminText(playerid, "/neon", params);
- // Check if the player has logged in
- if (APlayerData[playerid][LoggedIn] == true)
- {
- // Check if the player is the driver of a vehicle
- if (GetPlayerVehicleSeat(playerid) == 0)
- {
- format(DialogTitle, sizeof(DialogTitle), "Select neon lights:");
- format(OptionsList, sizeof(OptionsList), "%sPolice lights\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sRed lights\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sBlue lights\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sGreen lights\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sYellow lights\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sPink lights\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sWhite lights\n", OptionsList);
- format(OptionsList, sizeof(OptionsList), "%sRemove neons\n", OptionsList);
- // Show the neon menu
- ShowPlayerDialog(playerid, DialogNeon, DIALOG_STYLE_LIST, DialogTitle, OptionsList, "Select", "Cancel");
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "You're not the driver of a vehicle");
- }
- else
- return 0;
- // Let the server know that this was a valid command
- return 1;
- }
|