Jump to content

طلب تعديل على كود


Recommended Posts

السلام عليكم

عدلت على مود حق صوت الشات

لما حد يتكلم في الشات يطلع صوت

لكن

اضفت تحقق وهو ان اذا اللاعب كان في قروب الكوسنول فقط يطلع صوت

لكن حصل خطأ مدري وش هو

server

function chat (thePlayer) 
    local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Console" ) ) then 
triggerClientEvent("sonido",getRootElement()) 
end 
end 
addEventHandler ( "onPlayerChat", getRootElement(), chat ) 

================

client

function playSonido() 
local sound = playSound("chat.mp3",false) 
setSoundVolume(sound, 0.9) 
end 
addEvent("sonido",true) 
addEventHandler("sonido",getRootElement(),playSonido) 

Link to comment

Server side #

addEventHandler ("onPlayerChat", root,  
    function (plr) 
        local accName = getAccountName (getPlayerAccount (plr)) 
        if isObjectInACLGroup ("user." .. accName, aclGetGroup ("Console")) then 
            triggerClientEvent (root, "PlaySound", plr) 
        end 
    end 
) 

Client side #

addEvent ("PlaySound", true) 
addEventHandler ("PlaySound", root,  
    function () 
        local sound = playSound("chat.mp3", false) 
        setSoundVolume(sound, 0.9) 
    end 
) 
Link to comment
Server side #

addEventHandler ("onPlayerChat", root,  
    function (plr) 
        local accName = getAccountName (getPlayerAccount (plr)) 
        if isObjectInACLGroup ("user." .. accName, aclGetGroup ("Console")) then 
            triggerClientEvent (root, "PlaySound", plr) 
        end 
    end 
) 

خطأ

it must be like this

addEventHandler ("onPlayerChat", root,  
    function (message, messageType) 
      if messageType == 0 then 
        local accName = getAccountName (getPlayerAccount (source)) 
        if isObjectInACLGroup ("user." .. accName, aclGetGroup ("Console")) then 
            triggerClientEvent (root, "PlaySound", source) 
        end 
    end 
end  
) 

The source of this event is the player who sent the chatbox message.

Link to comment
triggerClientEvent("sonido",getRootElement()) -- هنا ناقص ارقمنت الي بيظهر له الكلام  
  
-- يصير كذا 
  
triggerClientEvent(root, "sonido", source) 

root ما له علاقة، الأرقمنت ذا اختياري مو اجباري و إذا ما حطه تلقائي يصير

onPlayerChat كان مستخدم بارتمر في الأفنت

الأفنت ذا اول بارتمار فيه هو الكلام الي انكتب بالشات ماهو اللاعب الي كتب في الشات

eHs6swv.png

هو اللاعب الي كتب في الشات و هو الي المفترض تجيب الأكاونت حقه onPlayerChat السورس في الأفنت

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...