Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. That's not possible. P.S: It's setElementDimension, not setElementDimention
  2. Castillo

    need scripter

    50p's resource? do you mean Slothman's? https://community.multitheftauto.com/index.php?p= ... ils&id=347
  3. local show = true function startRes() for key, value in ipairs(getElementsByType("player")) do setPlayerNametagShowing(value, false) end end addEventHandler("onClientResourceStart", getResourceRootElement(), startRes) local playerhp = { } local lasthp = { } local playerarmor = { } local lastarmor = { } function playerQuit() if (getElementType(source)=="player") then playerhp[source] = nil lasthp[source] = nil playerarmor[source] = nil lastarmor[source] = nil end end addEventHandler("onClientElementStreamOut", getRootElement(), playerQuit) addEventHandler("onClientPlayerQuit", getRootElement(), playerQuit) function setNametagOnJoin() setPlayerNametagShowing(source, false) end addEventHandler("onClientPlayerJoin", getRootElement(), setNametagOnJoin) function streamIn() if (getElementType(source)=="player") then playerhp[source] = getElementHealth(source) lasthp[source] = playerhp[source] playerarmor[source] = getPedArmor(source) lastarmor[source] = playerarmor[source] end end addEventHandler("onClientElementStreamIn", getRootElement(), streamIn) function isPlayerMoving(player) return (not isPedInVehicle(player) and (getPedControlState(player, "forwards") or getPedControlState(player, "backwards") or getPedControlState(player, "left") or getPedControlState(player, "right") or getPedControlState(player, "accelerate") or getPedControlState(player, "brake_reverse") or getPedControlState(player, "enter_exit") or getPedControlState(player, "enter_passenger"))) end local lastrot = nil function aimsSniper() return getPedControlState(localPlayer, "aim_weapon") and getPedWeapon(localPlayer) == 34 end function aimsAt(player) return getPedTarget(localPlayer) == player and aimsSniper() end function renderNametags() if (show) then local players = { } local distances = { } local lx, ly, lz = getCameraMatrix() for key, player in ipairs(getElementsByType("player")) do if (isElement(player)) and isElementStreamedIn(player) then local logged = getElementData(player, "loggedin") if (logged == 1) then local lx, ly, lz = getElementPosition(localPlayer) local rx, ry, rz = getElementPosition(player) local distance = getDistanceBetweenPoints3D(lx, ly, lz, rx, ry, rz) local limitdistance = 20 local reconx = getElementData(localPlayer, "reconx") -- smoothing playerhp[player] = getElementHealth(player) if (lasthp[player] == nil) then lasthp[player] = playerhp[player] end playerarmor[player] = getPedArmor(player) if (lastarmor[player] == nil) then lastarmor[player] = playerarmor[player] end if (player~=localPlayer) and (isElementOnScreen(player)) and (aimsAt(player) or distanceor reconx) then if not getElementData(player, "reconx") and not getElementData(player, "freecam:state") then --local lx, ly, lz = getPedBonePosition(localPlayer, 7) local lx, ly, lz = getCameraMatrix() local vehicle = getPedOccupiedVehicle(player) if (vehicle) then collision, cx, cy, cz, element = processLineOfSight(lx, ly, lz, rx, ry, rz+1, true, true, true, true, false, false, true, false, vehicle) else collision, cx, cy, cz = processLineOfSight(lx, ly, lz, rx, ry, rz+1, true, true, true, true, false, false, true, false) end if not (collision) or aimsSniper() or (reconx) then local x, y, z = getElementPosition(player) if not (isPedDucked(player)) then z = z + 1 else z = z + 0.5 end local sx, sy = getScreenFromWorldPosition(x, y, z+0.45, 100, false) local oldsy = nil -- HP if (sx) and (sy) then local health = math.ceil(lasthp[player]) if ( math.ceil(playerhp[player]) < health ) then health = health - 1 lasthp[player] = health elseif ( math.ceil(playerhp[player]) > health ) then health = health + 1 lasthp[player] = health end if (health>0) then distance = distance / 5 if (reconx or aimsAt(player)) then distance = 1 elseif (distance<1) then distance = 1 elseif (distance>2) then distance = 2 end local offset = 45 / distance -- DRAW BG dxDrawRectangle(sx-offset-5, sy, 95 / distance, 20 / distance, tocolor(0, 0, 0, 100), false) oldsy = sy -- DRAW HEALTH local width = 85 local hpsize = (width / 100) * health local barsize = (width / 100) * (100-health) local color if (health>70) then color = tocolor(0, 255, 0, 130) elseif (health>35 and health<=70) then color = tocolor(255, 255, 0, 130) else color = tocolor(255, 0, 0, 130) end if (distance<1.2) then dxDrawRectangle(sx-offset, sy+5, hpsize/distance, 10 / distance, color, false) dxDrawRectangle((sx-offset)+(hpsize/distance), sy+5, barsize/distance, 10 / distance, tocolor(162, 162, 162, 100), false) else dxDrawRectangle(sx-offset, sy+5, hpsize/distance-5, 10 / distance-3, color, false) dxDrawRectangle((sx-offset)+(hpsize/distance-5), sy+5, barsize/distance-2, 10 / distance-3, tocolor(162, 162, 162, 100), false) end end end -- ARMOR --sx, sy2 = getScreenFromWorldPosition(x, y, z+0.25, 100, false) if (sx) and (sy) then if (distance<=2) then sy = math.ceil( sy + ( 2 - distance ) * 20 ) end sy = sy + 10 if (sx) and (sy) then local armor = math.ceil(lastarmor[player]) if ( math.ceil(playerarmor[player]) < armor ) then armor = armor - 1 lastarmor[player] = armor elseif ( math.ceil(playerhp[player]) > armor ) then armor = armor + 1 lastarmor[player] = armor end if (armor>5) then local offset = 45 / distance -- DRAW BG dxDrawRectangle(sx-offset-5, sy, 95 / distance, 20 / distance, tocolor(0, 0, 0, 100), false) -- DRAW HEALTH local width = 85 local armorsize = (width / 100) * armor local barsize = (width / 100) * (100-armor) if (distance<1.2) then dxDrawRectangle(sx-offset, sy+5, armorsize/distance, 10 / distance, tocolor(197, 197, 197, 130), false) dxDrawRectangle((sx-offset)+(armorsize/distance), sy+5, barsize/distance, 10 / distance, tocolor(162, 162, 162, 100), false) else dxDrawRectangle(sx-offset, sy+5, armorsize/distance-5, 10 / distance-3, tocolor(197, 197, 197, 130), false) dxDrawRectangle((sx-offset)+(armorsize/distance-5), sy+5, barsize/distance-2, 10 / distance-3, tocolor(162, 162, 162, 100), false) end end end -- NAME --sx, sy = getScreenFromWorldPosition(x, y, z+0.6, 100, false) --sy = sy - (60 - distance*10) if (distance<=2) then sy = math.ceil( sy - ( 2 - distance ) * 40 ) end sy = sy - 20 if (sx) and (sy) then if (distance < 1) then distance = 1 end if (distance > 2) then distance = 2 end local offset = 75 / distance local scale = 0.6 / distance local font = "bankgothic" local r, g, b = getPlayerNametagColor(player) dxDrawText(getPlayerNametagText(player), sx-offset+2, sy+2, (sx-offset)+130 / distance, sy+20 / distance, tocolor(0, 0, 0, 220), scale, font, "center", "top", false, false, false) dxDrawText(getPlayerNametagText(player), sx-offset, sy, (sx-offset)+130 / distance, sy+20 / distance, tocolor(r, g, b, 220), scale, font, "center", "top", false, false, false) -- DRAW ids local offset = 65 / distance local id = getElementData(player, "playerid") if (oldsy) and (id) then if (id<100 and id>9) then -- 2 digits dxDrawRectangle(sx-offset-15, oldsy, 30 / distance, 20 / distance, tocolor(0, 0, 0, 100), false) dxDrawText(tostring(id), sx-offset-22.5, oldsy, (sx-offset)+26 / distance, sy+20 / distance, tocolor(255, 255, 255, 220), scale, font, "center", "top", false, false, false) elseif (id<=9) then -- 1 digit dxDrawRectangle(sx-offset-5, oldsy, 20 / distance, 20 / distance, tocolor(0, 0, 0, 100), false) dxDrawText(tostring(id), sx-offset-12.5, oldsy, (sx-offset)+26 / distance, sy+20 / distance, tocolor(255, 255, 255, 220), scale, font, "center", "top", false, false, false) elseif (id>=100) then -- 3 digits dxDrawRectangle(sx-offset-25, oldsy, 40 / distance, 20 / distance, tocolor(0, 0, 0, 100), false) dxDrawText(tostring(id), sx-offset-32.5, oldsy, (sx-offset)+26 / distance, sy+20 / distance, tocolor(255, 255, 255, 220), scale, font, "center", "top", false, false, false) end end end end end end end end end end end end addEventHandler("onClientRender", getRootElement(), renderNametags) function hideNametags() show =
  4. Castillo

    need scripter

    All these things will cost you a lot of money, I could do somethings, but not everything as I have a lot of stuff to do.
  5. This has gone to nowhere, I'm locking the topic.
  6. Nice to meet you too, welcome to the forums!
  7. Well, that error means that the MySQL connection is nil.
  8. Is "handler" a valid MySQL connection?
  9. Castillo

    dxdraw

    Don't you see the variables in the top of the script? Line: #5: local x, y, z = 0, 0, 5
  10. Castillo

    dxdraw

    local distance = 70 local screenSizeX, screenSizeY = guiGetScreenSize() local scale = 7 local myImage = "mtalogo.png" local x, y, z = 0, 0, 5 function renderImage() local px, py, pz = getElementPosition ( localPlayer ) local dist = getDistanceBetweenPoints3D ( px, py, pz, x, y, z ) if (dist < distance and isLineOfSightClear( px, py, pz, x, y, z, true, false, false, false )) then local screenX, screenY = getScreenFromWorldPosition ( x, y, z+0.5 ) local scaled = screenSizeX * (1/(2*(dist+5))) *.85 local relX, relY = scaled * scale, scaled * scale if ( screenX and screenY ) then dxDrawImage( screenX, screenY, relX, relY, tostring(myImage) ) end end end addEventHandler( "onClientRender", root, renderImage ) Change: x, y, z to your 3D world coordinates.
  11. What...? what is this?
  12. Castillo

    Flags problem

    The exported function: addScoreboardColumn has a width argument. Like this: exports["scoreboard"]:addScoreboardColumn ("Hello World!", 3, root, 0.10 ) -- 0.10 = width.
  13. addEventHandler("onClientPlayerWasted", getRootElement(), function() if ( source == localPlayer and isPlayerDead ( localPlayer ) ) then guiSetVisible ( menu, true ) showCursor (true) end end)
  14. onPlayerWasted is server side, GUI is client side only. Why don't you just use onClientPlayerWasted?
  15. You're welcome .
  16. Castillo

    Flags problem

    Change the column width.
  17. I have sent you a PM, maybe you should read it?
  18. -- client side: sWidth,sHeight = guiGetScreenSize() function onJoin() showCursor(true) LoginW = guiCreateWindow(sWidth/3.3,sHeight/3.3,500,300,"Oriental Night Gaming - Login",false) NameL = guiCreateLabel(28,139,35,15,"Name:",false,LoginW) guiSetFont(NameL,"default-bold-small") PassL = guiCreateLabel(18,180,56,15,"Password:",false,LoginW) guiSetFont(PassL,"default-bold-small") NameED = guiCreateEdit(78,132,233,31,"",false,LoginW) PassED = guiCreateEdit(80,174,233,31,"",false,LoginW) SepAD = guiCreateLabel(335,24,5,276,"|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n",false,LoginW) LoginB = guiCreateButton(23,244,120,32,"Login",false,LoginW) RegisterB = guiCreateButton(192,244,120,32,"Register",false,LoginW) Name = guiGetText(NameED) Pass = guiGetText(PassED) addEventHandler("onClientGUIClick",RegisterB,RegisterC) addEventHandler("onClientGUIClick",LoginB,LoginE) end addEventHandler("onClientResourceStart",getRootElement(),onJoin) function RegisterC() destroyElement(LoginW) RegisterW = guiCreateWindow(sWidth/3.3,sHeight/3.3,500,300,"Oriental Night Gaming - Register",false) NameLR = guiCreateLabel(28,77,35,15,"Name:",false,RegisterW) guiSetFont(NameLR,"default-bold-small") PassLR = guiCreateLabel(14,120,56,15,"Password:",false,RegisterW) guiSetFont(PassLR,"default-bold-small") NameEDR = guiCreateEdit(78,69,233,31,"",false,RegisterW) PassEDR = guiCreateEdit(80,111,233,31,"",false,RegisterW) SepADR = guiCreateLabel(335,24,5,276,"|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n",false,RegisterW) BackB = guiCreateButton(23,244,120,32,"Back",false,RegisterW) RegisterBR = guiCreateButton(192,244,120,32,"Register",false,RegisterW) ConfEDR = guiCreateEdit(80,154,233,31,"",false,RegisterW) ConfLR = guiCreateLabel(18,163,56,15,"Confirm:",false,RegisterW) guiSetFont(ConfLR,"default-bold-small") NameR = guiGetText(NameEDR) PassR = guiGetText(PassEDR) addEventHandler("onClientGUIClick",BackB,LoginC) addEventHandler("onClientGUIClick",RegisterBR,RegisterE) end function LoginC() destroyElement(RegisterW) LoginW = guiCreateWindow(sWidth/3.3,sHeight/3.3,500,300,"Oriental Night Gaming - Login",false) NameL = guiCreateLabel(28,139,35,15,"Name:",false,LoginW) guiSetFont(NameL,"default-bold-small") PassL = guiCreateLabel(18,180,56,15,"Password:",false,LoginW) guiSetFont(PassL,"default-bold-small") NameED = guiCreateEdit(78,132,233,31,"",false,LoginW) PassED = guiCreateEdit(80,174,233,31,"",false,LoginW) SepAD = guiCreateLabel(335,24,5,276,"|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n|\n",false,LoginW) LoginB = guiCreateButton(23,244,120,32,"Login",false,LoginW) RegisterB = guiCreateButton(192,244,120,32,"Register",false,LoginW) addEventHandler("onClientGUIClick",RegisterB,RegisterC) addEventHandler("onClientGUIClick",LoginB,LoginE) end function LoginE() local Name = guiGetText(NameED) local Pass = guiGetText(PassED) triggerServerEvent("login",localPlayer,localPlayer,Name,Pass) end function RegisterE() local NameR = guiGetText(NameEDR) local PassR = guiGetText(PassEDR) local Confirm = guiGetText(ConfEDR) triggerServerEvent("register",localPlayer,localPlayer,NameR,PassR,Confirm) end addEvent("agree",true) addEventHandler("agree",getRootElement(), function() destroyElement(LoginW) WelcomeW = guiCreateWindow(0.2188,0.1325,0.5445,0.7725,"Oriental Night Game - Agreement",true) guiWindowSetMovable(WelcomeW,false) guiWindowSetSizable(WelcomeW,false) EngL = guiCreateLabel(18,31,41,16,"English:",false,WelcomeW) MemoEng = guiCreateMemo(20,54,653,224,"Thank you for joining \"Oriental Night Gaming\"!\n\nThis is a server in development and it's just starting, so please be patient while we complete the development and add all the new functions and resources that will make this server a better one!\n\nFor now, please enjoy our Freeroam play, but follow these rules:\n\n1. Do not kill players while using a Jetpack\n2. You are not allowed to kill a player while you're in a vehicle and the player you want to kill is on foot (Get off the vehicle and kill it)\n3. Absolutely NO SPAWN KILLING, if they spawn, let them spawn normally, do not camp them or the present admin will ban you permanently.\n4. No HeliKill (Do not kill with the chopper razors) NOTE: The vehicle weapons have been disabled.\n5. Do not disrespect admins! (If the admin disrespects you, report it!)\n6. No admin impresionation! (Do not copy their names, if they are admins, they will do an admin function or appear in a team)\n7. No Ramming (Do not step on people with a car)\n_______________________________________________\n\nThis is the Member List so far:\n\n- WolfPire\n- Cross\n- MoonLight\n- Toxiccastle\n- Land\n\nDo not accept copy's!\n_______________________________________________\n\nThat's all! Accept if you agree and enjoy our server! =)",false,WelcomeW) guiMemoSetReadOnly(MemoEng,true) MemoEsp = guiCreateMemo(20,334,653,224,"Gracias por entrar a \"Oriental Night Gaming\"!\n\nEste servidor esta en desarrollo y solo esta empezando, asi que por favor se paciente mientras completamos el desarrollo y anadimos todas las nuevas funciones y recursos que haran de este server uno mejor!\n\nPor ahora, disfruta de nuestro juego Freeroam, pero sigue estas reglas:\n\n1. No mates a otros jugadores mientras usas un Jetpack\n2. No tienes permitido matar a otro jugador mientras estas en un auto y el otro jugador a pie (Salte del auto y matalo)\n3. Absolutamente NO MATAR GENTE DONDE APARECEN, si aparecen, dejalos aparecer normalmente, no los esperes o el admin presente te baneara permanentemente.\n4. No matar con el helicoptero (No los mates con las aspas de el helicoptero) NOTA: Las armas de los vehiculos estan desactivadas.\n5. No le faltes el respeto a los admins! (Si el admin te falta el respeto, reportalo!)\n6. No falsifiques a un admin! (No copies sus nombres, si ellos son admins, ellos haran alguna funcion admin o apareceran en algun equipo)\n7. No pises a los demas (No los pises con un auto)\n\n_______________________________________________\n\nEsta es la Lista de Miembros hasta ahora:\n\n- WolfPire\n- Cross\n- MoonLight\n- Toxiccastle\n- Land\n\nNo aceptes copias!\n_______________________________________________\n\nEso es todo! Acepta nuetras reglas si estas de acuerdo y disfruta nuestro server! =)",false,WelcomeW) guiMemoSetReadOnly(MemoEsp,true) Line = guiCreateLabel(21,278,654,20,"______________________________________________________________________________________________________________",false,WelcomeW) guiLabelSetColor(Line,0,255,0) EspL = guiCreateLabel(18,303,44,16,"Espanol:",false,WelcomeW) AcceptB = guiCreateButton(24,568,220,36,"Accept / Aceptar",false,WelcomeW) addEventHandler("onClientGUIClick",AcceptB,AcceptC) end ) function AcceptC() destroyElement(WelcomeW) showCursor(false) end
  19. A "massive" modification? It's not that hard to make it.
  20. Castillo

    Flags problem

    I think this will help you: https://community.multitheftauto.com/index.php?p= ... ls&id=3580
  21. You have to make the script or pay someone to do it for you, I never seen such resource released.
  22. They still are server-side only, these two functions are used to send/receive information.
  23. These functions are only available server-side.
  24. Just start the script in your server and test it, if it has no errors, then compile it.
  25. Try this: function createhouse(thePlayer, cmd, int, preis) if (isAdminLevel ( thePlayer ) == 3) then if (intids[tonumber(int)]) and (tonumber(int) >= 1) then if (tonumber(preis) >= 5000) and (tonumber(preis) <= 10000000) then x,y,z = getElementPosition(thePlayer) owner = "none" local erg = mysql_query(sqlcon, "INSERT INTO house_data (`Int`, Owner, Preis, X, Y, Z, `Lock`) VALUES ('"..tonumber(int).."','"..owner.."','"..tonumber(preis).."','"..x.."','"..y.."','"..z.."','0')") Housspawn() outputChatBox("House created!") else outputChatBox("Invalid price!", thePlayer,255,0,0) end else outputChatBox("Invalid interior!", thePlayer,255,0,0) end else outputChatBox("You are not authorized!", thePlayer, 255,0,0) end end addCommandHandler("addhouse", createhouse)
×
×
  • Create New...