Jump to content

denny199

Members
  • Posts

    877
  • Joined

  • Last visited

Everything posted by denny199

  1. Yes, here it is: addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() call(getResourceFromName("scoreboard"),"addScoreboardColumn","ACL") end ) addEventHandler ( "onPlayerJoin", root, function() setElementData(source,"ACL","None") end) addEventHandler ( "onPlayerLogin", root, function( _, acc) if isObjectInACLGroup ( "user." ..acc, aclGetGroup ( "Army" ) ) then setElementData(source,"ACL","Army") elseif isObjectInACLGroup ( "user." ..acc, aclGetGroup ( "Admin" ) ) then setElementData(source,"ACL","Admin") end end)
  2. As I said, yes, but you still need to edit the code foryourself Client local x, y = guiGetScreenSize() local tigre1 = nil addEventHandler("onClientRender",getRootElement(), function () if ( isElement ( tigre1 ) ) then local mx, my, mz = getElementPosition(tigre1) local mcx, mcy, mcz = getCameraMatrix() if isLineOfSightClear ( mcx , mcy, mcz, mx, my, mz, true, false, false, true, false, true, false, getLocalPlayer ( )) then local x1,y1,z1 = getElementPosition (getLocalPlayer()) local x2,y2,z2 = getElementPosition (tigre1) local visibleto = getDistanceBetweenPoints3D(x1,y1,z1,x2,y2,z2) if visibleto < 75 then local sx,sy = getScreenFromWorldPosition ( x2,y2,z2+1.45 ) if sx and sy then if y/102-visibleto/5 > 0 then dxDrawRectangle ( sx-x/14/2+visibleto/2, sy+y/25-visibleto/3, x/14-visibleto,y/146.3-visibleto/10, tocolor(0,0,0,245) ) if getElementHealth(tigre1) > 1 then dxDrawRectangle ( sx-x/14/2+visibleto/2, sy+y/25-visibleto/3, x/14*getElementHealth(tigre1)/100-visibleto,y/146.3-visibleto/10, tocolor(190,0,0,245) ) end end end end end end end) addEvent ("get:element",true) addEventHandler ( "get:element", root, function (element) tigre1 = element outputChatBox ( "element" ) end) addEventHandler ( "onClientResourceStart", resourceRoot, function() triggerServerEvent ( "ped:clientready", getLocalPlayer(), getLocalPlayer() ) end) Server: Lped = createPed ( 0,0,0,10) function sendServer(playerToSendTo) triggerClientEvent (playerToSendTo, "get:element", root, Lped ) end addEvent ( "ped:clientready", true ) addEventHandler ( "ped:clientready", root, sendServer )
  3. Hey guys, So I was making costum emotions for the chatbox, but now I need to know how I can convert the "getChatboxLayout()" to the screen position. Let me give you an example: local chatbox = getChatboxLayout() outputChatBox (chatbox["chat_width"]) This will return 1.5 for example, but now I want to convert this to the screen relative (like it will be 400) instead of 1.5 so that I can draw an DXrectangle over the chatbox, is this possible? https://wiki.multitheftauto.com/wiki/GetChatboxLayout Regards, Danny
  4. Thats still an bad idea for putting it on the nickname, like when he will change the name the datakey will be lost like IIYAMA said, you can better set it on the player element, since the player element will last forever when he's connected, and when he's disconnected he will be removed from the table. And it's simpler than the getPlayerName function
  5. You actually can: Client: local screenX, screenY = guiGetScreenSize() local sizeX = screenX*(100/1920) local rootElement = getRootElement() function PETvida() if ( isElement ( tigre1 ) ) then local pedX, pedY, pedZ = getElementPosition ( tigre1 ) local plX, plY, plZ = getElementPosition ( localPlayer ) local visibleto = getDistanceBetweenPoints3D(pedX, pedY, pedZ,plX, plY, plZ) if visibleto < 45 then local headX, headY, headZ = getPedBonePosition( tigre1, 5 ) local sx, sy = getScreenFromWorldPosition (headX, headY, headZ+0.6) if sx then guiSetPosition ( life, sx-((sizeX-visibleto)/2), sy, false ) guiSetSize (life, sizeX-visibleto, screenY*((30-visibleto)/1080), false) local vida = getElementHealth ( tigre1 ) guiProgressBarSetProgress(life, tonumber (vida)) end end end end function HandleTheRendering() life = guiCreateProgressBar( 0, 0,0, 0, false, nil ) addEventHandler("onClientRender",rootElement, PETvida) end addEventHandler("onBotSpawned",rootElement, HandleTheRendering) Now you only need to send the element to the client like this: client: local clientElement = nil addEvent ( "get:element", true ) addEventHandler ( "get:element", root, function(element) clientElement = element end) Server: Lped = createPed ( 0,0,0,1) function sendServer(playerToSendTo) triggerClientEvent (playerToSendTo, "get:element", root, Lped ) end This will send the server element "Lped" to the client, in that way you can check his health. If you need explanation with these functions tell it here. But dx rectangles will look nicer, and it it's faster for a client pc. Regards, Danny
  6. Yes, but you will have some stuff that you can't do like forms, JS & other stuffs. You need to get the HTML content with PHP (You can do it with file_get_contents function per example) of the page that you want and parse it. <?php $page = "http://www.website.com/"; $content = file_get_contents($page); -- parse that html file, get every links & images and return it to MTA ?> You should recreate every links (create a button or whatever to call the page etc...) & images (fetchRemote). I've started a project like this one but never finish it. I wish you good luck if you want to make it. Edit: An easy way to parse the HTML code: http://simplehtmldom.sourceforge.net/manual.htm As you can see, FatalTerror is a web-dev just like me. I think I do got alittle more experience in some part then him but he also has more experience in other parts of web-dev which I dont have or didn't master. You should also have alot of knowledge and experience with parsing data between a browser and a game etc before you can make this totally bug free. You are an self-fish, and you are always going off-topic.... on-topic: You should try it first out in your own web-browser (the reading)
  7. I was thingking exactly like that before but then difference, I was scripting for free, still doing sometimes for friends. I'm agreeing with you at the part with the "it's only a game", but for the server owners is it their own choise to buy scripts, also why would you complain about it? In my opinion is a server owner a scripter, but since alot of people have another mind-intercoursing isn't this possible, everyone in mta wants their server looks like any other server, let's take today a roleplay server, it's all leaked content nowdays, everyone is using those scripts for their own roleplay server, with bad admins, also let's take the SAUR server as an example, nowdays is everyone trying to copying it. or let's take FFS, everyone is trying to copy a multi-gamemode. the people who are calling them-self "scripters" which are developing a server from leaked server files can't call themself "scripters" (in my opinion ofcourse). After that, let's go back inside the scripters mind. Let's say that scripting is pretty easy for the script developers, and there's a demand for scripts, a scripter thinks "HWELLOW, a simple project, I can make it for money",after that to gain some money for investing their own project. I've selled some scripts and i've bought a new game from it, just because why not(Yes i have the money for it to buy a game), but it just feels right to gain some little money from a hobby.
  8. Oh, goodluck then i'll remove it from the list since I don't want to interupt awesome people with their projects
  9. I didn't neither, also, I posted already a valid code, and helped him further. Also my way is faster since I'm attaching the event direclty to the marker, you are attaching it to the "root" so every marker in the server, after that when someone is hitting it it will look for that marker if it matches with the created marker, let's say, he's having 50 players in his server, with a costum housesystem, and map-created markers, some players are hitting the marker, and voila, it will chek if it's the created marker.
  10. denny199

    question

    Like I was showing a costum HEX label color maker.
  11. local marker = createMarker ( 2806.6999511719, 1371.0999755859, 10, "corona", 4, 0, 0, 255, 255); addEventHandler ( "onMarkerHit", marker, function (hitElement) if (getElementType ( hitElement ) == "player") then setElementPosition ( hitElement, 2821.3000488281, 1340.3000488281, 65.099998474121, true ) end end) I'm only helping you this time, after that you need to learn for yourself. visit this link: https://forum.multitheftauto.com/viewtopic.php?f=148&t=40809 Good luck.
  12. denny199

    question

    @tosfera, He want's to use HEX colors, like a player can have 2 HEX colors in his name, it will be shown as #ff0000D#00ff00anny, that isn't very handy for labels, like a deathlist, so Danny would look better. I don't know who made this function, just found it on the forums. For HEX codes: function guiCreateColorLabel( ax, ay, bx, by,str, bool, parent ) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find( pat, 1 ) local last = 1 local r,g,b while s do if cap == "" and col then r,g,b = tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth( cap ) avc321 = guiCreateLabel( ax, ay, ax + w, by,cap,bool,parent ) if not r then r = 255 end if not g then g = 255 end if not b then b = 255 end guiLabelSetColor( avc321,r,g,b ) ax = ax + w r,g,b = tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then local cap = str:sub( last ) local w = dxGetTextWidth( cap ) local avc123 = guiCreateLabel( ax, ay, ax + w, by,cap,bool,parent ) guiLabelSetColor( avc123,r or 255,g or 255,b or 255 ) return avc123 end end
  13. Added poll, still need some more ideas, I'm idealess , if someone request a gamemode I will add it to the poll and the highest vote will I make.
  14. See my post, edited it, i made some big mistakes
  15. If you want to target more players then you must use tables, much faster than cheking if something is attached on the player -- partial name function start by TAPL 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 g_Local = getLocalPlayer() local followTable = {} function followTarget(g_Local, cmd, target) if not target then outputChatBox("You have to type a player name.") elseif target then local tPlayer = getPlayerFromNamePart(target) if tPlayer == g_Local then outputChatBox("You can't follow yourself.") elseif not ( isElement ( followTable[tPlayer] ) ) then followTable[tPlayer] = createBlipAttachedTo( tPlayer, 0, 2, 255, 255, 255, 255, 0, 99999.0, g_Local) elseif ( isElement ( followTable[tPlayer] ) ) then outputChatBox("You are already following this player.") end end end function unfollowTarget(g_Local, cmd, target) if not target then outputChatBox("You have to type a player name.") elseif target then local tPlayer = getPlayerFromNamePart(target) if isElement (followTable[tPlayer]) then destroyElement ( followTable[tPlayer] ) end end end addCommandHandler("follow", followTarget) addCommandHandler("unfollow", unfollowTarget)
  16. Fixed also some little bugs -- partial name function start by TAPL 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 g_Local = getLocalPlayer() function followTarget(g_Local, cmd, target) if not target then outputChatBox("You have to type a player name.") elseif target then tPlayer = getPlayerFromNamePart(target) if tPlayer == g_Local then outputChatBox("You can't follow yourself.") else if not isElement ( tMark ) then tMark = createBlipAttachedTo( tPlayer, 0, 2, 255, 255, 255, 255, 0, 99999.0, g_Local) elseif isElement ( tMark ) then destroyElement ( tMark ) tMark = createBlipAttachedTo( tPlayer, 0, 2, 255, 255, 255, 255, 0, 99999.0, g_Local) end end end end function unfollowTarget(g_Local, cmd, target) if isElement ( tMark ) then destroyElement ( tMark ) end end addCommandHandler("follow", followTarget) addCommandHandler("unfollow", unfollowTarget)
  17. "removeVehicleSirens" isn't working since it's only for costum sirenes use: https://wiki.multitheftauto.com/wiki/SetVehicleSirensOn function VehicleEnter ( thePlayer, seat, jacked ) if ( seat == 0 ) and (getElementModel ( source ) == 490) then setVehicleSirensOn ( source, false ) bindKey ( thePlayer, "h", "down", disableSiren ) end end addEventHandler ( "onVehicleEnter", getRootElement(), VehicleEnter ) function exitVehicle ( thePlayer, seat, jacked ) if ( seat == 0 ) and (getElementModel ( source ) == 490) then setVehicleSirensOn ( source, false ) unbindKey ( thePlayer, "h", "down", disableSiren ) end addEventHandler ( "onVehicleStartExit", getRootElement(), exitVehicle ) function disableSiren (presser) if not isPedInVehicle (presser) then unbindKey ( presser, "h", "down", disableSiren ) elseif isPedInVehicle (presser) then if getVehicleSirensOn ( getPedOccupiedVehicle ( presser) ) then setVehicleSirensOn ( getPedOccupiedVehicle ( presser), false ) end end end Not tested.
  18. This is wrong. You are creating every frame a label... Use this: addEventHandler( "onClientResourceStart", getRootElement(), function() label = guiCreateLabel(0.0, 0.95, 0.1, 0.1, "Time: ", true); addEventHandler("onClientRender", getRootElement(), timestart) if isTimer(timer) then killTimer(timer) end timer = setTimer(function() removeEventHandler("onClientRender", getRootElement(), timestart) end,1000000,1) end) function timestart() guiSetText(label, "Time: " ..convertMS(math.ceil(getTimerDetails(timer) / 1000)) ) end function convertMS( timeMs ) local minutes = math.floor( timeMs / 60 ) local timeMs = timeMs - minutes * 60; local seconds = math.floor( timeMs / 60 ) local ms = timeMs - seconds * 60; return string.format( '%02d :%3d', minutes, ms ); end
  19. Must be a bug, since it wasn't showing into my made postst, thanks for saying. FPS Deatmatch, did you ment like cod, if so, it would be easy to make, give me something bigger
  20. addEventHandler("onClientGUIClick", root, function() if ( source == PCScheckbox2 ) then if not (isPedInVehicle ( localPlayer ) ) then guiCheckBoxSetSelected(windowPCS.PCScheckbox2,false) end if guiCheckBoxGetSelected(PCScheckbox2) then triggerServerEvent("Arrow",localPlayer) else triggerServerEvent("Arrow",localPlayer) end end end ) Edited
  21. Hi there, I was looking arround on the forums for any ideas for a gamemode, but I found nothing. So, my question to you is, what gamemode would you like to see in MTA. I'm scripting for 3 years now, and I gained some experience with asking at the forums and making my own scripts, I owned a freeroam server, which was totally for friends only, but it had itself own funarenas so we didn't get bored after a while, and there was always each week new own made scripts coming, but lets stay on-topic. Which new-gamemode would you guys like to play? Regards, Danny
  22. Yea I know, that's the only solution (I think) If I want to allow clothes in the gamemode. If someone have an idea to solve this problem, let me know. Shaders ftw ^.^
  23. It isn't, I was testing MTA:Eir and they implemented GTA:VC and GTA:III into the game, but if you want to play on a vice city map with friends, then you should download the gta VC mp client.
×
×
  • Create New...