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

Wysłany: 2014-11-11, 14:54


Jeey

Lua, Grafik






Wiek: 27
Na forum: 4480 dni
Posty: 98
Nick w MP: Jeey

Piwa: 383

Respekt: 80

Ostrzeżeń: 100%
Witajcie zrobi?em skrypt na telefon ?e jak gracz wci?nie przycisk Lawet to wzywa mechanika ale nie dzia?a

Kod s-side


addEvent( "pdd", true )
addEventHandler( "pdd", root,
function (p)
    local players = getPlayersInTeam ( getTeamFromName("Mechanik" ) ) 
    local pdd = { }
    for k, v in pairs(players) do
        if getElementData(v, "afk_state") == false then
            table.insert(pdd, v)
        end
    end
    
    if #pdd == 0 then outputChatBox("Przykro mi, ale aktualnie na serwerze nie ma mechanik?w, ktorzy sa obecni!", p, 0, 255, 0) return false end
    local ddd = math.random(1, #pdd)
    outputChatBox("Gracz " .. string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "")  .. " wezwal Mechanika", pdd[ddd],0, 255, 0) 
    outputChatBox("Wezwales Mechanika ! Czekaj cierpliwie!", p, 0, 255, 0) 
end


i kawa?ek

Kod c-side



function laweta_pd ()
     if (source == pomocdrogowa) then
         guiSetVisible(pomocdrogowa, false) 
         guiSetVisible(policja, false) 
         guiSetVisible(zamknij, false) 
         showCursor(false)
         removeEventHandler("onClientRender", root,tele)
             triggerServerEvent ( "pdd", getLocalPlayer(),pomocdrogowa)
         end
    end
addEventHandler("onClientGUIClick", pomocdrogowa, laweta_pd)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-11, 22:01


Maximerr

Programmer PHP, LUA






Wiek: 25
Na forum: 4568 dni
Posty: 548

Piwa: 1051

Respekt: 365,3
Respekt: 365,3Respekt: 365,3Respekt: 365,3Respekt: 365,3

Jakie? /debugscript 3?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-11, 22:52


Jeey

Lua, Grafik






Wiek: 27
Na forum: 4480 dni
Posty: 98
Nick w MP: Jeey

Piwa: 383

Respekt: 80

Ostrzeżeń: 100%
no w?a?nie nie ma :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-12, 12:59


luki123luki123

Place Game






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

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Milo_, mo?la to o wiele szybciej zrobi?:
S:
function getAlivePlayersInTeam(theTeam)
    local theTable = { }
    local players = getPlayersInTeam(theTeam)
 
    for i,v in pairs(players) do
        if not isPedDead(v) then
            theTable[#theTable+1]=v
        end
    end
 
    return theTable
end

function isPlayerInTeam(player, team)
    assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]")
    assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]")
    return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true)))
end

addEvent( "pdd", true )
addEventHandler( "pdd", root,
function (player)
local count = #getAlivePlayersInTeam(getTeamFromName("Mechanik")) or 0
    if count == 0 then 
        outputChatBox("Przykro mi, ale aktualnie na serwerze nie ma mechanik?w, ktorzy sa obecni!", p, 0, 255, 0) 
        else
        outputChatBox("Wezwales Mechanika ! Czekaj cierpliwie!", player, 0, 255, 0) 
            for id, playeritem in ipairs(getElementsByType("player")) do 
               if isPlayerInTeam(playeritem, "Mechanik") then   
                    outputChatBox("Gracz " .. string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "")  .. " wezwal Mechanika", pdd[ddd],0, 255, 0) 
                 end
            end
    end
end)

C:
function laweta_pd ()
     if (source == pomocdrogowa) then
         guiSetVisible(pomocdrogowa, false) 
         guiSetVisible(policja, false) 
         guiSetVisible(zamknij, false) 
         showCursor(false)
         removeEventHandler("onClientRender", root,tele)
             triggerServerEvent ( "pdd", getRootElement(), getLocalPlayer())
         end
    end
addEventHandler("onClientGUIClick", pomocdrogowa, laweta_pd)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-12, 16:29


Jeey

Lua, Grafik






Wiek: 27
Na forum: 4480 dni
Posty: 98
Nick w MP: Jeey

Piwa: 383

Respekt: 80

Ostrzeżeń: 100%
gdy naciskam na button "laweta" to wyskakuje taki b??d



Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-12, 17:32


luki123luki123

Place Game






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

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Milo_, hmmm spr?buj tak:
function isPlayerInTeam(player, team)
    assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]")
    assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]")
    return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true)))
end

addEvent( "pdd", true )
addEventHandler( "pdd", root,
function (player)
local count = countPlayersInTeam ( getTeamFromName("Mechanik" )
    if count == 0 then 
        outputChatBox("Przykro mi, ale aktualnie na serwerze nie ma mechanik?w, ktorzy sa obecni!", p, 0, 255, 0) 
        else
        outputChatBox("Wezwales Mechanika ! Czekaj cierpliwie!", player, 0, 255, 0) 
            for id, playeritem in ipairs(getElementsByType("player")) do 
               if isPlayerInTeam(playeritem, "Mechanik") then   
                    outputChatBox("Gracz " .. string.gsub(getPlayerName(p), "#%x%x%x%x%x%x", "")  .. " wezwal Mechanika", pdd[ddd],0, 255, 0) 
                 end
            end
    end
end)


Postaw piwo autorowi tego posta
 

 
Tagi: telefon
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