Jump to content

R7flOq7KeSsU

Members
  • Posts

    5
  • Joined

  • Last visited

Details

  • Gang
    Grove Street

R7flOq7KeSsU's Achievements

Vic

Vic (3/54)

0

Reputation

  1. I think he wants a Kill per Death ratio... function getPlayerKDRatio(player) local kills, deaths = getElementData(player, "Kills"), getElementData(player, "Deaths") local ratio = kills/deaths if(kills > 0 and deaths <= 0) then return string.format("%.2f", kills) end return string.format("%.2f", ratio) end
  2. I searched and found this ->(https://forum.multitheftauto.com/viewtop ... 95&t=22007) but I guess I found some important info (idk...) see pic: http://h.imagehost.org/0723/mta-screen.jpg In my opinion: I think this can be fixed
  3. Okay, now the problem is: I can't create a table for Element "RadarArea" ZoneInfo = {} g_root = getRootElement() function ResourceStart() -- GangZones Setup local ReadZones = executeSQLQuery("SELECT Name, PosX, PosY, Width, Height FROM LSWars_Zones") local Zones = getElementsByType("radararea") ZoneInfo[Zones] = {} ZoneInfo[Zones].Name = "" for k,v in pairs(ReadZones) do createRadarArea(v.PosX, v.PosY, v.Width, v.Height, 255, 255, 255, 150) for i,z in pairs(Zones) do ZoneInfo[z].Name = v.Name end end end addEventHandler("onResourceStart", g_root, ResourceStart) So far this seems to be okay... but... function GetStats(player) local Zones = getElementsByType("radararea") --[[>>> LINE 186 <<<< --]]for k,v in pairs(Zones) do if(ZoneInfo[v].Name) then outputChatBox("Zone name: " .. ZoneInfo[v].Name .. " Zone ID: " .. k, player) end end end addCommandHandler("stats", GetStats) When I type the commad it gives a server error: ERROR: ...s/server/mods/deathmatch/resources/lswars/lswars.lua:186: attempt to index field '?' (a nil value)
  4. Hello, This is my first post and I'm still learning LUA (stopped here - http://www.lua.org/pil/5.2.html) My gamemode: http://athos.pastebin.com/f78050b09 (WIP) The problem is that when the player dies it is supposed that the PlayerStatus[Player].Deaths should increase but that's not happening, should I use triggerClientEvent ? I'm also reading the MTA wiki. Another thing, how to use the executeSQLInsert properly ? I saw on the wiki but that was't clear enough The gamemode doesn't have client lua files yet. Thanks in advance P.S: Sorry for my bad english...
×
×
  • Create New...