Jump to content

ma2med

Members
  • Posts

    178
  • Joined

  • Last visited

Everything posted by ma2med

  1. ma2med

    [HELP] SQLite

    It's coming from a script so I don't know, what about that ? CREATE TABLE `groups` ( `id` INTEGER, `userid` INTEGER, `key` TEXT, `value` TEXT, `type` INTEGER, PRIMARY KEY(id) );
  2. ma2med

    [HELP] SQLite

    What do you mean by the insert code ? Here is my code: connection = dbConnect( "sqlite", "groups.db" ) function test(account, key) for i, values in ipairs(getAccounts()) do if values == account then local query = dbQuery(connection, "SELECT value FROM groups WHERE userid =? AND key =?", i, key) return dbPoll(query, -1) end end end addCommandHandler("lol", function(p) for i, row in ipairs(test(getPlayerAccount(p), "Ranks")) do for column, value in ipairs(row) do outputChatBox(column..": "..value, root) end end end)
  3. ma2med

    [HELP] SQLite

    Sorry, I made mistake, the function is not getDBAccountData but test so I fixed it and it's still not working.
  4. ma2med

    [HELP] SQLite

    Hi, it's still not working sorry but I don't understood the second example that the same thing or maybe I am wrong?
  5. ma2med

    [HELP] SQLite

    When I execute it with SQLite it's show 1 row.
  6. ma2med

    [HELP] SQLite

    Nope. When I put addCommandHandler("lol", function(p) for i, v in ipairs(getDBAccountData(getPlayerAccount(p), "Ranks")) do outputChatBox(v, root) end end) It's show nothing but when I put addCommandHandler("lol", function(p) outputChatBox(getDBAccountData(getPlayerAccount(p), "Ranks"), root) end) It's wrote that the result is table.
  7. ma2med

    [HELP] SQLite

    I think working now, thanks WhoAmI. EDIT: Same result, I wasn't login I forgot. It's still print nothing.
  8. ma2med

    [HELP] SQLite

    It's not in meta, should I add it? Which tag is it, script, file ?
  9. ma2med

    [HELP] SQLite

    Hi, I tried to get result of SQL operation from a custom db but it won't work, why that? connection = dbConnect( "sqlite", "groups.db" ) function test(account, key) for i, values in ipairs(getAccounts()) do if getAccountName(values) == getAccountName(account) then local query = dbQuery(connection, "SELECT value FROM groups WHERE userid = ".. i .." and key = '".. key .."'") return dbPoll(query, -1) end end end-- addCommandHandler("lol", function(p) if not isGuestAccount(getPlayerAccount(p)) then for i, v in ipairs(test(getPlayerAccount(p), "Ranks")) do outputChatBox(v, root) end end end)
  10. Yeah sorry it's closed now, I'll try with my second server EDIT: Same error: Fatal error: Uncaught exception 'Exception' with message 'Could not connect to 52.11.205.66:22006' in /home/u375931079/public_html/mta/sdk/mta_sdk.php:146 Stack trace: #0 /home/u375931079/public_html/mta/sdk/mta_sdk.php(79): mta->do_post_request('52.11.205.66', 22006, '/someResource/c...', '') #1 /home/u375931079/public_html/mta/sdk/mta_sdk.php(257): mta->callFunction('someResource', 'someFunction', Array) #2 /home/u375931079/public_html/mta/index.php(5): Resource->call('someFunction') #3 {main} thrown in /home/u375931079/public_html/mta/sdk/mta_sdk.php on line 146
  11. It's loading for 5 secs then it's print Fatal error: Uncaught exception 'Exception' with message 'Could not connect to 5.39.66.97:22063' in /home/u375931079/public_html/mta/sdk/mta_sdk.php:146 Stack trace: #0 /home/u375931079/public_html/mta/sdk/mta_sdk.php(79): mta->do_post_request('5.39.66.97', 22063, '/someResource/c...', '') #1 /home/u375931079/public_html/mta/sdk/mta_sdk.php(257): mta->callFunction('someResource', 'someFunction', Array) #2 /home/u375931079/public_html/mta/index.php(5): Resource->call('someFunction') #3 {main} thrown in /home/u375931079/public_html/mta/sdk/mta_sdk.php on line 146
  12. Client: function isMyPingTheLowest() local players = getElementsByType("player") local yes = true for i, player in ipairs(players) do if getPlayerPing(getLocalPlayer()) > getPlayerPing(player) then yes = false end end if yes == true then return true else return false end end function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end return t end addEventHandler("onClientPedDamage", getRootElement(), function(attacker) if getElementData(source, "type") == "ped.sniper.npc" and getElementData(attacker, "type") == "ped.sniper.npc" then cancelEvent() end end ) setTimer( function() if isMyPingTheLowest() then for i, peds in ipairs(getElementsByType("ped")) do if getElementData(peds, "type") == "ped.sniper.npc" and getElementHealth(peds) > 0 then local x, y, z = getElementPosition(peds) local lowest = nil local player = nil for i, players in ipairs(getElementsByType("player")) do local px, py, pz = getElementPosition(players) if getDistanceBetweenPoints3D(x, y, z, px, py, pz) < 100 then if lowest == nil then lowest = getDistanceBetweenPoints3D(x, y, z, px, py, pz) player = players else if getDistanceBetweenPoints3D(x, y, z, px, py, pz) < lowest then lowest = getDistanceBetweenPoints3D(x, y, z, px, py, pz) player = players end end end end if isElement(player) and getTeamName(getPlayerTeam(player)) ~= "Military" then triggerServerEvent("sniperTakeDecision", getRootElement(), peds, player) end end end end end , 1500, 0) addEvent("sniperTakeDecisionClient", true) addEventHandler("sniperTakeDecisionClient", getRootElement(), function(sniperPedID, aimPlayer) local x, y, z = getElementPosition(sniperPedID) local px, py, pz = getElementPosition(aimPlayer) setPedAimTarget(sniperPedID, px, py, pz) local rotZ = findRotation(x, y, px, py) setPedRotation(sniperPedID, rotZ) setPedControlState(sniperPedID, "aim_weapon", true) setPedControlState(sniperPedID, "fire", true) setTimer( function() if isElement(sniperPedID) then setPedControlState(sniperPedID, "fire", false) setPedControlState(sniperPedID, "aim_weapon", false) end end , 500, 1) end )
  13. Ive problem to connect with the server : in local it works fine but on my online website it's not working, any idea?
  14. ma2med

    [HELP]

    Hi, I'm searching a way to remove attribute in XML file.
  15. ma2med

    help maplimit

    Use https://wiki.multitheftauto.com/wiki/CreateRadarArea
  16. ma2med

    help maplimit

    It must be within the yes <map edf:definitions="editor_main"> <maplimit> <point x="1998" y="-1450" /> <point x="1998" y="-1440" /> <point x="2008" y="-1440" /> <point x="2008" y="-1450" /> </maplimit> </map>
  17. ma2med

    help maplimit

    it's working, verify if maplimits is started and you put the part between
  18. -- get a table with all teams local allTeams = getElementsByType ( "team" ) -- for every team, addEventHandler("onResourceStart", resourceRoot, function () for index, theTeam in ipairs(allTeams) do -- if friendly fire is off, if ( getTeamFriendlyFire ( theTeam ) == true ) then -- switch it on setTeamFriendlyFire ( theTeam, false ) end end end) one end is missing
  19. ma2med

    Problem

    use onPlayerCommand instead of onPlayerChat text1 = "/police - Play as Police" text2 = "/terrorist - Play as Terrorist" text3 = "/president - Play as President" dis = textCreateDisplay() screentext = textCreateTextItem(text1,0.2,0.2,"medium",255,0,0,255,3) textDisplayAddText(dis,screentext) dis1 = textCreateDisplay() screentext1 = textCreateTextItem(text2,0.2,0.3,"medium",0,255,0,255,3) textDisplayAddText(dis1,screentext1) dis2 = textCreateDisplay() screentext2 = textCreateTextItem(text3,0.3,0.4,"medium",255,255,0,255,3) textDisplayAddText(dis2,screentext2) addEventHandler("onResourceStart",resourceRoot, function() for i,p in ipairs(getElementsByType("player")) do textDisplayAddObserver(dis,p) textDisplayAddObserver(dis1,p) textDisplayAddObserver(dis2,p) end end ) addEventHandler("onPlayerJoin",root, function() fadeCamera(source, true, 5) setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) textDisplayAddObserver(dis,source) textDisplayAddObserver(dis1,source) textDisplayAddObserver(dis2,source) end ) function onCommand(cmd) if cmd == "police" or cmd == "president" or cmd == "terrorist" then textDisplayRemoveObserver(dis, source) textDisplayRemoveObserver(dis1, source) textDisplayRemoveObserver(dis2, source) end end addEventHandler("onPlayerCommand", root, onCommand) in your code it remove the text when player use "/me police" and the parameters are 'string message, int messageType' the source is the player
  20. ma2med

    Problem with function

    https://community.multitheftauto.com/in ... ls&id=5317
×
×
  • Create New...