Jump to content

Blaawee

Members
  • Posts

    857
  • Joined

  • Last visited

Everything posted by Blaawee

  1. جرب ذآ احسن local gScreenSize = { guiGetScreenSize( ) }; local gOffest = 0.4; local gIconWidth = 0.35 * gScreenSize[ 1 ]; local gHconHalfWidth = gIconWidth / 2; addEventHandler ( 'onClientRender', root, function( ) for _, players in ipairs( getElementsByType( 'player' ) ) do while true do if not isElementOnScreen( players ) then break end local headX, headY, headZ = getPedBonePosition( players, 8 ); headZ = headZ + gOffest; local absX, absY = getScreenFromWorldPosition ( headX, headY, headZ ); if not absX or not absY then break end local camX, camY, camZ = getCameraMatrix( ); if not isLineOfSightClear ( camX, camY, camZ, headX, headY, headZ, true, false, false, true, false, true, false, players ) then break end dxDrawImages( absX, absY, 'img.png', tocolor( 255, 255, 255, 255 ), getDistanceBetweenPoints3D( camX, camY, camZ, headX, headY, headZ ) ); break end end end ) function dxDrawImages ( posX, posY, iconPath, color, distance ) distance = 1 / distance; dxDrawImage ( posX - gHconHalfWidth * distance, posY - gHconHalfWidth * distance, gIconWidth * distance, gIconWidth * distance, iconPath, 0, 0, 0, color, false ); end
  2. اول شيء انت مستخدم في بعدين getDistanceBetweenPoints2D( xx, yy, z, y ) و بعدين ترتيبك للارقمنت غلط getDistanceBetweenPoints2D ( x1, y1, x2, y2 ) -- x1: The X position of the first point -- y1: The Y position of the first point -- x2: The X position of the second point -- y2: The Y position of the second point
  3. ^ خطأ . استخدم ذي بس : getPedBonePosition -- اسهل لكك عشآن تحطه فوق رآسه getScreenFromWorldPosition getCameraMatrix isLineOfSightClear getDistanceBetweenPoints3D
  4. actually the freeroam already have that's function . this is the freeroam commands : Player: ss / setskin [id] wp / give [weaponid] [ammo] ac / addclothes [type] [texture] [model] rc / removeclothes [type] ap / alpha [value] (Transparency) jp / jetpack (or press J) setstyle [fightingstyle] anim [lib] [name] Vehicles: cv / createvehicle [vehicleid] au / addupgrade [upgradeid] ru / removeupgrade [upgradeid] pj / paintjob [paintjobid] rp / repair cl / color [colorid] f / flip [b][u]Tools: wt / warpto [playername] sp / setpos [x] [y] [z] [rot] gp / getpos[/u][/b] Environment: st / settime [hours] [minutes] sw / setweather [weatherid] speed / setgamespeed [value] grav / setgravity [value]
  5. try to fade the camera plus adding some random number like this function consoleSetPlayerPosition ( commandName, posX, posY, posZ ) setElementPosition ( getLocalPlayer(), posX + math.random( 0.8, 1.2 ), posY + math.random( 0.8, 1.2 ), posZ + math.random( 0.8, 1.2 ) ) end addCommandHandler ( "setpos", consoleSetPlayerPosition )
  6. https://community.multitheftauto.com/ind ... ls&id=6391 stolen from vio RealLife DONE
  7. اضيف للميتآ ذآ السطر : client="1.3.0-9.03931">
  8. الكود ذآ كلاينت وشلون حآطه سيرفر
  9. if you mean like mission timer you can this resource : [gameplay]/missiontimer
  10. police-s local gTeam = { -- ['Team Name'] = { PosX, PosY, PosZ, Rotation, SkinID, interior, dimension } [ 'Police' ] = { 0, 0, 0, 0, 280, 0, 0 } }; -- addEventHandler ( 'onResourceStart', resourceRoot, function( res ) SAPDteam = createTeam ( 'Police', 100, 149, 237 ) end ) -- function handleTheJoin( player, command ) if command == 'joinPD' then if not getPlayerTeam ( player ) == getTeamFromName ( 'Police' ) then setPlayerTeam( player, getTeamFromName ( 'Police' ) ); setElementModel( player, 280 ); giveWeapon ( player, 3 ); setAccountData( getPlayerAccount( player ), "team", "police", true ); outputChatBox( '* You are now SAPD agent.', player, 0, 255, 0 ); else outputChatBox( '* You are already SAPD agent!.', player, 255, 0, 0, true ); end elseif command == 'leavePD' then if not getPlayerTeam ( player ) == getTeamFromName ( 'Police' ) then outputChatBox ( '* You are not SAPD agent.', player, 255, 0, 0, true ); else setAccountData( getPlayerAccount( player ), "team", "unemployed", true ); setPlayerTeam( player, nil ); setElementModel( player, 0 ); takeWeapon( player, 3 ); outputChatBox( '* You are now an unemployed.', player, 255, 0, 0 ); end end end addCommandHandler( 'joinPD', handleTheJoin ); addCommandHandler( 'leavePD', handleTheJoin ); addEventHandler( 'onPlayerSpawn', root, function( _, _, _, _, theTeam ) if gTeam[ theTeam ] then spawnPlayer( source, gTeam[ theTeam ][ 1 ], gTeam[ theTeam ][ 2 ], gTeam[ theTeam ][ 3 ], gTeam[ theTeam ][ 4 ], gTeam[ theTeam ][ 5 ], gTeam[ theTeam ][ 6 ], gTeam[ theTeam ][ 7 ] ); fadeCamera( source, true ); setCameraTarget( source, source ); end end ); -- function policeJob ( attacker, attackerweapon, bodypart, loss ) if attacker and getElementType(attacker) == "player" then theTeam = getPlayerTeam ( attacker ) theWL = getPlayerWantedLevel ( source ) theSkin = getElementModel ( attacker ) if ( attackerweapon == 3 ) and ( loss > 2 ) and ( theWL > 0 ) and ( theSkin == 280 ) then if getTeamName( theTeam ) == "police" then setElementPosition ( source, 4076.3999023438, -1788.5, 3.511967, true ) theCop = getPlayerName ( attacker ) outputChatBox ( "You have been jailed by "..theCop.. " for 10 seconds.", source ) givePlayerMoney ( attacker, 100 ) setTimer ( setElementPosition, 10000, 1, source, 1544.4332275391, -1674.7698974609, 13.688399200439 ) setPlayerWantedLevel( source, 0 ) end end end end addEventHandler ( "onPlayerDamage", getRootElement(), policeJob ) you can join the police team with commands don't forget to change the spawn Position for the police team
  11. i think you should to use this function guiSetInputMode( 'no_binds_when_editing' )
  12. the third time =) . like i never say something
  13. why did you add a new event and that it's already exist !
  14. Blaawee

    Night.

    setTime( 0, 0 ) setMinuteDuration( 100000000 ) setSkyGradient( 0, 0, 0, 10, 5, 0 ) setFarClipDistance( 40 ) or you can use shaders
  15. you mean want it with bind ? if so here you go police-c GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} function guiMyCwindow( w, h, t ) local x, y = guiGetScreenSize( ) return guiCreateWindow( ( x - w ) / 2, ( y - h ) / 2, w, h, t, false ) end windowjob = guiMyCwindow( 301, 170, "SAPD agent v2.0" ) guiSetVisible( windowjob, false ) GUIEditor_Button[1] = guiCreateButton(22,80,108,35,"Take job",false,windowjob) GUIEditor_Button[3] = guiCreateButton(22,120,108,35,"Quit Job",false,windowjob) GUIEditor_Button[2] = guiCreateButton(179,120,110,36,"Cancel",false,windowjob) GUIEditor_Label[1] = guiCreateLabel(19,33,273,20,"Are you sure you want to take/leave this job?",false,windowjob) addEventHandler( "onClientGUIClick", guiRoot, function( ) if ( source == GUIEditor_Button[ 1 ] ) then triggerServerEvent( "setSAPD", localPlayer ) guiSetVisible( windowjob, false ) showCursor( false ) elseif ( source == GUIEditor_Button[ 2 ] ) then guiSetVisible( windowjob, false ) showCursor( false ) elseif ( source == GUIEditor_Button[ 3 ] ) then triggerServerEvent( "removeSAPD", localPlayer ) guiSetVisible( windowjob, false ) showCursor( false ) end end ) bindKey ( "o", "down", function( ) guiSetVisible ( windowjob, not guiGetVisible( windowjob ) ) showCursor ( guiGetVisible( windowjob ) ) end ) just change the key
  16. use setCustomBlipVisible( blip, bool visible )
  17. try this server : addEventHandler( 'onPlayerJoin', root, function( ) local name = getPlayerName( source ) local nick = string.gsub( name, "#%x%x%x%x%x%x", "" ) setPlayerName( source, nick ) end )
  18. try with this config , replace it with the old one : https://mega.co.nz/#!Qxwz0YaQ!FWLIiUKL4uIbZzx0b7ltPjsA6585Qwn2M71Y0kmAHnE
  19. try this i didn't test it but i'm sure it's working perfect client: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Image = {} -- local anims = { }; local screenSize = { guiGetScreenSize () }; -- GUIEditor_Window[1] = guiCreateWindow(264,152,255,341,"Welcome!",false) guiSetAlpha(GUIEditor_Window[1],1) LoginUsername = guiCreateEdit(0.298,0.1701,0.6157,0.1026,"",true,GUIEditor_Window[1]) guiSetAlpha(LoginUsername,1) LoginPassword = guiCreateEdit(0.298,0.2815,0.6157,0.1026,"",true,GUIEditor_Window[1]) guiSetAlpha(LoginPassword,1) guiEditSetMasked ( LoginPassword, true ) GUIEditor_Label[2] = guiCreateLabel(0.0431,0.1906,0.2471,0.0616,"Username:",true,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Label[2],1) guiLabelSetColor(GUIEditor_Label[2],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[2],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[2],"left",false) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Label[3] = guiCreateLabel(0.0471,0.2962,0.251,0.0704,"Password:",true,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Label[3],1) guiLabelSetColor(GUIEditor_Label[3],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[3],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Label[4] = guiCreateLabel(0.0745,0.5279,0.8314,0.0645,"If you are new, please register!",true,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Label[4],1) guiLabelSetColor(GUIEditor_Label[4],255,150,255) guiLabelSetVerticalAlign(GUIEditor_Label[4],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[4],"left",false) guiSetFont(GUIEditor_Label[4],"clear-normal") GUIEditor_Label[5] = guiCreateLabel(0.0784,0.0792,0.8314,0.0645,"Welcome to James Kile's server",true,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Label[5],1) guiLabelSetColor(GUIEditor_Label[5],255,150,255) guiLabelSetVerticalAlign(GUIEditor_Label[5],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[5],"left",false) guiSetFont(GUIEditor_Label[5],"clear-normal") GUIEditor_Button[1] = guiCreateButton(0.5216,0.4164,0.3961,0.0909,"Login!",true,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Button[1],1) EditRegisterUsername = guiCreateEdit(0.2902,0.5924,0.6157,0.1026,"",true,GUIEditor_Window[1]) guiSetAlpha(EditRegisterUsername,1) EditRegisterPassword = guiCreateEdit(0.2902,0.7038,0.6157,0.1026,"",true,GUIEditor_Window[1]) guiEditSetMasked ( EditRegisterPassword, true ) guiSetAlpha(EditRegisterPassword,1) GUIEditor_Label[6] = guiCreateLabel(0.0392,0.61,0.2471,0.0616,"Username:",true,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Label[6],1) guiLabelSetColor(GUIEditor_Label[6],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[6],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[6],"left",false) guiSetFont(GUIEditor_Label[6],"default-bold-small") GUIEditor_Label[7] = guiCreateLabel(0.0392,0.7185,0.251,0.0704,"Password:",true,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Label[7],1) guiLabelSetColor(GUIEditor_Label[7],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[7],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[7],"left",false) guiSetFont(GUIEditor_Label[7],"default-bold-small") GUIEditor_Button[2] = guiCreateButton(0.5216,0.8328,0.3961,0.0909,"Register!",true,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Button[2],1) GUIEditor_Image[1] = guiCreateStaticImage(0.0549,0.7918,0.349,0.173,"data/mtalogo.png",true,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Image[1],1) -- guiSetAlpha( GUIEditor_Window[ 1 ], 0 ); -- local localPlayer = getLocalPlayer ( ) function windowHandler( ) local playername = getPlayerName(localPlayer) guiSetText(LoginUsername, "") guiSetText(EditRegisterUsername, "") guiSetText(LoginUsername, playername) guiSetText(EditRegisterUsername, playername) -- local width, height = guiGetSize( GUIEditor_Window[ 1 ], false ); local x, y = screenSize[ 1 ] / 2 - width / 2, screenSize[ 2 ] / 2 - height / 2; anims.wndLoginFadein = Animation.create( GUIEditor_Window[ 1 ], Animation.presets.guiFadeIn( 1000 ) ); anims.wndLoginMovein = Animation.create( GUIEditor_Window[ 1 ], Animation.presets.guiMove( x, y, 750 ) ); anims.wndLoginFadeout = Animation.create( GUIEditor_Window[ 1 ], Animation.presets.guiFadeOut( 1000 ) ); anims.wndLoginMoveout = Animation.create( GUIEditor_Window[ 1 ], Animation.presets.guiMove( math.random( -500, 800 ), math.random( -500, 800 ), 750 ) ); anims.wndLoginFadein:play( ); anims.wndLoginMovein:play( ); -- guiSetInputEnabled(true) showCursor ( true ) end function onClickBtn ( button, state ) if (source == GUIEditor_Button[1]) then triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(LoginUsername), guiGetText(LoginPassword) ) end end function onClickBtn2 ( button, state ) if (source == GUIEditor_Button[2]) then triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword)) end end function hideLoginWindow() -- anims.wndLoginFadeout:play( ); anims.wndLoginMoveout:play( ); -- guiSetInputEnabled(false) showCursor ( false ) end addEvent( "hideLoginWindow", true ) addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow ) addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onClickBtn, false ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], onClickBtn2, false ) server : function onLogin ( player, user, pass ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then triggerClientEvent ( "hideLoginWindow", getRootElement()) else outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end else outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong. end end addEvent( "onLogin", true ) addEventHandler( "onLogin", getRootElement(), onLogin ) function onRegister ( player, user, pass ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then triggerClientEvent ( "hideLoginWindow", getRootElement()) else outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end else account = addAccount ( user, pass ) if (logIn ( player, account, pass ) == true) then triggerClientEvent ( "hideLoginWindow", getRootElement()) else outputChatBox ( "Register/Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end end end addEvent( "onRegister", true ) addEventHandler( "onRegister", getRootElement(), onRegister ) you have to use arc_'s animation . client : --[[ Client animation library by arc_ Version 1.0.0 Licence ---------------- You are free to modify this file and redistribute it with your changes. However, always mention that you changed it (and eventually what changes you made) and keep the original author, version number and licence intact. Selling this script or a derivative of it is not allowed. Documentation ---------------- Terminology - Animation: a sequence of phases that act on one or more elements and follow each other sequentially in time. Multiple animations can be running at the same time. All defined animations run in parallel. An animation is in fact one phase with several subphases (see below), with animation specific functions available. - Phase: a part of an animation sequence. A phase consists of a paramater that linearly goes from a given starting value to a given ending value, over the specified amount of time, and is applied to one certain element. While a phase is running, its callback function will be called onClientRender with the following arguments: phase.fn(element elem, float param, table phase) Specifying time and callback function is optional. If no time is specified but a function is, phase.fn(elem) will be called once. If no function is specified but a time is, the phase consists of simply waiting during that time, doing nothing. A phase can be run once, repeated multiple times or loop infinitely. Phases can also contain phases. In that case the parent phase consists of completing all child phases, in order. This allows you to f.e. make an element move left and right continuously: define a phase for moving it to the left, followed by a phase for moving it back to the right, and encapsulate these two phases in a parent phase that loops forever. Phases can be nested to arbitrary depth. The element a subphase works on is inherited from its parent phase (or, if the parent phase doesn't specify an element, from the grandparent, etc). Definition of a phase A phase is simply a table containing properties and (optionally) subphases. Available phase properties are: (the values for the properties are examples, not default values) phase = { from = 0, -- the starting value of the parameter to = 1, -- the ending value of the parameter [time = 1000,] -- the time (in ms) in which to go from start to end [fn = callback,] -- the function to call on each frame update [repeats = 5,] -- how many times to run this phase before going on to -- the next. defaults to 1 [subphase1,] -- optional subphases. if one or more of these are included, [subphase2,] -- only the "repeats" property is valid for this parent phase ... } Available functions anim = Animation.create(elem, phase1, phase2, ...) Creates and returns a new animation. This means nothing more than creating a new phase, putting the specified phases in it as subphases, and making the functions of the Animation class available to it. Once an animation is created, it is not yet running. anim = Animation.createAndPlay(elem, phase1, phase2, ...) Creates a new animation and immediately starts playing it. anim = Animation.createNamed(name, elem, ...) If an animation with the specified name exists, returns that animation. Otherwise creates a new named animation. You can look the animation up again later with Animation.getNamed(name). anim = Animation.createNamedAndPlay(name, elem, ...) Self explanatory. anim = Animation.getNamed(name) Returns the animation with the specified name if it exists, false otherwise. anim:play() Start playing a newly created animation or resume a paused animation. anim:pause() Pauses the animation. Resume it later with anim:play() or delete it with anim:remove(). anim:remove() Deletes the animation completely. It can not be resumed anymore. anim:isPlaying() Returns true if the animation is currently playing, false if not. Animation.playingAnimationsExist() Returns true if there is any animation that is currently playing. anim:addPhase(phase3), phase2:addPhase(phase3) Appends a new subphase to the animation or phase. Can be done while the animation is playing. Note that to be able to use phase2:addPhase(), phase2 first has to be processed (default values filled in, made part of the Phase class) by being passed as an argument to Animation.create[AndPlay] or addPhase. Examples Fade in a picture: local pict = guiCreateStaticImage(...) Animation.createAndPlay(pict, { from = 0, to = 1, time = 2000, fn = guiSetAlpha }) Fade in a picture using a preset (for more presets, see the end of this file): local pict = guiCreateStaticImage(...) Animation.createAndPlay(pict, Animation.presets.guiFadeIn(2000)) Move a label to the right while fading it in: local label = guiCreateLabel(10, 100, 150, 20, 'Test', false) Animation.createAndPlay(label, Animation.presets.guiMove(200, 100, 2000)) Animation.createAndPlay(label, Animation.presets.guiFadeIn(2000)) Move a label left and right forever, without presets: function guiSetX(elem, x) local curX, curY = guiGetPosition(elem, false) guiSetPosition(elem, x, curY, false) end local label = guiCreateLabel(10, 100, 150, 20, 'Test', false) Animation.createAndPlay( label, { repeats = 0, { from = 10, to = 200, time = 2000, fn = guiSetX }, { from = 200, to = 10, time = 2000, fn = guiSetX } } ) ]]-- Phase = {} Phase.__index = Phase Animation = setmetatable({}, { __index = Phase }) Animation.__index = Animation Animation.collection = {} function Animation.create(elem, ...) local anim = setmetatable({ elem = elem, ... }, Animation) anim:_setup() return anim end function Animation.createAndPlay(elem, ...) local anim = Animation.create(elem, ...) anim:play() return anim end function Animation.createNamed(name, elem, ...) local anim = Animation.getNamed(name) or Animation.create(elem, ...) anim.name = name return anim end function Animation.createNamedAndPlay(name, elem, ...) local anim = Animation.createNamed(name, elem, ...) anim:play() return anim end function Animation.getNamed(name) local i, anim = table.find(Animation.collection, 'name', name) return i and anim end function Animation:isPlaying() return self.playing or false end function Animation.playingAnimationsExist() return table.find(Animation.collection, 'playing', true) and true end function Animation:play() if self.playing then return end if not table.find(Animation.collection, self) then table.insert(Animation.collection, self) end if not Animation.playingAnimationsExist() then addEventHandler('onClientRender', getRootElement(), updateAnim) end self.playing = true end function Animation:pause() self.playing = false if not Animation.playingAnimationsExist() then removeEventHandler('onClientRender', getRootElement(), updateAnim) end end function Animation:remove() table.removevalue(Animation.collection, self) if not Animation.playingAnimationsExist() then removeEventHandler('onClientRender', getRootElement(), updateAnim) end self.playing = false end function Phase:_setup(parent) self.parent = parent if self[1] then for i,phase in ipairs(self) do if type(phase) == 'function' then phase = { fn = phase } self[i] = phase end setmetatable(phase, Phase) phase:_setup(self) end self.curphase = 1 elseif self.time then self.from = self.from or 0 self.to = self.to or 1 self.speed = (self.to - self.from) / self.time end self.repeats = self.repeats
  20. addEventHandler ( eventName, element attachedTo, handlerFunction ) have you looking to this !? this is the second time you forget the element that you want to attach To and that will be root hope you don't forget that again
×
×
  • Create New...