Jump to content

Vinctus

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by Vinctus

  1. @IIYAMA, in that case he could do this: local teamsTable = { ["ss"] = { name = "team name", tag = "team tag"}, ["aa"] = { name = "team name", tag = "team tag"}, ["dd"] = { name = "team name", tag = "team tag"}, } and access team name and tag by using teamsTable["the team name"].name teamsTable["the team name"].tag yes?
  2. Vinctus

    Gang add

    Isn't this stolen/leaked/whatever resource?
  3. Why do you do it like that? why not just: local teamsTable = { {"team name", "team tag"}, {"team name", "team tag"}, } for i,theTeam in ipairs(teamsTable) do outputChatBox(tostring(i) .. " Team: " .. theTeam[1] .. " [" .. theTeam[2] .. "]") end 1 being the team name, 2 being the tag
  4. Vinctus

    Problem

    also what you want to do is make the minimum XP for level 2 one higher than the max xp for level 100, as ">=" means "equal or bigger than", so for level 2 should be g_xp >= 101
  5. Vinctus

    Problem

    if ( g_xp >= 100 and g_xp <= 500 ) then setElementData(source, "Level", "1")
  6. It should give warning/error on debug for players with no team accountData on first function (players first time on server) at local team = getAccountData (account, "team") what you should do is set it to local team = getAccountData (account, "team") or "some default team"
  7. I usually use the first example with commandhandlers and onResourceStart functions
  8. local level__ = exports.jack:getPlayerLevel ( player ) local exp__ = exports.jack:getPlayerEXP ( player ) define the player
  9. why does the markers have to have a number? does it trigger a different event based on that? let me know what will have to happen on the marker hit so I can edit my script based on that to make it work for your needs EDIT: heres something, let me know if the markers have to have different type and size and color etc so I can fix it local posTable = { --{markerID,{markerx, markery, markerz}, {objx, objy, objz}} {1,{100,100,100},{100,10,120}}, -- just example {2,{100,100,100},{100,10,120}}, {3,{100,100,100},{100,10,120}}, } function loadElements() for i,v in ipairs(posTable) do createMarkerAndObj(v[1],v[2],v[3]) end end addEventHandler("onResourceStart", root, loadElements) function createMarkerAndObj(id,mark,obj) local mx,my,mz = mark[1],mark[2],mark[3] local ox,oy,oz = obj[1],obj[2],obj[3] local mark = createMarker(mx,my,mz,"cylinder",1,255,0,0) local obj = createObject(objecID,ox,oy,oz) setElementData(obj, "destroySource", mark) setElementData(mark, "markerID", id) addEventHandler("onMarkerHit", mark, function(elem,dim) if elem and dim and getElementType(elem) == "player" then local id = getElementData(source, "markerID") or 0 if id == 1 then -- trigger the event for marker 1 elseif id == 2 then -- trigger the event for marker 2 elseif id == 3 then -- and so on.. end for i,v in ipairs(getElementsByType("object")) do if getElementData(v, "destroySource") == source then destroyElement(v) -- destroys the object with same ID than the marker break end end destroyElement(source) end end) end
  10. I don't see the point for if oldValue == "number" as you just made it a number on line before, also this works just fine aswell: local oldValue = getElementData(thePlayer, "Thingy") or 0 setElementData(thePlayer, "Thingy", tonumber(oldValue) + 1 ) Actually it is to check if the data was a number or not. Yes, I realized, but what I was saying was: local oldValue = tonumber (getElementData(thePlayer, "Thingy") ) <-- You make it a number here with tonumber() if type (oldValue) == "number" then <-- yet you check if it's a number if you just made it a number
  11. try this, haven't tested function commitSuicide(src) if src then if getElementData(src, "suicide") == false then -- message when player writes the command if he is not already suiciding toggleAllControls(src, false) setElementData(src, "suicide", true) sec = 10 local suicideTimer = setTimer(function(plr) if sec <= 0 then killPed(plr) killTimer(suicideTimer) setElementData(plr, "suicide", false) toggleAllControls(src, true) -- message when suicided else sec = sec - 1 end end, 1000, 0, src) else -- message if player is already committing suicide but tries to enter the command end end end addCommandHandler("suicide", commitSuicide)
  12. local posTable = { --{{markerx, markery, markerz}, {objx, objy, objz}} {{100,100,100},{100,10,120}}, -- just example } function loadElements() for i,v in ipairs(posTable) do createMarkerAndObj(v[1],v[2]) end end addEventHandler("onResourceStart", root, loadElements) function createMarkerAndObj(mark,obj) local mx,my,mz = mark[1],mark[2],mark[3] local ox,oy,oz = obj[1],obj[2],obj[3] local mark = createMarker(mx,my,mz,"cylinder",1,255,0,0) local obj = createObject(objecID,ox,oy,oz) setElementData(obj, "destroySource", mark) addEventHandler("onMarkerHit", mark, function(elem,dim) if elem and dim and getElementType(elem) == "player" then for i,v in ipairs(getElementsByType("object")) do if getElementData(v, "destroySource") == source then destroyElement(v) break end end end end) end Not sure if this is what you was looking for, but it creates as many objects and markers as you put into the posTable (in given format), then when you hit a marker it finds object with the marker's data and destroys it
  13. I don't see the point for if oldValue == "number" as you just made it a number on line before, also this works just fine aswell: local oldValue = getElementData(thePlayer, "Thingy") or 0 setElementData(thePlayer, "Thingy", tonumber(oldValue) + 1 )
  14. Just addition, you can change 'math.random(1,#mine_pos)' to 'math.random(#mine_pos)', does the same thing
  15. when it respawns, set elementdata on it, such as "display", then on 'onClientVehicleStartEnter' check if it has the elementdata, if it does, cancelEvent()
  16. If you are going to have multiple teams, easiest way would probably be: local teams = { -- "team", r, g, b {"Red Team",255,0,0}, {"Blue Team",0,0,255}, } function team () for i,v in ipairs(teams) do createTeam (v[1], v[2], v[3], v[4] ) end end addEventHandler("onResourceStart", resourceRoot, team)
×
×
  • Create New...