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

Wysłany: 2016-03-01, 18:05


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4150 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Witam, tym razem z czatem frakcyjnym kt?ry pr?buj? zrobi?.


function message (thePlayer,cmd,...)
if not getPlayerAccount(thePlayerthen return end

local accName getAccountName getPlayerAccount thePlayer ) ) 
if not accName then return end

local allArgs = {...}
local theMessage table.concat(allArgs" ")


if isObjectInACLGroup ("user."..accNameaclGetGroup("PSP") ) or isObjectInACLGroup ("user."..accNameaclGetGroup("SAPD") ) or isObjectInACLGroup ("user."..accNameaclGetGroup("SAMC") ) then
            for k,v in ipairs (getElementsByType("player")) do
                if getPlayerAccount(vthen
                    accName getAccountName(getPlayerAccount(v))
                    if accName then
if isObjectInACLGroup ("user."..accNameaclGetGroup("PSP") ) or isObjectInACLGroup ("user."..accNameaclGetGroup("SAPD") ) or isObjectInACLGroup ("user."..accNameaclGetGroup("SAMC") ) then
                        outputChatBox("#ff0000"..getPlayerName(thePlayer).."#ffffff**#1D9DE6Frakcyjny:#ffffff**#49AC4C "..theMessagev255,255,255true)
                        end
                    end
                end
            end
        end

addCommandHandler("u"message)


addEventHandler("onPlayerJoin",getRootElement(),
function ()
bindKey(source,"u","down","chatbox","Frakcyjny")
end)
 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),
function ()
for indexplayer in pairs(getElementsByType("player")) do
bindKey(player,"u","down","chatbox","Frakcyjny")
  end
 end)
end


Mianowicie po wci?ni?ciu danego bindu w tym przypadku 'u' Nic si? nie dzieje a db3 nic nie pokazuje.

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-01, 18:07


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

marcin778, poniewa? jako mend? poda?e? "Frakcyjny"a komenda w twoim przypadku to jest poprostu u.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-01, 18:12


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4150 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Czyl te pierwsze 'u' to Pisze na chacie ? u: jakis tekst

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-01, 18:20


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

marcin778,
function isPlayerInACL playeracl )
    local account getPlayerAccount player )
    if ( isGuestAccount account ) ) then
        return false
    end
        return isObjectInACLGroup "user."..getAccountName account ), aclGetGroup acl ) )
end

function frakcyjny plrcmd, ... )
    local plr_account getPlayerAccount (plr)
    if not isGuestAccount(plr_accountthen
    local allArgs = {...}
    local theMessage table.concatallArgs" ")
        for k,v in ipairs getElementsByType("player")) do
        local v_account getPlayerAccount (v)
            if v_account then
                if not isGuestAccountv_account then
                    if isPlayerInACL(v_account"PSP") or isPlayerInACL(v_account"SAPD") or isPlayerInACL(v_account"SAMC"then
                    outputChatBox("#ff0000"..getPlayerName(plr).."#ffffff**#1D9DE6Frakcyjny:#ffffff**#49AC4C "..theMessagev255,255,255true)
                    end
                end
            end
        end
    else
    outputChatBox"Nie jeste? zalogowany. Nie mo?esz u?ywa? tej funkcji !")
    end
end
addCommandHandler"frakcyjny"frakcyjny)

addEventHandler("onPlayerJoin",getRootElement(),
function ()
bindKey(source,"u","down","chatbox","frakcyjny")
end)

addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),
function onStartResource()
    for indexplayer in pairs(getElementsByType("player")) do
        bindKey(player,"u","down","chatbox","frakcyjny")
    end
end )


Sprawd? m?j kod jest bardzo przejrzysty na pewno zobaczysz swoje b??dy.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-01, 18:20


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4150 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Zmieni?em i bez poprawy
addEventHandler("onPlayerJoin",getRootElement(),
function ()
bindKey(source,"u","down","chatbox","u")
end)
 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),
function ()
for indexplayer in pairs(getElementsByType("player")) do
bindKey(player,"u","down","chatbox","u")
  end
 end)
end


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-01, 18:32


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

marcin778,
function isPlayerInACL playeracl )
    local account getPlayerAccount player )
    if ( isGuestAccount account ) ) then
        return false
    end
        return isObjectInACLGroup "user."..getAccountName account ), aclGetGroup acl ) )
end

function frakcyjny plrcmd, ... )
    local plr_account getPlayerAccount (plr)
    if not isGuestAccount(plr_accountthen
    local allArgs = {...}
    local theMessage table.concatallArgs" ")
        for k,v in ipairs getElementsByType("player")) do
        local v_account getPlayerAccount (v)
            if v_account then
                if not isGuestAccountv_account then
                    if isPlayerInACL(v_account"PSP") or isPlayerInACL(v_account"SAPD") or isPlayerInACL(v_account"SAMC"then
                    outputChatBox("#ff0000"..getPlayerName(plr).."#ffffff**#1D9DE6Frakcyjny:#ffffff**#49AC4C "..theMessagev255,255,255true)
                    end
                end
            end
        end
    else
    outputChatBox"Nie jeste? zalogowany. Nie mo?esz u?ywa? tej funkcji !")
    end
end
addCommandHandler"frakcyjny"frakcyjny)

addEventHandler("onPlayerJoin",getRootElement(),
function ()
bindKey(source,"u","down","chatbox","frakcyjny")
end)

addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),
function()
    for indexplayer in pairs(getElementsByType("player")) do
        bindKey(player,"u","down","chatbox","frakcyjny")
    end
end )

Teraz zobacz. Nic nie zmieniaj .

[ Dodano: 2016-03-01, 18:32 ]
Tutaj masz m?j poradnik :D http://gtao.pl/poczatki-lua-vt89971.htm

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-01, 18:38


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4150 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Wypr?bowa?em tw?j kod i owszem bind dzia?a ale po naci?ni?ciu go jest napisz Frakcyjny: ale nie widac tego co napisze :.

[ Dodano: 2016-03-01, 18:42 ]
Ale tym razem db wysypa?o.


[2016-03-01 18:41] frakcyjne restarted successfully
[2016-03-01 18:41] WARNING: frakcyjne/script.lua:2: Bad argument @ 'getPlayerAccount' [Expected element at argument 1]
[2016-03-01 18:41] WARNING: frakcyjne/script.lua:3: Bad argument @ 'isGuestAccount' [Expected account at argument 1, got boolean]
[2016-03-01 18:41] WARNING: frakcyjne/script.lua:6: Bad argument @ 'getAccountName' [Expected account at argument 1, got boolean]
[2016-03-01 18:41] ERROR: frakcyjne/script.lua:6: attempt to concatenate a boolean value

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-01, 19:27


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

marcin778,

function isPlayerInACL playeracl )
    local account getPlayerAccount player )
    if ( isGuestAccount account ) ) then
        return false
    end
        return isObjectInACLGroup "user."..getAccountName account ), aclGetGroup acl ) )
end

function frakcyjny plrcmd, ... )
    local plr_account getPlayerAccount (plr)
    if not isGuestAccount(plr_accountthen
    local allArgs = {...}
    local theMessage table.concatallArgs" ")
        for k,v in ipairs getElementsByType("player")) do
        local v_account getPlayerAccount (v)
            if v_account then
                if not isGuestAccountv_account then
                    if isPlayerInACL(v"PSP") or isPlayerInACL(v"SAPD") or isPlayerInACL(v"SAMC"then
                    outputChatBox("#ff0000"..getPlayerName(plr).."#ffffff**#1D9DE6Frakcyjny:#ffffff**#49AC4C "..theMessagev255,255,255true)
                    end
                end
            end
        end
    else
    outputChatBox"Nie jeste? zalogowany. Nie mo?esz u?ywa? tej funkcji !")
    end
end
addCommandHandler"frakcyjny"frakcyjny)

addEventHandler("onPlayerJoin",getRootElement(),
function ()
bindKey(source,"u","down","chatbox","frakcyjny")
end)

addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),
function()
    for indexplayer in pairs(getElementsByType("player")) do
        bindKey(player,"u","down","chatbox","frakcyjny")
    end
end )



Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-01, 19:53


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4150 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Dzia?a, mo?na zamkn??

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Tagi: ponownie :: bindkeye
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Ponownie bindKey'e Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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