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: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

Respekt: 1436,8
Respekt: 1436,8

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


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

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

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


if isObjectInACLGroup ("user."..accName, aclGetGroup("PSP") ) or isObjectInACLGroup ("user."..accName, aclGetGroup("SAPD") ) or isObjectInACLGroup ("user."..accName, aclGetGroup("SAMC") ) then
            for k,v in ipairs (getElementsByType("player")) do
                if getPlayerAccount(v) then
                    accName = getAccountName(getPlayerAccount(v))
                    if accName then
if isObjectInACLGroup ("user."..accName, aclGetGroup("PSP") ) or isObjectInACLGroup ("user."..accName, aclGetGroup("SAPD") ) or isObjectInACLGroup ("user."..accName, aclGetGroup("SAMC") ) then
                        outputChatBox("#ff0000"..getPlayerName(thePlayer).."#ffffff**#1D9DE6Frakcyjny:#ffffff**#49AC4C "..theMessage, v, 255,255,255, true)
                        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 index, player 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: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

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: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

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: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

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

function frakcyjny ( plr, cmd, ... )
    local plr_account = getPlayerAccount (plr)
    if not isGuestAccount(plr_account) then
    local allArgs = {...}
    local theMessage = table.concat( allArgs, " ")
        for k,v in ipairs ( getElementsByType("player")) do
        local v_account = getPlayerAccount (v)
            if v_account then
                if not isGuestAccount( v_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 "..theMessage, v, 255,255,255, true)
                    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 index, player 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: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

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 index, player 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: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

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

function frakcyjny ( plr, cmd, ... )
    local plr_account = getPlayerAccount (plr)
    if not isGuestAccount(plr_account) then
    local allArgs = {...}
    local theMessage = table.concat( allArgs, " ")
        for k,v in ipairs ( getElementsByType("player")) do
        local v_account = getPlayerAccount (v)
            if v_account then
                if not isGuestAccount( v_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 "..theMessage, v, 255,255,255, true)
                    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 index, player 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: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

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: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

marcin778,

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

function frakcyjny ( plr, cmd, ... )
    local plr_account = getPlayerAccount (plr)
    if not isGuestAccount(plr_account) then
    local allArgs = {...}
    local theMessage = table.concat( allArgs, " ")
        for k,v in ipairs ( getElementsByType("player")) do
        local v_account = getPlayerAccount (v)
            if v_account then
                if not isGuestAccount( v_account ) then
                    if isPlayerInACL(v, "PSP") or isPlayerInACL(v, "SAPD") or isPlayerInACL(v, "SAMC") then
                    outputChatBox("#ff0000"..getPlayerName(plr).."#ffffff**#1D9DE6Frakcyjny:#ffffff**#49AC4C "..theMessage, v, 255,255,255, true)
                    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 index, player 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: 4290 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4661

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