Jump to content

Potrzebuje pomocy z Gridlist


Recommended Posts

Posted

Witam! Mam pytanie. Jak zrobić, by w gridlist pokazywało graczy będących w pobliżu? Wiem jak zrobić, by pokazywało wszystkich graczy, ale potrzebuje by pokazywało tylko tych będących w pobliżu. Proszę o pomoc i dzięki!

Posted

tworzysz wybrany przez Ciebie colshape w miejscu gdzie jest gracz, getElementsWithinColShape, kasujesz colshape.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted (edited)
local x,y = getElementPosition(getLocalPlayer()) 
colshape = createColCircle ( x, y, 20.0 ) 
playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) 
guiSetVisible(playerList,false) 
  
function createPlayerList () 
        -- Create the grid list 
        -- Create a players column in the list 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) 
        if ( column ) then         -- If the column has been created, fill it with players 
                for id, playeritem in ipairs(getElementsWithinColShape ( colshape, "player" )) do 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
                addEventHandler ( "onClientGUIClick", row, click ) 
        end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), createPlayerList ) 
  
function click ( button, state, sx, sy, x, y, z, elem, gui ) 
        -- if state is down ( not to trigger the function twice on mouse button up/down), clicked gui and the element is our player list 
        if ( source == playerList ) then 
                -- get the player name from the selected row, first column  
                local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) 
                outputChatBox ( playerName )     -- output it to chat box 
        end 
end 
  
function visible () 
    guiSetVisible(playerList,true) 
    showCursor(true) 
end 
addCommandHandler("pokaz",visible) 

Powiesz mi co tutaj jest źle? Gridliste tworzy, ale nie ma w niej żadnego gracza.

PS. Wszystkiego najlepszego! :)

Edited by Guest
Posted

na oko wygląda ok, nie mam czasu teraz sprawdzić. ty sprawdź tą stronę, szczególnie część 3.2 :)

powodzenia.

PS. Dzięki :P

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
Wiem jak zrobić, by pokazywało wszystkich graczy

Śmiem twierdzić że wiesz jedyne jak zrobić by pokazywało graczy którzy byli na serwerze w chili gdy skrypt załadował się na twoim cliencie ;)

Uwagi:

-lista powinna się odświeżać przy każdym wpisaniu komendy (usuwanie starej listy i tworzenie nowej)

-pobieranie pozycji local playera i tworzenie colschepa musi się odbywać przed stworzeniem listy, przy każdym wpisaniu komendy

-po stworzeniu komendy colshape należy usunąć

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...