Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.
GTAONLINE.PL
Tematy otagowane jako: megafon
1. Megafon SAPD
Witam, chcia?bym stworzy? megafon dla SAPD, mam ju? kod lua, ale co? gdy wpisuje komende to mi nie dzia?a, dlatego pisz? do was pro?b? o pomoc


function megafon(plr, cmd, ...)
    if 
not ... then return end
    
if getElementData(plr,'player:faction') == 'SAPD' then
     local text 
= table.concat({...}, " ")
        
local posX, posY, posZ=getElementPosition(plr)
        
local sphere=createColSphere( posX, posY, posZ, 55)
        
local nearbyPlayers=getElementsWithinColShape(sphere, 'player')
        
destroyElement(sphere)
        for 
index, player in ipairs( nearbyPlayers ) do
            
outputChatBox('[POLICJA] Megafon: '..text..'!', player, 255, 255, 0)
        
end
    end
end
addCommandHandler
('meg', megafon)
2. Megafon w SAPD.
Witam, megafon dzia?a ale.

Jak wpisz? /meg sta? tutaj..........

to pojawia si? tylko [POLICJA] sta?!!

a nie ca?e zdanie.

a jak wpisez stac-tutaj

to juz wszystko okej

jakies porady?

kod to


function megafon(plr, cmd, msg)
    if 
not msg then return end
    
if getElementData(plr,'player:duty') == 'SAPD' then
        local posX
, posY, posZ=getElementPosition(plr)
        
local sphere=createColSphere( posX, posY, posZ, 55)
        
local nearbyPlayers=getElementsWithinColShape(sphere, 'player')
        
destroyElement(sphere)
        for 
index, player in ipairs( nearbyPlayers ) do
            
outputChatBox('[POLICJA] Megafon: '..msg..'!', player, 255, 255, 0)
        
end
    end
end
addCommandHandler
('meg', megafon)