Jump to content

مشكلة | onPlayerChat


Recommended Posts

السلام عليكم ورحمة الله وبركاته

يَ شباب انا مسوي كود

ولوحة تاج خاص للاعب

يكتب اسم التاج في الإيديت edit box

ويختار لون التاج

المهم واجهتني مشكله مادري وين هي بالضبط

وحايس في الكود من يومين :lol::lol:

كلنت ---

local radio = guiRadioButtonSetSelected(RED,true) 
  
addEventHandler("onClientGUIClick", root, 
    function() 
            local getE = guiGetText ( edit ) 
         if ( source == OK ) then 
         elseif radio then 
             triggerServerEvent("RED",localPlayer, getE, radio)  
        end 
    end 
) 

سيرفر ---

  
  
 local root = getRootElement() 
  
--------------- 
-- RED Color 
--------------- 
function output(getE, radio, message) 
    local name = getPlayerName(source) 
    if ( getE ) then 
    outputChatBox("[" ..getE.. "]".. name .. ":#bbbbbb " ..message, root, 255, 255, 255, true) 
     end 
   end 
addEventHandler("onPlayerChat", root, output) 
  
 ---------------- 
 -- events 
 ---------------- 
  
  addEvent("RED",true) 
 addEventHandler("RED", getRootElement(), output) 

المشكله وانا اصلح الكود واجهتني مشاكل كثيره

يعني مره جربت اعدل الآوت بوت

واخترت لي اسم ولون

يوم اتكلم بالشات

يظهر الكلام الي اقوله بالشات مكان التاج

صراحه الكود صغير لكنه اشغل تفكيري ولحس مخي لحححس :?

Link to comment
من ثم تسوي تريقر وتحط داتا ع اللاعب بـ الاسم اللي كتبه ( guiGetText ) يوم يحط يضغط الزر تتحقق انه كتب الاسم بـ استخدام

! وتجيب الداتا وتجيب اسمه وتسوي مخرج الشات cancelEvent وتسوي تحقق لو معاهـ داتا وتسوي onPlayerChat وتضيف حدث

#ثانكس ع المرور

اسويها وارجع اكتب وش صار :lol:

Link to comment

سيرفر --

function output(getE, radio, message, thePlayer) 
    local getData = getElementData ( thePlayer, "getName", getE ) 
    local name = getPlayerName(source) 
    if ( getData ) then 
    outputChatBox("[" ..getE.. "]".. name .. ":#bbbbbb " ..message, root, 255, 255, 255, true) 
     end 
   end 
addEventHandler("onPlayerChat", root, output) 

كلنت --

local radio = guiRadioButtonSetSelected(RED,true) 
  
addEventHandler("onClientGUIClick", root, 
    function( thePlayer ) 
            local getE = guiGetText ( edit ) 
         if ( source == OK ) then 
         elseif getE then 
             setElementData ( thePlayer, "getName", getE ) 
             triggerServerEvent("RED",localPlayer, getE, radio)  
        end 
    end 
) 
  

جربت كذا ماضبط ونفس الطريقة مايطلع شيء

ألله يستر لايطلع فيه اخطاء واجد :shock:

0Xhy1s.pngGtAwlD.png

Link to comment

addEventHandler( "onClientGUIClick", resourceRoot, function(  ) 
   if ( source == OK ) then 
    if ( guiGetText ( edit ) ~= "" ) then 
     if ( guiRadioButtonGetSelected( RED ) == true )then 
             triggerServerEvent( "RED", localPlayer, guiGetText ( edit ) ) 
         end 
      end 
   end 
end ) 

local saveTable =  {   }  
  
addEvent ( "RED", true ) 
addEventHandler ( "RED", root, function ( textName )  
  if ( textName ) then 
         saveTable [ client ] = { textName, 0, 255, 255 } 
   end 
end )  
  
  
addEventHandler( "onPlayerChat", root, function ( msg, type ) 
  if ( type == 0 ) then 
   if ( saveTable [ source ] ) then 
        cancelEvent (    )  
        return outputChatBox( "[ "..tostring ( saveTable [ source ][1] ).." ]: "..msg, root, saveTable [ source ][2], saveTable [ source ][3], saveTable [ source ][4], true ) 
     end 
   end 
end ) 
  
addEventHandler ( "onPlayerQuit", root, function (   ) 
   if ( saveTable [ source ] ) then 
       saveTable [ source ] = nil 
    end 
end ) 
Edited by Guest
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...