Michcio Posted February 24, 2011 Posted February 24, 2011 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!
dzek (varez) Posted February 24, 2011 Posted February 24, 2011 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)!
Michcio Posted February 24, 2011 Author Posted February 24, 2011 (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 February 24, 2011 by Guest
dzek (varez) Posted February 24, 2011 Posted February 24, 2011 na oko wygląda ok, nie mam czasu teraz sprawdzić. ty sprawdź tą stronę, szczególnie część 3.2 powodzenia. PS. Dzięki 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)!
Wojak Posted February 25, 2011 Posted February 25, 2011 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 your teleports and interiors in MTA map editor want more excitment in your race map? - add a killer bot you may also add some peds (NPC) - CARMAGEDDON STYLE! 2paq MTA:SA Race Server
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now