Jump to content

Anubhav

Members
  • Posts

    2,277
  • Joined

  • Last visited

Everything posted by Anubhav

  1. Anubhav

    invite

    No problem. Whenever you create a group it should go in database like SQL or MySQL. Then when someone else creates you can just check. Some guide tho: con = dbConnect("sql", "group.db") -- It will create group.db automatically and you will be connected to the file. addEventHandler("onResourceStart", root, function() dbExec(con, "CREATE TABLE IF NOT EXISTS groupTable(group TEXT)") -- This will create a table if t doesn't exist with column GROUP which contains TEXT only. end ) dbExec(con, "INSERT INTO groupTable group=? VALUES(?)", "some group name") -- This will insert "some group name" to a table named groupTable. You can edit the first dbExec which was creating table. Just add more columns. Google for database types! Then you should put columnName=? VALUES(?,?,?). In VALUES you'll question marks which means how many columns are there in the table. dbExec(con, "UPDATE groupTable SET group=? ", "myGroupNameChanged!") -- this will update the column group and change its value to "myGroupNameChanged!". local query = dbQuery(con, "SELECT * FROM groupTable") -- This will select every column from groupTable. * means every column. You can make it one column too. Don't use dbExec for this thing please. dbPoll(query, 0) -- We want the result now, and it should be instead. Don't use -1 because it will freeze the server. You can just use these functions and account data, it will make it SO EASY!
  2. It will generate a value between it lol...
  3. Its client sided lol.. I am not sure about my if argument!
  4. Just use getZoneName lol.. Instead of using chat-range in this case.
  5. -- not sure L( function getMyTimer() local timer = getTime() if timer == 22,0 then addEventHandler("onClientRender", root, setMyTime) end end addEventHandler("onClientRender", root, getMyTimer) function setMyTime() setTime( 22, 0 ) end
  6. https://community.multitheftauto.com/ind ... ls&id=9944 - FAKE * MODIFIED WITHOUT PERMISSION AND NO CREDITS. https://community.multitheftauto.com/ind ... mp;id=9832 - ORIGINAL DONE
  7. Use /debugscript 3 Use /staffchat msg
  8. [lua] function hi() outputChatBox ("bla bla", source, 255, 0, 0, false) if isTimer(timer1) then killTimer (timer1) end end function (player) timer1 = setTimer ( function() outputChatBox ("miau miau", source, 255, 0, 0, false) end, 5000, 1 ) end hi() [lua]
  9. Anubhav

    invite

    function invite( player, cmd, target) local target = getPlayerFromNamePart ( target ) if target then outputChatBox("You have been invited to: "..getElementData( player, "gangData" ).. ", use /agree to accept. You have 15 seconds!",target) -- please replace gangData with the group of player. 'Element data' which you use to get player group. setElementData(target, "latestInvite", getElementData( player, "gangData" ) ) addCommandHandler("agree", agree) setTimer(removeElementData, 15000, 1, target, "gangData") end end function agree(source, commandName) local data = getElementData(source, 'lastestInvite') if data then setPlayerGroup(source, data) end end function getPlayerFromNamePart(name) if name then for i, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then return player end end end return false end
  10. I am always here to help anyone.
  11. function getOnlineAdmins() local t = {} for k,v in ipairs ( getElementsByType("player") ) do while true do local acc = getPlayerAccount(v) if not acc or isGuestAccount(acc) then break end local accName = getAccountName(acc) local isAdmin = isObjectInACLGroup("user."..accName,aclGetGroup("Admin")) if isAdmin == true then table.insert(t,v) end break end end return t end addCommandHandler("staffchat", function(source, cmd, ...) local concat = string.lower(table.concat(..., " ")) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then for k,v in ipairs(getOnlineAdmins()) do outputChatBox("(STAFF-CHAT)"..getPlayerName(source).. ": #ffffff"..tostring(concat), v, 255, 255, 255, true) end end end )
  12. Thanks for telling me got it.
  13. local messageToDraw = {} local chattingPlayers = {} local chatBubbleFor = {} local hideOwn local showTime local characterAddition local maxBubbles local showTheBubbles = true function income(message,messagetype) if source ~= getLocalPlayer() or not hideOwn then if messagetype == 2 then if getPlayerTeam(source) == getPlayerTeam(getLocalPlayer()) then addPlayerChatBubble(source,message,messagetype) end elseif messagetype == 1 then addPlayerChatBubble(source,message,messagetype) elseif messagetype == "typing" then addPlayerChatBubble(source,"Typing!","typing") else addPlayerChatBubble(source,message,messagetype) end end end function addPlayerChatBubble(source,message,messagetype) local notfirst = false for i,p in ipairs(messageToDraw) do if p[1] == source then p[4] = p[4] + 1 notfirst = true end end local infotable = {source,message,messagetype,0} table.insert(messageToDraw,infotable) setElementData(source, "chatbubblesTyping", true, false) if messagetype ~= "typing" then hidePlayerTypingBubble(source) setTimer(deletePlayerChatBubble, 10000, 1, {source,message,messagetype} ) end if not notfirst then setTimer(deletePlayerChatBubble,showTime + (#message * characterAddition),1,infotable) end end function deletePlayerChatBubble(infotable) for i,p in ipairs(messageToDraw) do if p[1] == infotable[1] and p[2] == infotable[2] then for i2,p2 in ipairs(messageToDraw) do if p2[1] == p[1] and p[4] - p2[4] == 1 then setTimer(deletePlayerChatBubble,showTime + (#p2[2] * characterAddition),1,p2) end end table.remove(messageToDraw,i) break end end end function getTextsToRemove() for i,p in ipairs(messageToDraw) do if p[1] == source then deletePlayerChatBubble(p) end end end addEventHandler("onClientPlayerQuit",getRootElement(),getTextsToRemove) function renderTheDisplay() if showTheBubbles then for i,p in ipairs(messageToDraw) do if isElement(p[1]) then if isPedDead(p[1]) then return end local camPosXl, camPosYl, camPosZl = getPedBonePosition (p[1], 6) local camPosXr, camPosYr, camPosZr = getPedBonePosition (p[1], 7) local x,y,z = (camPosXl + camPosXr) / 2, (camPosYl + camPosYr) / 2, (camPosZl + camPosZr) / 2 local cx,cy,cz = getCameraMatrix() local px,py,pz = getElementPosition(p[1]) local distance = getDistanceBetweenPoints3D(cx,cy,cz,px,py,pz) local posx,posy = getScreenFromWorldPosition(x,y,z+0.050*distance+0.10) local elementtoignore1 = getPedOccupiedVehicle(getLocalPlayer()) or getLocalPlayer() local elementtoignore2 = getPedOccupiedVehicle(p[1]) or p[1] if posx and distance <= 45 and ( isLineOfSightClear(cx,cy,cz,px,py,pz,true,true,false,true,false,true,true,elementtoignore1) or isLineOfSightClear(cx,cy,cz,px,py,pz,true,true,false,true,false,true,true,elementtoignore2) ) and ( not maxBubbles or p[4] < maxBubbles ) then -- change this when multiple ignored elements can be specified local width = dxGetTextWidth(p[2],1,"default-bold") dxDrawRectangle(posx - (3 + (0.5 * width)),posy - (2 + (p[4] * 20)),width + 5,19,tocolor(0,0,0,255)) dxDrawRectangle(posx - (6 + (0.5 * width)),posy - (2 + (p[4] * 20)),width + 11,19,tocolor(0,0,0,40)) dxDrawRectangle(posx - (8 + (0.5 * width)),posy - (1 + (p[4] * 20)),width + 15,17,tocolor(0,0,0,255)) dxDrawRectangle(posx - (10 + (0.5 * width)),posy - (1 + (p[4] * 20)),width + 19,17,tocolor(0,0,0,40)) dxDrawRectangle(posx - (10 + (0.5 * width)),posy - (p[4] * 20) + 1,width + 19,13,tocolor(0,0,0,255)) dxDrawRectangle(posx - (12 + (0.5 * width)),posy - (p[4] * 20) + 1,width + 23,13,tocolor(0,0,0,40)) dxDrawRectangle(posx - (12 + (0.5 * width)),posy - (p[4] * 20) + 4,width + 23,7,tocolor(0,0,0,255)) local r,g,b = 255,255,255 if p[3] == 2 then r,g,b = 154, 254, 46 elseif p[3] == 1 then r,g,b = 254,46,154 end dxDrawText(p[2],posx - (0.5 * width),posy - (p[4] * 20),posx - (0.5 * width),posy - (p[4] * 20),tocolor(r,g,b,255),1,"default-bold","left","top",false,false,false) end end end end end addEventHandler("onClientRender",getRootElement(),renderTheDisplay) function getServerSettings() triggerServerEvent("onAskForBubbleSettings",getLocalPlayer()) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getServerSettings) function saveSettings(settings) showTime = settings[1] characterAddition = settings[2] maxBubbles = settings[3] hideOwn = settings[4] addEvent("onChatbubblesMessageIncome",true) addEventHandler("onChatbubblesMessageIncome",getRootElement(),income) end addEvent("onBubbleSettingsReturn",true) addEventHandler("onBubbleSettingsReturn",getRootElement(),saveSettings) function setPlayerTyping() if (isChatBoxInputActive() or isConsoleActive()) and not typing then triggerServerEvent("onPlayerStartTyping", localPlayer) typing = true end if not (isChatBoxInputActive() or isConsoleActive()) and typing then triggerServerEvent("onPlayerFinishTyping", localPlayer) typing = false end end setTimer(setPlayerTyping, 50, 0) function showPlayerTypingBubble() if source ~= getLocalPlayer() or not hideOwn then addPlayerChatBubble(source, "Typing!", "typing") end end addEvent("onPlayerStartTyping", true) addEventHandler("onPlayerStartTyping", root, showPlayerTypingBubble) function hidePlayerTypingBubble(me) if not source then source = me end deletePlayerChatBubble({ source = source, message = "Typing!", messagetype = "typing" }) end addEvent("onPlayerFinishTyping", true) addEvent("onClientPlayerChat", true) addEventHandler("onPlayerFinishTyping", root, hidePlayerTypingBubble) addEventHandler("onClientPlayerChat", root, hidePlayerTypingBubble) function updateList(newEntry, newStatus) chattingPlayers[newEntry] = newStatus if(not chatBubbleFor[newEntry]) then showPlayerTypingBubble(localPlayer) end hidePlayerTypingBubble(localPlayer) end addEvent("updateChatList", true) addEventHandler ( "updateChatList", getRootElement(), updateList )
  14. Wrapper functions? What are they?
  15. local messageToDraw = {} local chattingPlayers = {} local chatBubbleFor = {} local hideOwn local showTime local characterAddition local maxBubbles local showTheBubbles = true function income(message,messagetype) if source ~= getLocalPlayer() or not hideOwn then if messagetype == 2 then if getPlayerTeam(source) == getPlayerTeam(getLocalPlayer()) then addPlayerChatBubble(source,message,messagetype) end elseif messagetype == 1 then addPlayerChatBubble(source,message,messagetype) elseif messagetype == "typing" then addPlayerChatBubble(source,"Typing!","typing") else addPlayerChatBubble(source,message,messagetype) end end end function addPlayerChatBubble(source,message,messagetype) local notfirst = false for i,p in ipairs(messageToDraw) do if p[1] == source then p[4] = p[4] + 1 notfirst = true end end local infotable = {source,message,messagetype,0} table.insert(messageToDraw,infotable) setElementData(source, "chatbubblesTyping", true, false) if messagetype ~= "typing" then hidePlayerTypingBubble(source) setTimer(deletePlayerChatBubble, 10000, 1, {source,message,messagetype} ) end if not notfirst then setTimer(deletePlayerChatBubble,showTime + (#message * characterAddition),1,infotable) end end function deletePlayerChatBubble(infotable) for i,p in ipairs(messageToDraw) do if p[1] == infotable[1] and p[2] == infotable[2] then for i2,p2 in ipairs(messageToDraw) do if p2[1] == p[1] and p[4] - p2[4] == 1 then setTimer(deletePlayerChatBubble,showTime + (#p2[2] * characterAddition),1,p2) end end table.remove(messageToDraw,i) break end end end function getTextsToRemove() for i,p in ipairs(messageToDraw) do if p[1] == source then deletePlayerChatBubble(p) end end end addEventHandler("onClientPlayerQuit",getRootElement(),getTextsToRemove) function renderTheDisplay() if showTheBubbles then for i,p in ipairs(messageToDraw) do if isElement(p[1]) then local camPosXl, camPosYl, camPosZl = getPedBonePosition (p[1], 6) local camPosXr, camPosYr, camPosZr = getPedBonePosition (p[1], 7) local x,y,z = (camPosXl + camPosXr) / 2, (camPosYl + camPosYr) / 2, (camPosZl + camPosZr) / 2 local cx,cy,cz = getCameraMatrix() local px,py,pz = getElementPosition(p[1]) local distance = getDistanceBetweenPoints3D(cx,cy,cz,px,py,pz) local posx,posy = getScreenFromWorldPosition(x,y,z+0.050*distance+0.10) local elementtoignore1 = getPedOccupiedVehicle(getLocalPlayer()) or getLocalPlayer() local elementtoignore2 = getPedOccupiedVehicle(p[1]) or p[1] if posx and distance <= 45 and ( isLineOfSightClear(cx,cy,cz,px,py,pz,true,true,false,true,false,true,true,elementtoignore1) or isLineOfSightClear(cx,cy,cz,px,py,pz,true,true,false,true,false,true,true,elementtoignore2) ) and ( not maxBubbles or p[4] < maxBubbles ) then -- change this when multiple ignored elements can be specified local width = dxGetTextWidth(p[2],1,"default-bold") dxDrawRectangle(posx - (3 + (0.5 * width)),posy - (2 + (p[4] * 20)),width + 5,19,tocolor(0,0,0,255)) dxDrawRectangle(posx - (6 + (0.5 * width)),posy - (2 + (p[4] * 20)),width + 11,19,tocolor(0,0,0,40)) dxDrawRectangle(posx - (8 + (0.5 * width)),posy - (1 + (p[4] * 20)),width + 15,17,tocolor(0,0,0,255)) dxDrawRectangle(posx - (10 + (0.5 * width)),posy - (1 + (p[4] * 20)),width + 19,17,tocolor(0,0,0,40)) dxDrawRectangle(posx - (10 + (0.5 * width)),posy - (p[4] * 20) + 1,width + 19,13,tocolor(0,0,0,255)) dxDrawRectangle(posx - (12 + (0.5 * width)),posy - (p[4] * 20) + 1,width + 23,13,tocolor(0,0,0,40)) dxDrawRectangle(posx - (12 + (0.5 * width)),posy - (p[4] * 20) + 4,width + 23,7,tocolor(0,0,0,255)) local r,g,b = 255,255,255 if p[3] == 2 then r,g,b = 154, 254, 46 elseif p[3] == 1 then r,g,b = 254,46,154 end dxDrawText(p[2],posx - (0.5 * width),posy - (p[4] * 20),posx - (0.5 * width),posy - (p[4] * 20),tocolor(r,g,b,255),1,"default-bold","left","top",false,false,false) end end end end end addEventHandler("onClientRender",getRootElement(),renderTheDisplay) function getServerSettings() triggerServerEvent("onAskForBubbleSettings",getLocalPlayer()) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getServerSettings) function saveSettings(settings) showTime = settings[1] characterAddition = settings[2] maxBubbles = settings[3] hideOwn = settings[4] addEvent("onChatbubblesMessageIncome",true) addEventHandler("onChatbubblesMessageIncome",getRootElement(),income) end addEvent("onBubbleSettingsReturn",true) addEventHandler("onBubbleSettingsReturn",getRootElement(),saveSettings) function setPlayerTyping() if (isChatBoxInputActive() or isConsoleActive()) and not typing then triggerServerEvent("onPlayerStartTyping", localPlayer) typing = true end if not (isChatBoxInputActive() or isConsoleActive()) and typing then triggerServerEvent("onPlayerFinishTyping", localPlayer) typing = false end end setTimer(setPlayerTyping, 50, 0) function showPlayerTypingBubble() if source ~= getLocalPlayer() or not hideOwn then addPlayerChatBubble(source, "Typing!", "typing") end end addEvent("onPlayerStartTyping", true) addEventHandler("onPlayerStartTyping", root, showPlayerTypingBubble) function hidePlayerTypingBubble(me) if not source then source = me end deletePlayerChatBubble({ source = source, message = "Typing!", messagetype = "typing" }) end addEvent("onPlayerFinishTyping", true) addEvent("onClientPlayerChat", true) addEventHandler("onPlayerFinishTyping", root, hidePlayerTypingBubble) addEventHandler("onClientPlayerChat", root, hidePlayerTypingBubble) function updateList(newEntry, newStatus) chattingPlayers[newEntry] = newStatus if(not chatBubbleFor[newEntry]) then showPlayerTypingBubble(localPlayer) end hidePlayerTypingBubble(localPlayer) end addEvent("updateChatList", true) addEventHandler ( "updateChatList", getRootElement(), updateList )
  16. Anubhav

    Question

    local keyTable = { "mouse1", "mouse2", "mouse3", "mouse4", "mouse5", "mouse_wheel_up", "mouse_wheel_down", "arrow_l", "arrow_u", "arrow_r", "arrow_d", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "num_0", "num_1", "num_2", "num_3", "num_4", "num_5", "num_6", "num_7", "num_8", "num_9", "num_mul", "num_add", "num_sep", "num_sub", "num_div", "num_dec", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "backspace", "tab", "lalt", "ralt", "space", "pgup", "pgdn", "end", "home", "insert", "delete", "lshift", "rshift", "lctrl", "rctrl", "[", "]", "pause", "capslock", "scroll", ";", ",", "-", ".", "/", "#", "\\", "=" } setTimer(function() for player,hi in ipairs(getElementsByType("player") do for _,i in ipairs(keyTable)do --loop through keyTable for _,v in ipairs(getFunctionsBoundToKey(hi,i))do --loop through the key bounded functions outputChatBox(i.." was bound to:"..v.." by"..getPlayerName(hi) kickPlayer(hi) end end end end, 5000, 0)
  17. /debugscript 3 or: --My Server addEventHandler("onResourceStart",resourceRoot, function () for index, player in ipairs(getElementsByType("player")) do showGUI2(player) end end) function showGUI2(thePlayer) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Admin")) then triggerClientEvent(thePlayer,"toggleGUI2",thePlayer) end end Only for Admin ACL.
  18. function bindMyKey() local toMy = root or source bindKey(toMy,"G", "down", "gc") end addEventHandler("onPlayerJoin", root, bindMyKey) addEventHandler("onResourceStart", root, bindMyKey)
  19. Anubhav

    GTA 5 Radar

    local function getCameraRotation () px, py, pz, lx, ly, lz = getCameraMatrix() local rotz = 6.2831853071796 - math.atan2 ( ( lx - px ), ( ly - py ) ) % 6.2831853071796 local rotx = math.atan2 ( lz - pz, getDistanceBetweenPoints2D ( lx, ly, px, py ) ) --Convert to degrees rotx = math.deg(rotx) rotz = math.deg(rotz) return rotz 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 function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end local screenx, screeny = guiGetScreenSize() local sW, sH = (screenx/1280), (screeny/960) local edgeHorizontal = 25.6*sW local edgeVertical = 3*sW local width = 320*sW local height = 192*sH local startwidth = 25.6*sW local startheight = 720*sH local blipsize = 16 local blipr, blipg, blipb local totalsize = 1600 local theTarget local t local showRadar = true local myRenderTarget1 = dxCreateRenderTarget( width, height, true ) function drawRadar() if getPedOccupiedVehicle(localPlayer) ~= false then theTarget = getPedOccupiedVehicle(localPlayer) elseif getCameraTarget(localPlayer) ~= false then theTarget = getCameraTarget(localPlayer) else return end --background dxDrawRectangle ( startwidth, startheight, width, height, tocolor ( 0, 155, 255, 50 ) ) local arena = getElementData(localPlayer, "Arena") dxDrawRectangle ( startwidth, startheight, width, edgeVertical, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle ( startwidth, startheight, edgeVertical, height, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle ( startwidth, startheight+height, width, edgeHorizontal, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle ( startwidth+width-edgeVertical, startheight, edgeVertical, height, tocolor ( 0, 0, 0, 255 ) ) local rotation = getCameraRotation() local xp, yp, zp = getElementPosition(theTarget) widthmap = (totalsize/2)+((totalsize/2)/2998)*xp heightmap = (totalsize/2)-((totalsize/2)/2998)*yp dxSetRenderTarget( myRenderTarget1, true ) dxDrawImage( -widthmap+(width/2), -heightmap+(height/2), totalsize, totalsize, "img/map.png", rotation, ((totalsize/2)/2998)*xp, -((totalsize/2)/2998)*yp, tocolor ( 255, 255, 255, 255 )) dxSetRenderTarget() dxDrawImage ( startwidth+edgeVertical, startheight+edgeVertical, width-edgeVertical*2, height-edgeVertical, myRenderTarget1, 0, 0, 0, tocolor ( 255, 255, 255, 255 ), false ) --players for i, p in pairs(getElementsByType("player")) do if getElementData(p, "state") == "Alive" then if p ~= theTarget and getPedOccupiedVehicle(p) ~= theTarget then local x, y, z = getElementPosition(p) local name = getPlayerName(p) local c1, c2 = string.find(name, '#%x%x%x%x%x%x') if c1 then blipr, blipg, blipb = getColorFromString(string.sub(name, c1, c2)) else blipr = 255 blipg = 255 blipb = 255 end local distance = getDistanceBetweenPoints2D(x, y, xp,yp) local rotation2 = findRotation(x,y,xp,yp) local , yd = getPointFromDistanceRotation(startwidth+(width/2), startheight+(height/2), distance/4, rotation2-rotation) if < startwidth+edgeVertical then = startwidth+edgeVertical elseif > startwidth+width-edgeVertical then = startwidth+width-edgeVertical end if yd < startheight+edgeVertical then yd = startheight+edgeVertical elseif yd > startheight+height then yd = startheight+height end dxDrawRectangle ( -4, yd-4, 8, 8, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle (-3, yd-3, 6, 6, tocolor (blipr, blipg, blipb, 255 ) ) end end end --checkpoints for i, p in pairs(getElementsByType("marker")) do if getElementData(p, "type") == "checkpoint" and getElementDimension(p) == getElementDimension(localPlayer) then if getMarkerSize(p) > 0.1 then local x, y, z = getElementPosition(p) blipr, blipg, blipb = getMarkerColor(p) local distance = getDistanceBetweenPoints2D(x, y, xp,yp) local rotation2 = findRotation(x,y,xp,yp) local , yd = getPointFromDistanceRotation(startwidth+(width/2), startheight+(height/2), distance/4, rotation2-rotation) if < startwidth+edgeVertical then = startwidth+edgeVertical elseif > startwidth+width-edgeVertical then = startwidth+width-edgeVertical end if yd < startheight+edgeVertical then yd = startheight+edgeVertical elseif yd > startheight+height then yd = startheight+height end if getElementData(p, "id") == getElementData(localPlayer, "checkpointname") then dxDrawRectangle ( -6, yd-6, 12, 12, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle (-5, yd-5, 10, 10, tocolor (blipr, blipg, blipb, 255 ) ) else dxDrawRectangle ( -4, yd-4, 8, 8, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle (-3, yd-3, 6, 6, tocolor (blipr, blipg, blipb, 255 ) ) end end end end if theTarget then local health = getElementHealth(theTarget) if getElementType(theTarget) == "player" then health = health*10 end health = math.max(health - 250, 0)/750 local p = -510*(health^2) local r,g = math.max(math.min(p + 255*health + 255, 255), 0), math.max(math.min(p + 765*health, 255), 0) local nitro if getElementType(theTarget) == "vehicle" then nitro = getVehicleNitroLevel(theTarget) end if not nitro then nitro = 0 end --health dxDrawRectangle(startwidth+edgeVertical, startheight+height+edgeVertical, width/2-edgeVertical*2+edgeVertical/2, edgeHorizontal-edgeVertical*2, tocolor(0,0,0,255) ) dxDrawRectangle(startwidth+edgeVertical+2, startheight+height+edgeVertical+2, width/2-edgeVertical*2+edgeVertical/2-4, edgeHorizontal-edgeVertical*2-4, tocolor(r,g,0,0.5*255) ) dxDrawRectangle(startwidth+edgeVertical+2, startheight+height+edgeVertical+2, health*(width/2-edgeVertical*2+edgeVertical/2-4), edgeHorizontal-edgeVertical*2-4, tocolor(r,g,0,255) ) --nitro dxDrawRectangle(startwidth+width/2+edgeVertical/2, startheight+height+edgeVertical, width/2-edgeVertical*2+edgeVertical/2, edgeHorizontal-edgeVertical*2, tocolor(0,0,0,255) ) dxDrawRectangle(startwidth+width/2+edgeVertical/2+2, startheight+height+edgeVertical+2, width/2-edgeVertical*2+edgeVertical/2-4, edgeHorizontal-edgeVertical*2-4, tocolor(0,150,220,0.5*255) ) dxDrawRectangle(startwidth+width/2+edgeVertical/2+2, startheight+height+edgeVertical+2, nitro*(width/2-edgeVertical*2+edgeVertical/2-4), edgeHorizontal-edgeVertical*2-4, tocolor(0,50,255,255) ) end local xr,yr,zr = getElementRotation(theTarget) dxDrawImage ( startwidth+(width/2)-blipsize/2, startheight+(height/2)-blipsize/2, blipsize, blipsize, "img/blip.png", -zr+rotation, 0, 0, tocolor ( 255, 255, 255, 255 ), false ) end addEventHandler("onClientRender", root, drawRadar) function getPlayersInArena(arena) local playerTable = {} for i, p in ipairs(getElementsByType("player")) do if getElementType(p) == "player" and getElementData(p, "Arena") == arena then table.insert(playerTable, p) end end return playerTable end function toggleRadar() if showRadar == true then showRadar = false elseif showRadar == false then showRadar = true end end addCommandHandler("showradar", toggleRadar)
  20. moneyGive = 10 -- Add your money here addEventHandler("onPlayerWasted", root, function(attacker) if getElementType(attacker) == "player" then outputChatBox("You killed "..getPlayerName(source).. ", and earned $"..moneyGive, attacker) givePlayerMoney(attacker, moneyGive) end end )
  21. bindKey("G", "down", GangChat)
  22. Anubhav

    GTA 5 Radar

    local function getCameraRotation () px, py, pz, lx, ly, lz = getCameraMatrix() local rotz = 6.2831853071796 - math.atan2 ( ( lx - px ), ( ly - py ) ) % 6.2831853071796 local rotx = math.atan2 ( lz - pz, getDistanceBetweenPoints2D ( lx, ly, px, py ) ) --Convert to degrees rotx = math.deg(rotx) rotz = math.deg(rotz) return rotz 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 function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end local screenx, screeny = guiGetScreenSize() local sW, sH = (screenx/1280), (screeny/960) local edgeHorizontal = 25.6*sW local edgeVertical = 3*sW local width = 320*sW local height = 192*sH local startwidth = 25.6*sW local startheight = 720*sH local blipsize = 16 local blipr, blipg, blipb local totalsize = 1600 local theTarget local t local showRadar = true local myRenderTarget1 = dxCreateRenderTarget( width, height, true ) function drawRadar() if getPedOccupiedVehicle(localPlayer) ~= false then theTarget = getPedOccupiedVehicle(localPlayer) elseif getCameraTarget(localPlayer) ~= false then theTarget = getCameraTarget(localPlayer) else return end --background dxDrawRectangle ( startwidth, startheight, width, height, tocolor ( 0, 155, 255, 50 ) ) local arena = getElementData(localPlayer, "Arena") dxDrawRectangle ( startwidth, startheight, width, edgeVertical, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle ( startwidth, startheight, edgeVertical, height, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle ( startwidth, startheight+height, width, edgeHorizontal, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle ( startwidth+width-edgeVertical, startheight, edgeVertical, height, tocolor ( 0, 0, 0, 255 ) ) local rotation = getCameraRotation() local xp, yp, zp = getElementPosition(theTarget) widthmap = (totalsize/2)+((totalsize/2)/2998)*xp heightmap = (totalsize/2)-((totalsize/2)/2998)*yp dxSetRenderTarget( myRenderTarget1, true ) dxDrawImage( -widthmap+(width/2), -heightmap+(height/2), totalsize, totalsize, "img/map.png", rotation, ((totalsize/2)/2998)*xp, -((totalsize/2)/2998)*yp, tocolor ( 255, 255, 255, 255 )) dxSetRenderTarget() dxDrawImage ( startwidth+edgeVertical, startheight+edgeVertical, width-edgeVertical*2, height-edgeVertical, myRenderTarget1, 0, 0, 0, tocolor ( 255, 255, 255, 255 ), false ) --players if p ~= theTarget and getPedOccupiedVehicle(p) ~= theTarget then local x, y, z = getElementPosition(p) local name = getPlayerName(p) local c1, c2 = string.find(name, '#%x%x%x%x%x%x') if c1 then blipr, blipg, blipb = getColorFromString(string.sub(name, c1, c2)) else blipr = 255 blipg = 255 blipb = 255 end local distance = getDistanceBetweenPoints2D(x, y, xp,yp) local rotation2 = findRotation(x,y,xp,yp) local , yd = getPointFromDistanceRotation(startwidth+(width/2), startheight+(height/2), distance/4, rotation2-rotation) if < startwidth+edgeVertical then = startwidth+edgeVertical elseif > startwidth+width-edgeVertical then = startwidth+width-edgeVertical end if yd < startheight+edgeVertical then yd = startheight+edgeVertical elseif yd > startheight+height then yd = startheight+height end dxDrawRectangle ( -4, yd-4, 8, 8, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle (-3, yd-3, 6, 6, tocolor (blipr, blipg, blipb, 255 ) ) end --checkpoints for i, p in pairs(getElementsByType("marker")) do if getElementData(p, "type") == "checkpoint" and getElementDimension(p) == getElementDimension(localPlayer) then if getMarkerSize(p) > 0.1 then local x, y, z = getElementPosition(p) blipr, blipg, blipb = getMarkerColor(p) local distance = getDistanceBetweenPoints2D(x, y, xp,yp) local rotation2 = findRotation(x,y,xp,yp) local , yd = getPointFromDistanceRotation(startwidth+(width/2), startheight+(height/2), distance/4, rotation2-rotation) if < startwidth+edgeVertical then = startwidth+edgeVertical elseif > startwidth+width-edgeVertical then = startwidth+width-edgeVertical end if yd < startheight+edgeVertical then yd = startheight+edgeVertical elseif yd > startheight+height then yd = startheight+height end if getElementData(p, "id") == getElementData(localPlayer, "checkpointname") then dxDrawRectangle ( -6, yd-6, 12, 12, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle (-5, yd-5, 10, 10, tocolor (blipr, blipg, blipb, 255 ) ) else dxDrawRectangle ( -4, yd-4, 8, 8, tocolor ( 0, 0, 0, 255 ) ) dxDrawRectangle (-3, yd-3, 6, 6, tocolor (blipr, blipg, blipb, 255 ) ) end end end end if theTarget then local health = getElementHealth(theTarget) if getElementType(theTarget) == "player" then health = health*10 end health = math.max(health - 250, 0)/750 local p = -510*(health^2) local r,g = math.max(math.min(p + 255*health + 255, 255), 0), math.max(math.min(p + 765*health, 255), 0) local nitro if getElementType(theTarget) == "vehicle" then nitro = getVehicleNitroLevel(theTarget) end if not nitro then nitro = 0 end --health dxDrawRectangle(startwidth+edgeVertical, startheight+height+edgeVertical, width/2-edgeVertical*2+edgeVertical/2, edgeHorizontal-edgeVertical*2, tocolor(0,0,0,255) ) dxDrawRectangle(startwidth+edgeVertical+2, startheight+height+edgeVertical+2, width/2-edgeVertical*2+edgeVertical/2-4, edgeHorizontal-edgeVertical*2-4, tocolor(r,g,0,0.5*255) ) dxDrawRectangle(startwidth+edgeVertical+2, startheight+height+edgeVertical+2, health*(width/2-edgeVertical*2+edgeVertical/2-4), edgeHorizontal-edgeVertical*2-4, tocolor(r,g,0,255) ) --nitro dxDrawRectangle(startwidth+width/2+edgeVertical/2, startheight+height+edgeVertical, width/2-edgeVertical*2+edgeVertical/2, edgeHorizontal-edgeVertical*2, tocolor(0,0,0,255) ) dxDrawRectangle(startwidth+width/2+edgeVertical/2+2, startheight+height+edgeVertical+2, width/2-edgeVertical*2+edgeVertical/2-4, edgeHorizontal-edgeVertical*2-4, tocolor(0,150,220,0.5*255) ) dxDrawRectangle(startwidth+width/2+edgeVertical/2+2, startheight+height+edgeVertical+2, nitro*(width/2-edgeVertical*2+edgeVertical/2-4), edgeHorizontal-edgeVertical*2-4, tocolor(0,50,255,255) ) end local xr,yr,zr = getElementRotation(theTarget) dxDrawImage ( startwidth+(width/2)-blipsize/2, startheight+(height/2)-blipsize/2, blipsize, blipsize, "img/blip.png", -zr+rotation, 0, 0, tocolor ( 255, 255, 255, 255 ), false ) end addEventHandler("onClientRender", root, drawRadar) function getPlayersInArena(arena) local playerTable = {} for i, p in ipairs(getElementsByType("player")) do if getElementType(p) == "player" and getElementData(p, "Arena") == arena then table.insert(playerTable, p) end end return playerTable end function toggleRadar() if showRadar == true then showRadar = false elseif showRadar == false then showRadar = true end end addCommandHandler("showradar", toggleRadar)
×
×
  • Create New...