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

Wysłany: 2017-02-24, 21:47


saller123

Dopiero się ucze ;)






Wiek: 25
Na forum: 4679 dni
Posty: 95
Nick w MP: Davitek

Piwa: 212

Respekt: 70

Witam, mam ma?y problem z wys?aniem wiadomosci poprzez funkcj? "outputChatBox".

Wywala mi b??d:
Cytat:

ERROR: [SKRYPTY]\rpg_chat_lokalny\chat.lua:13: attempt to call a boolean value


server.lua
Kod:

addEventHandler("onPlayerChat", root, function(tresc, msgtype)
if (msgtype == 0) then
cancelEvent()
local x,y,z = getElementPosition(source)
for key, gracze in ipairs(getElementsByType("player")) do
local x2,y2,z2 = getElementPosition(gracze)
if (getDistanceBetweenPoints3D(x,y,z,x2,y2,z2)<20) then
local int = getElementInterior(source)
local dim = getElementDimension(source)
local int2 = getElementInterior(gracze)
local dim2 = getElementDimension(gracze)
if (int == int2 and dim == dim2) then
outputChatBox("#808080" ..getElementData(source, "id") " #FFFFFF" ..getPlayerName(source) ": #808080" ..tresc, gracze, 255, 255, 255, true )
end
end
end
end
end)




Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-24, 23:27


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

saller123, ktos nie ma nadanej elementdaty zapewne

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-25, 01:26


saller123

Dopiero się ucze ;)






Wiek: 25
Na forum: 4679 dni
Posty: 95
Nick w MP: Davitek

Piwa: 212

Respekt: 70

No w?a?nie problem w tym ?e ma :/
Np. w skrypcie "scoreboard" id si? normalnie wy?wietla?o :/

System id:

Kod:

function updateid ()
for i,p in pairs (getElementsByType ('player') do
setElementData( p,'id', i )
end
end
addEventHandler ('onPlayerQuit',getRootElement(),updateid)

function myid()
local players = getElementsByType ('player')
local myID = #players + 1
setElementData (source,'id',myID)
end
addEventHandler ('onPlayerJoin',getRootElement(),myid)


Podpis
Jeżeli ci pomogłem, postaw piwerko :D
Postaw piwo autorowi tego posta
 

 
Tagi: wyświetlanie :: textu :: chacie
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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