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

Wysłany: 2017-12-09, 11:37


Pawlo3D







Wiek: 31
Na forum: 3597 dni
Posty: 5
Nick w MP: xPawlo



Respekt: 50

Wie kto? mo?e co tu jest nie tak? W konsoli wywala b??d "Bad argument 1 @ isPlayerInTeam [player expected, got nil]". Dopiero co zacz??em pisa? skrypty :->

Kod:

brama = createObject ( 980, 1587.9000244141, -1638.3000488281, 13.89999961853, 0, 0, 0 )

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


addCommandHandler("open",function()
local team = getTeamFromName("Milicja")
if isPlayerInTeam(source, team) then
moveObject ( brama, 2500, 1587.9000244141, -1638.3000488281, 8.5 )
end
end)


addCommandHandler("close",function()
local team = getTeamFromName("Milicja")
if isPlayerInTeam(source, team) then
moveObject ( brama, 2500, 1587.9000244141, -1638.3000488281, 13.89999961853 )
end
end )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-09, 14:39


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

w komendach masz da? argumenty "plr,cmd" i w kodzie tych komend zmie? source na plr

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-09, 17:40


Pawlo3D







Wiek: 31
Na forum: 3597 dni
Posty: 5
Nick w MP: xPawlo



Respekt: 50

Dzi?ki wielkie :) Teraz dzia?a.

Postaw piwo autorowi tego posta
 

 
Tagi: isplayerinteam :: [player :: expected :: got :: nil]
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » isPlayerInTeam [player expected, got nil] 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