Search the Community
Showing results for tags 'events'.
-
Are you bored and want to RACE with some folks, on maps made by me, my friends or some random maps? You're in the right place! Visit International Racing Server (IRS) - open for literally anyone. You can play with us, or your friends there. I want to do also some events in the future there, and the prize would be a temporary staff on the server, installing your own skin that you'll tell us to install or maybe even prized competitions soon. Keep in mind, that this is not DD / DM RACE, instead it is a Classic Race with checkpoints. Some server commands: /nos (nfs | hybrid | normal| ) Select your nitro style. NFS: You can manually turn it off / on by pressing LCTRL or L-MOUSE BUTTON at anytime, and hybrid-style NOS; press fire once to start NOS, press fire again to stop. /fpslimit (vehicle / boat) (number) Adjust your FPS number. Default server FPS is 100. We recommend setting 30 fps for Boats because boats won't work properly while sliding on land or when landing from a distance F7 - Turn on / off race progress bar F5 - Turn on / off toptimes on a map C - Enable carhide X - Enable carfade /cpdelays - toggle the delays /setdelaypos x y - set the relative position of the delays [0 - 1] /rate (1-10) (also can do 1.5-9.5) Rate the map you are currently playing. All ratings will be shown, when you'll vote for a new map in () near the map name /votemap Start a map voting process. If you dont like certain map you are playing, you can boot up a window and you can vote for a new map to be played there /new Vote for a random map to start /skin (number) - Change your racer skin. It will save it to your account, if you are logged in /register (password) Register your account /login (password) Login to your account with the credentials you've written when registering Things to come (if i'll find scripts / do scripts myself for it): Win Money after finishing race Map Panel where you can buy maps Wheel panel for you to give yourself a new wheel look You can also upload your own maps for us to validate, and they might appear on the server! Join our Discord channel for that! https://discord.gg/y6wt7awQDm you will be able to communicate with other folks there as well, and also tag me if you'll encounter any problems We just want to create a peaceful community with friends, and you randoms of course - and we want to grow it. Consider staying there. More server info is on the Discord. Thanks! - IRS Staff
-
∞ TDD++ | Turkish Destruction Derby [2012∞] mtasa://87.248.157.58:22003 ([Sunucuya Bağlanmak İçin Tıkla!]) Sunucumuz 2012 yılından beri Türkiye DD sunucularında kök kazımış yerel bir sunucudur. 2012-2018 yılları arasında aktif olup daha sonra çeşitli sebeplerle kapatıldıktan sonra tekrar kapatılmıştır. Ama bu sefer sonsuza kadar sizinleyiz ∞ Kurucumuz: mR.EmiN ∞ Gelişmiş Level + Rank Sistemi (1lvl>150lvl) -> Kusursuz dizayn edilmiş bu level sistemi rank sistemiyle optimize edilmiş bir sistem. -> Kusursuz dizayn edilmiş bu level sistemi rank sistemiyle optimize edilmiş bir sistem. ∞ Gelişmiş Kullanıcı Panel Sistemi ->(İstatistik-Dükkan-Klan-Klanlar-Top Sıralama- Müzik/Radyo-Kurallar/Yardım-Ayarlar) -> Gelişmiş Kullanıcı Paneli ile Sunucumuzdaki hesabınızı yönetmeniz artık daha çok kolay! ∞ Gelişmiş Klan Sistemi-> Bu sistem ile Takımınızı yönetmek oldukça kolay! Klan Puanları her hafta sistem tarafından sıfırlanmaktadır. Sunucumuzun kasasında ki paradan ve belirtilen puan takım üyelerine eşit bir şekilde paylaştırılır. [Ödül: 150000 ₺ ve 40000 puan] Ayrıca Klan puanı 1000 puana ulaşan ilk klan üyelerine 100,000₺ para verilecektir. [Her Hafta Şampiyon olan takım liderine 200₺ Para Ödülü] [10 Defa Şampiyon Olan Takım Liderine 2.000₺ Para Ödülü] ∞ Gelişmiş Bahis Sistemi-> Sunucuda minimum 8 kişi olduğunda her el başı bahis sistemi açılır. F7> Dükkan üzerinden Oyuncuların üzerine bahis basarsınız. ∞ Gelişmiş Piyango Sistemi-> /piyango [1-15] ile piyango oynayabilirsiniz. Sürekli Güncel İkramiye oluşturulmaktadır. ∞ Gelişmiş Zar Sistemi-> /zar [miktar] ile levelinize göre zar oynama miktarı artmaktadır. Örneğin 24 levelsiniz: Minimum 2400₺ Maksimum: 24000₺ zar atabilirsiniz. [YARDIMCI KOMUTLAR] /dc > Discord Linkimizi Kopyalar. F1 > Havayı Gündüz Yapar F3 > Nos Ayarları F4 > Yazışma Komutları F5 > Harita Kullanıcı İstatistikleri F6 > TDD Rank Şeması F7 > Kullanıcı Paneli F9 > TDD Bilgilendirme Paneli [SOHBET KOMUTLARI] /pm [oyuncu adı] [mesaj]: Özel mesaj gönderir /re [mesaj]: Özel mesaja yanıt verir /give [oyuncu adı] [miktar]: Oyuncuya para gönderir. /cc : Chati temizler /like - /dislike: Mevcut haritayı beğenir/beğenmez /ignore [oyuncu adı]: Oyuncunun yazılarını engeller /zar [miktar]: Belirttiğiniz miktarda zar oynar /reco: Sunucuya yeniden bağlanmanızı sağlar. /gerisayım : Son 2 oyuncu için 3 den geriye sayım yapar [0] Sağduyunuzu Kullanın Sıradan bir kişinin herkese açık alanlarda uygunsuz bulabileceği bu kurallarda özel olarak sayılmayan davranışlar, yine de yaptırımlara neden olabilir. Bir şeyin yolunda olup olmadığından emin değilseniz, bir yetkiliye sorun! [1] Spam Herhangi bir şekilde sohbet içerisinde spam yapmayın. [2] Özel Konular Başka bir oyuncuyla gizli hiçbir şeyi herkese açık bir şekilde tartışmayın. Diğer üyelerle aranızda olabilecek tüm kişisel anlaşmazlıkları sohbetten dışında tutun. [3] Kimliğe Bürünme İzinleri olmadan başka bir oyuncu gibi davranmayın. Sahip olmadığınız bir yetkiyi sahipmiş gibi davranmayın. [4] İfşalama Başka bir oyuncunun özel bilgilerini izinleri olmadan yayınlamayın. Ayrıca kendinizle ilgili hassas bilgileri (örneğin adres, telefon numarası) paylaşmaktan da kaçınmalısınız. [5] Reklam Sunucudaki oyuncuları başka bir sunucuya davet etmeyin. Herhangi bir reklam yapmayın. [6] Hakaretler, ayrımcılık ve taciz Oyuncuları küçük düşürecek, rencide edecek söz ve eylemlerden uzak durun. Diğer oyunculara karşı önyargılı ifadeler içeren hakaretler kullanmayın. [7] Son Söz Yetkililerindir! Yetkililerin uyarılarını dikkate alın, son söz her zaman onlardadır. Bazı durumlarda Yetkililerin İnisiyatifine bağlısınız! Sunucumuza kayıt olarak tüm bu kuralları kabul etmiş olursunuz, aksi taktirde gereken yasaklanmalar yapılmaktadır. Websitemiz: https://tr-servers.com Facebook Sayfamız: https://www.facebook.com/mtatrservers Facebook Grubumuz: https://facebook.com/groups/1538456619756865 Discord Sunucumuz: https://discord.gg/XrdkNqcGup
-
Let's talk script security. It might be a taboo topic for some but it shouldn't, at all. In fact, the more people talk about this and unite to discuss and create robust, safe and well-coded scripts, the better the MTA resource development community will be. Rules: Main article: https://wiki.multitheftauto.com/wiki/Script_security The key points are there, but the code examples don't suffice, and the implementations will vary depending on the gamemode and resources. Pinned information: Coming soon Notes: - I'm not perfect and everyone makes mistakes. Please correct me when I'm wrong. - Eventually if this becomes a popular topic, I am willing to incorporate translations of certain explanations into other languages in this OP, as I know a majority of the MTA community doesn't master the English language and prefers to communicate and read in other languages.
-
function updateVeh(vehicle) local id = getElementData (vehicle, "TS:VehicleID") --element data que ira setar no veiculo ao ser spawnado pela concessionaria if id then local result = dbPoll(dbQuery (db, "SELECT * FROM Inventario WHERE Vehicle = ?", id), -1) --database do porta malas local data = dbPoll(dbQuery (db, "SELECT * FROM Veiculo WHERE Vehicle = ?", id), -1) --database do porta malas if type (result) == "table" and type (data) == "table" then setElementData(vehicle, "TS:VehicleItens", result) --irá setar os itens q tem no porta malas do carro setElementData(vehicle, "TS:VehiclePeso", data) --irá setar o peso q o veiculo tem isso aq tá dando erro ao clicar no end --carro por isso preciso da ajuda de vcs end end createEventHandler("TS:updateVeh", getRootElement(), updateVeh) queria um event q verificasse se o carro foi spawnado no servidor e que no momento q o carro for spawnado executasse a função ai em cima
- 2 replies
-
- concessionária
- mala
-
(and 4 more)
Tagged with:
-
Hello everyone, I recently started with Lua programming at MTA, for studies, I started to develop a small system, whose goal is to create items on the map. So far everything worked perfectly, so I decided to implement an event, so that I know when the player goes through an item, but it didn't work (there are no errors in the console or in the debugscript) REMEMBERING: I started recently, so anything I have done wrong besides said, or that can be improved, let me know, please. For item creation I have this, at first, everything is working here, this is on ServerSide -- Count VARS local definirItem_Count = 0; local criarItemNoMapa_Count = 0; -- Table which stores the defined items item_ID = {} item_NOME = {} -- Table which stores spawned items on the map spawnedItem_ID = {} spawnedItem_NOME = {} spawnedItem_X = {} spawnedItem_Y = {} spawnedItem_Z = {} -- Function that defines the items function definirItem(item, nome) definirItem_Count = definirItem_Count + 1 table.insert(item_ID, definirItem_Count, item) table.insert(item_NOME, definirItem_Count, nome) end -- Function that creates the items on the map function criarItemNoMapa(item, nome, x, y, z) criarItemNoMapa_Count = criarItemNoMapa_Count + 1 createObject(item, x, y, z) table.insert(spawnedItem_ID, criarItemNoMapa_Count, item) table.insert(spawnedItem_NOME, criarItemNoMapa_Count, nome) table.insert(spawnedItem_X, criarItemNoMapa_Count, X) table.insert(spawnedItem_Y, criarItemNoMapa_Count, Y) table.insert(spawnedItem_Z, criarItemNoMapa_Count, Z) end -- Item definition definirItem(1853, "Chave de Fenda") definirItem(1577, "Mala Verde") definirItem(1580, "Mala Vemelha") definirItem(1579, "Mala Azul") I believe the problem arises in clientSide, because I have this -- Timer that repeats setTimer(verificarPositition, 500, 0) -- Function called by the timer to check if the player is in the range of an item -- For that I looped up to the highest value in the table of spawned items -- And I took the X, Y and Z values from certain tables -- And if the player is in this range, trigger the event function verificarPosition() for i = 0, table.maxn(spawnedItem_ID), 1 do local x, y, z = getElementPosition(getLocalPlayer()) if(isElementInRange(getLocalPlayer(), spawnedItem_X[i], spawnedItem_Y[i], spawnedItem_Z[i], 5)) triggerEvent("onPlayerEnterItemArea", getLocalPlayer()) end end end -- Event (its not been called) addEvent("onPlayerEnterItemArea", false) addEventHandler("onPlayerEnterItemArea", getRootElement(), function() outputChatBox("CALLED") end) Any help and improvement in the code will be a great help
-
بسم الله الرحمن الرحيم طفشان وتدور على فعاليات ؟ أدخل سيرفر Super Events في الدسكورد وصف السيرفر :- السيرفر عبارة عن فعاليات ومسابقات و العاب وتحديات و الخ... وإذا جبت ٥ اعضاء لك رتبة وإذا جمعت ١٥٠٠ Credits ArabCom Bot تقدر تشتري رتبة VIP + من الشوب عملة السيرفر ArabCom Bot وليست برو بوت والسيرفر يعتمد اعتماد كلي عليها واذا ربحت في الفعاليات والمسابقات رح تاخذ رتبة او كردت رابط الدسكورد :- https://discord.gg/qjqzuRC
-
Hey there, we just opened our MTA SA Server named BalkanRoam, an English freeroam server. Our server offers you different features such as: -Clans -A brand new Dogfight System -VIP Music Tracks -Clan Bases System -Wars System: Weapons Wars with Weapon Changements, no vehicles allowed! -Custom in-game shaders and optimised server, meaning you will get higher fps than the other servers. -Hydra Clan Skins -Custom Clan Base door commands -3D Radio System -Custom Cars -Custom Car Panel -Customized Freeroam Panel -Brand new scoreboard -Level System, Max Level: 100 -Different Events to get XP and Money: *Dogfight Event: There are two teams in this event, the winner team gets money and 2000 XP *Free For All: This event has different maps, you can fight everyone on it, the TOP 3 Killers get XP and Cash What are you waiting for? Join us now! Our Server IP: mtasa://51.77.125.189:22003
-
- freeroam
- custom features
-
(and 7 more)
Tagged with:
-
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ Hello gamers , i want to introduce you with my Server .. This is Zombie server but also you will find RPG stuffs like " Police, Jail, Houses". Server daily updates .. everyday you will find new things .. Earn Money by ; Killing Zombies, Bosses, Also Case Event .. Jobs etc.. For what i'm earning Money ? .. To Buy Guns .. vehicles houses .. skills etc.. ! Welcome ! ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ Events There Are 5 Events at the moment .. and more Soon Boss Events 1- Los Santos Boss : After 20 Min From Case Event Death. #Reward $15,000 2- LasVenturas Boss : After 20 Min From Los Santos Boss DEATH. #Reward $15,000. 3- SanFierro Boss : After 20 Min From Las Venturas Death #Reward $15,000. 4- Case Event ( Random at Los Santos ) : After 20 Min From Los Santos Death #Reward Taking Case from ' R ' location To ' Z ' Location gives you $10,000 5- Whenstone Boss : After 24 H From his DEATH. #Reward $50,000. ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ Server Progress ~> Clan System 100% ✔ Manage : 100% ✔ Member : 100% ✔ Send Invites : 100% ✔ System : 100% ✔ ~> Hud System 100% ✔ Player : 100% ✔ Vehicle : 100% ✔ Radar : 100% ✔ Boss : 100% ✔ ~> Map System 80% ✔ Bases : 75% ✔ Vehicles : 75% ✔ Interiors : 100% ✔ Zones : 100% ✔ ~> Zombie System 100% ✔ Zombies : 100% ✔ Bosses : 100% ✔ Sound : 100% ✔ ~> Level System 100% ✔ Level : 100% ✔ ~> Mods System 100% ✔ Vehicles : 100% ✔ Skins : 100% ✔ Weapons : 100% ✔ ~> Chat System 100% ✔ Ranked Chat : 100% ✔ Private Chat : 100% ✔ ~> Account System 100% ✔ Data : 100% ✔ Stats : 100% ✔ ~> Settings System100% ✔ Music : 100% ✔ ~> VIP System 100% ✔ Skins : 100% ✔ Panel : 100% ✔ Extras : 100% ✔ ~> Scoreboard System 100% ✔ Zombie kills : 100% ✔ Boss kills : 100% ✔ Played Time : 100% ✔ Country : 100% ✔ Zone : 100% ✔ Level : 100% ✔ Vehicle : 100% ✔ Money : 100% ✔ ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ Server ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ More Informations IP : mtasa://51.38.124.8:22003 Click ( Our Facebook Page. ) Server Staff : Legend<3 ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
-
APPENDIX DATA SYNCHRONIZATION. What is it? MTA's synchronization methods. Optimization tips. DATA SYNCHRONIZATION 1. What is it? Since unmemorable times humanity have faced problems caused mainly due to the storage of different ideas in almost each human. But thank God, machines storage methods are different and they have the possibility of having stored the same values in more than 100 machines. Well this is great, but those values must be set by someone, and here's where the server-side and client-side can be used as example of data synchronization. The server-side store's all the values given by each client-side and give's back those values to the all the client-sides ending up into something like this ( Figure 1 ). This is a way to get the same data in all the client-side, but there's also other methods well known like P2P. Figure 1. 2. MTA's synchronization methods. Since data sync it's a base element of every multiplayer game or mod, MTA is not an exception. That's why MTA scripting interface gives us two core ways to sync the server data with the client data or client data with server data. Well this two methods are the following one's. Element Data, it consists of assigning values to an element that are being stored under a key ( the key usually being a string like "health" ). This way is being used by a great amount of scripters in MTA because it's easy to use. But there are also negative points if this way is not being used properly like saving small amount of data in just one key and syncing it with the server or client's. An example of it would be: [[--CLIENT.LUA--]] local value = 0 local function handleStart() value = getTickCount() -- WE GET THE TIME THE SERVER HAS BEEN WORKING WHEN THE RESOURCE START setElementData( localPlayer, "start_tick", value, true ) -- WE SAVE THE 'value' VARIABLE INTO THE 'localPlayer' ELEMENT WITHIN THE KEY 'start_tick' AND WE SYNC IT TO GET THIS DATA TO THE SERVER. end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), handleStart ) [[--SERVER.LUA--]] local function handleCMD( thePlayer ) local mineTick = getElementData( thePlayer, "start_tick" ) -- WE RETRIEVE THE DATA, THAT HAS BEEN SAVED INTO 'thePlayer' DATA. local resultTick = getTickCount() - mineTick -- GET HOW MUCH TIME HAS PASSED SINCE THE RESOURCE STARTED FOR THE PLAYER outputChatBox( resultTick, thePlayer ) -- PRINT INTO THE CHAT THE RESULT end addCommandHandler( "mytime", handleCMD ) -- IN CASE YOU WANT TO TRY IT SAVE THE CODE WITH THE NAME MARKED ABOVE THEM. [[--META.XML--]] <meta> <script src="server.lua" type="server"/> <script src="client.lua" type="client"/> </meta> Events, this method is the one that elementData's one bases on, which means this is a 'rawer' method which can also be faster than elementData if it's being used efficiently. An event is just a message that's being send to one or various systems, if these systems handle the message then when the message is sent to the system there's a trigger which calls the functions that are defined like a reaction to that message that has been sent. It's pretty easy to understand, just think of this. You say hello to someone, the message in this case is 'Hello' and the system where is pointed to mainly is the person, the person gets the message and handles it by calling some cognitive functions, these functions at their time trigger another message as result which in the most common case would be 'Hello' or just a strange face motion because he or she doesn't know you. Maybe you will ask yourself about what does a hello to someone have to do with Events in MTA. Well let's convert the situation above into script. We've got to define first the message by using addEvent( "Hello" ), good we have defined our message, but if we stop here then we have made some useless stuff that's not going to be used ever, that's why we have to use this message somewhere and here is when we simulate the action of saying something the message by using triggerEvent( "Hello" ) but... wait who's supposed to say the message? Let's make it look like the localPlayer was saying the message so it would be like triggerEvent( "Hello", localPlayer ), okay we have said the message but do we talk alone? Maybe but it's not pretty normal, so we must find a receptor which in this case will be a ped so we add the a ped to the game by using createPed( 0, 105, 20, 5.5 ) supposing we are located in the position 104, 20, 5.5. Okay we have the receptor now but it won't answer to our message so let's obligate him to answer us by adding a handler for the message to the ped like this addEventHandler( "Hello", thePed ), okay but this way it will do the same as we wouldn't have used addEventHandler that's why we need to pass also a function to call like an argument which in this case is going to be called 'answerToHello' and we would finish up with addEventHandler( "Hello", thePed, answerToHello ). All this and little bit more of code below for simulating an answer to hello from a person in a non-realistic way. [[--CLIENT--]] -- EVENTS addEvent( "Hello", false ) -- LET'S MAKE IT LIKE JUST THE CLIENT CAN TRIGGER IT SO WE MAKE SURE JUST WE ARE GOING TO TALK TO THE PED -- VARIABLES local thePed = createPed( 0, 105, 20, 5.5 ) -- WE ADD THE PED SO WE DON'T FEEL LONELY -- FUNCTIONS -- SAY HELLO local function sayHello() -- THIS FUNCTION WILL BE USED TO SEND UP THE MESSAGE TO THE PED triggerEvent( "Hello", thePed ) -- WE SAY HELLO TO THE PED end -- ANSWER local function answerToHello() -- WE DEFINE THE MESSAGE HANDLER SO WE MAKE SURE THE PED ANSWERS TO US outputChatBox( "Hello to you too!" ) -- THE PED GET'S THE MESSAGE AND GIVES US BACK A MESSAGE THAT WE CAN CHECK INTO THE CHAT. end -- COMMANDS addCommandHandler( "sayit", sayHello ) -- WE'VE GOT TO SAY SOMEHOW HELLO TO THE PED SO LET'S USE A COMMAND -- EVENT HANDLERS addEventHandler( "Hello", thePed, answerToHello ) 3. Optimization tips. Well both methods can be used in large development but there are some tips you can follow to make sure your script will run in an efficient way. Pack reasonable amount of data into one's element data key, don't save values like ( health, armor, money ) into different keys, compress them into an only one by using tables, by using this method we pass 3 values packed in one sync meanwhile separating each value with one key creates upon 3 different syncs which would end up in a greater amount of packets sent between the server and the client. This tip can be used for both methods [ elementData, Events ]. local basic_data = { health = 100, armor = 100, money = 100 } -- COMPRESSED PLAYER INFO setElementData( thePlayer, "main", basic_data, true ) -- WE GIVE 3 DIFFERENT VALUES TO 'main' KEY BY USING JUST A VARIABLE THAT'S A TABLE 'basic_data' triggerClientEvent( thePlayer, "onSync", thePlayer, basic_data ) -- WE SEND A MESSAGE TO THE CLIENT IN ORDER TO MAKE IT SYNC THE DATA OF THE PLAYER TO THE ONE THAT IS BEING STORED IN THE SERVER Lua is a garbage collection language so the reduce the amount of global variables as much as possible in order to make it run faster. Hope you enjoyed the tutorial, if you have any question just feel free to ask it in this post or by PM, Skype ( killer.68x ) or Email ( [email protected] ) or Discord ( Simple01#1106 ).
- 8 replies
-
- 8
-
- elementdata
- events
-
(and 1 more)
Tagged with:
-
hello every one , well im new at mta forum as i said in the first topic of myn so i created a server just to have fun so the name of the server is : [UGW] UnderGround World Events/Drift/Maps/RealRoads/Fun/Honda/BMW/Stunt/Mods+100 mtasa://46.105.250.205:26026 the main topic :
-
[Alright, first of all: I just joined the Forums, so if i do anything wrong, just tell me.] Ok, so i got a problem, it's about an event i want to trigger on a certain amount of zombie's, or on a certain timer, that's all fine and such.. But, i want to merge some event's into a resource called "zombies", like the 'onZombieWasted' event, but then for a seperated Event, What i mean with that is i want to have a new 'onNemesisWasted' event working together with the 'onZombieWasted', but they need to sync up with the (if possible exported) createZombie function from the "zombies" resource. And i am aiming to make it to a elementData trigger, that i locally created as for example: local Nemesis = export.zombies:createZombie(etc,etc..), So when i check for that element's data on the name 'Nemesis' by existence (as in: if ( isElement ( Nemesis ) ) then) and in combination on the 'onNemesisWasted'- event to check if that export of createZombie (ped works aswel) is dead or not, after all of that if the createZombie (ped) is actually dead, then i wan't it to trigger the reward system together with the other piece's of code. To clear out this idea and problem, i also recorded the ZTown Nemesis Event Script and also post the 2 main scripts that hold me from finishing the Nemesis: The Video of me, quickly explaining what, how, and showing the problem: "youtube" And the 2 script's, there both Server-Side, The Nemesis.lua is changed to test it's functionality and quick testing, but feel free to change the code and re-post it here to function with 'onNemesisWasted' additions!.. the first setTimer(function() is there to prevent complication problems from other zombie resource's and scripts, just delaying it for better run's. Also, the second setTimer(function() is just to delay it's Blip creation and Attaching to prevent the Blip not being attached to the createZombie named nemesis. Nemesis.lua (start/event): function nemesisON() setTimer(function() if ( not isElement ( Nemesis ) ) then local nemesis = exports.zombies:createZombie ( 2343, 57, 26.5, 90, 38, 0, 0, nemesis, 0, "hunting", true ) setPedHeadless(nemesis, true) exports.extrahealth:setElementExtraHealth ( nemesis, 150 ) setElementData ( nemesis, "nemesis", true ) setTimer(function() myBlip = createBlipAttachedTo ( nemesis, 23 ) outputChatBox ('#FFFFFF[#7CFC00ZTown#FFFFFF]: #00BFFF A #00FFFFNemesis #00BFFFHas been spawned inside ZTown! #FFFFFF(#7CFC00Nemesis Boss Event#FFFFFF)', root, 255, 255, 255, true) triggerClientEvent(root, "event", root, "start") end,2500,1) end end,2500,1) end addEventHandler ( "onResourceStart", getRootElement(), nemesisON) monemesi.lua (check/reward): addEvent ( "onNemesisWasted", true ) addEventHandler ( "onNemesisWasted", root, function ( killer ) if ( isElement ( Nemesis ) ) then givePlayerMoney(killer,math.random(5000,25000)) killer = getPlayerName(killer) destroyElement ( myBlip ) outputChatBox ('#FFFFFF[#7CFC00ZTown#FFFFFF]: #00BFFF The #00FFFFNemesis #00BFFFHas been killed! #FFFFFF(#7CFC00Nemesis-Boss Event#FFFFFF)', root, 255, 255, 255, true) triggerClientEvent(root, "event", root, "stop") end end ) I hope sombady could find a way to make this function correctly, because i have try'ed loads of ways, and the way to use slothbot together with zombies resource... nahh, won't work, they wil keep fighting together like d*cks. EDIT: if ( isElement ( Nemesis ) ) = nemesis, i already changed that, but right after i posted it, derp.. Gr.xboxxxxd
-
بسم الله الرحمن الرحيم السلام عليكم ورحمة الله وبركاته اليوم سأشرح لكم الأحداث ماهي الأحداث؟ الأحداث هي نظام تم برمجة لتشغيل الوظائف عندما يحدث شيء مثل دخول الاعب الماركر او دخول الاعب السيرفر والخ... يتم ربط هذا النظام في نظام الالمنت كيفية استخدام هذا النظام؟ addEventHandler لكي تقوم باستخدام هذا النظام عليك اولا ربط الوظيفة في الاعب عند طريق وعند القيام بذلك سوف تقوم الوظيفة بعملها على الالمنت المربوط بالوظيفة children, parent لكن عندما يكون الالمنت لديه صلة بالمنت اخر سواء كان سوف اشرح هذه الصلة في درس اخر عند استقبال حدث ما يتم تعريف متغيرات مخفية وهذه هي قائمة المتغيرات source : مصدر الحدث وهو الالمنت الذي تم ربط الحدث به eventName : (onPlayerQuit)اسم الحدث مثل this : الالمنت الذي تم ربطه بالوظيفة المستقبلة للحدث جميع الوظائف أعلاه بجانب السيرفر والكلنت وهناك ايضا متغير مخفي فقط في السيرفر client : هو الاعب الذي تم ارسال الحدث من جهته انتهينا من المتغيرات المخفية الآن ننتقل الى العوامل في الوظيفة المستقبلة ليس هناك نوع محدد من العوامل لكن لكل وظيفة عوامله الخاصة إذا كيف اقوم بمعرفة العوامل في الحدث paramaters اذهب إلى صفحة الويكي الخاصة بالحدث وقم بإيجاد قسم كما بالصورة التالية بالصورة تجد العوامل محددة بالمربع الأحمر ملاحظة : قد لا يوجد عوامل في بعض الاحداث لذا راجع الويكي لكي تعرف الوظيفة إذا لننتقل إلى المرحلة التالية هناك نوعين من الأحداث نوع مخصص مسبقا اي انه لا داعي لتشغيله - نوع يتم تخصيصه برمجياً اي أنه يتم تشغيه - كيفية استخدام النوع الأول أولا عليك معرفة الحدث اللي تريد استخدامه والذي خصصه فريق ام تي اي للاستخدام تجدها هنا https://wiki.multitheftauto.com/wiki/Client_Scripting_Events https://wiki.multitheftauto.com/wiki/Server_Scripting_Events النوع الأول مخصص للكلنت والنوع الثاني مخصص للسيرفر الآن سنشرح كيف تقوم باستقبال حدث addEventHandlerلكي نقوم بإستقبال حدث ما علينا استخدام علينا ان نشرح كيف نقوم بتركيب الجملة لدى هذه الوظيفة bool addEventHandler ( string eventName, element attachedTo, function handlerFunction, [ bool getPropagated = true, string priority = "normal" ] ) الارقمنات المطلوبة eventName: اسم الحدث المراد استقباله attachedTo: الالمنت المراد ربطه باستقبال هذا الحدث مثلا اذا كنت تريد للاعب محدد دخول ماركر يجب عليك وضعه هنا لكي يقوم باستقبال (root)الحدث لدى هذا الاعب فقط واذا كنت تريد لجميع الاعب استخدم الالمنت العام handlerFunction: الوظيفة المراد تشغيلها عند استقبال هذا الحدث الارقمنات الاختيارية getPropagated: اذا كنت تريد تشغيل هذا الحدث لدى جميع فروع هذا الالمنت ضعها قيمة صحيحة واذا كنت تريد ضعها خاطئة سأشرحها في درس أخر priority : أولية استقبال هذا الحدث اذا كان هناك حدث تريد استقباله بنفس الطريقة وتريد ان يبدا مثلا باستقبال هذا اولاً وهكذا هناك قيم عليك وضعها ولكل منها عمل خاص "high" "normal" "low" ويمكن وضعها بارقام مثلا low-999 high-999 low+999 اي قيمة رقم لكن يجب ان تكون ال- او + لاغير والآن شرحنا كيفية تركيب الجملة وهكذا onPlayerQuitلنختار حدث (هذا الحدث يقوم بالعمل اذا الاعب خرج من السيرفر(اي لاعب لكي نقوم باستقبال هذا الحدث ومعرفة من خرج من السيرفر يجب استخدام وظيفة addEventHandler("onPlayerQuit", root, function(quitType, reason, responsibleElement) outputChatBox(getPlayerName(source)) -- نقوم بكتابة اسم الاعب اللي خرج -- outputChatBox : اخراج نص بالشات -- getPlayerName : احضار اسم لاعب ما -- source : مصدر الحدث وهو الاعب الذي خرج من السيرفر outputChatBox(quitType) -- كتابة سبب الخروج بالشات if reason then -- نقوم بالتحقق ان هناك سبب outputChatBox(reason) -- كتابة سبب الخروج بالشات -- reason : هو سبب اعطاء الكيك او الباند، سوف يعطيك قيمة فولس اذا كان نوع الخروج ليس باند او كيك end if isElement(responsibleElement) and getElementType(responsibleElement) == "player" then -- نتحقق ان الالمنت اللذي قام بإعطاء كيك او باند لاعب ان نوعه هو لاعب outputChatBox(responsibleElement) --(الشاشة السوداء او اف 8) كتابة الاعب الذي قام بإعطاء الاعب كيك او باند قد يكون كونسل -- لكن نحن تحققنا مسبقاً انه لاعب end end) الآن شرحنا كيفية استخدام النوع الأول الآن النوع الثاني مالفائدة من النوع الأول؟ الفائدة تكمن اذا كنت تريد ارسال حدث خاص بك الى السيرفر او الكلنت او الجهة نفسها اللي تم ارسالها منها ولك مثال مشهور جدا وهو لوحة التسجيل لكي تقوم بعمل لوحة تسجيل عليك استخدام لوحة بالكلنت وتسجيل الدخول بالسيرفركيف اقوم بالربط؟ نعم نعم هذه هي الفائدة منها كيف الاستخدام؟ لكي تقوم بارسال حدث يجب عليك استخدام الوظائف الثانية triggerServerEvent : وظيفة تقوم بتشغيل الحدث من جهة الكلنت الى السيرفر اي لايمكن استخدامها الا بالكلنت bool triggerServerEvent ( string event, element theElement, [arguments...] ) الارقمنات المطلوبة event : اسم الحدث المراد تشغيله theElement : الالمنت هو مصدر الحدث(السورس) الارقمنات الاختيارية arguments : العوامل المراد ارفاقه مع الحدث انظر الشرح فوق لتفهم triggerClientEvent : وظيفة تقوم بتشغيل الحدث من السيرفر الى الكلنت وايضا هي وظيفة سيرفر اي لايمكن تشغيلها الا بالسيرفر bool triggerClientEvent ( [table/element sendTo=getRootElement()], string name, element sourceElement, [arguments...] ) sendTo: القيمة الافتراضية لهذا الارقمنت هو الروت واذا كنت تريد لاعب محدد ترسل اليه الترايقر ضع هذا الاعب وهكذا واذا كنت تريد وضع لاعبين محددين ضع جدول به الاعب وضعه بهذا الارقمنت (ارقمنت اختياري طبعاً) name : اسم الحدث المراد تشغيله بالكلنت sourceElement : مصدر او سورس هذا الحدث arguments : العوامل المراد ارفاقه مع الحدث انظر الشرح فوق لتفهم اختيارية طبعاً triggerEvent : تقوم هذه الوظيفة بتشغيل حدث من الجهة نفسها اي انه اذا تم تشغيلها ممن السيرفر يتم استقبالها بالسيرفر وههكذا ويعني انها وظيفة بكلها الجانبين سيرفر والكلنت لكن الاستقبال بنفس الجهة bool triggerEvent ( string eventName, element baseElement, [ var argument1, ... ] ) eventName : اسم الحدث المراد تشغيله baseElement : مصدر او سورس هذا الحدث , [ var argument1, ... ] : العوامل المراد ارفاقه مع الحدث انظر الشرح فوق لتفهم اختيارية طبعاً الآن نريد ان نعطيك مثال مثلا نريد ان نرسل حدث يقوم بالتأكد أن اي مود انتهى تحميله او لا اولا يجب وضع الكود الذي يقوم بارسال هذا الحدث الى السيرفر addEventHandler("onClientResourceStart", root, function(res) -- استقبال حدث اذا المود اشتغل triggerServerEvent("onPlayerClientResourceLoaded", localPlayer, res) -- ارسال حدث حدث ليتم استقباله بالسيرفر end) الآن نستقبله جانب السيرفر لكن لم اشرح كيف اقوم بتسجيل هذا الحدث بقائمة الأحداث طبعا سنحتاج وظيفة addEvent يتبع...
-
Hi there. I interesting the one of important question. When I want to get getPedVehicleOccupied, what' will be more better with a performance side? To check every frame with onClientRender event if player are in a vehicle (getPedVehicleOccupied)? Or set events like a onClientVehicleEnter/Exit, onClientResourceStart etc. and check getPedVehicleOccupied only in those events?