Wysłany: 2011-08-29, 14:39
Adrian1545
Wiek: 30 Na forum: 5647 dni Posty: 78
Nick w MP: [sXc]Lexon
Piwa : 125
Witam.
Mam skrypt kt?ry zmienia kolor chatu tylko osobom z grupy Admin. Tzn jesli jestes adminem do piszesz na kolor niebieski a inni na bia?y (podstawowy). Moje pytanie jest takie: dlaczego jak w??cze ten skrypt to osoba kt?ra pisze to wysy?a dwie wiadomosci ?
Kod: function setPlayerChatColor(message, messageType)
if (messageType == 0) then
local thePlayer = getPlayerName(source)
cancelEvent()
if not (getPlayerTeam(source) == shcteam) then
local team = getPlayerTeam(source)
local r,g,b
if (team) then
r,g,b = getTeamColor(team)
else
r,g,b = 231, 106, 12
end
message = string.gsub(message,"fuck","****")
message = string.gsub(message,"bitch","*****")
message = string.gsub(message,"ficken","******")
message = string.gsub(message,"wixxer","******")
message = string.gsub(message,"arsch","*****")
outputChatBox(thePlayer.. ': #FFFFFF' ..tostring(message),getRootElement(),r,g,b,true)
else
local r,g,b = getTeamColor(shcteam)
outputChatBox(thePlayer.. ': #00E5FF' ..tostring(message),getRootElement(),r,g,b,true)
end
end
end
addEventHandler( "onPlayerChat", getRootElement(), setPlayerChatColor )
Wysłany: 2011-08-29, 17:21
Piorun
Wiek: 32 Na forum: 6712 dni Posty: 1837
Nick w MP: Piorun
Piwa : 516
Po pierwsze - to nie jest dla admin?w tylko dla graczy, kt?rzy s? w dru?ynie 'shcteam'.
Po drugie - pisa?e? to sam? W?tpi?. Jakby? pisa? sam to by? znalaz? b??dy, bo skrypt jest dosy? zaawansowany co wskazuje na wysoki poziom tw?rcy.
Tyle z mojej strony.
Ja na razie go rozpracowuj?, bo w sumie sam nie wiem czemu si? b??d pojawi?.
@EDIT
Kod: function setPlayerChatColor(message, messageType)
if (messageType == 0) then
local playerTeam = getPlayerTeam(source)
local thePlayer = getPlayerName(source)
if not (getTeamName(playerTeam) == "shcteam") then
local r,g,b
if (playerTeam) then
r,g,b = getTeamColor(team)
else
r,g,b = 231, 106, 12
end
message = string.gsub(message,"f**k","****")
message = string.gsub(message,"b***h","*****")
message = string.gsub(message,"ficken","******")
message = string.gsub(message,"wixxer","******")
message = string.gsub(message,"arsch","*****")
outputChatBox(thePlayer..': #FFFFFF' ..tostring(message), getRootElement(), r, g, b, true)
cancelEvent()
else
local r,g,b = getTeamColor(playerTeam)
outputChatBox(thePlayer.. ': #00E5FF' ..tostring(message), getRootElement(), r, g, b, true)
cancelEvent()
end
end
end
addEventHandler( "onPlayerChat", getRootElement(), setPlayerChatColor )
Zrobi?em na dru?yn? jednak.
Mimo i? ten skrypt dzia?a b?dzie wy?wietla? si? warning . By go nie by?o musisz zadeklarowa?, ?e je?eli getPlayerTeam zwr?ci element to funkcja ma dzia?a? (if costamcostam then).
Pozdrawiam.
Wysłany: 2011-08-29, 18:54
Adrian1545
Wiek: 30 Na forum: 5647 dni Posty: 78
Nick w MP: [sXc]Lexon
Piwa : 125
Nie bede pisa? nowego tematu wiec napisze tutaj. Chcia? bym aby si? da?o zrobic tak ze koles idze do wi?zienia ale nie na interior tylko na moje wybrane miejsce PosX, PosY, PosZ
Kod: function isPlayerInJail(thePlayer)
if (getElementInterior(thePlayer) == 10) then
local x, y, z = getElementPosition(thePlayer)
if (y >= 107 and y <= 112.1) then
if (x >= 214 and x <= 229) then
return true
end
end
end
return false
end
Wysłany: 2011-08-29, 18:58
Piorun
Wiek: 32 Na forum: 6712 dni Posty: 1837
Nick w MP: Piorun
Piwa : 516
Ale, ?e ... co?
Chodzi Ci o to, ?e jak kto? wpisze komend? np. /jail [nazwa gracza] to go przenosi do wi?zienia?
Wysłany: 2011-08-29, 19:04
Jacob
Głupiomądry
Wiek: 28 Na forum: 5502 dni Posty: 967
Nick w MP: Jacob
Piwa : 786
Wysłany: 2011-08-29, 19:11
Piorun
Wiek: 32 Na forum: 6712 dni Posty: 1837
Nick w MP: Piorun
Piwa : 516
Jacob - nie! Raczej setElementPosition .
Wysłany: 2011-08-29, 19:26
Jacob
Głupiomądry
Wiek: 28 Na forum: 5502 dni Posty: 967
Nick w MP: Jacob
Piwa : 786
Mo?liwe, nie widzia?em tej funkcji
Wysłany: 2011-08-29, 20:15
Riot
3X
Wiek: 29 Na forum: 5729 dni Posty: 1123
Nick w MP: Riot/3X
Piwa : 286
Hm, co do pytania kiedy? co? takiego mia?em, ale nie pami?tam jak to naprawilem, spr?buj wy?aczy? play albo freeorama jesli masz wlaczonego i wtedy stestuj.
Wysłany: 2011-08-30, 10:17
Adrian1545
Wiek: 30 Na forum: 5647 dni Posty: 78
Nick w MP: [sXc]Lexon
Piwa : 125
Skrypt dzia?a tylko chodzi o to ze jak wstawie kogos do wi?zienia to jest w interiorze a ma byc w miejscy wyznaczonym przez ze mnie PosX, PosY, PosZ
Ca?y kod
Kod: function exitJail(hitElement, matchingDimension)
setElementInterior(hitElement, 0, -1616, 686, 7)
end
function isPlayerInJail(thePlayer)
if (getElementInterior(thePlayer) == 10) then
local x, y, z = getElementPosition(thePlayer)
if (y >= 107 and y <= 112.1) then
if (x >= 214 and x <= 229) then
return true
end
end
end
return false
end
function jailArrestPlayer(thePlayer, playerSource)
if (isPlayerInJail(thePlayer) == true) then
outputChatBox(getPlayerName(thePlayer) .. " jest ju? w wi?zieniu!", playerSource, 255, 0, 0, true)
else
outputChatBox("#FF0000*INFO: #0000FFZosta?e? wsadzony do wi?zienia przez: " .. getPlayerName(playerSource), thePlayer, 255, 255, 255, true)
setElementInterior(thePlayer, 10)
local nb = math.random(4)
if (nb == 1) then
setElementPosition(thePlayer, 228, 112, 1000, true)
elseif (nb == 2) then
setElementPosition(thePlayer, 224, 112, 1000, true)
elseif (nb == 3) then
setElementPosition(thePlayer, 220, 112, 1000, true)
elseif (nb == 4) then
setElementPosition(thePlayer, 216, 112, 1000, true)
end
end
end
function jailReleasePlayer(thePlayer, playerSource)
if (isPlayerInJail(thePlayer) == false) then
outputChatBox(getPlayerName(thePlayer) .. " nie jest w wi?zieniu!", playerSource, 255, 0, 0, true)
else
outputChatBox("#FF0000*INFO: #0000FFZosta?e? wypuszczony przez: " .. getPlayerName(playerSource), thePlayer, 255, 255, 255, true)
setElementInterior(thePlayer, 0)
setElementPosition(thePlayer, -1550, 659, 7, true)
end
end
addEvent("arrestPlayerEvent", true)
addEventHandler("arrestPlayerEvent", getRootElement(), jailArrestPlayer)
addEvent("releasePlayerEvent", true)
addEventHandler("releasePlayerEvent", getRootElement(), jailReleasePlayer)
Prosze o pomoc
Wysłany: 2011-08-30, 10:19
Jacob
Głupiomądry
Wiek: 28 Na forum: 5502 dni Posty: 967
Nick w MP: Jacob
Piwa : 786
Spr?buj napisa?. Po co robi? mase linijek jak mo?na kilka.
Dam Ci przyk?ad:
Kod: function jail ()
setElementPosition(thePlayer, x, y, z, true)
end
addCommandHandler ("komenda", jail)
Tyle wystarczy
Wysłany: 2011-08-30, 11:18
Riot
3X
Wiek: 29 Na forum: 5729 dni Posty: 1123
Nick w MP: Riot/3X
Piwa : 286
Jacob, tw?j kod jest na teleport a nie na wsadzenie kogo? chyba
Wysłany: 2011-08-30, 11:37
Jacob
Głupiomądry
Wiek: 28 Na forum: 5502 dni Posty: 967
Nick w MP: Jacob
Piwa : 786
A jak zrobisz inaczej? Nie ma funkcji wsad? do wi?zienia To jest teleport do wi?zienia. Da?em przyk?ad on sobie przerobi go tak, ?e musi wpisa? jeszcze nick gracza
Tagi: chat :: dwa :: słowa
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: