Jump to content

Saml1er

Retired Staff
  • Posts

    1,058
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Saml1er

  1. Saml1er

    Error Netc.dll

    The problem seems to lie on MTA's side. You have to wait for 1-2 days for the patch.
  2. Saml1er

    i have problems

    Yes, create a new topic here: https://forum.multitheftauto.com/forum/83-client/
  3. Saml1er

    Help !!!!!!!!!!

    Please check: You can download malwarebytes from here for free. Once you've scanned your computer for viruses and deleted them, then you can try reinstalling mta from mtasa.com.
  4. Saml1er

    i have problems

    can you please scan your computer for viruses? You can download malwarebytes for free.
  5. can you please post the entire message here or take a screenshot?
  6. Have you specified script type to client for client.lua in meta.xml?
  7. Tutorials on youtube are usually easy to follow, you can search Lua tutorials there. It's gonna take you a couple of months to get started, if you invest some time, you'll see the result.
  8. You no longer have to follow the steps in the original post, instead you can download latest nightly from: nightly.multitheftauto.com, it has all the latest IFP functions. You can also check the wiki. https://wiki.multitheftauto.com/wiki/EngineLoadIFP https://wiki.multitheftauto.com/wiki/EngineRestoreAnimation https://wiki.multitheftauto.com/wiki/EngineReplaceAnimation
  9. He messaged me that he solved the problem, although never mentions how.
  10. Server owners can also set client scripts cache to false. In this way, scripts will be downloaded and directly executed instead of being saved on the client. <script src="client.lua" type="client" cache="false"/> As Jusonex mentioned about luac.multitheftauto.com, it's not fully secure because scripts must be deobfuscated before loading them for execution. Anyone that understands reversing can copy the logic from MTA's binaries and create their own "decompiler".
  11. Looks like more related to the script rather than MTA. Loading your cheats to MTA is far more difficult than you can imagine.
  12. The code SP3CTR3 gave you is correct, you'll just need to change resourceRoot to root. Only buggy code will not work. Test it
  13. addEventHandler("onPedWasted", resourceRoot, deanimated) Why do you have resourceRoot in there? since you put resourceRoot in there, it means if a zombie is created by any other resource, that kill won't be counted. To fix this, just replace resourceRoot with root, like this: addEventHandler("onPedWasted", root, deanimated) I understand, you were able to fix this problem by checking damage, but that's not something you should rely on. onPedWasted is the right event for this.
  14. The process you call converting, requires you to rewrite the entire script, and I doubt if you'll be able to do it fast, although you can if you understand cleo scripting. There's no easy way around this.
  15. That won't work. You cannot run MTA's Lua scripts in GTA San Andreas. Although, it is possible to use cleo scripting for MTA, but you won't have that much freedom because it has some limitations.
  16. Your code looks fine to me, how about you test this code: addEvent("onZombieWasted",true) addEventHandler("onZombieWasted",root, function (attacker) outputChatBox ("onZombieWasted event triggered, attacker is: "..getPlayerName(attacker)) givePlayerMoney(attacker,math.random(75,150)) -- default 50$ end) function deanimated( ammo, attacker, weapon, bodypart ) if (attacker) then if (getElementType ( attacker ) == "player") and (getElementType ( source ) == "ped") then if (getElementData (source, "zombie") == true) then local oldZcount = getElementData ( attacker, "Zombie kills" ) if oldZcount ~= false then setElementData ( attacker, "Zombie kills", oldZcount+1 ) else setElementData ( attacker, "Zombie kills", 1 ) end outputChatBox ("Triggering onZombieWasted event now") triggerEvent ( "onZombieWasted", source, attacker, weapon, bodypart ) end end else outputChatBox ("Ped died without an attacker") end end addEventHandler("onPedWasted", resourceRoot, deanimated) When you kill a zombie, does it say "Ped died without an attacker..."? Also, you might want to check SP3CTR3's code.
  17. local staffACLGroup = "admin" -- you can change this to whatever acl group you want local playerAccount = getPlayerAccount(thePlayer) -- you need to pass the player object here if (isGuestAccount(playerAccount) == false) then local accountName = getAccountName (playerAccount) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( staffACLGroup ) ) then -- your code here end end You can use ACL functions.
  18. Saml1er

    help me

    can you please rephrase what you said? Also, when you output the message, if you don't want to do something else with the player then break the loop, like this: if ( getPlayerSerial ( v ) == mySerial ) then local TeamName = getTeamName ( getPlayerTeam(source) ) local r, g, b = getTeamColor ( getPlayerTeam(source) ) outputChatBox("("..TeamName..") "..getPlayerName(source)..":#FFFFFF "..message.."",v,r,g,b,true) break -- this will break the loop end
  19. Ah, yes, that's what you're supposed to use. I totally forgot about split function
  20. I haven't added that part, it doesn't modify player health after receiving damage. It just keeps track of how much damage was caused to each body part, like I said, it's just an example of how to handle damage. You'll need to create an event which detects zombies damage, there's no server side event, this means you'll need a client (player) to trigger a server side event that you'll create. You can gracefully use onClientPedDamage event on client side to trigger your server side event for detecting damage: client side: addEventHandler ( "onClientPedDamage", root, function ( attacker, weapon, bodypart ) -- here we check if the attacker is localPlayer, so we don't trigger -- the server side event for all players on server if getElementType ( source ) == "ped" and attacker == localPlayer then if (getElementData (source, "zombie") == true) then triggerServerEvent ("onZombieDamage", resourceRoot, source, attacker, weapon, bodypart ) end end end ) server side: local weaponTable = { -- populate this list by adding weapons: -- [weap_id] = { torso, ass, left_arm, right_arm, left_leg, right_leg, head } [24] = { 5, 8, 5, 8, 9, 4, 5 }, } addEvent( "onZombieDamage", true ) function Zheadhit ( ped,attacker, weapon, bodypart) if (getElementData (ped, "zombie") == true) then -- here you need to decide how much damage to give, I'm not quite sure if this line of code works -- but that's something you need to check local bodyPartsDamageTable = weaponTable[ getPedWeapon (attacker) ] if getElementType(attacker) == "player" and bodyPartsDamageTable then local damageMultiplier = bodyPartsDamageTable [ bodyPart - 2] setElementHealth ( ped, getElementHealth(ped) - (damageMultiplier * loss) ) end end end addEventHandler( "onZombieDamage", getRootElement(), Zheadhit ) EDIT: create two files, one for server, and other for client, then put this code in there, you have to make sure that they are within the same resource.
  21. Saml1er

    help me

    Color codes do not get translated because you have not enabled them. In order to enable color codes, you need to pass another argument (bool), which is true. bool outputChatBox ( string text [, element visibleTo = getRootElement(), int r = 231, int g = 217, int b = 176, bool colorCoded = false ] ) Take a look at the bool colorCoded, that's what's missing from your code, so we simply do this: outputChatBox("("..TeamName..") "..getPlayerName(source)..":#FFFFFF "..message.."",v,r,g,b, true) -- notice true here? that was missing from your code replace the outputChatBox line of code with this one, you should be able to see color coded text.
  22. I created something similar for a friend, a simple resource that loads settings from xml file, like how much damage each body part will take for every weapon. You can see how I did it: https://drive.google.com/file/d/10KC22xDZ9TkKYJQKoGiyVJ3oYzrLHkCz/view?usp=sharing before you start using it, just add this to main_server.lua at bottom of the file: addEventHandler ("onPlayerJoin", root, function () arrCPlayers [ source ] = CPlayer ( arrCBodyPartsCache ) end ) addEventHandler ("onPlayerQuit", root, function () arrCPlayers [ source ] = nil end ) I'm not a fan of loading data from xml files, I think they should be avoided if possible, because they can freeze your server for a few milliseconds if you have too much info in there, it's better to use a lua table for configuration data, like you did in your original post.
  23. Nice, I think it's a good habit to tell people how you were able to fix it, so in future other people can benefit from it. I don't know why you wanted to read it line by line, as you are dealing with a json file, you are meant to use: fromJSON toJSON fileRead function simply returns a string, you have to use lua string functions to detect lines by checking for the new line escape sequences "\n". Here's a simple example that prints all the lines in a string: local function getLineListFromString ( theString ) local lineList = {} local lineStartIndex = 1 for characterIndex = 1, string.len ( theString ) do if ( string.sub ( theString, characterIndex, characterIndex ) == "\n" ) then -- okay, we have a new line local lineEndIndex = characterIndex - 1 table.insert ( lineList, string.sub ( theString, lineStartIndex, lineEndIndex ) ) -- Now, we set the lineStartIndex after the new line escape sequence by -- assigning characterIndex to lineStartIndex, and then incrementing it by 1 -- for the next line lineStartIndex = characterIndex + 1 end end return lineList end local ourText = [[This is line 1 This is line 2 This is line 3 This is line 4 This is line 5 ]] local lineList = getLineListFromString ( ourText ) -- print all lines for i, line in ipairs ( lineList ) do outputChatBox ( line ) end Output: This is line 1 This is line 2 This is line 3 This is line 4 This is line 5
  24. MTA already has this feature, most servers don't seem to use it. Check the "voice" resource in server\mods\deathmatch\resources\[gameplay]. Fortunately, there's some good documentation on wiki about the resource: https://wiki.multitheftauto.com/wiki/Resource:Voice
×
×
  • Create New...