Jump to content

pa3ck

Members
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by pa3ck

  1. Then this is the problem: if (thePlayer) and (exports["ZA-system"]:isPlayerLogin(thePlayer)) and not (getElementData(thePlayer, "zombieProof")) and not (isPedDead(thePlayer)) then Anything is after this line will be skipped. So think about this... 1st cycle = while 0 < 5*2 -> true 2nd cycle = while 0 < 5*2 -> true 3rd cycle = while 0 < 5*2 -> true 9999999999999th cycle = while 0 < 5*2 -> true "pacecount" is not changing, so it's an infinite loop.
  2. Is it running at the very moment you are trying to delete the file?
  3. Is this evaluates to true or false if fileExists("ghosts/"..mapName..".ghost") then Is there any chance that the file is in use by a resource therefore not letting it be removed?
  4. And your code that shows us where to problem is?
  5. Well I can see a "possible" infinite loop. See the way you have this line: if (tzombiecount < ZombieLimit) then If that evaluates to false, you will never actually increment "pacecount" (will always stay 0) leaving it always less than 5*2.
  6. getPlayerAccount is server side only
  7. https://wiki.multitheftauto.com/wiki/Split
  8. pa3ck

    Coords

    That's wrong, getRootElement() is already the sendTo argument, no need for localPlayer (unless if you want it to pass as argument, which is pointless because you have the client variable already) What is wrong exactly with your code?
  9. I don't see any reason why would it be an infinite loop, would you be able to post "onCheckZombie" event handler function?
  10. The error message tells you exactly what to do. "event is not added clientside" you are missing the client-side addEvent("onFlyGranted", true)
  11. function fail (player) -- Are you sure this actually returns the player? I don't see it on the wiki... if player and getElementType ( player ) == 'player' then setElementData(player, "mission", false) setTimer(setVehicleLocked, 350, 1, vehicle, false) outputChatBox("test") end end addEventHandler ( "onVehicleExplode", vehicle, fail ) Try to get the "player" by using this: local player = getPedOccupiedVehicle(source)
  12. Wherever you have "player" change it to localPlayer, I can't see you defined it anywhere. localPlayer is the same as getLocalPlayer(), it's just a predefined variable that comes with MTA.Or if you don't want to change it, put this line to the top of your script: local player = localPlayer
  13. What's the concatenation for? Serial is one long string, First of all, you will need to get all the accounts and check if the account name entered via the command actually points to an account and then change the serial of that given account. Try this: function setAccountSerial(p, cmd, target, serial) if target and target ~= "" and serial and serial ~= "" then local accounts = getAccounts() for i = 1, #accounts do if(getAccountName(accounts[i]) == target) then local oldSerial = getAccountData(accounts[i], "account:protect") or "none" setAccountData(accounts[i], "account:protect", serial) outputChatBox("User " .. target .. "'s serial has been updated", p) outputChatBox("-> Old: ".. oldSerial .."| New: " .. serial, p) return end end outputChatBox("Couldn't find any users with the name: " .. target, p) else outputChatBox("Syntax: /"..cmd.." [account-name] [serial]", p) end end addCommandHandler("changeserial",setAccountSerial)
  14. Didn't actually test your code, but here's what I just wrote and is working fine for me. However, you will need to change it a bit so it fires @ onPlayerJoin and also change the static IP. To test it replace your ip @ line 1. local ip = "" -- currently it only works with pre-defined IP, because MTA detects my IP as 127.0.0.1 function getPlayerCity(p, cmd) function displayPlayerCity( resp, errno, p) if errno == 0 then local data = fromJSON("[".. resp .. "]") local status = data["status"] or "fail" if status == "success" then outputChatBox("Player " .. getPlayerName(p) .. " is connected from: " .. data["city"]) else outputDebugString("Cannot retrieve network details") end else outputDebugString("Error @fetchRemote, ERRNO: " .. errno) end end fetchRemote("http://ip-api.com/json/" .. ip, displayPlayerCity, "", false, p) end addCommandHandler("gcity", getPlayerCity, false, false)
  15. You could use an API that returns JSON: http://ip-api.com/json All you have to do is send a request with: http://ip-api.com/json/xxx.xxx.xxxx.xxxx (replace with client IP)
  16. local dates = { "2017-01-09", "2017-01-06", "2017-01-08", "2017-01-01" } table.sort ( dates, function ( a,b ) return a < b end ); for k, v in ipairs(dates) do print(v) end --Returns --2017-01-01 --2017-01-06 --2017-01-08 --2017-01-09
  17. This is working fine for me: function addTeam() local ranks = toJSON ( {"Headquarter", "Leader", "Prospect"}, true, "none" ) dbExec(connection, "INSERT INTO teams (team_name, team_ranks) VALUES ( ?, ? )", "TestName", ranks ) end function getRank() local qry = dbQuery(connection, "SELECT * FROM teams WHERE team_id LIKE 1 LIMIT 1") local res = dbPoll(qry, -1) local teamRank if(res and #res >0) then for k, rows in ipairs(res) do teamRank = fromJSON(rows["team_ranks"]) -- "team_ranks" is the column name in my table end end for i = 1, #teamRank do outputChatBox("Rank " .. i .. ": " .. teamRank[i]) end end
  18. Note: Client side function only works with the server the player is connected to or it will return the error #1006
  19. pa3ck

    Name tag

    Please either use your own language section under Other languages section or edit your post with your question translated to English.
  20. pa3ck

    File Watcher

    Are you in the Admin ACL group? If not, open acl.xml and search for the group admin, then add your username like this: <object name="user.USERNAME"></object> If you don't have a user account registered on your server yet, create one with /register [on the server] or use 'addaccount' command in the server console. Alternatively, you can also use MTA functions to put yourself in the admin group with aclGroupAddObject and this way you don't have to restart the server. Once you added your account to the ACL group, all you have to do is login and you will be able to use commands like: /restart /refresh /stop /start etc... Then you will be able to bind commands like "/restart resource"
  21. You don't need to split up the JSON. Look at this example to see how it works local jsonString = toJSON ( {"Headquarter", "Leader", "Prospect"}, true, "none" ) local jsonTable = fromJSON(jsonString) -- a LUA table from JSON string outputDebugString(jsonTable[1]) --> "Headquarter"
×
×
  • Create New...