Jump to content

Blaawee

Members
  • Posts

    857
  • Joined

  • Last visited

Everything posted by Blaawee

  1. Blaawee

    Question

    What #Mr.Pres[T]ege want to tell you is to check the arg of your functions like : guiCreateWindow, guiCreateMemo and guiCreateButton . there is an argument called ' relative ' , like this one guiCreateWindow ( float x, float y, float width, float height, string titleBarText, bool relative ) Required Arguments: * x: A float of the 2D x position of the GUI window on a player's screen. This is affected by the relative argument. * y: A float of the 2D y position of the GUI window on a player's screen. This is affected by the relative argument. * width: A float of the width of the GUI window. This is affected by the relative argument. * height: A float of the height of the GUI window. This is affected by the relative argument. * titleBarText: A string of the text that will be displayed in the title bar of the window. * relative: This is whether sizes and positioning are relative. If this is true, then all x,y,width,height floats must be between 0 and 1, representing sizes/positions as a fraction of the screen size. If false, then the size and co-ordinates are based on client's resolution, accessible using guiGetScreenSize.
  2. شف اذا كان البيت هو في Interior استخدم ذي الفنكشن : setElementInterior اما اذا كان بدون استخدم setElementPosition + dX للـ viewtopic.php?f=91&t=52883&start=15#p516049
  3. I recommend to use it in server side.
  4. function comnd( player ) local x, y, z = getElementPosition(player) outputChatBox ( x ..' ' .. y ..' ' . . z, player ) end addCommandHandler( "lp", comnd )
  5. #Not tested -- Server local gBus = { [ 1 ] = { ID, x, y, z }, [ 2 ] = { ID, x, y, z } }; local gVeh = { }; addEventHandler ( 'onResourceStart', resourceRoot, function( ) for key, value in ipairs ( gBus ) do gVeh[ key ] = createVehicle( value[ 1 ], value[ 2 ], value[ 3 ], value[ 4 ] ); end triggerClientEvent( root, 'handleSong', root, gVeh[ key ] ); end ); -- Client local soundPath = 'Path goes here'; addEvent ( 'handleSong', true ); addEventHandler ( 'handleSong', root, function( buss ) local x, y, z = getElementPosition ( buss ); local sound = playSound3D ( soundPath, x, y, z, true ); setSoundMaxDistance ( sound, 20 ); attachElements ( sound, buss ); end ); Don't forget to change the id and position.
  6. Make sure the resource name called ' legalsystem '.
  7. Is there a texture called '*' ?
  8. engineApplyShaderToWorldTexture( element shader, string textureName [, element targetElement = nil, bool appendLayers = true ] ) Required Arguments - shader: The shader which is to be applied - textureName: The name of the world texture to apply the shader to. Wildcard matching e.g. "ro?ds*" can be used to apply to more than one texture at a time.
  9. #مو مجرب -- Server local gPeds = { ped = { }, colShape = { } }; local gRadius = 2 addEventHandler ( 'onResourceStart', resourceRoot, function( resource ) if resource == getThisResource( ) then gPeds.ped[ 'guerd' ] = createPed( 289, 2033.6513671875, -1404.0823974609, 17.268367767334, true ); gPeds.colShape[ 'pedCol' ] = createColSphere( 2033.6513671875, -1404.0823974609, 17.268367767334, gRadius ); setElementID( gPeds.colShape[ 'pedCol' ], 'pedColShape' ); giveWeapon( gPeds.ped[ 'guerd' ], 30, 999, true ) end end ); addEventHandler ( 'onColShapeHit', root, function( element, matchingDimension ) if isElement( element ) and getElementType( element ) == 'player' and getElementID( source ) == 'pedColShape' and matchingDimension and not isPedInVehicle( element ) then triggerClientEvent( element, 'syncPed', element, gPeds.ped[ 'guerd' ], 'Fire' ); end end ); addEventHandler ( 'onColShapeLeave', root, function( element, matchingDimension ) if isElement( element ) and getElementType( element ) == 'player' and getElementID( source ) == 'pedColShape' and matchingDimension and not isPedInVehicle( element ) then triggerClientEvent( element, 'syncPed', element, gPeds.ped[ 'guerd' ], 'Stop' ); end end ); -- client local gTarget; local gPed; addEvent( 'syncPed', true ) addEventHandler( 'syncPed', root, function( ped, state ) if state == 'Fire' then setPedControlState( ped, 'fire', true ); addEventHandler( 'onClientRender', root, updateTarget ) elseif state == 'Stop' then setPedControlState( ped, 'fire', false ); removeEventHandler( 'onClientRender', root, updateTarget ) end gTarget = client; gPed = ped; end ); function updateTarget( ) x, y, z = getElementPosition ( gTarget ); setPedAimTarget ( gPed, x, y, z ); end
  10. is the teams created ?! are you in the cop team ?! * Edit try this : kingCOP = createElement( "Pgroup", "cops" ) kingCIV = createElement( "Pgroup", "civs" ) kingNONE = createElement( "Pgroup", "none" ) function legalstartup(startedresource) if startedresource == getThisResource() then createTeam ( get( 'legalsystem.Copteam' ) ); WantedWatch = setTimer (wantedlevelmonitor, 1000, 0) local allplayers = getElementsByType ( "player" ) local detectmethod = get("legalsystem.Copmethod") for playerKey,thePlayer in ipairs(allplayers) do if detectmethod == "team" then local copteam = get("legalsystem.Copteam") local thisTeam = getPlayerTeam(thePlayer) if thisTeam ~= false then if thisTeam == getTeamFromName(copteam) then setElementParent ( thePlayer, kingCOP ) else setElementParent ( thePlayer, kingCIV ) end end elseif detectmethod == "skin" then local thisSkin = getPedSkin(thePlayer) setElementData(getRootElement(),"Copskins",get("legalsystem.Copskins")) local copskins = getElementData(getRootElement(),"Copskins") if type(copskins) == "table" and #copskins > 0 then for k,skinID in ipairs(copskins) do copskins[skinID] = true end end local isacop = 0 for ElementKey, ElementValue in ipairs ( copskins ) do if thisSkin == ElementValue then isacop = 1 end end if isacop == 1 then setElementParent ( thePlayer, kingCOP ) else setElementParent ( thePlayer, kingCIV ) end end end end end addEventHandler( "onResourceStart", getRootElement(), legalstartup) function copSpawnCheck() local detectmethod = get("legalsystem.Copmethod") if detectmethod == "team" then local copteam = get("legalsystem.Copteam") local thisTeam = getPlayerTeam(source) if thisTeam ~= false then if thisTeam == getTeamFromName(copteam) then setElementParent ( source, kingCOP ) else setElementParent ( source, kingCIV ) end end elseif detectmethod == "skin" then local thisSkin = getPedSkin(source) setElementData(getRootElement(),"Copskins",get("legalsystem.Copskins")) local copskins = getElementData(getRootElement(),"Copskins") if type(copskins) == "table" and #copskins > 0 then for k,skinID in ipairs(copskins) do copskins[skinID] = true end end local isacop = 0 for ElementKey, ElementValue in ipairs ( copskins ) do if thisSkin == ElementValue then isacop = 1 end end if isacop == 1 then setElementParent ( source, kingCOP ) else setElementParent ( source, kingCIV ) end end end addEventHandler ( "onPlayerSpawn", getRootElement(), copSpawnCheck ) --ARREST PLAYERS BY SMACKING WITH A NIGHTSTICK function rodneykingcheck ( attacker, weapon, bodypart, loss ) if (attacker) and (weapon == 3) then if getElementParent(attacker) == kingCOP then local thecop = attacker local theprisoner = source local wlevel = getPlayerWantedLevel( source ) if (getElementData ( theprisoner, "currentstatus" ) ~= "underarrest") and (wlevel > 0) then if (getElementData ( attacker, "currentarrests" ) ~= "single" ) and (getElementData ( attacker, "currentarrests" ) ~= "double" ) then setElementData ( thecop, "currentarrests", "single" ) triggerClientEvent(thecop,"copdirections",thecop) elseif (getElementData ( attacker, "currentarrests" ) == "single" ) then setElementData ( thecop, "currentarrests", "double" ) end setElementData ( theprisoner, "currentstatus", "underarrest" ) setElementData ( theprisoner, "captor", thecop ) showCursor ( source, true ) toggleAllControls ( source, false, true, false ) walktheprisoner ( thecop, theprisoner ) setElementData ( theprisoner, "arrestTimeout", setTimer ( freetheguy, 180000, 1, theprisoner )) end end end end addEventHandler ( "onPlayerDamage", getRootElement(), rodneykingcheck ) --ARREST PLAYERS BY HOLDING THEM AT GUNPOINT IF THEY HAVE LOW HP function sightscheck ( element ) if isElement(element) then if ( getElementType ( element ) == "player" ) then if ( getControlState ( source, "aim_weapon" ) ) then local currentgun = getPedWeapon ( source ) local wlevel = getPlayerWantedLevel( element ) if (currentgun > 19) and (currentgun < 39) and (wlevel > 0) then if getElementParent(source) == kingCOP then local thecop = source local theprisoner = element local cx, cy, cz = getElementPosition ( source ) local px, py, pz = getElementPosition ( element ) if ( getElementHealth ( element ) < 15 ) and ( getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) < 3 ) then if (getElementData ( theprisoner, "currentstatus" ) ~= "underarrest" ) then if (getElementData ( thecop, "currentarrests" ) ~= "single" ) and (getElementData ( thecop, "currentarrests" ) ~= "double" ) then triggerClientEvent(thecop,"copdirections",thecop) setElementData ( thecop, "currentarrests", "single" ) elseif (getElementData ( thecop, "currentarrests" ) == "single" ) then setElementData ( thecop, "currentarrests", "double" ) end setElementData ( theprisoner, "currentstatus", "underarrest" ) setElementData ( theprisoner, "captor", thecop ) showCursor ( theprisoner, true ) toggleAllControls ( theprisoner, false, true, false ) walktheprisoner ( thecop, theprisoner ) setElementData ( theprisoner, "arrestTimeout", setTimer ( freetheguy, 180000, 1, theprisoner )) -- local arresttoolong = setTimer ( freetheguy, 180000, 1, theprisoner ) end end end end end end end end addEventHandler ( "onPlayerTarget", getRootElement(), sightscheck ) --ARREST PLAYERS BY PULLING THEM OUT OF A VEHICLE function yankhimout(player, seat, jacker) if isElement(jacker) then if getElementParent(jacker) == kingCOP then local wlevel = getPlayerWantedLevel( player ) if wlevel > 0 then if (getElementData ( jacker, "currentarrests" ) ~= "single" ) and (getElementData ( jacker, "currentarrests" ) ~= "double" ) then local thecop = jacker local theprisoner = player setElementData ( theprisoner, "currentstatus", "underarrest" ) setElementData ( theprisoner, "captor", thecop ) setElementData ( thecop, "currentarrests", "single" ) triggerClientEvent(thecop,"copdirections",thecop) showCursor ( theprisoner, true ) toggleAllControls ( theprisoner, false, true, false ) walktheprisoner ( thecop, theprisoner ) setElementData ( theprisoner, "arrestTimeout", setTimer ( freetheguy, 180000, 1, theprisoner )) elseif (getElementData ( jacker, "currentarrests" ) == "single" ) then local thecop = jacker local theprisoner = player setElementData ( theprisoner, "currentstatus", "underarrest" ) setElementData ( theprisoner, "captor", thecop ) setElementData ( thecop, "currentarrests", "double" ) showCursor ( theprisoner, true ) toggleAllControls ( theprisoner, false, true, false ) walktheprisoner ( thecop, theprisoner ) setElementData ( theprisoner, "arrestTimeout", setTimer ( freetheguy, 180000, 1, theprisoner )) end end end end end addEventHandler ( "onVehicleExit", getRootElement(), yankhimout ) --FORCES A PRISONER TO FOLLOW THE COP function walktheprisoner(thecop, theprisoner) if (getElementData ( theprisoner, "currentstatus" ) == "underarrest") and (getPedOccupiedVehicle ( theprisoner ) == false ) then local copx, copy, copz = getElementPosition ( thecop ) local prisonerx, prisonery, prisonerz = getElementPosition ( theprisoner ) copangle = ( 360 - math.deg ( math.atan2 ( ( copx - prisonerx ), ( copy - prisonery ) ) ) ) % 360 setPedRotation ( theprisoner, copangle ) setCameraTarget ( theprisoner, theprisoner ) local dist = getDistanceBetweenPoints2D ( copx, copy, prisonerx, prisonery ) if ( dist > 40 ) then freetheguy ( theprisoner ) end elseif ( dist > 12 ) then setControlState ( theprisoner, "sprint", true ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", true ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) elseif ( dist > 6 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", true ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) elseif ( dist > 1.5 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", true ) setControlState ( theprisoner, "forwards", true ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) elseif ( dist < 1.5 ) then setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", false ) local zombify = setTimer ( walktheprisoner, 500, 1, thecop, theprisoner ) end end --FREES A PLAYER (RESETS THEIR CONTROLS AND STATUS) function freetheguy (theprisoner) local thecaptor = (getElementData ( theprisoner, "captor" )) setElementData ( theprisoner, "currentstatus", "none" ) setElementData ( theprisoner, "captor", "none" ) showCursor ( theprisoner, false ) setControlState ( theprisoner, "sprint", false ) setControlState ( theprisoner, "walk", false ) setControlState ( theprisoner, "forwards", false ) toggleAllControls (theprisoner, true) local prisonercheck = setTimer ( checkforprisoners, 1500, 1, thecaptor ) TimoutTimer = (getElementData ( theprisoner, "arrestTimeout" )) if isTimer(TimoutTimer) then killTimer(TimoutTimer) setElementData ( theprisoner, "arrestTimeout", nil) TimeoutTimer = nil end end function checkforprisoners(thecop) if isElement(thecop) then local prisoners = 0 local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do if (getElementData ( thePlayer, "captor" ) == thecop ) then prisoners = prisoners+1 end end if prisoners == 0 then setElementData ( thecop, "currentarrests", "none" ) triggerClientEvent( thecop,"clearcopdirections",thecop) elseif prisoners == 1 then setElementData ( thecop, "currentarrests", "single" ) elseif prisoners == 2 then
  11. https://wiki.multitheftauto.com/wiki/Call
  12. Blaawee

    car spawer

    the missing part : local vehicles = {} function spawnVehp( model ) local x, y, z = getElementPosition( source ) if isElement( vehicles[ source ] ) then destroyElement( vehicles[ source ] ) end vehicles[ source ] = createVehicle( model, x + 2, y, z ) warpPedIntoVehicle( source, vehicles[ source ] ) end addEvent("CreVehicePv",true) addEventHandler("CreVehicePv", root, spawnVehp)
  13. show to us your codes to we can help you :\
  14. try this : addEventHandler ( "onClientPlayerDamage",root, function () if getElementData(source,"invincible") then cancelEvent() end end ) addEventHandler("onClientPlayerStealthKill",localPlayer, function (targetPlayer) if getElementData(targetPlayer,"invincible") then cancelEvent() end end ) addEventHandler( 'onClientRender', root, function( ) for _, player in ipairs( getElementsByType( 'player') ) do if isElementOnScreen( player ) and getElementData( player, 'invincible' ) then local x, y, z = getElementPosition( player ); local cx, cy, cz = getCameraMatrix( ); if getDistanceBetweenPoints3D( cx, cy, cz, x, y, z ) <= 15 then local px, py = getScreenFromWorldPosition( x, y, z + 1.3, 0.06 ); if px then dxDrawText( 'GodMode : ' .. tostring( getElementData( player, "invincible" ) ), px, py, px, py, tocolor( 255, 255, 255, 255 ), 1, "arial-bold", "center", "center", false, false, false , true ); end end end end end );
  15. Blaawee

    local

    اخوي مثالك خطأ .. في سطر 5 يعني كل مرة رح تخلي التايم 100 وفي سطر 7 كانك تسوي تحقق على شيء ما له اي فايدة بالاضافة الى ان سطر 8 ماله فايدة لانك مسوي على التايم من اول tostring التعديل : local time = 100 addEventHandler( 'onClientRender', root, function() time = time - 1 if time <= 0 then time = nil end dxDrawText( tostring( time ), 30, 300, 80, 310, tocolor( 255, 255, 255, 255 ) ) end ) عفوآ اخخوي عمر , انا مسوي مثآل بس عشآن يفهم المتغيرآت .
  16. ب النسبه لي انا افضل اللوب
  17. Blaawee

    local

    local الـ او ب الاصح متغير عمومي ياخذ متغيرآت مثآل : local time = nil; addEventHandler( 'onClientRender', root, function( ) time = 100; time = time - time; if time == 0 then time = 'nil'; time = nil; end dxDrawText( tostring( time ), 30, 300, 80, 310, tocolor( 255, 255, 255, 255 ) ); end );
  18. table.concat(arg, " ") arg ??! addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function ( ) for index,player in ipairs(getElementsByType("player")) do bindKey( player,"m","down", "chatbox", "CustomChat" ) end end ) addEventHandler("onPlayerJoin", getRootElement(), function ( ) bindKey( source,"m","down", "chatbox", "CustomChat" ) end ) addCommandHandler("CustomChat", function (element, _, ...) local r,g,b = math.random(255),math.random(255),math.random(255) local PlayerName = getPlayerName(element) local message = table.concat( { ... }, " " ); for _,player in ipairs(getElementsByType("player")) do outputChatBox("CustomChat : " .. tostring(PlayerName) .. ": " .. tostring(message), player,r,g,b) end end )
  19. viewtopic.php?f=91&t=52883&start=15#p516049
  20. لا تستخدم : nil جرب ذآ addEventHandler( 'onClientGUIClick', guiRoot, function( ) if souurce == GUIEditor_Button[ 1 ] then local text = guiGetText( الايديت); if text:len( ) < 5 then outputChatBox ( 'أنت لم تضع شيء !' ); return end end end );
  21. maybe like this ! localPlayer = getLocalPlayer() wnd_window = {} addCommandHandler( "beneficios", function ( ) --outputConsole( "wnd_showServerInfo called" ) --outputConsole( " Fonte: ".. tostring( source ) ) --outputConsole( " resourceStarted: ".. tostring( theResource ) ) --outputConsole( " passed if: source == resource" ) local xml = xmlLoadFile( "server.xml" ) local contents = xmlNodeGetValue( xml ) wnd_create( "Seja Bem Vindo Ao Servidor", "logo.png", contents ) end ) function wnd_close() guiSetVisible( wnd_window.wnd, false ) showCursor( false ) end function wnd_create( title, logo, content ) --outputConsole( "wnd_create called" ) if not wnd_window.wnd then --outputConsole( " passed if" ) wnd_window.wnd = guiCreateWindow( 0.1, 0.15, 0.8, 0.7, title, true ) guiWindowSetSizable( wnd_window.wnd, false ) guiWindowSetMovable( wnd_window.wnd, false ) wnd_window.logo = guiCreateStaticImage( 0.01, 0.035, 1.40, 0.25, logo, true, wnd_window.wnd ) --wnd_window.text = content- wnd_window.memo = guiCreateMemo( 0, 0.3, 1, .6, content, true, wnd_window.wnd ) guiMemoSetReadOnly( wnd_window.memo, true ) wnd_window.close_btn = guiCreateButton( 0, .91, .3, 1, "Fechar", true, wnd_window.wnd ) --outputConsole( " window created: ".. tostring( wnd_window.wnd ) ) showCursor( true ) addEventHandler( "onClientGUIClick", wnd_window.close_btn, wnd_close ) end end addEvent( "window_text", true ) addEventHandler( "window_text", getRootElement(), wnd_create ) #EDIT
  22. what do you mean by how to use it ! maybe this will help you https://forum.multitheftauto.com/viewtopic.php?f=160&t=54062#p523870
×
×
  • Create New...