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

Wysłany: 2013-04-04, 19:04


Drak







Wiek: 34
Na forum: 4903 dni
Posty: 71
Nick w MP: Drak

Piwa: 3

Respekt: 50

Witam!
Chcia?bym zrobi? rangi na scoreboardzie, ale nie wiem jak.

Chodzi mi dok?adniej o to aby do scoreboardu doda? kolumn? 'Ranga', w kt?rej pokazywa?a by si? grupa ACL danego gracza. I w tym problem;/ Nie wiem jak zrobi? te 'rangi'.

Prosi?bym o szybk? odpowied? i z g?ry dzi?kuje.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-04, 19:53


Riot

3X






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

Piwa: 286

Respekt: 123
Respekt: 123

Tworzymy kolumn?:

call (getResourceFromName ("scoreboard"), "scoreboardAddColumn""Ranga")


I teraz...Musisz sprezycowa? co w ma si? tam pokazywa?? Wszystkie grupy danego gracza czy jak? ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-04, 20:11


Drak







Wiek: 34
Na forum: 4903 dni
Posty: 71
Nick w MP: Drak

Piwa: 3

Respekt: 50

Kolumne umiem zrobi? :P

Chodzi mi ?eby pokazywa?o wszystkie grupy w jakich dany gracz sie znajduje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-06, 13:06


Oski

LUA Scripter






Wiek: 30
Na forum: 5246 dni
Posty: 428
Nick w MP: Oski

Piwa: 56

Respekt: 75,1

Przy wej?ciu na server sprawdzasz warunkami lub pobierasz p?tl? wszystkie grupy gracza.
I nadajesz setElementData

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-06, 13:37


Drak







Wiek: 34
Na forum: 4903 dni
Posty: 71
Nick w MP: Drak

Piwa: 3

Respekt: 50

Oski, mo?na prosi? o jaki? wz?r? Jestem jeszcze s?aby w lua ;/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-06, 18:43


Oski

LUA Scripter






Wiek: 30
Na forum: 5246 dni
Posty: 428
Nick w MP: Oski

Piwa: 56

Respekt: 75,1


rangi = {}
accName getAccountName getPlayerAccount thePlayer ) )
if isObjectInACLGroup ("user."..accNameaclGetGroup "Policja" ) ) then rangi[#rangi+1]= "Policja" end
if isObjectInACLGroup ("user."..accNameaclGetGroup "Pogotowie" ) ) then rangi[#rangi+1]= "Pogo" end
if isObjectInACLGroup ("user."..accNameaclGetGroup "XXX" ) ) then rangi[#rangi+1]= "XX" end



--onPlayerLogin
setElementData(source,"Ranga","")
for i=1,#rangi do
if i+== #rangi then
setElementData(source,"Ranga",getElementData(thePlayer,"Ranga")..rangi[i])
else
setElementData(source,"Ranga",getElementData(thePlayer,"Ranga")..rangi[i]..",")
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-06, 18:51


AFX







Wiek: 41
Na forum: 4808 dni
Posty: 3
Nick w MP: XJL/AFX

Piwa: 1

Respekt: 50

Cytat:


--onPlayerLogin
setElementData(source,"Ranga","")
for i=1,#rangi do
if i+== #rangi then
setElementData(source,"Ranga",getElementData(thePlayer,"Ranga")..rangi[i])
else
setElementData(source,"Ranga",getElementData(thePlayer,"Ranga")..rangi[i]..",")
end


albo po prostu:

setElementData(source,"Ranga", table.concat(rangi, ", "))

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-06, 21:16


Drak







Wiek: 34
Na forum: 4903 dni
Posty: 71
Nick w MP: Drak

Piwa: 3

Respekt: 50

Zrobi?em wed?ug wzoru, ale wyskakuje b??d ;/

Kod:

[skrypty]/play/scoreboard.lua:23: <name> expected near '1'


Kod:
function addColumn()
    exports.scoreboard:addScoreboardColumn("Ranga")
end
addEventHandler("onResourceStart"getRootElement(), addColumn)

function rank()
    rangi = {}
    accName getAccountName getPlayerAccount thePlayer ) )
    if isObjectInACLGroup ("user."..accNameaclGetGroup "HeadAdmin" ) ) then rangi[#rangi+1]= "HeadAdmin" end
    if isObjectInACLGroup ("user."..accNameaclGetGroup "Skrypter" ) ) then rangi[#rangi+1]= "Skrypter" end
    if isObjectInACLGroup ("user."..accNameaclGetGroup "Admin" ) ) then rangi[#rangi+1]= "Admin" end
    if isObjectInACLGroup ("user."..accNameaclGetGroup "JuniorAdmin" )) then rangi[#rangi+1]= "JuniorAdmin" end
    if isObjectInACLGroup ("user."..accNameaclGetGroup "SuperModerator" )) then rangi[#rangi+1]= "SMod" end
    if isObjectInACLGroup ("user."..accNameaclGetGroup "Moderator" )) then rangi[#rangi+1]= "Mod" end
    if isObjectInACLGroup ("user."..accNameaclGetGroup "Vip" )) then rangi[#rangi+1]= "Vip" end
    if isObjectInACLGroup ("user."..accNameaclGetGroup "Gracz" )) then rangi[#rangi+1]= "Gracz" end
end

function rankSet()
    setElementData(source,"Ranga","")
    for i=1,#rangi do
    if i+== #rangi then
    setElementData(source,"Ranga",getElementData(thePlayer,"Ranga")..rangi[i])
    else
    setElementData(source,"Ranga",getElementData(thePlayer,"Ranga")..rangi[i]..",")
end
addEventHandler("onPlayerLogin"rankSet)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-06, 22:36


Oski

LUA Scripter






Wiek: 30
Na forum: 5246 dni
Posty: 428
Nick w MP: Oski

Piwa: 56

Respekt: 75,1


function rankSet()
    setElementData(source,"Ranga","")
    for i=1,#rangi do
    if i+== #rangi then
    setElementData(source,"Ranga",getElementData(thePlayer,"Ranga")..rangi[i:1])
    else
    setElementData(source,"Ranga",getElementData(thePlayer,"Ranga")..rangi[i:2]..",")
end
addEventHandler("onPlayerLogin"rankSet)


Zamie? na:

function rankSet()
rankSet()
table.concat(rangi", ")
end
addEventHandler("onPlayerLogin"rankSet)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-06, 22:39


Riot

3X






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

Piwa: 286

Respekt: 123
Respekt: 123

"Oski" napisał/a:

Zamie? na:


function rankSet()
rankSet()
table.concat(rangi, ", ")
end
addEventHandler("onPlayerLogin", rankSet)


Co? tu jest nie tak..Odnosisz si? do funkcji kt?rej aktualnie u?ywasz?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-04-07, 00:28


Piorun







Wiek: 32
Na forum: 6712 dni
Posty: 1837
Nick w MP: Piorun

Piwa: 516

Respekt: 480,7
Respekt: 480,7

Ziomek11, takie co? jest dopuszczalne. To si? jako? nazywa?o .. aczkolwiek zapomnia?em.

Podpis
Możesz mnie znaleźć na: Facebook
Postaw piwo autorowi tego posta
 

 
Tagi: rangi :: scoreboardzie
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Rangi na scoreboardzie 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