Jump to content

Lawliet

Members
  • Posts

    87
  • Joined

  • Last visited

Everything posted by Lawliet

  1. Oh. My. God. This is just what we needed. Thanks a lot! Means I can finally rework the stamina system for our DayZ server.
  2. What exactly does "script" mean in this regard? Is it a resource you can enable/disable at any time or is it a third party program which exclusively targets MTA DayZ? Also, what exactly is said script trying to accomplish? Do I have to worry about compromised passwords, usernames, resources etc? Is this announcement an extension to this post by Woovie? EDIT: I see that Woovie has already answered my questions. We never used that particular resource, so we don't have to worry about anything...but rest assured, we will still update to the latest version once it's available for us.
  3. I'd be glad to help, just shoot me a private message.
  4. Tried that. Now the immense lag is gone - what remains is that the character is still not holding the corresponding weapon. New code (slightly edited): function loadModels() weapontxd1 = engineLoadTXD ("mods/fnfal.txd"); weapondff1 = engineLoadDFF ("mods/fnfal.dff", 0); weapontxd2 = engineLoadTXD ("mods/g36c.txd"); weapondff2 = engineLoadDFF ("mods/g36c.dff", 0); end addEventHandler("onClientResourceStart",root,loadModels) function onClientPlayerSkinChange() if getElementData(localPlayer,"currentweapon_1") == "FN FAL" then engineImportTXD (weapontxd1, 355); engineReplaceModel (weapondff1, 355); elseif getElementData(localPlayer,"currentweapon_1") == "G36C" then engineImportTXD (weapontxd2, 355); engineReplaceModel (weapondff2, 355); elseif getElementData(localPlayer,"currentweapon_1") == "AK-47" then engineRestoreModel(355) else engineRestoreModel(355) end end addEventHandler("onClientPlayerWeaponSwitch",localPlayer,onClientPlayerSkinChange) I can switch the weapon one time, but then, it simply stops. I am only able to use my fists then. Debugscript 3 doesn't output anything either.
  5. So I've been trying to make the same weapon (AK-47) have two different skins, depending on what weapon the player has (assigned via setElementData). Here's the code (clientside only): function onClientPlayerSkinChange() if getElementData(localPlayer,"currentweapon_1") == "FN FAL" then weapontxd = engineLoadTXD ("mods/fnfal.txd"); engineImportTXD (weapontxd, 355); weapondff = engineLoadDFF ("mods/fnfal.dff", 355); engineReplaceModel (weapondff, 355); elseif getElementData(localPlayer,"currentweapon_1") == "G36C" then weapontxd = engineLoadTXD ("mods/g36c.txd"); engineImportTXD (weapontxd, 355); weapondff = engineLoadDFF ("mods/g36c.dff", 355); engineReplaceModel (weapondff, 355); elseif getElementData(localPlayer,"currentweapon_1") == "AK-47" then engineRestoreModel(355) else return end end addEventHandler("onClientPlayerWeaponSwitch",localPlayer,onClientPlayerSkinChange) I can't really tell if the code works...because the game starts to massively lag when switching between weapons, and even though the player has the weapon equipped (checked with getPedWeapon), he doesn't hold it in his hand. Could it be a bug with "onClientPlayerWeaponSwitch"? Another attempt I made was to do it via a timer...but the character is "spazing" out and you can't properly aim (obviously, because the skin gets changed every X seconds), so that's a failure. I tried to use killTimer, but the skin didn't change at all...though it can be assumed that I did it wrong, somehow. My question now is: Does anyone have any idea how to let the same weapon have different skins? It doesn't matter if other players perceive the weapon as something entirely different, I just want to know if there is a way. Also, while we are at it: I assume it is not possible to let skins change "locally" and "globally"? Locally would mean only the client would see the changed skin, while other players would just see a normal/standard weapons, and globally means the skin changes for every player who has the weapon equipped.
  6. Please don't help this person, he/she acquired the gamemode by illegal means (= didn't buy it from the developer). In case you didn't realize: it's me, L.
  7. It's not much of an issue if it cannot be prevented in the first place, simply stopping the player from using it is more than sufficient for the intended purpose. Resetting the state of the player might be a good idea - I could use a function which checks the player's speed, and if it surpasses a certain amount, the player will be put into a static animation...that could work out. Thanks for "inspirating" me, I'll see what I can do about that. Suggestions are still more than welcome, though.
  8. I would care - it's not like I want to punish those who are powersprinting, I want to prevent it from the beginning. A punishing system is not needed. However, I nevertheless appreciate your willingness to help me out.
  9. Uh, not sure how many taps you need, however, tapping twice in succession usually triggers powersprint. Continue to quickly tap, and you will powersprint ad infinitum (in MTA). Note that not everyone has spacebar as their sprint button, so you might need a function which checks what key the player is using for "sprint".
  10. Bumping this topic, I really need to know how to solve this particular issue.
  11. How would such a function look like? As I said, I'm rather new, so something like that might go above my current level of knowledge.
  12. I'd like to know how one can disable the powersprinting in MTA. For those who do not know what powersprinting is: you powersprint by repeatedly smashing your sprint button. The "stamina" stat you could use needs a special activation flag, but I'm rather new in the "ways" of LUA, so I don't know what "flag" means in this regard. I tried SolidSnake's code snippet... stamina = 10 addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), function () stamina = 10 setTimer(checkKey,700,0) setTimer(updateStamina,1000,0) end) function checkKey() if ( getControlState ( "sprint" ) ) and stamina ~= 0 then stamina = stamina -1 end if ( stamina == 0 ) then setControlState( "sprint", false ) end end function updateStamina() if stamina ~= 10 and getControlState ( "sprint" ) == false then stamina = stamina +1 end end ...however, this only disables the normal sprinting - you can still powersprint even when out of stamina, and that's not exactly what I want. I wrote a small function which checks my movestate every 2 seconds and displays it in chat, and the state seems to be "sprint". Toggling the control won't help either, as a similiar problem arises: While you cannot powersprint anymore when out of stamina, once you regain some, you can again do it, and that continuously, regardless of how high your stamina value is. Recap: - The aforementioned code only disables normal sprint, not powersprint - Toggling controls disables both normal sprint and powersprint, but only until you regain stamina, in which case you can then powersprint, no matter how high your stamina was to that point Is there any way to prevent players from continuously powersprinting?
×
×
  • Create New...