Jump to content

Jaysds1

Members
  • Posts

    4,961
  • Joined

  • Last visited

Everything posted by Jaysds1

  1. Can I test this script on my server please? I'm not going to steal it, trust me
  2. Jaysds1

    random vehicles

    here: addEventHandler ( "onPickupHit", root, function(playerWhoUsed) --Script here end) In the "script here" part, put what you want to do (in lua) this is the only event that could help you with the change vehicle and limitation of the pick up
  3. Oh, now I know why you wrote the script like that... Copy the script again, i've edited it
  4. try this: g_Players = getElementsByType('player') nametag = {} local nametags = {} local g_screenX,g_screenY = guiGetScreenSize() local bHideNametags = false local NAMETAG_SCALE = 0.3 --Overall adjustment of the nametag, use this to resize but constrain proportions local NAMETAG_ALPHA_DISTANCE = 25 --Distance to start fading out local NAMETAG_DISTANCE = 25 --Distance until we're gone local NAMETAG_ALPHA = 120 --The overall alpha level of the nametag --The following arent actual pixel measurements, they're just proportional constraints local NAMETAG_TEXT_BAR_SPACE = 2 local NAMETAG_WIDTH = 50 local NAMETAG_HEIGHT = 5 local NAMETAG_TEXTSIZE = 0.9 local NAMETAG_OUTLINE_THICKNESS = 1.3 -- local NAMETAG_ALPHA_DIFF = NAMETAG_DISTANCE - NAMETAG_ALPHA_DISTANCE NAMETAG_SCALE = 1/NAMETAG_SCALE * 800 / g_screenY -- Ensure the name tag doesn't get too big local maxScaleCurve = { {0, 0}, {3, 3}, {13, 5} } -- Ensure the text doesn't get too small/unreadable local textScaleCurve = { {0, 0.8}, {0.8, 1.2}, {99, 99} } -- Make the text a bit brighter and fade more gradually local textAlphaCurve = { {0, 0}, {25, 100}, {120, 190}, {255, 190} } function nametagcreate ( player ) nametags[player] = true end function nametagdestroy ( player ) nametags[player] = nil end addEventHandler ( "onClientRender", root, function() -- Hideous quick fix -- for i,player in ipairs(g_Players) do if isElement(player) then if player ~= localPlayer then setPlayerNametagShowing ( player, false ) if not nametags[player] then nametagcreate ( player ) end end end end if bHideNametags then return end local x,y,z = getCameraMatrix() for player in pairs(nametags) do while true do if not isElement(player) then break end if getElementDimension(player) ~= getElementDimension(localPlayer) then break end local px,py,pz = getElementPosition ( player ) if processLineOfSight(x, y, z, px, py, pz, true, false, false, true, false, true) then break end local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if pdistance <= NAMETAG_DISTANCE then --Get screenposition local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) --------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------ POSI OF STATUS ---------------------------------------------- --------------------------------------------------------------------------------------------------------------------- local sxStat,syStat = getScreenFromWorldPosition ( px, py, pz+0.85, 0.06 ) if not sx or not sy then break end if not sxStat or not syStat then break end --Calculate our components local scale = 1/(NAMETAG_SCALE * (pdistance / NAMETAG_DISTANCE)) local alpha = ((pdistance - NAMETAG_ALPHA_DISTANCE) / NAMETAG_ALPHA_DIFF) alpha = (alpha < 0) and NAMETAG_ALPHA or NAMETAG_ALPHA-(alpha*NAMETAG_ALPHA) scale = math.evalCurve(maxScaleCurve,scale) local textscale = math.evalCurve(textScaleCurve,scale) local textalpha = math.evalCurve(textAlphaCurve,alpha) local outlineThickness = NAMETAG_OUTLINE_THICKNESS*(scale) --Draw our text local health local p local r,g health = getElementHealth ( player ) health = math.max(health, 0)/100 p = -510*(health^2) r,g = math.max(math.min(p + 255*health + 255, 255), 0), math.max(math.min(p + 765*health, 255), 0) local offset = (scale) * NAMETAG_TEXT_BAR_SPACE/2 --------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------ STATUS ------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------- dxDrawText ( "DER STATUS", sxStat, syStat - offset, sxStat, syStat - offset, tocolor(10,10,10,255), (textscale*NAMETAG_TEXTSIZE)-0.3, "default", "center", "bottom", false, false, false ) if health <= 0 then --------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------ IMAGE -------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------- dxDrawImage ( sx - offset, sy - offset, 20, 20, 'images/tt.png' ) dxDrawText ( getPlayerName(player), sx, sy - offset+3, sx, sy - offset+3, tocolor(0,0,0,textalpha), (textscale*NAMETAG_TEXTSIZE)-0.3, "default", "center", "bottom", false, false, false ) else dxDrawText ( getPlayerName(player), sx, sy - offset+3, sx, sy - offset+3, tocolor(r,g,0,textalpha), (textscale*NAMETAG_TEXTSIZE)-0.3, "default", "center", "bottom", false, false, false ) end end break end end end ) ---------------THE FOLLOWING IS THE MANAGEMENT OF NAMETAGS----------------- addEventHandler('onClientResourceStart', resourceRoot, function() for i,player in ipairs(g_Players) do if player ~= localPlayer then nametagcreate ( player ) end end end ) addEventHandler ( "onClientPlayerJoin", root, function() if source == localPlayer then return end setPlayerNametagShowing ( source, false ) nametagcreate ( source ) end ) addEventHandler ( "onClientPlayerQuit", root, function() nametagdestroy ( source ) end ) -- Math functions function math.lerp(from,to,alpha) return from + (to-from) * alpha end -- curve is { {x1, y1}, {x2, y2}, {x3, y3} ... } function math.evalCurve( curve, input ) -- First value if input[1][1] then return curve[1][2] end -- Interp value for idx=2,#curve do if input[idx][1] then local x1 = curve[idx-1][1] local y1 = curve[idx-1][2] local x2 = curve[idx][1] local y2 = curve[idx][2] -- Find pos between input points local alpha = (input - x1)/(x2 - x1); -- Map to output points return math.lerp(y1,y2,alpha) end end -- Last value return curve[#curve][2] end
  5. Certain, start learning now: viewtopic.php?f=148&t=40809 MOD LOCK PLEASE
  6. Jaysds1

    Next map

    ok, check pm
  7. anyways, try this: addEventHandler ("onResourceStart",resourceRoot, function() removeWorldModel(10821, 2000, -1292.48046875, 938.3876953125, 52.886108398438) for i=10821,10000 do removeWorldModel(i,2000,-1292.48046875, 938.3876953125, 52.886108398438) end end) function restoreall() restoreAllWorldModels() end addCommandHandler("rawo", restoreall)
  8. Why did you put this? You already got the bridge model and deleted it on resource start.
  9. Jaysds1

    random vehicles

    well, it'll be on all the maps that you start, unless you stop it... It can work but your going to need a script to enable it to work on a certain map.
  10. I think when a ped dies, their not an element anymore, because they're dead... plus gta automatically removes it from the game or the world so, MTA needs to remove it as an element.
  11. true... but... never mind you have a point
  12. Jaysds1

    random vehicles

    you can use: addEventHandler ( "onPickupUse", root, function(playerWhoUsed) --Script here end)
  13. The default gun shot is implanted in the gun it's self... the only thing we could do right now is create a sound over it..
  14. Jaysds1

    random vehicles

    ok, forget about the markers, you want the vehicle pickup limited right? What pickup are you using?
  15. A: No Q: What car should we use to get to LV?
  16. oh, snap, srry, I was looking at something else EDIT: try this: connect_mysql_check = mysql_connect(host, user, password, database_, 3306, "/var/run/mysqld/mysqld.sock") if not connect_mysql_check then outputChatBox("#FF8800[TOPTIMES] #FF6565Could not connect with MySQL Server.",root, 255, 255, 255, true) else setTimer(CHECKING, 500, 1) end function CHECKING() result = mysql_query(connect_mysql_check, "SELECT name FROM granted") if (result) then local row = mysql_fetch_assoc(result) if not row then outputDebugString("Sorry, but the row was not returned") end if getParticalServerName(row.name) then CONNECT() else WRONG() end end mysql_free_result(result) end
  17. Jaysds1

    random vehicles

    so, you want the markers to be in different places right?
  18. This is what I got from the wiki: mysql_query I don't see any errors in it but the wiki is saying there's an error.
  19. now, try running that query using this: "SELECT name FROM granted" Post a screenshot after.
  20. Jaysds1

    [Question]

    try this then: Client-side: addEvent("onClientLogin",true) addEventHandler("onClientLogin",root,function() bindKey ("o", "down", showTnsAdminpanel) end) Server-side: addEventHandler("onPlayerLogin",root,function() if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Admin"))then triggerClientEvent(source,"onClientLogin",root) end end)
  21. The server seem like it can't get the column and table... I've edited the code again, if there's no debugstring then the column doesn't exit. and if there is then the table granted doesn't exit.
  22. Table: granted Plus, the "name" is not defined... What name do you want to get?
×
×
  • Create New...