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

Wysłany: 2013-04-14, 14:42


vipSEBOvip

A poor begginer






Wiek: 27
Na forum: 5319 dni
Posty: 597
Nick w MP: xSebaPL

Piwa: 77

Respekt: 140
Respekt: 140

Witajcie, jak u?yje komendy /me w kodzie:
function akcjaME(player, cmd, ...)
    local playername = getPlayerName(player)
    local x, y, z = getElementPosition(player)
    local dimension = getElementDimension(player)
    local interior = getElementInterior(player)
    
    playername = string.gsub(playername, "_", " ")
    for k, gracze in ipairs(getElementsByType("player")) do
        if getDistanceBetweenPoints3D(x, y, z, getElementPosition(gracze)) < 20 then
            local graczeDim = getElementDimension(gracze)
            local graczeInt = getElementInterior(gracze)
            if (graczeDim==dimension) and (graczeInt==interior) then
                outputChatBox("#6600ff* " .. playername .. " " .. table.concat({...}, " "), gracze, 255, 255, 255, true)
            end
        end
    end
end
addCommandHandler("me", akcjaME)


To zamiast funkcji akcjaME aktywuje si? chat lokalny:
function icchat(message)
    cancelEvent()
    local x, y, z = getElementPosition(source)
    local playername = getPlayerName(source)
    
    playername = string.gsub(playername, "_", " ")
    message = string.gsub(message, "#%x%x%x%x%x%x", "")

    local dimension = getElementDimension(source)
    local interior = getElementInterior(source)
    
    for k, gracze in ipairs(getElementsByType("player")) do
        if getDistanceBetweenPoints3D(x, y, z, getElementPosition(gracze)) < 20 then
            local graczeDim = getElementDimension(gracze)
            local graczeInt = getElementInterior(gracze)
            if (graczeDim==dimension) and (graczeInt==interior) then
                outputChatBox("#EEEEEE" .. playername .. " m?wi: " .. message, gracze, 255, 255, 255, true)
            end
        end
    end
end
addEventHandler("onPlayerChat", getRootElement(), icchat)


A wi?c gdy u?yje /me idzie to zamiast wyskoczy? 'Sebastian Momot idzie' to wyskakuje 'Sebastian Momot m?wi: idzie

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-14, 14:51


Brzysiek

Skrypter pralek






Wiek: 28
Na forum: 5339 dni
Posty: 488
Nick w MP: Brzysiek

Piwa: 1034

Respekt: 360
Respekt: 360Respekt: 360Respekt: 360Respekt: 360


function icchat(message, msgType)
    if msgType == 0 then
        cancelEvent()
        local x, y, z = getElementPosition(source)
        local playername = getPlayerName(source)
        
        playername = string.gsub(playername, "_", " ")
        message = string.gsub(message, "#%x%x%x%x%x%x", "")

        local dimension = getElementDimension(source)
        local interior = getElementInterior(source)
    
        for k, gracze in ipairs(getElementsByType("player")) do
            if getDistanceBetweenPoints3D(x, y, z, getElementPosition(gracze)) < 20 then
                local graczeDim = getElementDimension(gracze)
                local graczeInt = getElementInterior(gracze)
                if (graczeDim==dimension) and (graczeInt==interior) then
                    outputChatBox("#EEEEEE" .. playername .. " m?wi: " .. message, gracze, 255, 255, 255, true)
                end
            end
        end
    end
end
addEventHandler("onPlayerChat", getRootElement(), icchat)




Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-14, 18:53


vipSEBOvip

A poor begginer






Wiek: 27
Na forum: 5319 dni
Posty: 597
Nick w MP: xSebaPL

Piwa: 77

Respekt: 140
Respekt: 140

?ap piwo puki zimne.

Postaw piwo autorowi tego posta
 

 
Tagi: zła :: funkcja
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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