Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2018-04-15, 15:46


Troyson







Wiek: 29
Na forum: 3731 dni
Posty: 12
Nick w MP: Troy



Respekt: 50

Witam. ot?? napisa?em taki oto kod kt?ry ma za zadanie sprawdzi? czy mamy przy sobie dan? bro?, je?li tak to je?eli wpiszemy
/daj [nick gracza] [nazwa broni np. ak-47]
to nam usunie t? bro? a da graczowi kt?remu chcemy przekaza? dan? bro?.

SERVER:

function give_ak(player, command, who, weapID)
    local weapID = getWeaponIDFromName ( weapName )
    local targetPlayer = getPlayerFromName (who)
    if (targetPlayer) then                                   
        if player (getWeaponNameFromID(30) == false) then
                outputChatBox ( "Nie posiadasz AK-47 aby m?c go przekaza? komu? innemu.", player, 255, 255, 255, true )
        else
            giveWeapon(targetPlayer, 30, 0)
            outputChatBox ( "Odda?e? AK-47", player, 255, 255, 255, true )
            outputChatBox ( "Otrzyma?e? AK-47", targetPlayer, 255, 255, 255, true )
            takeWeapon(player, 30)
        end
    else
        outputChatBox ( "Nie znaleziono gracza o podanym nicku.", root, 255, 255, 255, true )
    end
end
addCommandHandler("daj", give_ak)



Pomo?e mi kto? w przerobieniu tego skryptu?


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-15, 16:08


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

Troyson,Spr?buj tak:


function give_ak(player, command, who, weapID)
    local weapID = getWeaponIDFromName ( weapName )
    local targetPlayer = getPlayerFromName (who)
    if (targetPlayer) and (weapID) then                                   
        if weapID ~= 30 then
                outputChatBox ( "Nie posiadasz AK-47 aby m?c go przekaza? komu? innemu.", player, 255, 255, 255, true )
        else
            giveWeapon(targetPlayer, 30, 0)
            outputChatBox ( "Odda?e? AK-47", player, 255, 255, 255, true )
            outputChatBox ( "Otrzyma?e? AK-47", targetPlayer, 255, 255, 255, true )
            takeWeapon(player, 30)
        end
    else
        outputChatBox ( "Nie znaleziono gracza o podanym nicku.", player, 255, 255, 255, true )
    end
end
addCommandHandler("daj", give_ak)


Powinno dzia?a? :oops: .

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-16, 22:34


Troyson







Wiek: 29
Na forum: 3731 dni
Posty: 12
Nick w MP: Troy



Respekt: 50

"Atroth" napisał/a:

Troyson,Spr?buj tak:


function give_ak(player, command, who, weapID)
    local weapID = getWeaponIDFromName ( weapName )
    local targetPlayer = getPlayerFromName (who)
    if (targetPlayer) and (weapID) then                                   
        if weapID ~= 30 then
                outputChatBox ( "Nie posiadasz AK-47 aby m?c go przekaza? komu? innemu.", player, 255, 255, 255, true )
        else
            giveWeapon(targetPlayer, 30, 0)
            outputChatBox ( "Odda?e? AK-47", player, 255, 255, 255, true )
            outputChatBox ( "Otrzyma?e? AK-47", targetPlayer, 255, 255, 255, true )
            takeWeapon(player, 30)
        end
    else
        outputChatBox ( "Nie znaleziono gracza o podanym nicku.", player, 255, 255, 255, true )
    end
end
addCommandHandler("daj", give_ak)


Powinno dzia?a? :oops: .


*******************************************************************************************************************
No ju? co? tam dzia?a tylko nie daje i nie zabiera broni graczowi kt?ry chce j? przekaza? innemu graczowi a wy?wietla ten tekst ?e odda?e? itd..

oto skrypt (zamiast weapID da?em weapName)


function give_ak(player, command, who, weapName)
    local weapID = getWeaponIDFromName ( weapName )
    local targetPlayer = getPlayerFromName (who)
    if (targetPlayer) and (weapID) then                                   
        if weapID ~= 30 then
                outputChatBox ( "Nie posiadasz AK-47 aby m?c go przekaza? komu? innemu.", player, 255, 255, 255, true )
        else
            outputChatBox ( "Odda?e? AK-47", player, 255, 255, 255, true )
            outputChatBox ( "Otrzyma?e? AK-47", targetPlayer, 255, 255, 255, true )
            takeWeapon(player, 30)
            giveWeapon(targetPlayer, 30, 0)
        end
    else
        outputChatBox ( "Nie znaleziono gracza o podanym nicku.", player, 255, 255, 255, true )
    end
end
addCommandHandler("daj", give_ak)



Brakuje tu takiej linijki kt?ra sprawdza gracza kt?ry u?ywa tej komendy czy ma AK-47 przy sobie i dopiero gdy je ma to skrypt zadzia?a a je?eli nie ma to poka?e nam wiadomo?? ?e nie posiadamy AK.

I w?a?nie nie wiem jakby to dopisa? ale z g?ry dzi?ki za przerobienie. ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-18, 19:30


Marcineq1234







Wiek: 27
Na forum: 3509 dni
Posty: 12
Nick w MP: Bocikk



Respekt: 35,8

Witam ;D , przychodz? do was aby kto? mi pom?g?, temat jest prosty.
1.Gdy wychodz? z markera to buguje mi si? hud ;/ prosze o pomoc
2.Nie moge kupi? mo?otva

https://pastebin.com/a4mQGSGP - c
https://pastebin.com/FThNfLzs - s

pomocnym postawie rep + oraz tyskie ((piwero))

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-21, 10:06


Waszkaa







Wiek: 33
Na forum: 3361 dni
Posty: 24
Nick w MP: WaszkaG



Respekt: 50

Witam ,
Mam problem z tym skryptem , po wej?ciu na serwer pokazuje mi si? automatycznie okno tego skryptu a chc? aby w??cza? si? panel po nacisnieciu klawisza "F2", za pomoc z g?ry dzi?kuje i stawiam :piwo:


function Window ( )

        if ( guiGetVisible ( myWindow ) == true ) then   
        
                guiSetVisible ( myWindow, false )

                showCursor ( false )
        else      
                guiSetVisible ( myWindow, true )

                showCursor ( true )
        end
end

myWindow = guiCreateWindow ( 0.16, 0.0, .7, .7, "Teleport", true )


local tabPanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, myWindow )
local Teleports = guiCreateTab( "Drift mapy", tabPanel )




--GUI Buttons
LSAirport = guiCreateButton( 0.03, 0.01, 0.18, 0.12, "Touge Akina UP", true, Teleports )
guiSetFont ( LSAirport, "default-bold-small" )

LVAirport = guiCreateButton( 0.03, 0.13, 0.18, 0.12, "Touge Akina Down", true, Teleports )
guiSetFont ( LVAirport, "default-bold-small" )

AbandedAirstrip = guiCreateButton( 0.03, 0.25, 0.18, 0.12, "Touge Bihoku", true, Teleports )
guiSetFont ( AbandedAirstrip, "default-bold-small" )

SFAirport = guiCreateButton( 0.03, 0.37, 0.18, 0.12, "Drift Stage", true, Teleports )
guiSetFont ( SFAirport, "default-bold-small" )

MountChiliad = guiCreateButton( 0.03, 0.49, 0.18, 0.12, "East Minami Circuit", true, Teleports )
guiSetFont ( MountChiliad, "default-bold-small" )

WangCars = guiCreateButton( 0.03, 0.61, 0.18, 0.12, "Meihancircuit", true, Teleports )
guiSetFont ( WangCars, "default-bold-small" )

Ottos = guiCreateButton( 0.4, 0.01, 0.18, 0.12, "Drift Track", true, Teleports )
guiSetFont ( Ottos, "default-bold-small" )

Area51 = guiCreateButton( 0.4, 0.13, 0.18, 0.12, "Touge Ebisu Soutch", true, Teleports )
guiSetFont ( Area51, "default-bold-small" )

BigEar = guiCreateButton( 0.4, 0.25, 0.18, 0.12, "Touge Ebisu West", true, Teleports )
guiSetFont ( BigEar, "default-bold-small" )

BlueBerry = guiCreateButton( 0.4, 0.37, 0.18, 0.12, "Touge Project Touge", true, Teleports )
guiSetFont ( BlueBerry, "default-bold-small" )

Heli = guiCreateButton( 0.4, 0.49, 0.18, 0.12, "Touge Nikko", true, Teleports )
guiSetFont ( Heli, "default-bold-small" )

Grove = guiCreateButton( 0.4, 0.61, 0.18, 0.12, "Nakayubi", true, Teleports )
guiSetFont ( Grove, "default-bold-small" )

Dam = guiCreateButton( 0.77, 0.01, 0.18, 0.12, "Touge Okaru", true, Teleports )
guiSetFont ( Dam, "default-bold-small" )

BackBeyond = guiCreateButton( 0.77, 0.13, 0.18, 0.12, "Touge Gokart", true, Teleports )
guiSetFont ( BackBeyond, "default-bold-small" )

Quarry = guiCreateButton( 0.77, 0.25, 0.18, 0.12, "Ultra Nitro Track", true, Teleports )
guiSetFont ( Quarry, "default-bold-small" )

Bayside = guiCreateButton( 0.77, 0.37, 0.18, 0.12, "Touge Sekia.", true, Teleports )
guiSetFont ( Bayside, "default-bold-small" )

Pecker = guiCreateButton( 0.77, 0.49, 0.18, 0.12, "Tsukuba", true, Teleports )
guiSetFont ( Pecker, "default-bold-small" )

Bridge = guiCreateButton( 0.77, 0.61, 0.18, 0.12, "Fantazy Hill", true, Teleports )
guiSetFont ( Bridge, "default-bold-small" )


Redring = guiCreateButton( 0.4, 0.78, 0.18, 0.063, "Russian drift", true, Teleports )
guiSetFont ( Close, "default-bold-small" )
Garage = guiCreateButton( -0.08, 0.87, 1.1, 0.063, "Garage", true, Teleports )
guiSetFont ( Close, "default-bold-small" )
Close = guiCreateButton( -0.08, 0.94, 1.1, 0.063, "Zamknij (f2)'", true, Teleports )
guiSetFont ( Close, "default-bold-small" )


bindKey ( "F2", "down", Window )


guiSetAlpha ( myWindow, 1 )
guiWindowSetSizable ( myWindow, false )

--Label Color
function changeLabelColor ( )

    guiLabelSetColor ( One, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
end

setTimer ( changeLabelColor, 1000, 0 )


--Close
addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
           if (source == Close) then
           guiSetVisible( myWindow, false )
           showCursor( false )
                end  

           end
)


--Teleports
addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
    function ( )
        if (source == MountChiliad) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
            setElementPosition (player , -877.7409667969, 520.6766357422, 14.1091003418  )
        end
    end)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == LSAirport) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                        setElementPosition (player , -3289.7409667969, 890.6766357422, 322.1091003418  ) 
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == LVAirport) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , -2926.9138183594, 487.1204833984, 5.2602405548  )
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == AbandedAirstrip) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , -3266.59480957031, -1067.1661152344, 13.2322671096  ) 
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == SFAirport) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , -3112.1933, -868.0136820678711, 10.471401863098  ) 
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == WangCars) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , -2844, 1483.881521875, 49.9797288131714  )
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == Ottos) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , 1326.7004394531, -2840.574921875, 9.8597288131714  )
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == Area51) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , -824.61033300781, 2192.1982431641, 123.08539108276  ) 
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == BigEar) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , 174.56447021484, 3035.1215283203, 29.465629577637  )
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == BlueBerry) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , 2969.3661103248596, -1723.78341293335, 37.5212655067444  )
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == Heli) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , -2246.39447021484, 2099.9415283203, 5.965629577637  )
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == Grove) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , -311.3193359375, -3027.1716308594, 50.765625 )
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == Dam) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , -4235.02734375, 633.9217529297, 620.654315948486 )
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == BackBeyond) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , 3409.93298339844, 1335.8010253906, 20.003288269043 )
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == Quarry) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , -3449.7600, -1642.94840595703, 61.8789616699 )
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == Bayside) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , 2082.322290625, -142.640660156, 28.9991247940063 )
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == Pecker) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , 140.91618725586, 637.1567421875, 420.863159790039 )
            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == Bridge) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                  setElementPosition (player , 827.9711, -2061.2324, 13.86 )

            end
         end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == Garage) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                    setElementPosition (player , 2591.8709667969, -2347.7366357422, 13.652  )
            end
          end
)

addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),
        function ( )
            if (source == Redring) then
            local player = getLocalPlayer()
            if isPedInVehicle(localPlayer) then
                player = getPedOccupiedVehicle(localPlayer)
            end
                    setElementPosition (player , -566.404409667969, -649.5066357422, 326.252  )
            end
          end
)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-21, 10:31


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

Waszkaa, Powinno dzia?a? :oops:

https://pastebin.com/FGz5L2Yi

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-21, 10:40


Waszkaa







Wiek: 33
Na forum: 3361 dni
Posty: 24
Nick w MP: WaszkaG



Respekt: 50

Atroth nie pokazuje sie teraz odrazu okno ale r?wniez nie moge go w?aczyc przyciskiem f2 , czyli jak by go nie by?o ;(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-21, 11:00


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

Waszkaa, Podmie? to:


function Window ( )
 
        if ( guiGetVisible ( myWindow ) == true ) then  
       
                guiSetVisible ( myWindow, false )
 
                showCursor ( false )
        else      
                guiSetVisible ( myWindow, true )
 
                showCursor ( true )
        end
end
bindKey("F2","down",Window)


pod to:


local enable = false 

function Window ( )

    if enable == false then 
        guiSetVisible ( myWindow, true )
        showCursor ( true )
        enable = true 
    else
        enable = false 
        guiSetVisible ( myWindow, false )
        showCursor ( false )
    end 
end
bindKey("F2","down",Window)


Jakby nie dzia?a?o podaj db3.

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Waszkaa
Wysłany: 2018-04-22, 12:50


Waszkaa







Wiek: 33
Na forum: 3361 dni
Posty: 24
Nick w MP: WaszkaG



Respekt: 50

Witam ,
Mam problem z panelem logowania , mianowicie rozchodzi si? o to ?e gdy piszemy sw?j nick NP. Maciek , to pod klawiszem "M" Na serwerze mam bind na okno na prywatn? wiadomo?? i w?asnie to okno sie otwiera, z innymi klawiszami jest tak samo , Podczas pisania has?a pod "N" w??cza sie radio itp .

link: https://community.multitheftauto.com/index.php?p=resources&s=details&id=8971

client

sW,sH = guiGetScreenSize()
mX, mY = 0, 0
myFont = dxCreateFont( "opensans-light.ttf", 15 )
logoW, logoH = sW/8.4, sW/8.4
bgY = 0
function createLoginPanel()
    addEventHandler("onClientRender",getRootElement(),renderLoginPanel)
    addEventHandler("onClientRender",getRootElement(),renderButtons)
    showCursor(true,true)
    toggleAllControls(false)
    showChat(false)
    xml = xmlLoadFile("userdata.xml")
    loadXML()
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), createLoginPanel)

function loadXML()
  if not xml then
    xml = xmlCreateFile("userdata.xml","userdata")
    usernameChild = xmlCreateChild(xml,"username")
    passwordChild = xmlCreateChild(xml,"password")
    checkboxChild = xmlCreateChild(xml,"state")
    xmlSaveFile(xml)
  else
    usernameChild = xmlFindChild(xml,"username",0)
    passwordChild = xmlFindChild(xml,"password",0)
    checkboxChild = xmlFindChild(xml,"state",0)
  end
  if xmlNodeGetValue(checkboxChild) == "true" then
    checkboxs[1].state = true
  end
    usernameLoad = xmlNodeGetValue(usernameChild)
    passwordLoad = xmlNodeGetValue(passwordChild)
    for w in string.gmatch(usernameLoad, ".") do
      for i,ebox in ipairs(editbox) do
        if ebox.name == "username" then
          table.insert(text[i], w)
        end
      end
    end
    for w in string.gmatch(passwordLoad, ".") do
      for i,ebox in ipairs(editbox) do
        if ebox.name == "password" then
          table.insert(text[i], w)
        end
      end
    end
end
function saveXML(username,password,checkboxState)
  if checkboxs[1].state == true then
    xmlNodeSetValue(usernameChild,username)
    xmlNodeSetValue(passwordChild,password)
    xmlNodeSetValue(checkboxChild,tostring(checkboxState))
    xmlSaveFile(xml)
  else
    xmlNodeSetValue(usernameChild,"")
    xmlNodeSetValue(passwordChild,"")
    xmlNodeSetValue(checkboxChild,"")
    xmlSaveFile(xml)
  end
end
addEvent("saveXML",true)
addEventHandler("saveXML",getRootElement(),saveXML)
boxes = {
  {x = sW/2-sW/10, y = sH/2-sH/7, w = sW/5, h = sH/20, borderColor = tocolor(224, 224, 224), boxD = "green", text = "Zaloguj si?", messageBox = "1"},
    {x = sW/2-sW/10, y = sH/2-sH/7.4+sH/18, w = sW/5, h = sW/5, borderColor = tocolor(224, 224, 224)},
  {x = sW/2-sW/10, y = sH/2-sH/7 + sH, w = sW/5, h = sH/20, borderColor = tocolor(224, 224, 224), boxD = "green", text = "Rejestracja", messageBox = "2"},
  {x = sW/2-sW/10, y = sH/2-sH/7.4+sH/18 + sH, w = sW/5, h = sW/5, borderColor = tocolor(224, 224, 224)},
}
buttons = {
  {x = boxes[2].x + sW/47, y = boxes[2].y + boxes[2].h - sH/14, w = sW/13, h = boxes[2].w/6.5, color = tocolor(255,255,255), borderColor = tocolor(224, 224, 224), text = "Rejestracja", func = "pressRegisterBut"},
  {x = boxes[2].x + boxes[2].w - sW/47 - sW/13, y = boxes[2].y + boxes[2].h - sH/14, w = sW/13, h = boxes[2].w/6.5, color = tocolor(255,255,255), borderColor = tocolor(224, 224, 224), text = "Graj", func = "pressLogin"},
  {x = boxes[2].x + boxes[2].w - sW/47 - sW/13, y = boxes[2].y + boxes[2].h - sH/14 + sH, w = sW/13, h = boxes[2].w/6.5, color = tocolor(255,255,255), borderColor = tocolor(224, 224, 224), text = "Cofnij", func = "pressBack"},
  {x = boxes[2].x + sW/47, y = boxes[2].y + boxes[2].h - sH/14 + sH, w = sW/13, h = boxes[2].w/6.5, color = tocolor(255,255,255), borderColor = tocolor(224, 224, 224), text = "Stworz", func = "pressRegister"}
}
editbox = {
  {x = boxes[2].x + sW/47, y = boxes[2].y + boxes[2].w/6.5, w = sW/13 + sW/13 + (boxes[2].w - sW/47 - sW/13 - sW/47 - sW/13), h = boxes[2].w/6.5, borderColor = tocolor(224, 224, 224), textUp = "Nick", text = "", name = "username"},
  {x = boxes[2].x + sW/47, y = boxes[2].y + boxes[2].w/6.5 + boxes[2].w/6.5 + boxes[2].w/6.5, w = sW/13 + sW/13 + (boxes[2].w - sW/47 - sW/13 - sW/47 - sW/13), h = boxes[2].w/6.5, borderColor = tocolor(224, 224, 224), textUp = "Haslo", text = "", hide = true, name = "password"},
  {x = boxes[2].x + sW/47, y = boxes[2].y + boxes[2].w/6.5 + sH, w = sW/13 + sW/13 + (boxes[2].w - sW/47 - sW/13 - sW/47 - sW/13), h = boxes[2].w/6.5, borderColor = tocolor(224, 224, 224), textUp = "Nick", text = "", name = "usernameReg"},
  {x = boxes[2].x + sW/47, y = boxes[2].y + boxes[2].w/6.5 + boxes[2].w/6.5 + boxes[2].w/6.5 + sH, w = sW/13 + sW/13 + (boxes[2].w - sW/47 - sW/13 - sW/47 - sW/13), h = boxes[2].w/6.5, borderColor = tocolor(224, 224, 224), textUp = "Haslo", text = "", hide = true, name = "passwordReg"},
}
checkboxs = {
  {x = boxes[2].x + sW/47, y = boxes[2].y + boxes[2].w/6.5 + boxes[2].w/6.5 + boxes[2].w/6 + boxes[2].w/6, wh = boxes[2].w/25, state = false, text = "Zapamietaj"}
} 
text = {}
for i,ebox in ipairs(editbox) do
table.insert(text,{})
end
bindKey("backspace", "down", function ()
  table.remove(text[eboxClickI], #text[eboxClickI])
end)
function getCharacter(character)
  for i,ebox in ipairs(editbox) do
    if eboxClickI == i then
      table.insert(text[i], character)
    end
  end
end
function renderLoginPanel()
    dxDrawRectangle(0 , bgY, sW, sH, tocolor(241, 241, 241))
    dxDrawImage ( sW/2 - logoW/2 + mX, boxes[1].y - logoH - sH/50 + mY, logoW, logoH, 'logo.png')
    dxDrawImage ( sW/2 - logoW/2 + mX, boxes[1].y - logoH - sH/50 + mY + sH, logoW, logoH, 'logo.png')
    for i,box in ipairs(boxes) do
        dxDrawRectangle(box.x + mX, box.y + mY, box.w, box.h)
        dxDrawRectangle(box.x + mX, box.y + mY, box.w, 1, box.borderColor)
        dxDrawRectangle(box.x + mX, box.y + mY, 1, box.h, box.borderColor)
        dxDrawRectangle(box.x + mX, box.y + box.h + mY, box.w, 1, box.borderColor)
        dxDrawRectangle(box.x + box.w + mX, box.y + mY, 1, box.h, box.borderColor)
    if box.boxD then
      if box.boxD == "green" then
      dxDrawRectangle(box.x + mX, box.y + mY, sW/160, box.h, tocolor(124,198,35))
      elseif box.boxD == "red" then
      dxDrawRectangle(box.x + mX, box.y + mY, sW/160, box.h, tocolor(255,0,0))
    end
    end
    if box.text then
        dxDrawText ( box.text, box.x + sW/80 + mX, box.y + mY, box.x + box.w + mX, box.y + box.h + mY, tocolor(31,31,31), sW/1600, myFont, "left", "center")
    end
    end
    for i,ebox in ipairs(editbox) do
      dxDrawRectangle(ebox.x + mX, ebox.y + mY, ebox.w, ebox.h)
      dxDrawRectangle(ebox.x + mX, ebox.y + mY, ebox.w, 1, ebox.borderColor)
      dxDrawRectangle(ebox.x + mX, ebox.y + mY, 1, ebox.h, ebox.borderColor)
      dxDrawRectangle(ebox.x + mX, ebox.y + ebox.h + mY, ebox.w, 1, ebox.borderColor)
      dxDrawRectangle(ebox.x + ebox.w + mX, ebox.y + mY, 1, ebox.h, ebox.borderColor)
      if ebox.textUp then
        dxDrawText ( ebox.textUp, ebox.x + mX, ebox.y - ebox.h + mY, ebox.x + ebox.w + mX, ebox.y + mY, tocolor(31,31,31), sW/1600, myFont, "left", "bottom")
      end
      if isMouseWithinRangeOf(ebox.x + mX, ebox.y + mY, ebox.w, ebox.h) then
        ebox.borderColor = tocolor(204,204,204)
      else
        ebox.borderColor = tocolor(224,224,224)
      end
      if ebox.text then
        ebox.text = table.concat(text[i],"")
        if ebox.hide == true then
        dxDrawText (string.rep("*",#text[i],""), ebox.x + 10 + mX, ebox.y + mY, ebox.x + ebox.w + mX, ebox.y + ebox.h + mY, tocolor(31,31,31), sW/1600, myFont, "left", "center", true)
        else
        dxDrawText ( table.concat(text[i],""), ebox.x + 10 + mX, ebox.y + mY, ebox.x + ebox.w + mX, ebox.y + ebox.h + mY, tocolor(31,31,31), sW/1600, myFont, "left", "center",true)
      end
      end
      if eboxClickI == i then
        dxDrawRectangle(ebox.x + mX, ebox.y + mY, ebox.w, 1, tocolor(124,198,35))
        dxDrawRectangle(ebox.x + mX, ebox.y + mY, 1, ebox.h, tocolor(124,198,35))
        dxDrawRectangle(ebox.x + mX, ebox.y + ebox.h + mY, ebox.w, 1, tocolor(124,198,35))
        dxDrawRectangle(ebox.x + ebox.w + mX, ebox.y + mY, 1, ebox.h, tocolor(124,198,35))
      end
    end
    for i,cbox in ipairs(checkboxs) do
      if cbox.state == true then
        dxDrawRectangle(cbox.x + mX, cbox.y + mY, cbox.wh, cbox.wh, tocolor(124,198,35))
      else
        dxDrawRectangle(cbox.x + mX, cbox.y + mY, cbox.wh, cbox.wh, tocolor(200,200,200))
      end
      if cbox.text then
        dxDrawText (cbox.text, cbox.x + cbox.wh + 5 + mX, cbox.y + mY, cbox.x + cbox.wh*10 + mX, cbox.y + cbox.wh + mY, tocolor(31,31,31), sW/2000, myFont, "left", "center",true)
      end
    end
end
addEventHandler("onClientCharacter", getRootElement(), getCharacter)
function pressLogin()
  for i, ebox in ipairs(editbox) do
    if ebox.name == "username" then
      gUser = ebox.text
    elseif ebox.name == "password" then
      gPass = ebox.text
    end
  end 
triggerServerEvent ( "onLogin", getLocalPlayer(), gUser, gPass, checkboxs[1].state)
end
function pressRegister()
  for i, ebox in ipairs(editbox) do
    if ebox.name == "usernameReg" then
      rUser = ebox.text
    elseif ebox.name == "passwordReg" then
      rPass = ebox.text
    end
  end 
triggerServerEvent ( "onRegister", getLocalPlayer(), rUser, rPass)
end
function pressRegisterBut()
  p_Move = {}
  p_Move.startTime = getTickCount()
  p_Move.endTime = p_Move.startTime + 1200
  p_Move.easingFunction = "InOutQuad"
  addEventHandler("onClientRender", getRootElement(), movePanelOut)
end
function pressBack()
  p_Move = {}
  p_Move.startTime = getTickCount()
  p_Move.endTime = p_Move.startTime + 1200
  p_Move.easingFunction = "InOutQuad"
  addEventHandler("onClientRender", getRootElement(), movePanelIn)
end
addEvent("pressBack",true)
addEventHandler("pressBack",getRootElement(),pressBack)
function movePanelOut()
  local now = getTickCount()
  local elapsedTime = now - p_Move.startTime
  local duration = p_Move.endTime - p_Move.startTime
  local progress = elapsedTime / duration
 
  local fAnimationTime = getEasingValue(progress, p_Move.easingFunction)
 
  local move = fAnimationTime*sH
  mY = ( -move )
  if now > p_Move.endTime then
    removeEventHandler("onClientRender", getRootElement(), movePanelOut)
  end
end
function movePanelIn()
  local now = getTickCount()
  local elapsedTime = now - p_Move.startTime
  local duration = p_Move.endTime - p_Move.startTime
  local progress = elapsedTime / duration
 
  local fAnimationTime = getEasingValue(progress, p_Move.easingFunction)
 
  local move = fAnimationTime*sH
  mY = (-sH + move)
  if now > p_Move.endTime then
    removeEventHandler("onClientRender", getRootElement(), movePanelIn)
  end
end
function renderButtons()
    for i,b in ipairs(buttons) do
        dxDrawRectangle(b.x + mX,b.y + mY,b.w,b.h,b.color)
        dxDrawRectangle(b.x + mX, b.y + mY, b.w, 1, b.borderColor)
      dxDrawRectangle(b.x + mX, b.y + mY, 1, b.h, b.borderColor)
      dxDrawRectangle(b.x + mX, b.y + b.h + mY, b.w, 1, b.borderColor)
      dxDrawRectangle(b.x + b.w + mX, b.y + mY, 1, b.h, b.borderColor)
      if b.text then
        dxDrawText ( b.text, b.x + mX, b.y + mY, b.x + b.w + mX, b.y + b.h + mY, tocolor(31,31,31), sW/1600, myFont, "center", "center")
      end
        if isMouseWithinRangeOf(b.x + mX, b.y + mY, b.w, b.h) then
           dxDrawRectangle(b.x + mX,b.y + mY,b.w,b.h,tocolor(124,198,35))
           if b.text then
            dxDrawText ( b.text, b.x + mX, b.y + mY, b.x + b.w + mX, b.y + b.h + mY, tocolor(255,255,255), sW/1600, myFont, "center", "center")
           end
        end
    end
end

function changeMessage(mesBox, newMessage, boxColor)
  for i,box in ipairs(boxes) do
    if box.messageBox ==  mesBox then
      box.text = newMessage
      box.boxD = boxColor
    end
  end
end
addEvent("changeMessage",true)
addEventHandler("changeMessage",getRootElement(),changeMessage)
function onClick(mButton,state,ax,ay)
  if not (state == "down" and mButton == "left") then
    return false
  end
  for i,b in pairs(buttons) do
    if isMouseWithinRangeOf(b.x + mX, b.y + mY, b.w, b.h) then
      outputDebugString("Pressed "..b.text)
      if b.func then
      loadstring("return "..b.func.."()")()
      end
    end
  end
  for i,ebox in pairs(editbox) do
    if isMouseWithinRangeOf(ebox.x + mX, ebox.y + mY, ebox.w, ebox.h) then
      outputDebugString("Pressed "..ebox.textUp)
      eboxClickI = i
      return true
    end
  end
  for i,cbox in pairs(checkboxs) do
    if isMouseWithinRangeOf(cbox.x + mX, cbox.y + mY, cbox.wh, cbox.wh) then
      outputDebugString("Pressed "..i.." checkbox")
      if cbox.state == false then
      cbox.state = true
      else
      cbox.state = false
      end
    end
  end
  eboxClickI = nil
  return false
end

addEventHandler("onClientClick",getRootElement(),onClick)

function isMouseWithinRangeOf(posX, posY, sizeX, sizeY)
  if isCursorShowing() == false then
    return false
  end
  local cx,cy = getCursorPosition()
  cx,cy = cx*sW,cy*sH
  if cx >= posX and cx <= posX+sizeX and cy >= posY and cy <= posY+sizeY then
    return true,cx,cy
  else
    return false
  end
end


function hideLoginPanel()
  p_Move = {}
  p_Move.startTime = getTickCount()
  p_Move.endTime = p_Move.startTime + 1200
  p_Move.easingFunction = "InOutQuad"
  addEventHandler("onClientRender", getRootElement(), hidePanelOut)
end
function hidePanelOut()
  local now = getTickCount()
  local elapsedTime = now - p_Move.startTime
  local duration = p_Move.endTime - p_Move.startTime
  local progress = elapsedTime / duration
 
  local fAnimationTime = getEasingValue(progress, p_Move.easingFunction)
 
  local move = fAnimationTime*sH
  mY = move
  bgY = move

  if now > p_Move.endTime then
    removeEventHandler("onClientRender", getRootElement(), hidePanelOut)
    removeEventHandler("onClientRender",getRootElement(),renderLoginPanel)
    removeEventHandler("onClientRender",getRootElement(),renderButtons)
    showCursor(false,false)
    toggleAllControls(true)
    showChat(true)
  end
end
addEvent("hideLoginPanel",true)
addEventHandler("hideLoginPanel",getRootElement(),hideLoginPanel)


server

function onLogin(username,password,checkboxState)
    if not (username == "") then
        if not (password == "") then
            local account = getAccount ( username, password )
            if ( account ~= false ) then
                logIn(source, account, password)
                triggerClientEvent (source,"hideLoginPanel",getRootElement())
                triggerClientEvent (source,"saveXML",getRootElement(),username,password,tostring(checkboxState))
            else
                triggerClientEvent(source,"changeMessage",getRootElement(),"1","Cos poszlo nie tak", "red")
            end
        else
            triggerClientEvent(source,"changeMessage",getRootElement(),"1","Wpisz haslo!", "red")
        end
    else
        triggerClientEvent(source,"changeMessage",getRootElement(),"1","Wpisz nick!", "red")
    end
end
addEvent("onLogin",true)
addEventHandler("onLogin",getRootElement(),onLogin)

function onRegister(username,password)
    if not (username == "") then
        if not (password == "") then
                    local account = getAccount (username, password)
                    if (account == false) then
                        addAccount(tostring(username),tostring(password))
                        triggerClientEvent(source,"changeMessage",getRootElement(),"2","Eleganco , mozesz juz grac", "green")
                        triggerClientEvent(source,"changeMessage",getRootElement(),"1","Teraz zaloguj sie", "green")
                        triggerClientEvent(source,"pressBack", getRootElement())
                    else
                        triggerClientEvent(source,"changeMessage",getRootElement(),"2","Taki nick juz gdzies widzialem!", "red")
                    end
        else
            triggerClientEvent(source,"changeMessage",getRootElement(),"2","Wpisz haslo!", "red")
        end
    else
        triggerClientEvent(source,"changeMessage",getRootElement(),"2","Wpisz nick!", "red")
    end
end
addEvent("onRegister",true)
addEventHandler("onRegister",getRootElement(),onRegister) 


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-22, 21:27


TeeNekk

Cienzaruwka :v






Wiek: 23
Na forum: 3351 dni
Posty: 264
Nick w MP: TeeNekk.

Piwa: 919

Respekt: 110,5
Respekt: 110,5

dodaj: guiSetInputMode("no_binds_when_editing")

Podpis
Pomogłem Ci
? Może zostawiłbyś za to piwko, lub respekt? Dzięki!
Mój projekt:
?
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-22, 21:36


Waszkaa







Wiek: 33
Na forum: 3361 dni
Posty: 24
Nick w MP: WaszkaG



Respekt: 50

M?g?by? mi podes?ac gotowy kod gdyz nie wiem gdzie to wrzucic ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-22, 23:14


Atroth







Wiek: 24
Na forum: 3818 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4813

Respekt: 540
Respekt: 540

Waszkaa,


addEventHandler("onClientResourceStart", getResourceRootElement(),
function()
    guiSetInputMode("no_binds_when_editing") --Calls guiSetInputMode once and for all to not have to handle binds state dynamically
end)


Kod z wiki i powinno ?miga?. R*

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-23, 15:29


Qwertick

Coming soon...






Wiek: 23
Na forum: 3719 dni
Posty: 472
Nick w MP: Qwertick

Piwa: 2727

Respekt: 215,8
Respekt: 215,8Respekt: 215,8

Waszkaa,
function createLoginPanel()
    addEventHandler("onClientRender",getRootElement(),renderLoginPanel)
    addEventHandler("onClientRender",getRootElement(),renderButtons)
    showCursor(true,true)
    toggleAllControls(false)
    showChat(false)
    xml = xmlLoadFile("userdata.xml")
    loadXML()
    guiSetInputMode("no_binds_when_editing")
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), createLoginPanel)


Podpis

Kontakt
Discord: Qwertick#1210

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-04-23, 16:06


Waszkaa







Wiek: 33
Na forum: 3361 dni
Posty: 24
Nick w MP: WaszkaG



Respekt: 50

Dalej dzialaja klawisze serwerowe ;(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-05-12, 14:22


Ciastuuś

As-salamu alaykum






Wiek: 27
Na forum: 3212 dni
Posty: 800
Nick w MP: Ciastuuś

Piwa: 4304

Respekt: 640
Respekt: 640Respekt: 640

Zr?b tak,

addEventHandler("onClientResourceStart", resourceRoot, function()
    guiSetInputMode("no_binds_when_editing")
end)


Podpis
As-salamu alaykum
Postaw piwo autorowi tego posta
 

 
Tagi: prośby :: przerobienie :: skryptu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Zasoby do MTA » PROŚBY O PRZEROBIENIE SKRYPTU Odpowiedz do tematu

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku