Jump to content

مشكلة


Recommended Posts

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

معي وظيفة راعي غنم

عدلت %80 من الوظيفة

لكن اجتني مشكلة

عندما اضغط على زر دخول الوظيفة يجيني خطأ بالترايقر

والمشكلة انا ما عدلت اكواد زر الدخول والترايقر

الاكواد

addEventHandler("onClientGUIClick",root, 
function () 
  if source == GUIEditor.button[1] then 
   local skin = guiGridListGetItemText( GUIEditor.gridlist[1],guiGridListGetSelectedItem(GUIEditor.gridlist[1]),2) 
     if skin ~= "" then 
      guiSetVisible(GUIEditor.window[1],false) 
      showCursor(false) 
      triggerServerEvent("shep",localPlayer,skin) --- start 
    end 
  elseif source == GUIEditor.button[2] then 
  guiSetVisible(GUIEditor.window[1],false) 
      showCursor(false) 
  end 
 end) 

addEvent("shep",true) 
addEventHandler("shep",root, 
function (skin) 
    setElementModel(client,tonumber(skin)) 
    setElementData(source,'Job','ShepJob') ---- 'Job'  
    setElementData ( client,'Job','ShepJob' ) 
    end 
) 

:|

Link to comment

سطر الخامس في الكلينت

احذفه

وضيف ما بين السطر الثالث والرابع ذذ تحقق

  
if guiGridListGetSelectedItem(GUIEditor.gridlist[1]) ~= -1 then 
  

---

وسطر الرابع في السيرفر بدل الكلينت ب سورس

واحذف السطر ال6

ما تغيير شيئ والدي بق نفسه

Link to comment

جابر لاتعدل في كودك شيء

بس بدل اللوكال بلاير ب

root

النتيجة

  
addEventHandler("onClientGUIClick",root, 
function () 
  if source == GUIEditor.button[1] then 
   local skin = guiGridListGetItemText( GUIEditor.gridlist[1],guiGridListGetSelectedItem(GUIEditor.gridlist[1]),2) 
     if skin ~= "" then 
      guiSetVisible(GUIEditor.window[1],false) 
      showCursor(false) 
      triggerServerEvent("shep",root,skin) --- start 
    end 
  elseif source == GUIEditor.button[2] then 
  guiSetVisible(GUIEditor.window[1],false) 
      showCursor(false) 
  end 
 end) 
  

Link to comment

جابر لاتعدل في كودك شيء

بس بدل اللوكال بلاير ب

root

النتيجة

  
addEventHandler("onClientGUIClick",root, 
function () 
  if source == GUIEditor.button[1] then 
   local skin = guiGridListGetItemText( GUIEditor.gridlist[1],guiGridListGetSelectedItem(GUIEditor.gridlist[1]),2) 
     if skin ~= "" then 
      guiSetVisible(GUIEditor.window[1],false) 
      showCursor(false) 
      triggerServerEvent("shep",root,skin) --- start 
    end 
  elseif source == GUIEditor.button[2] then 
  guiSetVisible(GUIEditor.window[1],false) 
      showCursor(false) 
  end 
 end) 
  

ما تغيير شيئ

Link to comment
  
--Client Side 
function SetPanelShow( Panel , True , False ) 
    guiSetVisible(Panel,True) 
         showCursor(False) 
end  
  
addEventHandler("onClientGUIClick",root, 
function (  ) 
  if ( source == GUIEditor.button[1] ) then 
      if ( Skin ~= "" ) then 
          local Skin = guiGridListGetItemText( GUIEditor.gridlist[1],guiGridListGetSelectedItem(GUIEditor.gridlist[1]),2) 
          SetPanelShow( GUIEditor.window[1] , false , false ) 
          triggerServerEvent("Shep",localPlayer,Skin) 
        end 
  elseif ( source == GUIEditor.button[2] ) then 
      SetPanelShow( GUIEditor.window[1] , false , false ) 
    end 
end ) 

  
-- Server Side 
addEvent("Shep",true) 
addEventHandler("Shep",root, 
function ( Skin ) 
    setElementModel(client,tonumber(Skin) ) 
        setElementData ( client,'Job','ShepJob' ) 
end ) 

Link to comment

حتى الان المشكلة ما تغيرت

p_118otya1.png

المشكلة اجت يوم ضفت الكود دا

addCommandHandler("meat",function() 
    if getElementHealth(source) =< 50 then 
        setElementHealth(source,getElementHealth(source) + 50) 
            setElementData(source,"meat",getElementData(source,"meat") - 1 ) 
    else 
        outputChatBox("Your Health is > 50",source,255,0,0) 
     
    end 
end) 

Link to comment

addCommandHandler("meat", 
function(  ) 
    if ( getElementHealth(source) <= 50 ) then 
        setElementHealth(source,getElementHealth(source) + 50) 
            setElementData(source,"meat",getElementData(source,"meat") - 1 ) 
    else 
        outputChatBox("Your Health is > 50",source,255,0,0,true) 
    
    end 
end ) 

ضض

Link to comment
addCommandHandler("meat", 
function(  ) 
    if ( getElementHealth(source) <= 50 ) then 
        setElementHealth(source,getElementHealth(source) + 50) 
            setElementData(source,"meat",getElementData(source,"meat") - 1 ) 
    else 
        outputChatBox("Your Health is > 50",source,255,0,0,true) 
    
    end 
end ) 

ضض

شكراً لك لكن ما شوف غيرت شيئ غير ,true

Link to comment

ضفت هذا التحقق

    if getElementData(source,"meat") >= 1 then 

صار يجيني خطأ بالسطر الخاص به

وجربته بالحالات دي ايضاً

    if getElementData(source,"meat") > 0 then 

    if getElementData(source,"meat") > 0 or getElementData(source,"meat") == 0 then 

Link to comment
WARNING: Sheep/server.lua:26: Bad argument @ 'getElementData' [Expected element at argument 1, got nil]

ERROR: Shep/Server.lua:26: attempt to compare boolean with number

    if getElementData(source,"meat") >= 1 then 

وريني كودك كامل مشان اعرف تعريف السورس

Link to comment
addCommandHandler("meat", 
function(  ) 
    if getElementData(source,"meat") >= 1 then 
    if ( getElementHealth(source) < 49 ) then 
        setElementHealth(source,getElementHealth(source) + 50) 
            setElementData(source,"meat",getElementData(source,"meat") - 1 ) 
                outputChatBox("You Was get Health",source,0,255,0,true) 
    else outputChatBox("Your Health is > 50",source,255,0,0,true) 
        end 
    end 
end ) 

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