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

Wysłany: 2012-10-07, 11:38


luki123luki123

Place Game






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

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Witam tworzy?em clinet i niewiem co dalej .
Clinet jest m?j i mojego kolegi
local x,guiGetScreenSize()
koszt 7
taxiWindow = { }
taxiButton = { }
taxiGrid = { }
taxirow = {}
taxiEdit = { }
taxilabel = { }
taxiTable = { }
wyplatytable = { }

taxiWindow[1] = guiCreateWindow((x/400/2), (y/415/2), 400415"Taxi panel" false)
taxiButton[1] = guiCreateButton(1704023050"Start rachunek"falsetaxiWindow[1])    
taxiButton[2] = guiCreateButton(17010023050"Stop rachunek"falsetaxiWindow[1])
taxiButton[3] = guiCreateButton(3303756050"Wyjdz"falsetaxiWindow[1])
taxiButton[4] = guiCreateButton(17025023050"Odbierz pieni?dze za przew?z"falsetaxiWindow[1])
taxiButton[5] = guiCreateButton(17016023050"Anuluj wezwanie"falsetaxiWindow[1])
taxiButton[6] = guiCreateButton(17031023050"Wyrzu? wszystkich graczy z tax?wki"falsetaxiWindow[1])
taxiGrid[1] = guiCreateGridList(1020150220falsetaxiWindow[1])
taxiGrid[2] = guiCreateGridList(10250150140falsetaxiWindow[1])
taxirow[1] = guiGridListAddColumn(taxiGrid[1], "Gracze".9)
taxirow[2] = guiGridListAddColumn(taxiGrid[2], "Gracz".4)
taxirow[3] = guiGridListAddColumn(taxiGrid[2], "Koszt".4)
taxilabel[1] = guiCreateLabel(170,210,160,15,"Stawka za 100 yard?w: "..koszt.."$",false,taxiWindow[1])
taxilabel[2] = guiCreateLabel(170,230,230,15"Gracz:"false,taxiWindow[1])
guiWindowSetSizable(taxiWindow[1], false)
guiSetVisible(taxiWindow[1], false)

function openTaxiPanel()
    showCursor(true)
    guiSetVisible(taxiWindow[1], true)
    for k,v in ipairs(getElementsByType("player")) do
        guiGridListSetItemPlayerName (taxiGrid[1], guiGridListAddRow (taxiGrid[1]), 1getPlayerName (v), falsefalse )
    end
end

function onClick()
    if source == taxiButton[1then
        local veh getPedOccupiedVehicle(getLocalPlayer())
        if veh then
            local model getElementModel(veh)
            if model == 420 or model == 438 then
                local pl guiGridListGetItemText (taxiGrid[1], guiGridListGetSelectedItem (taxiGrid[1]), taxirow[1])
                if pl ~= "" then
                    local player getPlayerFromName(pl)
                    if player then
                        if getElementData(player,"login") == true then
                            if isPlayerVehiclePassager(veh,playerthen
                                local acc getElementData(player,"account_rpg")
                                if acc then
                                    local x,y,getElementPosition(player)
                                    table.insert(taxiTable,{player,acc,x,y,z})
                                    outputChatBox("Rozpocz?to nalicznie",255,255,0)
                                else
                                    outputChatBox("B??d gamemoda. Popro? gracza o reconnect, je?li nie pomo?e zg?o? do administratora!",255,0,0)
                                end
                            else
                                outputChatBox("Gracz nie jest twoim pasa?em!",255,0,0)
                            end
                        else
                            outputChatBox("Gracz nie jest zalogowany!",255,0,0)
                        end
                    else
                        outputChatBox("Nie znaleziono gracza!",255,0,0)
                    end
                else
                    outputChatBox("Nie zaznaczy?e? gracza!",255,0,0)
                end
            else
                outputChatBox("Twoje auto to nie tax?wka!",255,0,0)
            end
        else
            outputChatBox("Nie jeste? w aucie!",255,0,0)
        end
    elseif source == taxiButton[2then
        local pl guiGridListGetItemText (taxiGrid[1], guiGridListGetSelectedItem (taxiGrid[1]), taxirow[1])
        if pl ~= "" then
            local gracz getPlayerFromName(pl)
            if isElement(graczthen
                local veh getPedOccupiedVehicle(getLocalPlayer())
                if isPlayerVehiclePassager(veh,graczthen
                    for k,v in ipairs(taxiTable) do
                        if v[1] == gracz then
                            local x,y,getElementPosition(gracz)
                            local dystans getDistanceBetweenPoints3D (x,y,z,v[3],v[4],v[5])
                            local cash math.floor((dystans/100)*koszt)
                            table.remove(taxiTable,k)
                            table.insert(wyplatytable,{v[2],tostring(cash)})
                            outputChatBox("Naliczanie zako?czono",255,255,0)
                            refresh_wyplaty()
                        end
                    end
                else
                    outputChatBox("Gracz nie jest twoim pasa?em!",255,0,0)    
                end
            else
                outputChatBox("Nie znaleziono gracza!",255,0,0)
            end
        else
            outputChatBox("Nie zaznaczy?e? gracza!",255,0,0)
        end
    elseif source == taxiButton[3then
        guiSetVisible(taxiWindow[1], false)
        showCursor(false)
        guiGridListClear (taxiGrid[1])
        guiSetText(taxilabel[2],"")
    elseif source == taxiButton[4then
        local row guiGridListGetSelectedItem (taxiGrid[2])
        if row then
            local name guiGridListGetItemText (taxiGrid[2], rowtaxirow[2])
            local cash guiGridListGetItemText (taxiGrid[2], rowtaxirow[3])
            if name ~= "" and cash ~= "" then
                guiGridListRemoveRow(taxiGrid[2], row)
                triggerServerEvent("taxi:giveWyplata",getLocalPlayer(),name,cash)
                for k,v in ipairs(wyplatytable) do
                    if v[1] == tostring(name) and v[2] == tostring(cashthen
                        table.remove(wyplatytable,k)
                        refresh_wyplaty()
                        return
                    end
                end
            end
        end
    elseif source == taxiButton[5then
        triggerServerEvent("taxi:anulujWezwanie",getLocalPlayer(),guiGridListGetItemText (taxiGrid[1], guiGridListGetSelectedItem (taxiGrid[1]), taxirow[1]))
    elseif source == taxiGrid[1then
        local pl guiGridListGetItemText (taxiGrid[1], guiGridListGetSelectedItem (taxiGrid[1]), taxirow[1])
        guiSetText(taxilabel[2],"Gracz: "..pl)
    elseif source == taxiButton[6then
        triggerServerEvent("taxi:removePlayerFromCar",getLocalPlayer())
    end
end

function refresh_wyplaty()
    guiGridListClear (taxiGrid[2])
    for k,v in ipairs(wyplatytable) do
        local row guiGridListAddRow (taxiGrid[2])
        guiGridListSetItemPlayerName(taxiGrid[2], rowtaxirow[2], v[1], falsefalse )
        guiGridListSetItemPlayerName(taxiGrid[2], rowtaxirow[3], v[2], falsefalse )
    end
end

function isPlayerVehiclePassager(vehicle,player)
    if getElementType(vehicle) == "vehicle" then
        local pass getVehiclePassagers (vehicle)
        if pass then
            for k,v in ipairs(pass) do
                if == player then
                    return true
                end
            end
        end
    end
    return false
end

function getVehiclePassagers (theVehicle)
    local ret_table = { }
    local numseats getVehicleMaxPassengers theVehicle )
    if tonumber(numseatsthen
        for 0numseats do
            local targetPlayer getVehicleOccupant theVehicle)
            if targetPlayer and isElement(targetPlayer) and isPedInVehicle(targetPlayerthen
                table.insert(ret_table,targetPlayer)
            end
        end
    end
    return ret_table
end

function onChangeNick(oldNicknewNick)
    if guiGetVisible(taxiWindow[1]) then
        local id 0
        while ( id <= guiGridListGetRowCount(taxiGrid[1]) ) do
            if ( guiGridListGetItemPlayerName(taxiGrid[1], id) == oldNick then
                guiGridListRemoveRow(taxiGrid[1], id )
                guiGridListSetItemText (taxiGrid[1], guiGridListAddRow (taxiGrid[1]), taxirow[1], newNickfalsefalse )
            end
            id id 1
        end
    end
end

function guiGridListGetItemPlayerNamegridlistrowcol )
    return guiGridListGetItemDatagridlistrowcol ) or guiGridListGetItemTextgridlistrowcol )
end

function onJoin()
    if guiGetVisible(taxiWindow[1]) then
        guiGridListSetItemPlayerName (taxiGrid[1], guiGridListAddRow (taxiGrid[1]), 1getPlayerName source ), falsefalse )
    end
end
function guiGridListSetItemPlayerNamegridlistrowcolname )
    guiGridListSetItemTextgridlistrowcolnamefalsefalse )
    guiGridListSetItemDatagridlistrowcolname )
end

function onQuit()
    if guiGetVisible(taxiWindow[1]) then
        local id 0
        while ( id <= guiGridListGetRowCount(taxiGrid[1]) ) do
            if ( guiGridListGetItemPlayerName(taxiGrid[1], id) == getPlayerName source ) ) then
                guiGridListRemoveRow(taxiGrid[1], id )
            end
            id id 1
        end
    end
    for k,v in ipairs(taxiTable) do
        if isPlayerVehiclePassager(getPedOccupiedVehicle(getLocalPlayer()),sourcethen
            if v[1] == source then
                local x,y,getElementPosition(source)
                local dystans getDistanceBetweenPoints3D (x,y,z,v[3],v[4],v[5])
                local cash math.floor((dystans/100)*koszt)
                table.remove(taxiTable,k)
                table.insert(wyplatytable,{v[2],tostring(cash)})
                outputChatBox("Automatycznie zako?czono naliczanie",255,255,0)
                refresh_wyplaty()
            end
        end
    end
end

function onExit(pl,seat)
    local pveh getPedOccupiedVehicle(getLocalPlayer())
    if isElement(pvehthen
        if isPlayerVehiclePassager(pveh,plthen
            for k,v in ipairs(taxiTable) do
                if v[1] == pl then
                    local x,y,getElementPosition(pl)
                    local dystans getDistanceBetweenPoints3D (x,y,z,v[3],v[4],v[5])
                    local cash math.floor((dystans/100)*koszt)
                    table.remove(taxiTable,k)
                    table.insert(wyplatytable,{v[2],tostring(cash)})
                    outputChatBox("Automatycznie zako?czono naliczanie",255,255,0)
                    refresh_wyplaty()
                end
            end
        end
    end
end

--
addEvent("taxi:openPanel"true)
addEventHandler("taxi:openPanel"getRootElement(), openTaxiPanel)
addEventHandler "onClientPlayerChangeNick"getRootElement(),onChangeNick)
addEventHandler "onClientPlayerJoin"getRootElement(), onJoin)
addEventHandler "onClientPlayerQuit"getRootElement(), onQuit)
addEventHandler "onClientVehicleStartExit",getRootElement(),onExit)
addEventHandler "onClientGUIClick"getResourceRootElement(getThisResource()), onClick)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-10-07, 11:51


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

R?ce odpadaj?...Co nie dzia?a?

PS. Nie licz na to ?e Ci zrobimy ca?y skrypt.

Postaw piwo autorowi tego posta
 

 
Tagi: panel :: taxi :: luki
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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