Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. First, don't double post, and second, copy the code again, I forgot to add a 'end'.
  2. Look, this is a total mess, and also, you are saying "I made this" when actually I did, it's not cool to steal someone's credits. call(getResourceFromName("scoreboard"),"addScoreboardColumn","Total Win's") function vehicleDetector(pickupID, pickupType, vehicleModel) if pickupType == "vehiclechange" and vehicleModel == 425 then increaseAccountData(source) outputChatBox("*HUNTER ALERT: "..getPlayerName(source).." has found the Hunter and get +1 win!",getRootElement(),25,125,225, true) end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),vehicleDetector) function increaseAccountData(player) if not player then return end local account = getPlayerAccount(player) if not account or isGuestAccount(account) then return end local accountData = getAccountData(account,"hunterPoints") if not accountData then setAccountData(account,"hunterPoints",1) else setAccountData(account,"hunterPoints",tonumber(accountData)+1) end end function updateScoreboardTotalWins() for i,v in pairs(getElementsByType("player")) do local account = getPlayerAccount(v) if not account or isGuestAccount(account) then return end local point = getAccountData(account,"hunterPoints") setElementData(v,"Total Win's",tonumber(point)) end end setTimer(updateScoreboardTotalWins,2000,0)
  3. Well, I think I already gave you the most part, now you should try doing the rest, right?
  4. function vehicleDetector(pickupID, pickupType, vehicleModel) if pickupType == "vehiclechange" and vehicleModel == 425 then increaseAccountData(source) outputChatBox("*HUNTER ALERT: "..getPlayerName(source).." has found the Hunter!",getRootElement(),25,125,225, true) end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),vehicleDetector) function increaseAccountData(player) if not player then return end local account = getPlayerAccount(player) if not account or isGuestAccount(account) then return end local accountData = getAccountData(account,"hunterPoints") if not accountData then setAccountData(account,"hunterPoints",1) else setAccountData(account,"hunterPoints",tonumber(accountData)+1) end end I think it should work (not tested).
  5. Your createColCube arguments are wrong..... Take a look in here: https://wiki.multitheftauto.com/wiki/CreateColCube
  6. function myLoop() outputChatBox("This is my message every 10 minute(s).",root,255,255,0) end setTimer(myLoop,60000 * 10,0) P.S: JR10, 60000 = 1 minute .
  7. What do you mean...? I don't get you.
  8. Castillo

    FR Gui...

    qaisjp, finish what? it's already "finished" as you say, there's nothing to finish, if you want to use it, then just say it .
  9. Castillo

    Portforwarding

    You must forward the ports: 22003 (UDP/TCP) 22005 (UDP) 22126 (UDP).
  10. https://wiki.multitheftauto.com/wiki/Garage And use setGarageOpen(ID, true) to open them.
  11. Well...... then use the code I posted, it works fine.
  12. And what has that to do with this? I tested this in a freeroam server and works fine.
  13. I don't know why you do all that, it's useless. addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() exports.scoreboard:addScoreboardColumn("Health") end) function scoreboardHealthUpdate() if source and getElementType(source) == "player" then local health = math.floor(getElementHealth(source)) setElementData(source, "Health", health.."%") end end addEventHandler("onPlayerDamage", getRootElement(), scoreboardHealthUpdate) addEventHandler("onPlayerSpawn", getRootElement(), scoreboardHealthUpdate) addEventHandler("onPlayerLogin", getRootElement(), scoreboardHealthUpdate) addEventHandler("onPlayerWasted", getRootElement(), scoreboardHealthUpdate)
  14. Well, I know that the function exists, but if you know how to use "Search" you would get it fast.
  15. You have this: https://wiki.multitheftauto.com/wiki/IsE ... inColShape It's the same as isElementWithinMarker, if i'm right .
  16. Why don't you use a colshape for this?
  17. Castillo

    FR Gui...

    function applyAttachment(leaf) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndIcon, 'iconlist') if not leaf then return end end if isElement(pickup) then destroyElement(pickup) end local x, y, z = getElementPosition(g_Me) pickup = createPickup(x, y, z, 3, tonumber(leaf.id)) if pickup then attachElements(pickup, g_Me, 0, 0, 1.5) end end
  18. Castillo

    FR Gui...

    function applyAttachment(leaf) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndIcon, 'iconlist') if not leaf then return end end local x, y, z = getElementPosition(g_Me) local pickup = createPickup(x, y, z, 3, tonumber(leaf.id)) if pickup then attachElements(pickup, g_Me, 0, 0, 1.5) end end wndIcon = { 'wnd', text = 'Icon Window', width = 250, controls = { { 'lst', id='iconlist', width=230, height=280, columns={ {text='Icons', attr='name'} }, rows={xml='icons.xml', attrs={'id', 'name'}}, onitemdoubleclick=applyAttachment }, {'btn', id='Use', onclick=applyAttachment}, {'btn', id='Close', closeswindow=true} } } Everything works fine, but it won't attach it, dunno why.
  19. Yes, you can use a timer and it will work. segundos = 30 timerEnabled = false function onJoin () if gamemodeStarted == false then setElementData(source,"secondsRemaining",tostring(segundos)) --if timerEnabled then --setElementData(source,"secondsRemaining",tostring(segundos)) --triggerClientEvent ( source, "showDX", source) --end if(getPlayerCount() >= 2) then escreve() end end end addEventHandler ( "onPlayerJoin", getRootElement(), onJoin ) function escreve () timerEnabled = true for i,v in pairs(getElementsByType("player")) do setElementData(v,"secondsRemaining",tostring(segundos)) triggerClientEvent ( v, "showDX", v ) end setTimer(countDown,1000,30) end function countDown() segundos = segundos -1 for i,v in pairs(getElementsByType("player")) do setElementData(v,"secondsRemaining",tostring(segundos)) end if segundos <= 0 then triggerClientEvent ( "hideDX", getRootElement() ) timerEnabled = false spawn() gamemodeStarted = true end end function onStart () timerEnabled = false if(getPlayerCount() >= 2) then --for i, v in ipairs(getElementsByType("player")) do --setElementData(v,"secondsRemaining",tostring(segundos)) --end setTimer(escreve,1000,1) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onStart )
  20. I had similar problems triggering events to client onResourceStart.
  21. Demon, don't double post, even saying the same thing.....
×
×
  • Create New...