-
Posts
1,423 -
Joined
-
Last visited
-
Days Won
19
Everything posted by Tekken
-
You may show the code?
-
[HELP] need help with exp when i kill player
Tekken replied to Trust aka Tiffergan's topic in Scripting
You misunderstand the using of the event system Try this, if this is not working reply me with the name of the gamemode you're using. local xpNeed = 100; -- E.g. 100 * lvl = XP you need to rank up! addEvent("onPlayerLevelUp", true); -- addEvent("onZombieGetsKilled", true) you do't need to add the event here as this event is already added in the dayz gamemode function addPlayerXp(player, xp) local acc = getPlayerAccount(player); local oldexp = getAccountData(acc, "exp") or 0; local oldlvl = getAccountData(acc, "lvl") or 1; local newlevel = oldlvl + 1; local newexp = oldexp + xp; setAccountData(acc, "exp", newexp); setElementData(player, "exp", newexp); if (newexp >= (oldlvl * xpNeed)) then outputChatBox("[Level-Up] Congratulations! New level "..newlevel.."!", player, 66, 134, 244); setAccountData(acc, "lvl", newlevel); setAccountData(acc, "exp", 0); setElementData(player, "exp", 0); setElementData(player, "lvl", newlevel); triggerEvent("onPlayerLevelUp", player, newlevel); end end addEventHandler("onPlayerLogin", root, function() local acc = getPlayerAccount(source); setElementData(source, "lvl", getAccountData(acc, "lvl") or 0); setElementData(source, "exp", getAccountData(acc, "exp") or 0); end); function rewardOnWasted ( killer ) -- local exp = getElementData(killer,"exp") -- local thelvl = getElementData(killer, "lvl") or 0; -- local theexp = getElementData(killer, "exp") or 0; -- if exp then --setElementData(killer,"exp",tonumber(getElementData(killer,"exp"))+50) if killer then addPlayerXp(killer, 50) --outputChatBox("Experience gained +50! total ".. tostring(((thelvl + 1) * xpNeed) - theexp -50).."!", killer ) --you normally don't need this as you have the client syde to show that end -- else -- setElementData(killer,"exp",50) -- end end --addEvent("onZombieGetsKilled", true) addEventHandler("onZombieGetsKilled", getRootElement(), rewardOnWasted) function rewardOnWasted1 ( killer1) --if there is a killer, and that killer is not the same person as whoever died if ( killer1 ) and ( killer1 ~= source ) and getElementType(killer1) == "player" then -- setElementData(killer1,"exp",tonumber(getElementData(killer1,"exp"))+50) addPlayerXp(killer1, 50) -- outputChatBox("Experience gained +50! total ".. tostring(((thelvl + 1) * xpNeed) - theexp -50)) else setElementData(killer1,"exp",50) end end -- addEvent("killDayZPlayer", true) same for this one! addEventHandler ( "killDayZPlayer", getRootElement(), rewardOnWasted1 ) --attach the rewardOnWasted function to the relevant event You may delete the comments as I let them there just so you know the mistakes you done. Greetings. -
But why shared will not work?
-
So I'm interested into replacing element data functions to more efficient store data into tables but with this comes a problem, syncing the data between client and server so I taught of creating a shared Lua file and building the system there so in this way the functions will work both client/server. But will this work? Or should I use a make around with the event system?
-
You may try using colshapes https://wiki.multitheftauto.com/wiki/Element/Collision_shape
-
Also I have already told you, you can't check a player position like that, try using getDistanceBetweenPoints3D local x,y,z = getElementPosition(player); local tx,ty,tz = 1554.2001953125, -1675.599609375, 15.199999809265; if getDistanceBetweenPoints3D(x,y,z,tx,ty,tz) <= 1 then -- do something end
-
Well in this case you may try an interior system, there are plenty on the community. https://community.multitheftauto.com/
-
@majqq What about the peds that are managed by slothbot? As those ones have continuos animations and those interpolates. @IIYAMA I don't see how this will work? I tried like this but that does nothing besides letting the ped pass through the vehicle for a fraction of a second. addEventHandler("onClientVehicleCollision", root, function(hitElement) if hitElement and getElementType(hitElement) == "ped" then setElementCollidableWith(source, hitElement, false); setTimer(setElementCollidableWith, 1000, 1, source, hitElement, true); end end); Hold on, it may be because I have canceled the event onClientPedDamage could it? Yes indeed this was a misconception of onClientPedDamage thank you guys anyway!
-
So in my server I have a lots of peds but when I try to drive them over they do nothing but blocking the car. How can I do that they tumbles down?
-
1 localPlayer is for the client side 2 It't almost impossible to check a position like that, you may try getDistanceBetweenPoints3D
-
Poti incerca Dar te anunt de acum, nu exista nicio modalitate usoara. Succes.
-
I think it has something to do with guiSetProperty
-
@IIYAMA will you make a simple example as I don't really understand the idea, thank you.
-
Cu placere local unallowedVeh = {422, 514, 674}; addEventHandler("onVehicleStartEnter", root, function(player) local model = getElementModel(source); for _,id in ipairs(unallowedVeh) do if (model == id) then if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then outputChatBox("You are not allowed to use this vehicle!", 255, 0, 0); cancelEvent(); end end end end);
-
Copy/Paste the exact line 339
-
Un script sincer n-am timp sa-l fac, insa te invit sa inverci, ai nevoie de Eventul : 'onPlayerVehicleEnter' Functii: isObjectInAclGroup Si daca te uiti pe wiki la isObjectInAclGroup ai un exemplu te poti Lua dupa el. Succes.
-
O mica eroare tin sa rectific deoarece nu pot modifica postul, prin acest reply, este ca Zday este de fapt un gamemode facut de Slothman si nu de Zorgman. Mersi Zorgman pentru precizie.
-
Wow, stai linistit nu ma sperie pe mine cineva care vine sa arunce cu kkt ca de'..., insa ma bucura faptul ca exista moderatori inca prezenti si activi pe comunitatea romaneasca de MTA. Serverul din pacate nu mai este activ din lipsa de jucatori, nu mai am timp sa "il fac cunoscut" asa ca, cred eu lumea nu stie de existenta lui, iar jucatorii nu vin sa caute servere aici pe forumuri. Gamemodu pentru cei care sunt in dubii este o versiune veche a originalului MTA DayZ 0.6 + Zday by zorgman modificate de mine la maxim cu foarte multe inbunatatiri si bug fix-uri MTA:DayZ 0. Source Code! pentru cunoscatori. Da intradevar contine ceva ramasite de la RoZ si cateva moduri de pe comunitate, iar skinurile va spun de pe acum ca nu eu le-am facut, insa chiar si asa toate astea is modificate atat de mult de mine incat nu mai au practic nicio legatura cu orginalele. Chiar daca nu sunt sigur ca o sa il mai deschid serverul, va las aici un mic istoric cu ce vreau sa mai aduc pe server (care probabil va fi lansat ca open source/free to download pe comunitate): Toate mesajele vor fi afisate in dreapta jos, in acest mod pe chat vom vedea doar discutiile. Imbunatatit AI zombii (recunosc ca aici ma autoprovoc umpic dar na..) CJ skin customizabil. (Da stiu prea TOP-GTA, da ce sa fac daca nesimtitii astia s-au gandit inainte-a mea) Basebuilding (Garaje, Hangare sau hambare pe care veti putea sa le customizatii la interior desigur cu vesnica protectie inbunatatita) Sistemul de Login inbunatatit cu password recovery. Multumesc pentru timpul acordat.
-
Mic update -17.02.2020 IP: 91.134.166.72:1112 + 500$ Pentru primii 50 de jucatori inregistrati!
-
Update - Server deschis 12/02/20 Va asteptam!
-
Custom weapons nu e o resursa e un ansamblu de functii si moduri, eu l am implementat in gamemode si pentru tine cred ca e destul de dificil daca nu chiar imposibil sa-l "scoti", daca nu stii cu ce te joci iti recomand sa nu atingi, insa cred doar ca ai sters sau inlocuit in folderul DayZ\mods\weapons alpha.dff/.txd, incearca sa le recuperezi dintr-un backup. Daca ai alte intrebari.
-
Delete the for loop I think you have an outdated version. This part of the code: for _,v in ipairs(playerDataTable) do if (type(getElementData(player, v[1])) ~= type(v[2])) then removeBackpack(player); removeWeaponBack(player); removeWeaponBack2(player); removeWeaponReplace(player); spawnDayZPlayer(player); outputChatBox(getPlayerName(player).."'s account is buggy and has been reset.", getRootElement(), 25, 255, 25); end end Also just to ensure that everything is right delete internal.db