Jump to content

Forums

  1. Multi Theft Auto: San Andreas 1.x

    1. Support for MTA:SA 1.x

      HELP! HELP! Need help? Post here.

      54.9k
      posts
    2. User Guides

      These guides are a good place to start learning how to achieve certain things within MTA in an efficient and well mannered way.

      11
      posts
    3. Open Source Contributors

      This space is for contributors to discuss the development of MTA. No user suggestions/support.

      1.3k
      posts
    4. Suggestions

      Suggestions and requests go here. Please note that actual feature requests must be filed on our GitHub.

      7.7k
      posts
    5. Ban appeals

      Use this forum to appeal your GLOBAL MTA:SA bans. Permanent bans only - appeals for timed ones (eg. 24 hours) will be refused.

      Do not use it for appealing server-specific bans as we do not have power over these specific servers.

      4.6k
      posts
  2. General MTA

    1. News

      News and updates on Multi Theft Auto.

      9.8k
      posts
    2. Media

      User-made screens and movies go here.

      4.5k
      posts
    3. Site/Forum/Discord/Mantis/Wiki related

      Share your comments & concerns about our services.

      5.6k
      posts
    4. MTA Chat

      MTA related chat that is NOT support related!

      2.1k
      posts
    5. 330.3k
      posts
  3. MTA Community

    1. Scripting

      All Lua scripting topics related to Multi Theft Auto.

      261.2k
      posts
    2. Maps

      Discussions for maps on various gamemodes.

      13.4k
      posts
    3. Resources

      Everything else about resources.

      28.6k
      posts
    4. Other Creations & GTA modding

      This section includes things such as GUI themes, forum userbars, user-created MTA logos, etc. Also contains topics which cover general GTA modding areas that can be used in MTA, such as modelling.

      2.5k
      posts
    5. Competitive gameplay

      Discussions about various MTA-related competitive gameplay events. Also gang (clan) forums.

      26.7k
      posts
    6. Servers

      Looking for a server to play on? Looking for someone to host your server? Looking for a place to discuss with other server owners? Here's where to look.

      15.6k
      posts
  4. Other

    1. General

      Non-MTA discussions. Anything you want.

      38.1k
      posts
    2. Multi Theft Auto 0.5r2

      Discussion regarding Multi Theft Auto 0.5r2 for GTAIII and Vice City.

      672
      posts
    3. Third party GTA mods

      Showcase for single player mods and requests.

      812
      posts
  5. Archive

    1. 144k
      posts
    2. Trash

      These posts have broken forum rules. They are stored here temporarily so offending users can see what they have done wrong.

      2.6k
      posts
  • Posts

    • Alguém Teria Um Bate Ponto Que quando vc da o comando ele coloca vc na acl que vc escolhe e se der o outro comando sai da acl que te coloco    ex: dou /ponto e vou para acl Policial, dps eu dou /sair eu sou tirado da acl policial  e para acessar o marker precisa estar na acl BAEP   Se alguém tiver eu agradeço demais
    • Can anyone help me?  
    • I have this client script in my customblips resource:    ---------------BUGS------------------- --* 1)        There's a period in between entering and exiting a vehicle whereby the camera switches its "lock on" from the ped to the vehicle or vice versa --        During this period, It is not possible to rotate the camera, but getCameraMatrix returns the lookAt point as if it had rotated.   --        This means the customblip rotates like crazy but the radar doesnt -- --* 2)        showPlayerHUDComponent has the ability to hide the radar, but custom blips is not aware of this. --        All scripts would also need to hook into customblips to notify it whenever hiding the radar -- -- Bug #2 is most easily fixed if we get a isRadarVisible/isPlayerHUDComponentVisible function or something to that effect local g_screenX,g_screenY = guiGetScreenSize() local localPlayer = getLocalPlayer() --Radar position/size  local rel = {     pos_x = 0.0625,                 pos_y = 0.76333333333333333333333333333333,                 size_x = 0.15,                 size_y = 0.175,                 radar_blip_y = 0.03333333333333333333333333333333, } local abs = {     pos_x = math.floor(rel.pos_x * g_screenX),                 pos_y = math.floor(rel.pos_y * g_screenY),                 size_x = math.floor(rel.size_x * g_screenX),                 size_y = math.floor(rel.size_y * g_screenY),                 radar_blip_y = math.floor(rel.radar_blip_y * g_screenY) } abs.half_size_x =  abs.size_x/2 abs.half_size_y =  abs.size_y/2 abs.center_x = abs.pos_x + abs.half_size_x abs.center_y = abs.pos_y +abs.half_size_y local minBound = 0.1*g_screenY function getRadarScreenRadius ( angle ) --Since the radar is not a perfect ciricle, we work out the screen size of the radius at a certain angle     return math.max(math.abs((math.sin(angle)*(abs.half_size_x - abs.half_size_y))) + abs.half_size_y,minBound) end count = 0 function renderBlip ( blip, toF11Map, radarWorldX, radarWorldY, camRot, radarRadius, F11minX, F11minY, F11maxX, F11maxY, F11sizeX, F11sizeY )     local blipX,blipY = streamedBlips[blip].x,streamedBlips[blip].y     local width,height = streamedBlips[blip].width,streamedBlips[blip].height     local radarScale = streamedBlips[blip].radarScale     if not toF11Map then         local toBlipRot = getVectorRotation(radarWorldX,radarWorldY,blipX,blipY )         local blipRot = toBlipRot - camRot         --Get the screen radius at that rotation         local radius = getRadarScreenRadius ( blipRot )         count = count + 1         local distance = getDistanceBetweenPoints2D ( radarWorldX,radarWorldY,blipX,blipY )         if (distance <= radarRadius) then             setWidgetIsInRadar(blip, true)             radius = (distance/radarRadius)*radius                 else             setWidgetIsInRadar(blip, false)         end         local tx = radius * math.sin(blipRot) + abs.center_x         local ty = -radius * math.cos(blipRot) + abs.center_y             --         local sx,sy  = width,height         if radarScale then             sx,sy = width*radarScale, height*radarScale             setWidgetSize (blip,sx,sy)         else             --If the user hasnt forced a radar blip scale, we use GTA's default sizing             local ratio = abs.radar_blip_y/height             sx = ratio*width             sy = abs.radar_blip_y             setWidgetSize (blip,sx,sy)         end         setWidgetPosition(blip,tx-sx/2,ty-sy/2)     else --Render to f11 map         local minX, minY, maxX, maxY, sizeX, sizeY = F11minX, F11minY, F11maxX, F11maxY, F11sizeX, F11sizeY         --         local mapX = blipX + 3000         local mapY = blipY + 3000         mapX = mapX*sizeX + minX         mapY = maxY - mapY*sizeY         --We set the original size in the F11 map         local sx,sy = width,height         setWidgetSize (blip,width,height)         setWidgetPosition(blip,mapX-sx/2,mapY-sy/2)     end end And I'm wondering how I can solve the Bug #2 with my radar client script in my radar resource.   local screenSize = Vector2(guiGetScreenSize()) local settingsFileName = "configs.json" local radar = {     x = 25,     y = (screenSize.y - 240),     w = 200,     h = 200,     mapImg = dxCreateTexture("images/map.png");     mapSize = 3072,     playerSize = 24,     blipSize = 12,     shape = "round", } local bold = exports.fonts:getFont("roboto",12) local rt = dxCreateRenderTarget(radar.w, radar.h, true) local roundShaderMask = dxCreateShader("files/hud_mask.fx") local roundShaderImage = dxCreateTexture("images/circle_mask.png") local mapIcon = dxCreateTexture("images/map_icon.png"); addEventHandler("onClientResourceStart", resourceRoot, function()     if not rt then rt = dxCreateRenderTarget(radar.w, radar.h, true) end     if not roundShaderMask then roundShaderMask = dxCreateShader("files/hud_mask.fx") end     if not roundShaderImage then roundShaderImage = dxCreateTexture("images/circle_mask.png") end     dxSetShaderValue(roundShaderMask, "sPicTexture", rt)     dxSetShaderValue(roundShaderMask, "sMaskTexture", roundShaderImage)     setPlayerHudComponentVisible('radar', false)     --dxSetShaderTransform(roundShaderMask, 0, 110, 0)     local confile = fileOpen(settingsFileName)     if confile then         local count = fileGetSize(confile)         local data = fileRead(confile, count)         fileClose(confile)         data = fromJSON(data)         radar.x = data.x         radar.y = data.y         radar.w = data.w         radar.h = data.h         radar.shape = data.shape     else         confile = fileCreate(settingsFileName)         fileClose(confile)     end end) function getPlayerPosOnMap()     local playerPos = Vector3(getElementPosition(localPlayer))     local mapX = radar.w/2 -(playerPos.x/(6000/radar.mapSize))     local mapY = radar.h/2 + (playerPos.y/(6000/radar.mapSize))     return Vector2(mapX, mapY) end addEventHandler("onClientRender", root, function()     if not bold then         bold = dxCreateFont(":hud/roboto.ttf", 12)     end     if getElementData(localPlayer, "loggedin") ~= 1 then return false end     if not exports.hud:isActive() then return false end     if getElementInterior(localPlayer) ~= 0 then return false end     local camX,camY,camZ = getElementRotation(getCamera())     local playerPos = getPlayerPosOnMap()     local pos = Vector2(getElementPosition(localPlayer))     if rt then         dxSetRenderTarget(rt, true)         dxDrawImage(playerPos.x - radar.mapSize/2, playerPos.y - radar.mapSize/2, radar.mapSize, radar.mapSize, radar.mapImg, camZ, (pos.x/(6000/radar.mapSize)), -(pos.y/(6000/radar.mapSize)))         dxSetRenderTarget()     end     if radar.shape == "rect" or radar.shape == "square" then         dxDrawRectangle(radar.x - 5, radar.y - 5, radar.w + 10, radar.h + 10, tocolor(17, 17, 17, 255))         dxDrawImage(radar.x, radar.y, radar.w, radar.h, rt)         dxDrawRectangle(radar.x, radar.y, radar.w, 23, tocolor(17, 17, 17, 200))         dxDrawImage(radar.x + 2, radar.y, 20, 20, mapIcon, 0, 0, 0, tocolor(217, 70, 70))         dxDrawText(getZoneName(getElementPosition(localPlayer)), radar.x + 25, radar.y, 0, radar.y + 20, tocolor(255, 255, 255), 1, bold, "left", "center")         dxDrawText("© Los Santos Roleplay", radar.x + 3, radar.y + radar.h - 15, 0, 0, tocolor(217, 70, 70, 150), 1)     elseif radar.shape == "round" then         dxDrawImage(radar.x - 8, radar.y - 6, radar.w + 16, radar.h + 16, roundShaderImage, 0, 0, 0, tocolor(217, 70, 70))         dxDrawImage(radar.x - 8, radar.y - 8, radar.w + 16, radar.h + 16, roundShaderImage, 0, 0, 0, tocolor(17, 17, 17))         dxDrawImage(radar.x, radar.y, radar.w, radar.h, roundShaderMask)     end     local rB, lB, tB, bB = radar.x + radar.w, radar.x, radar.y, radar.y + radar.h     local cX, cY = (rB+lB)/2, (tB+bB)/2     local toLeft, toTop, toRight, toBottom = cX-lB, cY-tB, rB-cX, bB-cY     if radar.shape == "square" or radar.shape == "rect" then         tB = radar.y + 25     end     for _, blip in ipairs(getElementsByType("blip")) do         local blipPos = Vector2(getElementPosition(blip))         local distance = getDistanceBetweenPoints2D(blipPos.x, blipPos.y, pos.x, pos.y)         local maxDistance = getBlipVisibleDistance(blip)         if distance <= maxDistance and getElementDimension(blip) == getElementDimension(localPlayer) and getElementInterior(localPlayer) == getElementInterior(blip) then             local trueDistance = distance/(6000/radar.mapSize)             local rot = findRotation(blipPos.x, blipPos.y, pos.x, pos.y) - camZ             local goodBlipPos = Vector2(getPointFromDistanceRotation(cX, cY, math.min(trueDistance, math.sqrt(toTop^2 + toRight^2)), rot))             if radar.shape ~= "rect" and radar.shape ~= "square" then                 goodBlipPos = Vector2(getPointFromDistanceRotation(cX, cY, math.min(trueDistance, radar.w/2), rot))             end             goodBlipPos.x = math.max(lB, math.min(rB, goodBlipPos.x))             goodBlipPos.y = math.max(tB, math.min(bB, goodBlipPos.y))             local r, g, b, a = getBlipColor(blip)             dxDrawImage(goodBlipPos.x - (radar.blipSize * getBlipSize(blip))/2, goodBlipPos.y - (radar.blipSize * getBlipSize(blip))/2, radar.blipSize * getBlipSize(blip), radar.blipSize * getBlipSize(blip), "images/blips/" .. getBlipIcon(blip) .. ".png", 0, 0, 0, tocolor(r or 255, g or 255, b or 255, a or 255))         end     end     --[[local ux, uy = nil, nil         local alapBeallitasok = exports['ace_rendszer']:getAlapBeallitasok()         for i,utvonal in ipairs(gpsPontok) do             local hsl = exports['ace_rendszer']:tabla_masolas(alapBeallitasok["szerverSzin"]["hsl"])             hsl[2] = -0.5             local szin = {exports['ace_rendszer']:hsl2rgb(hsl[1], hsl[2], hsl[3])}             local x,y = utvonal.x, utvonal.y             local n_x = (((((3000)+x)/(6000)*(radar.mapSize))-((radar.w/2)))+((radar.w/2)))             local n_y = ((((3000-y)/(6000)*radar.mapSize)-((radar.h/2)))+((radar.h/2)))             if(ux and uy) then                 dxDrawLine ( ux, uy, n_x, n_y, tocolor(144, 0, 254, 255), 8 )                 ux, uy = n_x, n_y             else                 ux, uy = n_x,n_y             end         end]]     dxDrawImage((radar.x + radar.w/2) - radar.playerSize/2, (radar.y + radar.h/2) - radar.playerSize/2, radar.playerSize, radar.playerSize, "images/player.png", camZ-getPedRotation(localPlayer)) end) north = createBlip( 0, 10000, 0, 4, 2, 255, 255, 255 ) function findRotation( x1, y1, x2, y2 )     local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) )     return t < 0 and t + 360 or t end function getPointFromDistanceRotation(x, y, dist, angle) --Author: robhol     local a = math.rad(90 - angle);     local dx = math.cos(a) * dist;     local dy = math.sin(a) * dist;     return x+dx, y+dy; end addEvent("radar:changeShape", true) addEventHandler("radar:changeShape", root, function(shape)     if shape == "round" then         radar.w = 200         radar.h = 200         radar.y = (screenSize.y - 240)     elseif shape == "square" then         radar.w = 200         radar.h = 200         radar.y = (screenSize.y - 240)     elseif shape == "rect" then         radar.y = (screenSize.y - 190)         radar.w = 200         radar.h = 150     end     radar.shape = shape     saveRadarConf() end) function saveRadarConf()     local confile = fileOpen(settingsFileName)     if not confile then         confile = fileCreate(settingsFileName)     end     local conTable = {         x = radar.x,         y = radar.y,         w = radar.w,         h = radar.h,         shape = radar.shape     }     fileWrite(confile, toJSON(conTable))     fileClose(confile) end --BLIPS CNN = createBlip(1419.16796875, -1607.21875, 13.546875, 19, 2, 255, 255, 255) PD = createBlip(1554.8681640625, -1675.5947265625, 16.1953125, 30, 2, 255, 255, 255) GOV = createBlip(1481.0302734375, -1772.3134765625, 18.795755386353, 41, 2, 255, 255, 255) SMURD = createBlip(1172.0771484375, -1323.3505859375, 15.403001785278, 22, 2, 255, 255, 255) TUNNING = createBlip(946.90625, -1655.5498046875, 13.543536186218, 27, 2, 255, 255, 255) Can somebody help me ?    
    • well i downloaded this resource and idk how to change the interior and dimension of the marker.    ----------------- --- (c) 2010 ---- --- by Zipper --- ----------------- --[[ Don't change anything if you don't know what you're doing!!! ______________________________ Please don't remove the copyright, but feel free to edit this resource and please report if you find a bug! ______________________________ Maybe it would have been better to use tables instead of "_G", but i simply like the "_G" much more. ______________________________ Don't like the optic of the cards? Think that "_G" is crap? Think that my english is too bad? Then go to hell. ]] pokerPlayerPositions = {} pokerPlayerPositions[1] = {} pokerPlayerPositions[1]["x"] = 1117.9412841797 pokerPlayerPositions[1]["y"] = 11.394277572632 pokerPlayerPositions[1]["z"] = 1002 pokerPlayerPositions[1]["rot"] = 0 pokerPlayerPositions[2] = {} pokerPlayerPositions[2]["x"] = 1118.427734375 pokerPlayerPositions[2]["y"] = 12.34 pokerPlayerPositions[2]["z"] = 1001.8 pokerPlayerPositions[2]["rot"] = -45 pokerPlayerPositions[3] = {} pokerPlayerPositions[3]["x"] = 1119.2440185547 pokerPlayerPositions[3]["y"] = 12.797629356384 pokerPlayerPositions[3]["z"] = 1002 pokerPlayerPositions[3]["rot"] = -90 pokerPlayerPositions[4] = {} pokerPlayerPositions[4]["x"] = 1120.1339111328 pokerPlayerPositions[4]["y"] = 12.356394767761 pokerPlayerPositions[4]["z"] = 1002 pokerPlayerPositions[4]["rot"] = -135 pokerPlayerPositions[5] = {} pokerPlayerPositions[5]["x"] = 1120.3681640625 pokerPlayerPositions[5]["y"] = 11.336325645447 pokerPlayerPositions[5]["z"] = 1002 pokerPlayerPositions[5]["rot"] = 180 pokerPlayerPositions[6] = {} pokerPlayerPositions[6]["x"] = 1118.6916503906 pokerPlayerPositions[6]["y"] = 10.396108627319 pokerPlayerPositions[6]["z"] = 1001.5 pokerPlayerPositions[6]["rot"] = 206 -- The door & the dice-blip at the marker-position createObject ( 3109, -2502.216796875, 2361.5061035156, 5.2554173469543 ) createBlip ( -2502.216796875, 2361.5061035156, 5.2554173469543, 25 ) -- Need an explanation? pokerPlayer1 = false pokerPlayer2 = false pokerPlayer3 = false pokerPlayer4 = false pokerPlayer5 = false pokerPlayer6 = false pokerCurPlayers = 0 pokerFirstLoop = false pokerPlayer1In = false pokerPlayer2In = false pokerPlayer3In = false pokerPlayer4In = false pokerPlayer5In = false pokerPlayer6In = false pokerPlayer1Money = 0 pokerPlayer2Money = 0 pokerPlayer3Money = 0 pokerPlayer4Money = 0 pokerPlayer5Money = 0 pokerPlayer6Money = 0 pokerPlayer1Bet = 0 pokerPlayer2Bet = 0 pokerPlayer3Bet = 0 pokerPlayer4Bet = 0 pokerPlayer5Bet = 0 pokerPlayer6Bet = 0 pokerPlayer1HandValue = 0 pokerPlayer2HandValue = 0 pokerPlayer3HandValue = 0 pokerPlayer4HandValue = 0 pokerPlayer5HandValue = 0 pokerPlayer6HandValue = 0 communityCard1 = false communityCard2 = false communityCard3 = false communityCard4 = false communityCard5 = false pokerPlayer1TotalBet = 0 pokerPlayer2TotalBet = 0 pokerPlayer3TotalBet = 0 pokerPlayer4TotalBet = 0 pokerPlayer5TotalBet = 0 pokerPlayer6TotalBet = 0 curPokerRound = 0 curPokerPlayer = false curPokerPot = 0 curPokerBlindPlayer = false bigBlind = 20 smallBlind = bigBlind / 2 -- The Marker for entering the poker pokerEntranceMarker = createMarker ( 1119.03, 9.81, 1002.07, "cylinder", 1.5, 125, 0, 0, 125, 1620, 12 ) -- The poker table pokerTable = createObject ( 2189, 1119.17, 11.49, 1001.88 ) setElementInterior ( pokerTable, 12 ) pokerChair1 = createObject ( 1720, 1119.8155517578, 10.448568344116, 1001.078, 0, 0, 206 ) pokerChair2 = createObject ( 1720, 1118.6916503906, 10.396108627319, 1001.078, 0, 0, 146 ) setElementInterior ( pokerChair1, 12 ) setElementInterior ( pokerChair2, 12 ) function pokerMarkerHit ( hit, dim ) if dim then if getElementType ( hit ) == "player" then suc = true for i = 1, 6 do if _G["pokerPlayer"..i] == hit then suc = false break end end -- Only proceed if the player isn't already playing and is not in a vehicle! if not getPedOccupiedVehicle ( hit ) and suc then -- If there is one more seat if pokerCurPlayers <= 5 then pokerCurPlayers = pokerCurPlayers + 1 for i = 1, 6 do if not _G["pokerPlayer"..i] then _G["pokerPlayer"..i] = hit _G["pokerPlayer"..i.."Money"] = 200 _G["pokerPlayer"..i.."In"] = false setPedFrozen ( hit, true ) setElementPosition ( hit, pokerPlayerPositions[i]["x"], pokerPlayerPositions[i]["y"], pokerPlayerPositions[i]["z"] ) setElementInterior ( hit, 12 ) setPedRotation ( hit, pokerPlayerPositions[i]["rot"] - 90 ) setCameraMatrix ( hit, 1119.8720703125, 11.228228569031, 1005.1077270508, 1119.1854248047, 11.514589309692, 1002.0599365234 ) toggleAllControls ( hit, false, true, false ) -- Sometimes the animations stops, don't ask me why for i = 1, 6 do if _G["pokerPlayer"..i] then setPedAnimation ( _G["pokerPlayer"..i], "FOOD", "FF_Sit_Loop", -1, true, false, false ) setPedRotation ( _G["pokerPlayer"..i], pokerPlayerPositions[i]["rot"] - 90 ) end end showCursor ( hit, true ) setElementData ( hit, "ElementClicked", true ) triggerClientEvent ( hit, "showPokerHand", hit, 0, 0 ) triggerClientEvent ( hit, "setVarbs", getRootElement(), "pokerCurOwnChips", 200 ) -- Refresh the Values for the new player for k = 1, 6 do if _G["pokerPlayer"..k] then _G["p"..k] = "(".._G["pokerPlayer"..k.."Money"]..") "..getPlayerName ( _G["pokerPlayer"..k] ) if _G["pokerPlayer"..k.."In"] then _G["p"..k.."s"] = true else _G["p"..k.."s"] = false end else _G["p"..k] = "" _G["p"..k.."s"] = false end end sendMessageToAllPokerPlayers ( getPlayerName(hit).." joined the game!", 200, 200, 0 ) triggerClientEvent ( _G["pokerPlayer"..i], "refreshPokerVarbs", getRootElement(), _G["pokerPlayer"..i.."Bet"], curPokerPot, getHighestCall(), _G["pokerPlayer"..i.."Money"], p1, p1s, p2, p2s, p3, p3s, p4, p4s, p5, p5s, p6, p6s ) if not pokerRoundStarted then _G["pokerPlayer"..i.."In"] = true else _G["pokerPlayer"..i.."In"] = false end break end end else outputChatBox ( "Please wait, all seats are currently in use!", hit, 125, 0, 0 ) end end end end end addEventHandler ( "onMarkerHit", pokerEntranceMarker, pokerMarkerHit ) function takePlayerChips ( player, amount ) _G["pokerPlayer"..player.."Money"] = _G["pokerPlayer"..player.."Money"] - amount curPokerPot = curPokerPot + amount if _G["pokerPlayer"..player.."Money"] < 0 then _G["pokerPlayer"..player.."Money"] = 0 sendMessageToAllPokerPlayers ( getPlayerName(_G["pokerPlayer"..player]).." is all in!", 0, 0, 170 ) end end function roundCheck() -- Check if enough players are there - -- if there are enough, proceed pokerCurPlayers = 0 for i = 1, 6 do if _G["pokerPlayer"..i] ~= false then pokerCurPlayers = pokerCurPlayers + 1 if _G["pokerPlayer"..i.."Money"] <= 0 then setPlayerLeavingPoker_func ( _G["pokerPlayer"..i] ) end end end if pokerCurPlayers > 1 then curPokerPot = 0 sendMessageToAllPokerPlayers ( "Dealer: New round!", 200, 200, 0 ) pokerRoundStarted = true curPokerRound = 0 if not curPokerBlindPlayer then curPokerBlindPlayer = 0 end pokerFirstLoop = false for i = 1, 6 do _G["pokerPlayer"..i.."Bet"] = 0 end i = getNextPlayerAtPoker ( curPokerBlindPlayer ) i = getPrevPlayerAtPoker ( i ) curPokerBlindPlayer = i _G["pokerPlayer"..i.."Bet"] = bigBlind takePlayerChips ( i, bigBlind ) _G["pokerPlayer"..i.."Bet"] = _G["pokerPlayer"..i.."Bet"] smallBlindPlayer = getNextPlayerAtPoker (curPokerBlindPlayer) _G["pokerPlayer"..smallBlindPlayer.."Bet"] = smallBlind takePlayerChips ( smallBlindPlayer, smallBlind ) sendMessageToAllPokerPlayers ( "Dealer: Bigblind: "..getPlayerName(_G["pokerPlayer"..curPokerBlindPlayer])..", Smallblind: "..getPlayerName(_G["pokerPlayer"..smallBlindPlayer]).."!", 200, 200, 0 ) cardsInUse = nil cardsInUse = {} pokerFirstLoop = false -- Give out the hand cards for the players & some other things for i = 1, 6 do _G["pokerPlayer"..i.."HandValue"] = 0 if _G["pokerPlayer"..i] then card1 = getNewCard() card2 = getNewCard() _G["pokerPlayer"..i.."In"] = true _G["pokerPlayer"..i.."card1"] = card1 _G["pokerPlayer"..i.."card2"] = card2 triggerClientEvent ( _G["pokerPlayer"..i], "showPokerHand", getRootElement(), card1, card2 ) triggerClientEvent ( _G["pokerPlayer"..i], "setVarbs", _G["pokerPlayer"..i], "pokerCurBets", bigBlind ) end end setTimer ( nextRoundPlayer, 1000, 1 ) else if isTimer ( roundCheckTimer ) then killTimer ( roundCheckTimer ) end roundCheckTimer = setTimer ( roundCheck, 5000, 1 ) end end roundCheckTimer = setTimer ( roundCheck, 5000, 1 ) function playerTurnCheck_func ( player ) -- if the player decides to check local id = getPlayerPokerID ( player ) sendMessageToAllPokerPlayers ( getPlayerName(player).." checks!", 200, 0, 0 ) killTimer ( timeoutTimer ) nextRoundPlayer () end addEvent ( "playerTurnCheck", true ) addEventHandler ( "playerTurnCheck", getRootElement(), playerTurnCheck_func ) function playerTurnCall_func ( player ) -- if the player decides to call local id = getPlayerPokerID ( player ) sendMessageToAllPokerPlayers ( getPlayerName(player).." calls ( To "..getHighestCall().." )!", 200, 0, 0 ) local curAmount = getHighestCall () local amount = curAmount - _G["pokerPlayer"..id.."Bet"] -- Check if its an all in if amount >= _G["pokerPlayer"..id.."Money"] then _G["pokerPlayer"..id.."TotalBet"] = _G["pokerPlayer"..id.."TotalBet"] + amount sendMessageToAllPokerPlayers ( getPlayerName(_G["pokerPlayer"..id]).." is all in!", 0, 0, 170 ) else _G["pokerPlayer"..id.."TotalBet"] = _G["pokerPlayer"..id.."TotalBet"] + _G["pokerPlayer"..id.."Money"] end curPokerPot = curPokerPot + amount _G["pokerPlayer"..id.."Bet"] = getHighestCall () killTimer ( timeoutTimer ) nextRoundPlayer () end addEvent ( "playerTurnCall", true ) addEventHandler ( "playerTurnCall", getRootElement(), playerTurnCall_func ) function playerTurnRaise_func ( amount ) -- if the player decides to raise local player = source sendMessageToAllPokerPlayers ( getPlayerName(player).." raises ( To: "..amount.." )!", 200, 0, 0 ) local id = getPlayerPokerID ( player ) takePlayerChips ( id, amount ) _G["pokerPlayer"..id.."Bet"] = _G["pokerPlayer"..id.."Bet"] + amount _G["pokerPlayer"..id.."TotalBet"] = _G["pokerPlayer"..id.."TotalBet"] + amount if isTimer ( timeoutTimer ) then killTimer ( timeoutTimer ) end nextRoundPlayer () end addEvent ( "playerTurnRaise", true ) addEventHandler ( "playerTurnRaise", getRootElement(), playerTurnRaise_func ) function playerTurnFold_func () -- if the player decides to fold local player = source local id = getPlayerPokerID ( player ) sendMessageToAllPokerPlayers ( getPlayerName(player).." folds!", 200, 0, 0 ) _G["pokerPlayer"..id.."Bet"] = 0 _G["pokerPlayer"..id.."In"] = false if isTimer ( timeoutTimer ) then killTimer ( timeoutTimer ) end nextRoundPlayer () end addEvent ( "playerTurnFold", true ) addEventHandler ( "playerTurnFold", getRootElement(), playerTurnFold_func ) function getPlayerPokerID ( player ) -- get the poker-ID of the player, responsible for his money / seat / ect. for i = 1, 6 do if _G["pokerPlayer"..i] == player then return i end end end function getHighestCall () -- get the highest call local highest = 0 for i = 1, 6 do if _G["pokerPlayer"..i.."Bet"] > highest then highest = _G["pokerPlayer"..i.."Bet"] end end return highest end function nextRoundPlayer () -- After a player decides to call / raise / whatever if isTimer ( timeoutTimer ) then killTimer ( timeoutTimer ) end sucess = true p1, p2, p3, p4, p5, p6, p1s, p2s, p3s, p4s, p5s, p6s = getPokerPlayerStats() for i = 1, 6 do if _G["pokerPlayer"..i] then triggerClientEvent ( _G["pokerPlayer"..i], "refreshPokerVarbs", getRootElement(), _G["pokerPlayer"..i.."Bet"], curPokerPot, getHighestCall(), _G["pokerPlayer"..i.."Money"], p1, p2, p3, p4, p5, p6, p1s, p2s, p3s, p4s, p5s, p6s ) end end counter = 0 for i = 1, 6 do if _G["pokerPlayer"..i.."In"] then counter = counter + 1 pokerCPlayerFolder = i if _G["pokerPlayer"..i.."Bet"] ~= getHighestCall () and _G["pokerPlayer"..i.."Money"] ~= 0 then sucess = false end end end if counter == 0 then sendMessageToAllPokerPlayers ( "Runde beendet!", 0, 125, 0 ) resetPokerValues() elseif counter == 1 then sendMessageToAllPokerPlayers ( "Runde beendet - Durch Fold gewonnen hat: "..getPlayerName(_G["pokerPlayer"..pokerCPlayerFolder]).."!", 0, 125, 0 ) _G["pokerPlayer"..pokerCPlayerFolder.."Money"] = _G["pokerPlayer"..pokerCPlayerFolder.."Money"] + curPokerPot for i = 1, 6 do if _G["pokerPlayer"..i] then triggerClientEvent ( _G["pokerPlayer"..i], "hidePokerPlayerBtns", getRootElement() ) end end resetPokerValues() else if curPokerPlayer == curPokerBlindPlayer then pokerFirstLoop = true elseif not _G["pokerPlayer"..curPokerBlindPlayer.."In"] then if curPokerPlayer == getPrevPlayerAtPoker ( curPokerBlindPlayer ) then pokerFirstLoop = true end end if not sucess or not pokerFirstLoop then nextPlayer() pokerFirstLoop = false elseif curPokerRound == 0 then showFlop() pokerFirstLoop = false elseif curPokerRound == 1 then showTurn() pokerFirstLoop = false elseif curPokerRound == 2 then showRiver() pokerFirstLoop = false elseif curPokerRound == 3 then getWinner() pokerFirstLoop = false end end end function setPlayerLeavingPoker_func ( player, id ) -- If someone leaves the game, for e.g. by disconnect -- or "timeout" triggerEvent ( "playerTurnFold", player ) if not id then id = getPlayerPokerID ( player ) end if isElement ( player ) then setPedFrozen ( player, false ) setElementPosition ( player, -2504.489, 2362.214, 4.634 ) setElementInterior ( player, 0 ) setCameraTarget ( player, player ) toggleAllControls ( player, true, true, true ) setPedAnimation ( player ) showCursor ( player, false ) setElementData ( player, "ElementClicked", false ) sendMessageToAllPokerPlayers ( getPlayerName(player).." left the game!", 200, 200, 0 ) triggerClientEvent ( player, "hidePokerDisplay", getRootElement() ) end _G["pokerPlayer"..id] = false _G["pokerPlayer"..id.."HandValue"] = 11 _G["pokerPlayer"..id.."Bet"] = 0 _G["pokerPlayer"..id.."Money"] = 0 _G["pokerPlayer"..id.."In"] = false pokerCurPlayers = pokerCurPlayers - 1 if curPokerPlayer == id then nextPlayer () end end addEvent ( "setPlayerLeavingPoker", true ) addEventHandler ( "setPlayerLeavingPoker", getRootElement(), setPlayerLeavingPoker_func ) -- If a player quits whos playing at the moment function pokerPlayerQuit () for i = 1, 6 do if _G["pokerPlayer"..i] == source then setPlayerLeavingPoker_func ( source ) end end end addEventHandler ( "onPlayerQuit", getRootElement(), pokerPlayerQuit ) -- start the turn of the next player function nextPlayer () if not curPokerPlayer then curPokerPlayer = getNextPlayerAtPoker ( getNextPlayerAtPoker ( getNextPlayerAtPoker ( 0 ) ) ) end curPokerPlayer = getNextPlayerAtPoker ( curPokerPlayer ) sendMessageToAllPokerPlayers ( getPlayerName(_G["pokerPlayer"..curPokerPlayer]).."'s turn!", 0, 0, 170 ) outputChatBox ( "Current call: "..getHighestCall()..", your call: ".._G["pokerPlayer"..curPokerPlayer.."Bet"], _G["pokerPlayer"..curPokerPlayer], 150, 150, 25 ) if isTimer ( timeoutTimer ) then killTimer ( timeoutTimer ) end local player = _G["pokerPlayer"..curPokerPlayer] timeoutTimer = setTimer ( setPlayerLeavingPoker_func, 30000, 1, player, curPokerPlayer ) triggerClientEvent ( _G["pokerPlayer"..curPokerPlayer], "turnBegin", getRootElement() ) end -- show the flop to the players function showFlop() communityCard1 = getNewCard() communityCard2 = getNewCard() communityCard3 = getNewCard() for i = 1, 6 do _G["pokerPlayer"..i.."Bet"] = 0 end for i = 1, 6 do if _G["pokerPlayer"..i] then triggerClientEvent ( _G["pokerPlayer"..i], "refreshPokerCommunityCards", getRootElement(), communityCard1, communityCard2, communityCard3 ) end end curPokerRound = curPokerRound + 1 nextPlayer () end -- show the turn to the players function showTurn() communityCard4 = getNewCard() for i = 1, 6 do _G["pokerPlayer"..i.."Bet"] = 0 end for i = 1, 6 do if _G["pokerPlayer"..i] then triggerClientEvent ( _G["pokerPlayer"..i], "refreshPokerCommunityCards", getRootElement(), communityCard1, communityCard2, communityCard3, communityCard4 ) end end curPokerRound = curPokerRound + 1 nextPlayer () end -- show the river to the players function showRiver() communityCard5 = getNewCard() for i = 1, 6 do _G["pokerPlayer"..i.."Bet"] = 0 end for i = 1, 6 do if _G["pokerPlayer"..i] then triggerClientEvent ( _G["pokerPlayer"..i], "refreshPokerCommunityCards", getRootElement(), communityCard1, communityCard2, communityCard3, communityCard4, communityCard5 ) end end curPokerRound = curPokerRound + 1 nextPlayer () end -- force the clients to "tell" their hand-values function getWinner() for i = 1, 6 do if _G["pokerPlayer"..i] and _G["pokerPlayer"..i.."In"] then triggerClientEvent ( _G["pokerPlayer"..i], "getPlayerBestHand", getRootElement(), communityCard1, communityCard2, communityCard3, communityCard4, communityCard5, _G["pokerPlayer"..i.."card1"], _G["pokerPlayer"..i.."card2"] ) else _G["pokerPlayer"..i.."HandValue"] = 11 end end setTimer ( finalCheck, 2000, 1 ) end function finalCheck () curWinnerValue = 11 pokerPlayer0HandSecValue = 0 curWinner = 0 curWinners = 0 curWinnersList = nil curWinnersList = {} for i = 1, 6 do if _G["pokerPlayer"..i.."In"] then val = _G["pokerPlayer"..i.."HandValue"] -- If a player has a better hand than the current "winner" -- "<" instead ">", because smaller values are better hands if _G["pokerPlayer"..i.."HandValue"] < curWinnerValue then curWinnerValue = _G["pokerPlayer"..i.."HandValue"] curWinner = i curWinners = 1 curWinnersList = nil curWinnersList = {} table.insert ( curWinnersList, curWinner ) -- if the current "winner" has the same hand as a player elseif _G["pokerPlayer"..i.."HandValue"] == curWinnerValue then if val == 3 or val == 6 or val == 7 or val == 9 then if _G["pokerPlayer"..i.."HandSecValue"] and _G["pokerPlayer"..curWinner.."HandSecValue"] then if _G["pokerPlayer"..i.."HandSecValue"] > _G["pokerPlayer"..curWinner.."HandSecValue"] then curWinner = i curWinners = 1 curWinnersList = nil curWinnersList = {} table.insert ( curWinnersList, i ) -- if they've got the same "hand value" elseif _G["pokerPlayer"..i.."HandSecValue"] ==_G["pokerPlayer"..curWinner.."HandSecValue"] then curWinners = curWinners + 1 table.insert ( curWinnersList, i ) end end else -- choose the highcard if getPlayerHighCard ( i ) > getPlayerHighCard ( curWinner ) then curWinner = i curWinners = 1 curWinnersList = nil curWinnersList = {} table.insert ( curWinnersList, i ) -- if they've got the same highcard elseif getPlayerHighCard ( i ) == getPlayerHighCard ( curWinner ) then curWinners = curWinners + 1 table.insert ( curWinnersList, i ) end end end end end if curWinners == 1 then local winnername = getPlayerName(_G["pokerPlayer"..curWinner]) local value = handValueNames[_G["pokerPlayer"..curWinner.."HandValue"]] local h1 = pokerColorOutNames[getCardColor(_G["pokerPlayer"..curWinner.."card1"])].." "..cardIDTypeOutName[getCardType(_G["pokerPlayer"..curWinner.."card1"])] local h2 = pokerColorOutNames[getCardColor(_G["pokerPlayer"..curWinner.."card2"])].." "..cardIDTypeOutName[getCardType(_G["pokerPlayer"..curWinner.."card2"])] -- if the winner was "all in" -- if the winner was "all in" if _G["pokerPlayer"..curWinner.."Money"] <= 0 then _G["pokerPlayer"..curWinner.."Money"] = curPokerPot - _G["pokerPlayer"..curWinner.."TotalBet"] * 2 curPokerPot = curPokerPot - _G["pokerPlayer"..curWinner.."TotalBet"] * 2 sendMessageToAllPokerPlayers ( winnername.." winns with "..value..". ( Hand: "..h1..", "..h2.." ), "..(_G["pokerPlayer"..curWinner.."TotalBet"] * 2).." chips", 0, 125, 0 ) if curPokerPot > 0 then counter = 0 for i = 1, 6 do if _G["pokerPlayer"..i.."In"] then if i == curWinner then else counter = counter + 1 end end end local amount = math.floor ( curPokerPot / counter ) sendMessageToAllPokerPlayers ( "The remaining "..curPokerPot.." chips will be split!", 0, 125, 0 ) for i = 1, 6 do if _G["pokerPlayer"..i.."In"] then if i == curWinner then else _G["pokerPlayer"..i.."Money"] = _G["pokerPlayer"..i.."Money"] + amount end end end resetPokerValues() end else sendMessageToAllPokerPlayers ( winnername.." winns with a "..value..". ( Hand: "..h1..", "..h2.." ), "..curPokerPot.." chips", 0, 125, 0 ) _G["pokerPlayer"..curWinner.."Money"] = _G["pokerPlayer"..curWinner.."Money"] + curPokerPot resetPokerValues() end else winnernames = nil counter = 0 for i, key in ipairs ( curWinnersList ) do counter = counter + 1 if winnernames then local h1 = pokerColorOutNames[getCardColor(_G["pokerPlayer"..i.."card1"])].." "..cardIDTypeOutName[getCardType(_G["pokerPlayer"..i.."card1"])] local h2 = pokerColorOutNames[getCardColor(_G["pokerPlayer"..i.."card2"])].." "..cardIDTypeOutName[getCardType(_G["pokerPlayer"..i.."card2"])] winnernames = winnernames..", "..getPlayerName(_G["pokerPlayer"..i]).." ("..h1..", "..h2..")" else local h1 = pokerColorOutNames[getCardColor(_G["pokerPlayer"..i.."card1"])].." "..cardIDTypeOutName[getCardType(_G["pokerPlayer"..i.."card1"])] local h2 = pokerColorOutNames[getCardColor(_G["pokerPlayer"..i.."card2"])].." "..cardIDTypeOutName[getCardType(_G["pokerPlayer"..i.."card2"])] winnernames = getPlayerName(_G["pokerPlayer"..i]).." ("..h1..","..h2..")" end end local splot = math.floor ( curPokerPot / counter ) sendMessageToAllPokerPlayers ( "Split pot between: "..winnernames..", "..splot.." chips ( each )!", 0, 125, 0 ) for i, key in ipairs ( curWinnersList ) do _G["pokerPlayer"..i.."Money"] = _G["pokerPlayer"..i.."Money"] + splot end resetPokerValues() end end function resetPokerValues () -- Reset the values when a round is finished pokerRoundStarted = false pokerFirstLoop = false curPokerRound = 0 curPokerPlayer = false curPokerPot = 0 curPokerBlindPlayer = getNextPlayerAtPoker ( curPokerBlindPlayer ) for i = 1, 6 do if _G["pokerPlayer"..i] then _G["pokerPlayer"..i.."In"] = true else _G["pokerPlayer"..i.."In"] = false end _G["pokerPlayer"..i.."TotalBet"] = 0 _G["pokerPlayer"..i.."Bet"] = 0 _G["pokerPlayer"..i.."HandValue"] = 0 _G["communityCard"..i] = 0 end p1, p2, p3, p4, p5, p6, p1s, p2s, p3s, p4s, p5s, p6s = getPokerPlayerStats() for i = 1, 6 do if _G["pokerPlayer"..i] then setTimer ( triggerClientEvent, 3000, 1, _G["pokerPlayer"..i], "refreshPokerCommunityCards", getRootElement() ) setTimer ( triggerClientEvent, 3000, 1, _G["pokerPlayer"..i], "refreshPokerVarbs", getRootElement(), _G["pokerPlayer"..i.."Bet"], curPokerPot, getHighestCall(), _G["pokerPlayer"..i.."Money"], p1, p2, p3, p4, p5, p6, p1s, p2s, p3s, p4s, p5s, p6s ) end end if isTimer ( roundCheckTimer ) then killTimer ( roundCheckTimer ) end roundCheckTimer = setTimer ( roundCheck, 7500, 1 ) end function getNextPlayerAtPoker ( id ) -- get the next player ( clockwise ) if id then for i = id, 6 do if _G["pokerPlayer"..i] and _G["pokerPlayer"..i.."In"] and i ~= id then return i end end for i = 1, 6 do if _G["pokerPlayer"..i] and _G["pokerPlayer"..i.."In"] and i ~= id then return i end end end return false end function getPrevPlayerAtPoker ( id ) -- get the next player ( counter-clockwise ) if id then for i = id, 0, -1 do if _G["pokerPlayer"..i] and _G["pokerPlayer"..i.."In"] and i ~= id then return i end end for i = 6, 0, -1 do if _G["pokerPlayer"..i] and _G["pokerPlayer"..i.."In"] and i ~= id then return i end end end return false end function getPlayerHighCard ( id ) if id > 0 then local card1 = getCardType ( _G["pokerPlayer"..id.."card1"] ) local card2 = getCardType ( _G["pokerPlayer"..id.."card2"] ) for i = 1, 5 do _G["card"..(i+2)] = _G["communityCard"..i] end curBest = card1 for i = 2, 7 do if curBest < _G["card"..i] then curBest = _G["card"..i] end end return curBest end return -1 end function handRecieveFromClient_func ( value, sec ) -- retrieve the hand-value from the client local id = getPlayerPokerID ( source ) _G["pokerPlayer"..id.."HandValue"] = value if sec then _G["pokerPlayer"..id.."HandSecValue"] = sec end end addEvent ( "handRecieveFromClient", true ) addEventHandler ( "handRecieveFromClient", getRootElement(), handRecieveFromClient_func ) function sendMessageToAllPokerPlayers ( text, r, g, b ) -- send a message to all current players for i = 1, 6 do local player = _G["pokerPlayer"..i] if player then if isElement ( player ) then outputChatBox ( text, player, r, g, b ) end end end end function getNewCard() -- get a new card from the "stack" while true do local card = math.random ( 1, 52 ) if not cardsInUse[card] then table.insert ( cardsInUse, card ) cardsInUse[card] = true return card end end end function getPokerPlayerStats () -- get the stats for the client for i = 1, 6 do if _G["pokerPlayer"..i.."In"] then _G["p"..i.."s"] = true else _G["p"..i.."s"] = false end if _G["pokerPlayer"..i] then _G["p"..i] = "(".._G["pokerPlayer"..i.."Money"]..") "..getPlayerName ( _G["pokerPlayer"..i] ) else _G["p"..i] = "" end end return p1, p2, p3, p4, p5, p6, p1s, p2s, p3s, p4s, p5s, p6s end  
    • Hello, I'm making an inventory and now I've found that the items can be moved, but it's not good, for example, that if I bring it to another item, they don't change places, the slot[5] table contains the items. Can someone help me fix the bugs?   function ItemMove() for i, slot in ipairs(slots) do if isMouseInPosition(sx * slot[1], sy * slot[2], sx * slot[3], sy * slot[4]) then if slot[5] then if slot[5][1] == DragNDrop[1][1] then if slot[5][2] < items[slot[5][1]][3] then if slot[5][2] + DragNDrop[1][2] > items[slot[5][1]][3] then slot[5][2] = items[slot[5][1]][3] else slot[5][2] = slot[5][2] + DragNDrop[1][2] end else DragNDrop[1] = slot[5] slot[5] = DragNDrop[5] end else slots[DragNDrop[2]][5] = slot[5] slot[5] = DragNDrop[5] end else slot[5] = DragNDrop[1] print("XD") end end end end DragNDrop = {slot[5], i}   Below, I only wrote what is in the DragNDrop table

Twitter Feed

×
×
  • Create New...