Jump to content

xeon17

Members
  • Posts

    1,903
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by xeon17

  1. That means the code you showed us above was never executed. That's because the function is not attached to any event handler. Try this code: addEventHandler("onResourceStart", resourceRoot, -- resourceRoot == the resource that just started (this resource) function () setWeaponProperty("minigun", "pro", "damage", 2) end)
  2. Do this, Login > open F8 > start runcode > srun getWeaponProperty("minigun", "pro", "damage") And tell me what it outputs.
  3. Is this the entire script? it the script server side in meta?
  4. nvm, fixed, thanks Bonsai
  5. Error: [string "if (#test[me] == 0) then print("empty") end"]:1: attempt to get length of field '?' (a boolean value)
  6. How do i know if a table row is empty? if(self.playerWeapons[player]) then for weapon,ammo in pairs(self.playerWeapons[player]) do player:giveWeapon(weapon, ammo, true) end else -- if empty (this does not work) self:setDefaultWeapons(player) end self.playerWeapons[player] = nil
  7. Making the perfect server without learning how to code? next joke pls
  8. xeon17

    Connection timed out

    Hello, I have a friend who is not able to play in my server. He cannot download the cache files for some reasons. MTADiag The error: Please someone help.
  9. Daj mu Megin broj telefona haha
  10. Moram se složiti sa ostalima. Na osnovu vaših prethodnih postova na forumu očekivao sam mnogo bolji server i više truda. Skripte koje koristite su mnogo loše optimizovane i ako vam server bude imao igrača koliko vi očekujete imaćete problem. Kad ste već odlučili da izmjenite već postojeći gamemode sa interneta trebali ste koristiti jedan koji nije ukraden. Pa bi ste mogli da oćekujete i pomoć na MTA forumu i vjerovatno bolju reakciju svih nas. Lua je veoma jednostavan jezik, za koji nije potrebno mnogo vremena a koji je istovremeno veoma efektivan.
  11. xeon17

    hacker on mta

    If he hacked you,then it's your fault. Get a anti-virus or stop downloading viruses from people.
  12. You can't cancel onPlayerJoin. Just show him the ban hud instead of the login if he's banned.
  13. Enable OOP or replace query with dbQuery <oop>true</oop>
  14. serverContainer.loginClient = function(user, pass) connection:query(function(result) local result = result:poll(0) for _,row in pairs(result) do local salt = row.salt local username = row.username local password = row.password print("Username: "..username..", Password: "..password.."") if salt and username and password then local newPass = md5(md5(salt):lower()..md5(pass):lower()):lower() if newPass == password then triggerClientEvent(source,'onClientSuccessfullyLogin',source) userData("success", player, user, pass) end end end end, "SELECT * FROM mybb_users WHERE username = ?", user) end addEvent('onClientLogins', true) addEventHandler('onClientLogins', root, serverContainer.loginClient)
  15. You must be kidding? Do you really expect us to know what is the name of your script?
  16. xeon17

    Help

    Enjoy addEvent("createMarker:Health", true); addEventHandler("createMarker:Health", root, function() if (source == client) then local x,y,z = getElementPosition(client) local marker = createMarker(x, y, z, "cylinder", 1.5, 255, 255, 255, 255) setElementInterior(marker, getElementInterior(client)) outputChatBox("[Server-Dragon] Player "..getPlayerName(client).." Has Been Create Marker at ("..math.floor(x)..","..math.floor(y)..","..math.floor(z)..").", root, 0, 255, 0, true); if (getPlayerTeam(client)) then setElementData(marker, "team", getTeamName(getPlayerTeam(client)), false) end setTimer(function() if (isElement(marker)) then destroyElement(marker) end end, 30000, 1) onTeamMarkerHit = function (hitElement, matchingDimensions) if (getElementType(hitElement) == "player") and (matchingDimensions) then if (getPlayerTeam(hitElement)) then local team = getPlayerTeam(hitElement) if (getElementData(source, "team") == getTeamName(team)) then setElementHealth(hitPlayer, getElementHealth(hitPlayer)+30); end end end end addEventHandler("onMarkerHit", marker, onTeamMarkerHit) end end)
  17. As far as i know, the game does not automatically turn the engine on. If i'm wrong, combine my code with the code of MrTasty.
  18. Remove the onVehicleExit event handler then. You can disable all vehicle engines with a loop, addEventHandler("onResourceStart", resourceRoot, function () for _,vehicle in pairs (getElementsByType("vehicle")) do if (getVehicleEngineState(vehicle) == true) then setVehicleEngineState(vehicle, false) end end end) And then just enter in the vehicle and type /engine.
  19. I don't understand what are you trying to do. The following code will disable the engine when you leave the vehicle. And you can enable or disable the engine by typing /engine (if you are the driver) addEventHandler("onVehicleExit", root, function (player, seat) if (seat == 0) then if (getVehicleEngineState(source) == true) then setVehicleEngineState(source, false) end end end) addCommandHandler("engine", function (player, command) local vehicle = getPedOccupiedVehicle(player) if(vehicle and getVehicleController(vehicle) == player) then if (getVehicleEngineState(vehicle) == true) then setVehicleEngineState(vehicle, false) else setVehicleEngineState(vehicle, true) end end end end)
  20. Try this function enterVehicle () if getVehicleEngineState(source) == false then setVehicleEngineState(source, true) end end addEventHandler ( "onVehicleEnter", root, enterVehicle) function exitVehicle () if getVehicleEngineState(source) == true then setVehicleEngineState(source, false) end end addEventHandler ( "onVehicleExit", root, enterVehicle)
  21. function enterVehicle () if getVehicleEngineState(source) == true then setVehicleEngineState(source, false) else setVehicleEngineState(source, true) end end addEventHandler ( "onVehicleEnter", root, enterVehicle) You were using the wrong event. The right event is onVehicleEnter Also, the source element of this event is the vehicle that was entered.
  22. This code should give you a idea how this can be done, but the last time i tried this code was in July, there could be unknown bugs Gang = {} Gang.__index = Gang Gang.instances = {} function Gang:create(name, r, g, b) local self = setmetatable({}, Gang) self.id = Gang.getFreeId() self.name = name self.team = Team(name, r, g, b) self.team:setData("id", self.id) table.insert(Gang.instances, self) return self end function Gang:getName() return self.name end function Gang:dispose() for index,instance in pairs(Gang.instances) do if (instance == self) then table.remove(Gang.instances, index) self.team:destroy() end end end function Gang.getFromMember(member) for index, gang in pairs(Gang.instances) do if(gang.team == member.team) then return gang end end return false end function Gang.getFromName(name) for index, gang in pairs(Gang.instances) do if(gang.team.name == name) then return gang end end return false end function Gang.getFromID(id) for index,gang in pairs(Gang.instances) do if (gang.id == id) then return gang end end return false end function Gang.getFreeId() for i=1, 100 do if not (Gang.getFromID(i)) then return i end end end addCommandHandler("gang", function (player, command, ...) local parameters = {...} local act = parameters[1] if(act == "create") then local name = table.concat ({parameters[2], parameters[3], parameters[4], parameters[5]}, " ") local gang = Gang:create(name, math.random(0,255),math.random(0,255),math.random(0,255)) player:setTeam(gang.team) player:outputChat("Gang successfully created!", 0, 255, 0) elseif(act == "delete") then local gang = Gang.getFromMember(player) if(gang) then gang:dispose() player:outputChat("Gang successfully deleted!", 0, 255, 0) end elseif (act == "invite") then local target = parameters[2] if (target) and (target ~= "") then if (player.team) then local gang = Gang.getFromName(player.team.name) if (getPlayerFromName(target)) then getPlayerFromName(target):setData("Invite", gang.name, false) player:outputChat("Invite sent to "..getPlayerFromName(target), 255, 255, 0) end else player:outputChat("A player with this name is not online", 255, 0, 0) end else player:outputChat("You have no gang bro", 255, 0, 0) end elseif(act == "accept") then if not (player:getData("Invite") == false) then local gangName = player:getData("Invite") local gang = Gang.getFromName(gangName) if (gang) then player:outputChat("Welcome in "..gangName, 0, 255, 0) player:setTeam(gang.team) player:removeData("Invite") end else player:outputChat("You were not invited to join any gang", 255, 0, 0) end end end) addEventHandler("onResourceStart", resourceRoot, function () addCommandHandler("gangs", function (player, command) player:outputChat("Gangs:", 255, 255, 0) for index,instance in pairs (Gang.instances) do player:outputChat("ID: "..instance.id.." Name: "..instance.name.."", 255, 255, 0) end end) end)
  23. Not easy if you are a begginer. Server side can be done using OOP (less pain for the brain xD) If you don't speak English, check the portugues section.
×
×
  • Create New...