Jump to content

طلب كود لما يكتب كلام يطلع صوت للسيرفر كلهم


Recommended Posts

السلام عليكم

حبيت آستفسر عن مثال

لسكربت :

انه الشخص اذا كتب

/sound

/sound1

الامر الاول يطلع صوت للناس كلهم اللي بالسيرفر + ويطلع كلام بالشات

واذا كتب الامر الثاني نفس الشي بس بصوت ثاني

, بس اتمنى يكون بطريقه اسهل يعني يفضل لو يكون table

على ما اضن علشان تسهل العمليه

وآهم شي لما يخلص الصوت يعني تنتهي مدته يقفل خلاص , يعني مايقعد يعيد كل شوي

آتمنى مثال :)

Link to comment
  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  
-- Client Side 
PlaySoundFunction_ = function ( ) 
if isElement(theSound) then destroyElement(theSound) theSound = false end 
theSound = playSound("sound1.mp4",true); 
    end 
addEvent("PlaySound",true); 
addEventHandler("PlaySound",root,PlaySoundFunction_); 
  
  
StopSoundFunction_ = function ( ) 
if isElement(theSound) then destroyElement(theSound) theSound = false end 
end 
addEvent("StopSound",true); 
addEventHandler("StopSound",root,StopSoundFunction_); 

  
-- Server Side 
CheckTheMsgFunction_ = function (theCmd) 
 if ( theCmd == "sound" ) then 
 triggerClientEvent("PlaySound",root); 
 elseif ( theCmd == "stopS" ) then 
    if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( "Admin" ) ) then 
triggerClientEvent("StopSound",root) 
        end 
    end 
end 
addEventHandler("onPlayerCommand",root,CheckTheMsgFunction_); 

سويت هذا قبل فتره , بس مافيه طريقه آسهل ؟

لآنه معقد كل شوي لازم انسخ نفس الفنكشن واعدل داخله علشان يضبط وحوسه

طبعا الكود فيه نواقص ( حاذفها بنفسي علشان نفتك من السرقه )!

Link to comment

^ الكود انا اذكر سويتة لك -_-" ذآ ذذ .. عموما مالنا بـ الطويلة تقدر تسوية كذآ ..

local vCommandLoader = {     
        { 'Command','Path' }, 
        { 'Command','Path' }, 
        { 'Command','Path' }, 
        { 'Command','Path' }, 
        { 'Command','Path' }, 
        { 'Command','Path' }, 
        { 'Command','Path' }, 
        { 'Command','Path' } 
} 
  
addEventHandler('onPlayerCommand',root, 
    function ( vCmd ) 
     if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( 'Admin' ) ) then 
        for index,value in ipairs ( vCommandLoader ) do 
            if ( vCmd == value [ 1 ] ) then 
                triggerClientEvent ( 'vSoundStartHandler',root,value [ 2 ] ); 
                outputChatBox ( value [ 1 ] ) 
            elseif ( vCmd == 'stopS' ) then 
                triggerClientEvent ( 'vSoundStopHandler',root ); 
            end; 
        end; 
    end; 
end 
); 

addEvent('vSoundStartHandler',true) 
addEventHandler('vSoundStartHandler',root, 
    function ( vPath ) 
            if vPath then 
                if isElement ( vSound ) then 
                    destroyElement ( vSound ); 
            end; 
                vSound = playSound ( vPath ); 
        end; 
    end 
); 
  
addEvent('vSoundStopHandler',true) 
addEventHandler('vSoundStopHandler',root, 
    function (  ) 
            if isElement ( vSound ) then 
               destroyElement ( vSound ); 
        end; 
    end 
); 

Link to comment

ضبطت حركتك ماتقصر

بس انا ابي لما يكتب مثلاً sound1

يطلع كلام بالشات انا احدده

ولما يكتب sound

يطلع كلام بالشات انا حدده

وياليت الكود يدعم الالوان هذي #FF0000

Link to comment
^ الكود انا اذكر سويتة لك -_-" ذآ ذذ .. عموما مالنا بـ الطويلة تقدر تسوية كذآ ..
local vCommandLoader = {     
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' } 
} 
  
addEventHandler('onPlayerCommand',root, 
    function ( vCmd ) 
     if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( 'Admin' ) ) then 
        for index,value in ipairs ( vCommandLoader ) do 
            if ( vCmd == value [ 1 ] ) then 
                triggerClientEvent ( 'vSoundStartHandler',root,value [ 2 ] ); 
                outputChatBox ( value [ 3 ] ) 
            elseif ( vCmd == 'stopS' ) then 
                triggerClientEvent ( 'vSoundStopHandler',root ); 
            end; 
        end; 
    end; 
end 
); 

addEvent('vSoundStartHandler',true) 
addEventHandler('vSoundStartHandler',root, 
    function ( vPath ) 
            if vPath then 
                if isElement ( vSound ) then 
                    destroyElement ( vSound ); 
            end; 
                vSound = playSound ( vPath ); 
        end; 
    end 
); 
  
addEvent('vSoundStopHandler',true) 
addEventHandler('vSoundStopHandler',root, 
    function (  ) 
            if isElement ( vSound ) then 
               destroyElement ( vSound ); 
        end; 
    end 
); 

جرب ذذ

Link to comment

طريقتك ضبطت وطلع الكلام بس ماقدرت الونه زي كذا

#FF0000

+

تقدر تضيف للكود انه بآخر الكلام اللي اكتبه يطلع اسم اللاعب اللي كتب الامر ؟

Link to comment
local vCommandLoader = {     
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' } 
} 
  
addEventHandler('onPlayerCommand',root, 
    function ( vCmd ) 
     if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( 'Admin' ) ) then 
        for index,value in ipairs ( vCommandLoader ) do 
            if ( vCmd == value [ 1 ] ) then 
                triggerClientEvent ( 'vSoundStartHandler',root,value [ 2 ] ); 
                outputChatBox ( value [ 3 ],source,255,255,255,true ) 
            elseif ( vCmd == 'stopS' ) then 
                triggerClientEvent ( 'vSoundStopHandler',root ); 
            end; 
        end; 
    end; 
end 
); 

الحين يصير يقبل

Link to comment

يصير كذا ؟

local vCommandLoader = {     
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' }, 
        { 'Command','Path','msg' } 
} 
  
addEventHandler('onPlayerCommand',root, 
    function ( vCmd ) 
     if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( 'Admin' ) ) then 
        for index,value in ipairs ( vCommandLoader ) do 
            if ( vCmd == value [ 1 ] ) then 
                triggerClientEvent ( 'vSoundStartHandler',root,value [ 2 ] ); 
                outputChatBox ( 'Sound Has Been Started By '..getPlayerName ( source )..' ',root,255,255,255,true ) 
            elseif ( vCmd == 'stopS' ) then 
                triggerClientEvent ( 'vSoundStopHandler',root ); 
            end; 
        end; 
    end; 
end 
); 

Link to comment
  
-- Server Side! 
local vCommandLoader = { 
      { 'bla','Sound/bukbuk.mp3','[sounds]blabla Sound Has Been Started By '..getPlayerName(thePlayer)..' '} 
} 
addEventHandler('onPlayerCommand',root, 
    function ( vCmd ) 
     if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( 'Admin' ) ) then 
        for index,value in ipairs ( vCommandLoader ) do 
            if ( vCmd == value [ 1 ] ) then 
                triggerClientEvent ( 'vSoundStartHandler',root,value [ 2 ] ); 
                outputChatBox ( value [ 3 ],source,255,255,255,true ) 
            elseif ( vCmd == 'stopS' ) then 
                triggerClientEvent ( 'vSoundStopHandler',root ); 
            end; 
        end; 
    end; 
end 
); 

Link to comment
  
-- Server Side! 
local vCommandLoader = { 
      { 'bla','Sound/bukbuk.mp3','Sound'} 
} 
addEventHandler('onPlayerCommand',root, 
    function ( vCmd ) 
     if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( 'Admin' ) ) then 
        for index,value in ipairs ( vCommandLoader ) do 
            if ( vCmd == value [ 1 ] ) then 
                triggerClientEvent ( 'vSoundStartHandler',root,value [ 2 ] ); 
                outputChatBox ( value [ 3 ],source,255,255,255,true ) 
                outputChatBox ( '[sounds]blabla Sound Has Been Started By '..getPlayerName( source )..' ',root,255,255,255,true ) 
            elseif ( vCmd == 'stopS' ) then 
                triggerClientEvent ( 'vSoundStopHandler',root ); 
            end; 
        end; 
    end; 
end 
); 

حط هذا هنا لانة الاعب ماهو معرف جرب كذآ !

Link to comment

الشي هذا يشتغل على امر واحد

يعني ما اقدر اضيف اوامر

بس اقدر اعرف الاوت بوت شات بوكس ؟

اعرف = حرف الراء بالشده ( علشان تفهمني ^^ ) د

هذي كلمة blabla

ابدلها لـ ..text..

..text.. = الكلام اللي اكتبه فوق

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...