Wysłany: 2015-09-21, 21:45
mlodasnygo
Wiek: 16 Na forum: 3973 dni Posty: 205
Piwa : 518
Witam, chcia?bym si? spyta? jak doda?, aby chat by? tylko dla kogo? kto jest w ACL
"Premium" ? Chodzi mi o globala..
Skrypt By DaxRel69
Kod:
function RGBToHex ( red , green , blue , alpha )
if(( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ))) then
return nil
end
if( alpha ) then
return string . format ( "#%.2X%.2X%.2X%.2X" , red , green , blue , alpha )
else
return string . format ( "#%.2X%.2X%.2X" , red , green , blue )
end
end
function onChat ( message , messagetype )
if isGuestAccount ( getPlayerAccount ( source )) then
outputChatBox ( "Najpierw wejd? do gry." , source , 255 , 000 , 000 )
return end
if messagetype == 0 then
cancelEvent ()
local x , y , z = getElementPosition ( source )
local chatCol = createColSphere ( x , y , z , 20 )
local chatRadius = getElementsWithinColShape ( chatCol )
local r , g , b = getPlayerNametagColor ( source )
for key , value in ipairs ( chatRadius ) do
outputChatBox ( getPlayerName ( source ).. "#FFFFFF: " .. message , value , r , g , b , true )
end
outputServerLog ( "LOCAL " .. getPlayerName ( source ).. ": " .. message )
-- if not isPedInVehicle ( source ) then
-- local talktime = string . len ( message )* 200
-- setPedAnimation ( source , "ped" , "IDLE_chat" , 0 , true , false , true , true )
-- setTimer (function () setPedAnimation ( source , nil , nil , nil ) end , talktime , 1 )
-- end
elseif messagetype == 1 then
cancelEvent ()
local x , y , z = getElementPosition ( source )
local chatCol = createColSphere ( x , y , z , 30 )
local chatRadius = getElementsWithinColShape ( chatCol )
for key , value in ipairs ( chatRadius ) do
outputChatBox ( "#FF5555*" .. getPlayerName ( source ).. " " .. message , value , 0 , 0 , 0 , true )
outputServerLog ( "ME *" .. getPlayerName ( source ).. " " .. message )
end
end
end
addEventHandler ( "onPlayerChat" , getRootElement (), onChat )
function global( psource , command ,...)
if isGuestAccount ( getPlayerAccount ( psource )) then
outputChatBox ( "Najpierw wejd? do gry." , psource , 255 , 000 , 000 )
return end
local tekst = table . concat ({...}, " " )
r , g , b = getPlayerNametagColor ( psource )
outputChatBox ( "#FF0000[Global] " .. RGBToHex ( r , g , b ).. getPlayerName ( psource ).. "#FFFFFF: " .. tekst , getRootElement (), r , g , b , true )
outputServerLog ( "GLOBAL " .. getPlayerName ( psource ).. ": " .. tekst )
end
addCommandHandler ( "global" ,global)
addEventHandler ( "onPlayerLogin" , getRootElement (),function ()
bindKey ( source , "u" , "down" , "chatbox" , "global" )
end )
addEventHandler ( "onResourceStart" , root ,
function ( )
for k , v in ipairs ( getElementsByType ( "player" , root )) do
unbindKey ( v , "u" , "down" , "chatbox" , "global" )
bindKey ( v , "u" , "down" , "chatbox" , "global" )
end
end )
Chcia?bym doda?, aby mogl na globalu pisa? tylko Admin ,Moderator i Premium
ACL:
Admin : Admin
Moderator : Moderator
Premium : Premium
Wiem, ze jest to bardzo proste, ale nie mog? ogarn?? gdzie i w kt?rym miejscu to wstawia? ;v
Za pomoc oczywi?cie piwko.. i reputacja!
Pozdrawiam,
mlodasny. :DDD
[/b]
Podpis
600 dni -
10 marca 2017
500 piw -
10 marca 2017
Wysłany: 2015-09-21, 21:48
#404
Wiek: 26 Na forum: 4772 dni Posty: 1438
Piwa : 2512
- posiadasz tam przyk?ad u?ycia i potrzebne do tej funkcji parametry.
Tworzysz tak? instrukcj? warunkow?, je?eli jest w tej grupie wykonujesz reszt? kodu, je?eli nie, zostawiasz pustke.
W jakim miejscu ? - Sugeruj? pod warunkiem na bycie zalogowanym, przynajmniej 1 problem odpadnie xD.
Wysłany: 2015-09-22, 15:40
mlodasnygo
Wiek: 16 Na forum: 3973 dni Posty: 205
Piwa : 518
Emm, ok?
Czy teraz dobrze doda?em i czy dobrze zrobi?em aby mogl jeszcze RCON?
Fragment Kodu...
function global( psource , command ,...)
if isGuestAccount ( getPlayerAccount ( psource )) then
accountname = getAccountName ( getPlayerAccount ( v ))
ifObjectInACLGroup ( "user." .. accountname , aclGetGroup ( "Admin" ) ) then or ifObjectInACLGroup ( "user." .. accountname , aclGetGroup ( "RCON" ) ) then
end
outputChatBox ( "Najpierw wejd? do gry." , psource , 255 , 000 , 000 )
return end
local tekst = table . concat ({...}, " " )
r , g , b = getPlayerNametagColor ( psource )
outputChatBox ( "#FF0000[Global] " .. RGBToHex ( r , g , b ).. getPlayerName ( psource ).. "#FFFFFF: " .. tekst , getRootElement (), r , g , b , true )
outputServerLog ( "GLOBAL " .. getPlayerName ( psource ).. ": " .. tekst )
end
addCommandHandler ( "global" ,global)
Podpis
600 dni -
10 marca 2017
500 piw -
10 marca 2017
Wysłany: 2015-09-22, 15:44
#404
Wiek: 26 Na forum: 4772 dni Posty: 1438
Piwa : 2512
bardziej co? takiego
function global( psource , command ,...)
if isGuestAccount ( getPlayerAccount ( psource )) then
outputChatBox ( "Najpierw wejd? do gry." , psource , 255 , 000 , 000 )
return end
accountname = getAccountName ( getPlayerAccount ( psorce ))
if isObjectInACLGroup ( "user." .. accountname , aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user." .. accountname , aclGetGroup ( "RCON" )) then
local tekst = table . concat ({...}, " " )
r , g , b = getPlayerNametagColor ( psource )
outputChatBox ( "#FF0000[Global] " .. RGBToHex ( r , g , b ).. getPlayerName ( psource ).. "#FFFFFF: " .. tekst , getRootElement (), r , g , b , true )
outputServerLog ( "GLOBAL " .. getPlayerName ( psource ).. ": " .. tekst )
else
outputChatBox ( "Brak dost?pu do chatu" , psource , 255 , 0 , 0 )
end
end
addCommandHandler ( "global" ,global)
Wysłany: 2015-09-22, 20:09
mlodasnygo
Wiek: 16 Na forum: 3973 dni Posty: 205
Piwa : 518
Stoj? na takim czym?...
function RGBToHex ( red , green , blue , alpha )
if(( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ))) then
return nil
end
if( alpha ) then
return string . format ( "#%.2X%.2X%.2X%.2X" , red , green , blue , alpha )
else
return string . format ( "#%.2X%.2X%.2X" , red , green , blue )
end
end
addEventHandler ( "onPlayerChat" , getRootElement (), onChat )
function global( psource , command ,...)
if isGuestAccount ( getPlayerAccount ( psource )) then
outputChatBox ( "Najpierw wejd? do gry." , psource , 255 , 000 , 000 )
return end
accountname = getAccountName ( getPlayerAccount ( psorce ))
if isObjectInACLGroup ( "user." .. accountname , aclGetGroup ( "Admin" ) ) or isObjectInACLGroup ( "user." .. accountname , aclGetGroup ( "RCON" ) ) or isObjectInACLGroup ( "user." .. accountname , aclGetGroup ( "Moderator" ) ) or isObjectInACLGroup ( "user." .. accountname , aclGetGroup ( "Console" ) ) or isObjectInACLGroup ( "user." .. accountname , aclGetGroup ( "SuperModerator" ) ) or isObjectInACLGroup ( "user." .. accountname , aclGetGroup ( "Premium" ) ) then
local tekst = table . concat ({...}, " " )
r , g , b = getPlayerNametagColor ( psource )
outputChatBox ( "#FF00cc[Global] #ffffff" .. RGBToHex ( r , g , b ).. getPlayerName ( psource ).. "#FFFFFF: " .. tekst , getRootElement (), r , g , b , true )
outputServerLog ( "GLOBAL " .. getPlayerName ( psource ).. ": " .. tekst )
else
outputChatBox ( "Brak dost?pu do chatu" , psource , 255 , 0 , 0 )
end
end
addCommandHandler ( "global" ,global)
addEventHandler ( "onPlayerLogin" , getRootElement (),function ()
bindKey ( source , "u" , "down" , "chatbox" , "global" )
end )
addEventHandler ( "onResourceStart" , root ,
function ( )
for k , v in ipairs ( getElementsByType ( "player" , root )) do
unbindKey ( v , "u" , "down" , "chatbox" , "global" )
bindKey ( v , "u" , "down" , "chatbox" , "global" )
end
end )
Ale gdy pisze na u pojawia si? te "Global:" Ale jak napisze np. "Global: TEST" To nie wy?wietla si? .
Usun??em locala, narazie nie potrzebny.
Pozdrawiam,
mlodasny
[ Dodano : 2015-09-23, 19:32 ]
No i jak? Bo co nie pyka..
Podpis
600 dni -
10 marca 2017
500 piw -
10 marca 2017
Wysłany: 2015-10-02, 16:31
Fanciak
BOT
Wiek: 25 Na forum: 4446 dni Posty: 728
Nick w MP: Fanciak
Piwa : 1572
function RGBToHex ( red , green , blue , alpha )
if(( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ))) then
return nil
end
if( alpha ) then
return string . format ( "#%.2X%.2X%.2X%.2X" , red , green , blue , alpha )
else
return string . format ( "#%.2X%.2X%.2X" , red , green , blue )
end
end
function global ( thePlayer , _ , ... )
local message = table . concat ( { ... }, " " )
if isGuestAccount ( getPlayerAccount ( psource )) then
outputChatBox ( "Najpierw wejd? do gry." , psource , 255 , 000 , 000 )
return end
if ( isPlayerOnGroup ( thePlayer ) ) then
for _ , player in ipairs ( getElementsByType ( "player" ) ) do
if ( isPlayerOnGroup ( player ) ) then
r , g , b = getPlayerNametagColor ( thePlayer )
outputChatBox ( "#FF00cc[Global] #ffffff" .. RGBToHex ( r , g , b ).. getPlayerName ( thePlayer ).. "#FFFFFF: " .. message , player , r , g , b , true )
outputServerLog ( "GLOBAL " .. getPlayerName ( thePlayer ).. ": " .. message )
end
end
else
outputChatBox ( "#ff0012Nie masz uprawnie? do tej komendy." , thePlayer , r , g , b , true )
end
end
addCommandHandler ( "global" , global )
function isPlayerOnGroup ( thePlayer )
local account = getPlayerAccount ( thePlayer )
local inGroup = false
for _ , group in ipairs ( { "RCON" , "Admin" , "SuperModerator" , "Moderator" , "Console" , "Premium" } ) do
if isObjectInACLGroup ( "user." .. getAccountName ( account ), aclGetGroup ( group ) ) then
inGroup = true
break
end
end
return inGroup
end
addEventHandler ( "onPlayerLogin" , getRootElement (),function ()
bindKey ( source , "u" , "down" , "chatbox" , "global" )
end )
addEventHandler ( "onResourceStart" , root ,
function ( )
for k , v in ipairs ( getElementsByType ( "player" , root )) do
unbindKey ( v , "u" , "down" , "chatbox" , "global" )
bindKey ( v , "u" , "down" , "chatbox" , "global" )
end
Powinno byc git
Tagi: dodanie :: chatu :: tylko :: dla :: acl!!!
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: