Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.
GTAONLINE.PL
Tematy otagowane jako: countplayer
1. CountPlayer
Witam, mam tutaj funkcj? na to aby do danej dru?yny mog?o wej?? maks. 10 graczy.
I nie jestem pewny dlaczego nie dzia?a, najpewniej dlatego, ?e nie ma eventHandlera ale nie wiem jak go u?y? :P Za pomoc stawiam piwo. A oto kodzik:

Kod:

function getCountPlayerInTeam ( team )
assert ( isElement ( team ) and getElementType ( team ) == "GROM", "Bad argument @ getCountPlayerInTeam [ team expected, got " .. type ( team ) .. " ]" )
local countPlayer = 10
for _,v in ipairs ( getElementsByType ( "player" ) ) do
if ( getPlayerTeam ( v ) == team ) then
countPlayer = countPlayer + 1
end
end
return countPlayer
end