Wysłany: 2014-06-22, 12:28
Maciąg
Wiek: 26 Na forum: 4376 dni Posty: 211
Nick w MP: Dawirzo
Piwa : 149
Elo, witam Jak zrobi? czat, tak aby nie by? ci?gle globalny, tylko jak kto? napisze wiadomo?? to wy?wietla si? tylko nad nim + na czacie osobom, kt?re s? w pobli?u, prosz? o gotowy skrypt (najlepiej) lub o r??nego rodzaju pomoc
Stawiam piwo, nawet za dobre ch?ci
Wysłany: 2014-06-22, 17:26
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
local chatRadius = 50
function sendMessageToNearbyPlayers ( message , messageType )
if ( messageType == 0 ) then
local posX , posY , posZ = getElementPosition ( source )
local chatSphere = createColSphere ( posX , posY , posZ , chatRadius )
local nearbyPlayers = getElementsWithinColShape ( chatSphere , "player" )
local idplayer = getElementData ( source , "playerid" )
destroyElement ( chatSphere )
for index , nearbyPlayer in ipairs ( nearbyPlayers ) do
local red , green , blue = getPlayerNametagColor ( source )
local nick = getPlayerName ( source )
-- outputChatBox ( "[" .. tonumber ( idplayer ).. "] " .. nick .. ": #ffffff" .. message , nearbyPlayer , red , green , blue , true )
konto = getPlayerAccount ( source )
local idplayer = getElementData ( source , "playerid" )
local r , g , b = getPlayerNametagColor ( source )
if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source )), aclGetGroup ( "Admin" ) ) and r == 204 and g == 255 and b == 0 then
cancelEvent ( )
outputChatBox ( "#FFFF00[" .. tonumber ( idplayer ).. "] #FFFF00ADMINISTRATOR #ffffff " .. getPlayerName ( source ) .. ":#FFFFFF " .. message , nearbyPlayer , r , g , b , true )
elseif isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source )), aclGetGroup ( "RCON" ) ) and r == 204 and g == 0 and b == 0 then
cancelEvent ( )
r , g , b = getPlayerNametagColor ( source )
outputChatBox ( "#FFFF00[" .. tonumber ( idplayer ).. "] #CC0000RCON #ffffff" .. getPlayerName ( source ) .. ":#FFFFFF " .. message , nearbyPlayer , r , g , b , true )
elseif isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source )), aclGetGroup ( "SSupport" ) ) and r == 255 and g == 0 and b == 255 then
cancelEvent ( )
r , g , b = getPlayerNametagColor ( source )
outputChatBox ( "#ffffff[" .. tonumber ( idplayer ).. "] #FF00FFSuper Support#ffffff " .. getPlayerName ( source ) .. ":#FFFFFF " .. message , nearbyPlayer , r , g , b , true )
elseif isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source )), aclGetGroup ( "Support" ) ) and r == 204 and g == 102 and b == 0 then
cancelEvent ( )
r , g , b = getPlayerNametagColor ( source )
outputChatBox ( "#ffffff[" .. tonumber ( idplayer ).. "] #CC6600Support#ffffff " .. getPlayerName ( source ) .. ":#FFFFFF " .. message , nearbyPlayer , r , g , b , true )
elseif isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source )), aclGetGroup ( "VIP" ) ) then
cancelEvent ( )
r , g , b = getPlayerNametagColor ( source )
outputChatBox ( "#FFFF00[" .. tonumber ( idplayer ).. "] #FFFF00PREMIUM #ffffff|| " .. getPlayerName ( source ) .. ":#FFFFFF " .. message , nearbyPlayer , r , g , b , true )
elseif isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source )), aclGetGroup ( "SzefPolicji" ) ) and type == 0 and r == 0 and g == 0 and b == 255 then
cancelEvent ( )
r , g , b = getPlayerNametagColor ( source )
outputChatBox ( "#0000FF[ #ff0000Szef Policji#0000FF ]#FFFFFF " .. getPlayerName ( source ) .. ": " .. message , nearbyPlayer , r , g , b , true )
elseif getAccountData ( konto , "duty" ) then
cancelEvent ( )
r , g , b = getPlayerNametagColor ( source )
outputChatBox ( "#ffffff[" .. tonumber ( idplayer ).. "] #0000FFPolicja #FFFFFF " .. getPlayerName ( source ) .. ": " .. message , nearbyPlayer , r , g , b , true )
elseif getAccountData ( konto , "mechanik" ) then
cancelEvent ( )
r , g , b = getPlayerNametagColor ( source )
outputChatBox ( "#ffffff[" .. tonumber ( idplayer ).. "] #663300Mechanik #FFFFFF|| " .. getPlayerName ( source ) .. ": " .. message , nearbyPlayer , r , g , b , true )
elseif getAccountData ( konto , "mduty" ) then
cancelEvent ( )
r , g , b = getPlayerNametagColor ( source )
outputChatBox ( "#ffffff[" .. tonumber ( idplayer ).. "] #66CCFFDoktor #FFFFFF|| " .. getPlayerName ( source ) .. ": " .. message , nearbyPlayer , r , g , b , true )
elseif getAccountData ( konto , "nduty" ) then
cancelEvent ( )
r , g , b = getPlayerNametagColor ( source )
outputChatBox ( "#ffffff[" .. tonumber ( idplayer ).. "] #990099Newser#FFFFFF|| " .. getPlayerName ( source ) .. ": " .. message , nearbyPlayer , r , g , b , true )
elseif isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source )), aclGetGroup ( "Everyone" ) ) then
cancelEvent ( )
r , g , b = getPlayerNametagColor ( source )
outputChatBox ( "#ffffff[" .. tonumber ( idplayer ).. "]#ffffff Gracz " .. getPlayerName ( source ) .. ":#ffffff " .. message , nearbyPlayer , r , g , b , true )
end
end
cancelEvent ( )
end
end
addEventHandler ( "onPlayerChat" , getRootElement (), sendMessageToNearbyPlayers )
W kodzie s? r??ne urozmaicenia, gdy? wzi?ty jest z mojego serwera.
Wysłany: 2014-06-22, 17:32
Maciąg
Wiek: 26 Na forum: 4376 dni Posty: 211
Nick w MP: Dawirzo
Piwa : 149
Mog? wykorzysta? ten kod do swojego serwera? Je?li tak to dzi?kuj? ! Mo?na zamkn??
Podpis
Status prac nad Time to play RPG 25%
Wysłany: 2014-06-22, 17:38
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Maci?g , tak mo?esz, jednak nie zmieniaj tre?ci kodu i nie nadawaj Sobie autora.
Tagi: czat
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: