Jump to content

FlorinSzasz

Members
  • Posts

    145
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by FlorinSzasz

  1. Bine ai revenit, :)) mai merge mta la noi cât se creează servere ce apar și dispar peste noapte, roleplay-ul merge aparent dar doar la noi din ce vad asa in mare parte.
  2. Well remove player argument from the function on the Event ,,onClientRender' just function() and on getElementData replace player with localPlayer Also onClientRender will output something/ refresh every second if i remember, so until the data is not true then it wont output only false.
  3. Remove local word who is in front of marker first like this -> If u put local in front of variable and the variable is in a function the variable can be used in that function only. With ,,local`` you limit the scope of the variable! marker = createMarker(x, y, z, "cylinder", 3.0) -- <<<<<< like this! And again do this here too
  4. Well which is client and which is server? Also here you should change your code with this -> function pickUpLocation(player, id) local x, y, z = garbages[id][1],garbages[id][2],garbages[id][3] marker = createMarker(x, y, z, "cylinder", 3.0) addEventHandler("onMarkerHit", marker, function(player) if getPedOccupiedVehicle(player) == 408 then destroyElement(marker) marker = nil outputChatBox("hitted",player) setElementData(player, "trashlocation", getElementData(player, "trashlocation")+1) newLocation = getElementData(player, "trashlocation") pickUpLocation(player, newLocation) end end) end
  5. function spawn() setTimer(function(source) outputChatBox("This server is protected by BattlDayZ (V1.1), an anticheat system.",source,255,0,0) end,2000,1,source) local playerAccount = getPlayerAccount(source) if getAccountData(playerAccount,"combattime") == 1 then setTimer ( killhim, 7000, 1,source) else setElementData(source,"combattime",getAccountData(playerAccount,"combattime") or 0) end end addEventHandler("onPlayerLogin",root,spawn) function killhim(source) outputChatBox("you got killed for disconnecting during a fight!") -- exports.DayZ:setPlayerBlood(source,-5) setTimer(function(source) setElementData(source,"combattime",0) end,5000,1,source) end addEvent("setAccount1",true) function setAccount1() if client then setElementData(client,"combattime",1) end end addEventHandler("setAccount1", root, setAccount1) addEvent("setAccount2", true) function setAccount2() if client then setElementData(client,"combattime",0) end end addEventHandler("setAccount2", root, setAccount2) function saveData() local a = getPlayerAccount(source); if a then outputDebugString(getElementData(source,"combattime")) setAccountData(a,"combattime",getElementData(source,"combattime")) end end addEventHandler("onPlayerQuit",getRootElement(),saveData) Server Here, Now client: combatloglabel = guiCreateLabel(0.82, 0.00, 0.27, 0.04, "A", true) guiSetVisible(combatloglabel,false) function createLogLabel() guiSetVisible(combatloglabel,true) guiLabelSetHorizontalAlign(combatloglabel, "center", false) guiLabelSetVerticalAlign(combatloglabel, "center") guiSetText(combatloglabel,"[Out of combat]") guiLabelSetColor(combatloglabel, 17, 249, 5) end addEventHandler("onClientPlayerSpawn",localPlayer,createLogLabel) function onPlayerActivateCombatLog(attacker) if source == localPlayer then guiSetText(combatloglabel,"[In combat]\nDont disconnect or you will die") guiLabelSetColor(combatloglabel,255,0,0) triggerServerEvent("setAccount1", localPlayer) setTimer(function(localPlayer) triggerServerEvent("setAccount2", localPlayer) guiSetText(combatloglabel,"[Out of combat]") guiLabelSetColor(combatloglabel, 17, 249, 5) end,10000,1,localPlayer) end end addEventHandler("onClientPlayerDamage",root,onPlayerActivateCombatLog) It should work is tested now. Also when u trigger a server event always check for client because source can be some fake data and in more complicated scripts it can create problems. Thats why i used client when i trigger a server event!
  6. function saveData() if source then local a = getPlayerAccount(source); if a then if not isGuestAccount(a) then setAccountData(a,"combattime",tonumber(getAccountData(a,"combattime"))) end end end end addEventHandler("onPlayerQuit",getRootElement(),saveData) This should work but i did not test it. Also here is a topic which might help you. -> https://forum.multitheftauto.com/topic/106193-help-save-account-data/
  7. well markers work, pickups are not rendered however if i hit the pickup on a pickup event it returns my debug message so they are there at least. My total pickup number is around 32 without this script. Well i will try to use rotating objects then. Thx for advice!
  8. I want to create a company system, however i run into a problem. I create some pickups but the game doesnt create all the pickups only a part of them. Here is all the code -> local company = dbConnect("sqlite","company.db") for i=1,55 do createObject(4012,2880.809765625+(i*65.95),-1934.609375,0.20000001788139,0,0,180) -- some ground / platform createPickup(2885.14+(i*65.95),-1943.72803,1.11521,3,1239,100) -- only 18 are rendered/created from /55 end for K=1,54 do createObject(4012,2946.759765625+(K*65.95),-2033.0093994141,0.20000001788139,0,0,360) createPickup(2951.09+(K*65.95),-2022.72803,1.11521,3,1239,100) -- only 17 are rendered/created from / 54 end https://drive.google.com/file/d/19tmzV5Y8OIOElWP0LsWsS3HX5HSzQa73/view?usp=sharing Link for the video. Also the road on video is from the .map file :)) Also ignore debugscript from video the code is ok no errors.
  9. Is your db password hashed? if yes you sould use this -> https://wiki.multitheftauto.com/wiki/PasswordVerify
  10. Also do you have data in db? Also u can try to loop through result and see if something comes from db. Also when u send the data from client to server check on server side if something comes outputDebugString(username) outputDebugString(password)
  11. Revin cu un update! Acum avem backup si la versiunea 1.6.0 Link: https://drive.google.com/file/d/16xBwa0aZBxxb4CcldlYDZNyLGhKOhPgr/view?usp=sharing
  12. Pfff mai e de lucru nu asa de mult insa eu vreau sa fac si un anticheat :)) plus ca am reluat toate scripturile si am incercat sa le optimizez mai ales cele vechi si sa le aduc la zi, `job-urile` si sistemul de ,, depozite`` , de asemenea mai este un minigame de adaugat momentan vor mai fi si altele in timp.
  13. Yes but not in the way u think. U can do something like this -> local object local objects = {} CreateRandomObjects = function(player,commandName) local number = math.random(1,2) if number == 2 then local object = createObject(objects[number][1],objects[number][2],objects[number][3],objects[number][4],objects[number][5],objects[number][6],robjects[number][7]) -- we just get from objects table based on number the object and his model and x,y,z,rotation x ,rotation y, rotation z, and u can add more to it. elseif number == 1 then local object = createObject(objects[number][1],objects[number][2],objects[number][3],objects[number][4],objects[number][5],objects[number][6],robjects[number][7]) end end addCommandHandler ( "randomobject", CreateRandomObjects,false,false) well we can add more objects at the same time not only one but i added only one for example. I made a command for this u can do this thing on marker hit or any event u want.
  14. Yes u can do that but u need to add this groups to acl, like u need to create these groups, but also u can create teams! https://wiki.multitheftauto.com/wiki/CreateTeam Also u can create a database with tables and save in which table who is from what faction/ gang.
  15. U can use -> tonumber()
  16. FlorinSzasz

    Help

    Hi! You mean this? https://wiki.multitheftauto.com/wiki/SetModelHandling
  17. i want to ask if this is a good way to make it -> something = function(player) --player form the client if player == client then -- do something end -- and also this something = function(player) --player form the client if source == player and source == client then -- is the same thing right? -- do something end I dont have my own server, however when i will open one i want to be sure if what i did is right.
  18. i am not sure but it could be. If they are not compiled they can see the code so they can change stuff and inject data from client and if the server script doesnt check from where is the data then it will pass. On the other hand i am not a pro in mta security there older people here who have more knowledge on this topics, but i try to see if you have the basic stuff done things which we can do to protect our servers.
  19. maybe there are some bugs in scripts or they are not compiled also is the cache set the false to the scripts. Also there are maybe no checks when u send data from client to server and there will be some exploits. The Mta AC will do what it can but we also should build our server anti-cheat by scripts i mean some simple hard coded checks on servers-side and that`s it. Only you or your server scripter knows in which way they gamemode is made and what checks can be made.
  20. local spawns = { [1] = {1829.65564,-1842.47327,13.57813,178}; -- x , y ,z , and z rotation [2] = {2083.15747,-1844.75122,12.79247,359}; [3] = {2893.39746,-1638.96423,10.45679,333}; } local distances = {} respawn = function(ammo, attacker, weapon, bodypart) local x,y,z = getElementPosition(source) for k,v in ipairs(spawns) do distances[k] = getDistanceBetweenPoints3D(x,y,z,spawns[k][1],spawns[k][2],spawns[k][3]) end local a = math.min(distances[1],distances[2],distances[3]) for i=1,#distances do if distances[i] == a then spawnPlayer(source,spawns[i][1],spawns[i][2],spawns[i][3],spawns[i][4]) end end distances = nil distances = {} end addEventHandler("onPlayerWasted",getRootElement(),respawn) -- my spawns are random coordinates to test the script, they are not hospital spawns and also u have to change the z rotation to your wanted rotation. also if u have in spawns table more indexes u need to add more distances in local a = math.min() if u have 5 then u add five distances, here i have 3 spawns so 3 distances
  21. Well first wee need only 1 resource! a) you need a table with all spawn locations like this local spawns = { [1] = {0,0,0}; [2] = {5,5,5}; --etc this is just an example } -- in this table u will put your spawn coords from the hospitals b) you need this event -> onPlayerWasted c) also this https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPoints3D d) and another function math.min() e) and if u know how to loop through a table u wont need many lines of code to do this.
  22. i think u have to use table_name = {"A",1,2,3,"A"} for i=1,#table_name do -- it loops through all the indexes if table_name[i] == "A" then -- example outputDebugString("This index has useful value") end end I am not very advanced in tables but u should go for ipairs if u want to find a certain value in a table. Also check this topic it might be useful. -> https://forum.multitheftauto.com/topic/36318-ipairs-and-pairs/
  23. add before job function this -> local button local closebutton
  24. yes because you call it for every player not the one who hits the marker addEventHandler("onClientMarkerHit", jobMarker, function(player) if player == localPlayer then window = guiCreateWindow(500, 200, 250, 250, "*Tree JoB*", false) memo = guiCreateMemo(100, 20, 240, 100, "Unicos RP Tree Job You can make esy money with rhis one# happy happy happy", false, window) button = guiCreateButton(20, 150, 100, 100, "Accep", false, window) closebutton = guiCreateButton(150, 150, 100, 100, "Close", false, window) showCursor(true) end end)
  25. also replace the your last line with this addEventHandler ( "onClientGUIClick", closebutton, clicks, false ) addEventHandler ( "onClientGUIClick", button, clicks, false )
×
×
  • Create New...