Kirito0427 Posted March 11, 2022 Share Posted March 11, 2022 Hi Guys , How i Make Search Vehicle in Gridlist When player write in Edit Example : when i write in edit Infernus he show to me the player his name Infernus 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 okno = guiCreateWindow(385,236,602,519,"Panel Salonu",false) graczelist = guiCreateGridList(277,24,140,486,false,okno) guiGridListSetSelectionMode(graczelist,2) gracze = guiGridListAddColumn(graczelist,"Gracze",0.8) sell = guiCreateButton(421,24,172,71,"Sprzedaj Auto",false,okno) close = guiCreateButton(421,103,171,71,"Zamknij Panel",false,okno) LB4 = guiCreateLabel(421, 270, 172, 71, "Szukaj", false, okno) guiSetFont(LB4, "default-bold-small") guiLabelSetColor(LB4, 255, 0, 0) Search = guiCreateEdit(421, 303, 173, 71, "", false, okno) acs = guiCreateGridList(9,24,260,486,false,okno) guiGridListAddColumn(acs,"Auta",0.3) guiGridListAddColumn(acs,"ID",0.2) guiGridListAddColumn(acs,"Cena",0.25) guiGridListAddColumn(acs,"Score",0.15) guiSetVisible(okno,false) blokada=false function open_salon_panel1() if isPlayerInTeam(localPlayer,"Salon") then guiGridListClear (graczelist) guiGridListClear (acs) for k,v in ipairs(getElementsByType("player")) do guiGridListSetItemText (graczelist, guiGridListAddRow (graczelist), gracze,getPlayerName(v), false, false ) guiSetVisible(okno,true) showCursor(true) end samochodyGrid = xmlLoadFile("auto.xml") if samochodyGrid then else return end for i,auta in ipairs(xmlNodeGetChildren(samochodyGrid)) do local idZamawianegoPojazdu = xmlNodeGetAttribute(auta, "id") local KosztPojazdu = xmlNodeGetAttribute(auta, "koszt") local minScorePojazdu = xmlNodeGetAttribute(auta, "minscore") local nazwaZamawianegoPojazdu = getVehicleNameFromModel(idZamawianegoPojazdu) row1=guiGridListAddRow(acs) guiGridListSetItemText(acs, row1, 1, nazwaZamawianegoPojazdu, false, false) guiGridListSetItemText(acs, row1, 2, idZamawianegoPojazdu, false, false) guiGridListSetItemText(acs, row1, 3, KosztPojazdu, false, false) guiGridListSetItemText(acs, row1, 4, minScorePojazdu, false, false) end xmlUnloadFile(samochodyGrid) else outputChatBox("Nie masz praw frakcji Salon.", 0, 255, 0) end end addEvent("open_salon_panel",true) addEventHandler ( "open_salon_panel", getRootElement(), open_salon_panel1 ) function close_salon_panel1() if (guiGetVisible(okno) == true) then guiSetVisible(okno,false) showCursor(false) guiGridListClear (graczelist) guiGridListClear (acs) end end addEventHandler("onClientGUIClick",close,close_salon_panel1,false) function sprzedajPojazd(btn,state) if (guiGetVisible(okno) == true) then if not blokada then else return outputChatBox("Musisz odczekać 5 sekund przed sprzedażą następnego pojazdu!", 0, 255, 0) end local zaznaczonyGracz = guiGridListGetSelectedItem(graczelist) local zaznaczonyPojazd = guiGridListGetSelectedItem(acs) if (zaznaczonyGracz > -1) and (zaznaczonyPojazd > -1) then local idpojazdu=guiGridListGetItemText(acs, zaznaczonyPojazd,2) local koszty=guiGridListGetItemText(acs, zaznaczonyPojazd, 3) local minScoreP=guiGridListGetItemText(acs, zaznaczonyPojazd, 4) local wybranyKlient=guiGridListGetItemText(graczelist, zaznaczonyGracz, 1) local punktyGracza=getElementData(localPlayer, "Score") or 0 if (tonumber(punktyGracza) >= tonumber(minScoreP)) then dada=getPlayerName(localPlayer) klient=wybranyKlient triggerServerEvent("sprzedaj_pojazd_salon", localPlayer, dada, klient, tonumber(koszty), tonumber(idpojazdu)) blokada=true setTimer(function() blokada=false end, 5000, 1) else return outputChatBox("Gracz nie posiada wymaganej ilości score!", 0, 255,0) end else outputChatBox("Nie wybrałeś gracza lub pojazdu", 0, 255, 0) end end end addEventHandler("onClientGUIClick", sell, sprzedajPojazd, false) Edit" It's about the name of the vehicle Link to comment
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