Jump to content

مسـاعدهـ في شوب :(


SmoKing

Recommended Posts

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

شباب ممكن مساعده في الشوب انا خلصته بس ماشتغل معي في السيرفر

client

  
    root = getRootElement()
localPlayer = getLocalPlayer()
 
outputChatBox("#990000**  Shop Panel by  SmoKing  - #c0c0c0Press F2 To Open it  **",0,255,0,true)
shopWindow = guiCreateWindow(170,50,530,510,"BaseModePanel",false)
guiSetVisible (shopWindow, false)
guiWindowSetSizable(shopWindow,false)
guiWindowSetMovable(shopWindow,true)
tabPanel = guiCreateTabPanel(11,23,599,499,false,shopWindow)
 
 
-------------------------------------------------------------------------------------------------------
 
tab1 = guiCreateTab("info",tabPanel)
-------------------------------------------------------------------------------------------------------
addCommandHandler("myname",
  function()
   local localPlayerName = getPlayerName(getLocalPlayer())
   outputChatBox(localPlayerName)
  end
)
 
int getPlayerMoney ( )
 
function checkPing()
        local ping = getPlayerPing(getLocalPlayer())
        if (ping > 100) then
                outputChatBox("Your ping is pretty high! Please try to lower it if possible.")
        end
end
addCommandHandler("ping", checkPing)
-------------------------------------------------------------------------------------------------------
 
tab2 = guiCreateTab("Buy Weapons",tabPanel)
---------line 1 ----------------------------------------------------------------------------------------
guiCreateStaticImage( 10,10,90,75, "weapons/1.png", false,tab2 )
weapButton_1 = guiCreateButton(10,80,90,30,"$300        Deagle",false,tab2)
 
guiCreateStaticImage( 110,10,90,75, "weapons/2.png", false,tab2 )
weapButton_2 = guiCreateButton(110,80,90,30,"$350            M4",false,tab2)
 
guiCreateStaticImage( 110,10,90,75, "weapons/3.png", false,tab2 )
weapButton_3 = guiCreateButton(210,80,90,30,"$2000           Grenade ",false,tab2)
 
guiCreateStaticImage( 310,10,90,75, "weapons/4.png", false,tab2 )
weapButton_4 = guiCreateButton(310,80,90,30,"$350             AK-47",false,tab2)
 
guiCreateStaticImage( 410,10,90,75, "weapons/5.png", false,tab2 )
weapButton_5 = guiCreateButton(410,80,90,30,"$375              mp5",false,tab2)
 
-------------------------2 line-----------------------------------------------------------------------------------------------------------
guiCreateStaticImage( 10,110,90,80, "weapons/6.png", false,tab2 )
weapButton_6 = guiCreateButton(10,190,90,30,"$450                TEC-9",false,tab2 )
 
guiCreateStaticImage( 110,110,90,80, "weapons/7.png", false,tab2 )
weapButton_7 = guiCreateButton(110,190,90,30,"$650              Sniper",false,tab2)
 
guiCreateStaticImage( 210,110,90,80, "weapons/8.png", false,tab2 )
weapButton_8 = guiCreateButton(210,190,90,30,"$400               Uzi",false,tab2)
 
guiCreateStaticImage( 310,110,90,80, "weapons/9.png", false,tab2 )
weapButton_9 = guiCreateButton(310,190,90,30,"$500           Parachute ",false,tab2)
 
guiCreateStaticImage( 410,110,90,80, "weapons/10.png", false,tab2 )
weapButton_10 = guiCreateButton(410,190,90,30,"$450              ShotGun",false,tab2)
 
 
-------------------------------------------------------------------------- line 3
guiCreateStaticImage( 10,220,90,80, "weapons/11.png", false,tab2 )
weapButton_11 = guiCreateButton(10,300,90,30,"$750                      Sawn-Off",false,tab2 )
 
guiCreateStaticImage( 110,220,90,80, "weapons/12.png", false,tab2 )
weapButton_12 = guiCreateButton(110,300,90,30,"$500                      Combat",false,tab2 )
 
guiCreateStaticImage( 210,220,90,80, "weapons/13.png", false,tab2 )
weapButton_13 = guiCreateButton(210,300,90,30,"$500                    Knif",false,tab2 )
 
 
--------------------------------------------------------------------------------------line 4
 
 
 
 
 
 
guiCreateStaticImage( 10,330,90,80, "weapons/14.png", false,tab2 )
weapButton_14 = guiCreateButton(10,410,90,30,"$1500                    Tear Gas",false,tab2 )
 
guiCreateStaticImage( 110,330,90,80, "weapons/15.png", false,tab2 )
weapButton_15 = guiCreateButton(110,410,90,30,"$400                  Fire Extinguisher",false,tab2 )
 
guiCreateStaticImage( 410,330,90,80, "weapons/16.png", false,tab2 )
weapButton_16 = guiCreateButton(410,410,90,30,"$4900                     Minigun",false,tab2 )
 
guiCreateStaticImage( 310,330,90,80, "weapons/17.png", false,tab2 )
weapButton_17 = guiCreateButton(310,410,90,30,"$3000                     Satchel Charges",false,tab2 )
 
 
 
 
 
---------------------------------------------------------------------------------------------------------
 
tab3 = guiCreateTab("Shop",tabPanel)
---------------------------------------------------------------------------------------------------------
 
playerName = guiCreateLabel(115,101,209,20,"N/A",false,GUIEditor_Tab[3])
guiSetText ( playerName, getPlayerName(source))
 
addEventHandler ("onClientGUIClick", root,
    function()
        if ( source ==  HEALTH ) then
        triggerServerEvent("health", localPlayer)
       
        elseif ( source ==  ARMOR ) then
         triggerServerEvent("armor", localPlayer)
        end
    end
)  
---------------------------------------------------------------------------------------------------------
 
tab4 = guiCreateTab("Send Money",tabPanel)
---------------------------------------------------------------------------------------------------------
     gui["comboBox"] = guiCreateComboBox(50, 20, 191, 54,"Select a player to send", false,tab4)
   
    for id, player in ipairs(getElementsByType("player")) do
    guiComboBoxAddItem(gui["comboBox"], getPlayerName(player))
    end
 
 
 
    gui["label_2"] = guiCreateLabel(6, 20, 50, 13, "player :", false,tab4)
    guiLabelSetHorizontalAlign(gui["label_2"], "left", false)
    guiLabelSetVerticalAlign(gui["label_2"], "center")
                  guiLabelSetColor(gui["label_2"],0,255,0)
 
   
    gui["label_3"] = guiCreateLabel(20, 50, 50, 15, "Money :", false,tab4)
    guiLabelSetHorizontalAlign(gui["label_3"], "left", false)
    guiLabelSetVerticalAlign(gui["label_3"], "center")
                      guiLabelSetColor(gui["label_3"],255,0,255)
 
    gui["lineEdit"] = guiCreateEdit(80, 50, 101, 20, "", false,tab4)
    guiEditSetMaxLength(gui["lineEdit"],
 
     guiLabelSetHorizontalAlign(gui["label_4"], "left", false)
    guiLabelSetVerticalAlign(gui["label_4"], "center")
    guiSetFont(gui["label_4"],"default-smalls")
                  guiLabelSetColor(gui["label_4"],153,153,102)
 
    guiCreateStaticImage(6,160,320,70,"Send.png",false,tab4)
 
   
    gui["pushButton"] = guiCreateButton(40, 90, 331, 51, "Send", false,tab4)
 
-----------------------------------------------------------------------------------------------------------
 
bindKey ( "F2" , "down" , function()
 
if ( guiGetVisible ( shopWindow ) == true ) then
 guiSetVisible ( shopWindow ,false )
 showCursor (false )
 guiSetInputEnabled(false)
 
 elseif ( guiGetVisible ( shopWindow ) == false ) then
 guiSetVisible ( shopWindow ,true )
 showCursor (false )
 guiSetInputEnabled(true)
 playSound("S.mp3")
 
 end
 end
 )
 
 
 
 
 
 
------------------------------------------------------------------------------------------------------
 
 
 
 
 
------------------------------------------------------------------------------------------------------
addEventHandler ("onClientGUIClick", getRootElement(),
 
function(button, state, absoluteX, absoluteY)
 
if ( source ==  weapButton_1 ) then
 
 
 
 
triggerServerEvent("gived",getLocalPlayer())
 
end
 end
 
 
)
 
 
 
addEventHandler ("onClientGUIClick", getRootElement(),
 
function(button, state, absoluteX, absoluteY)
 
if ( source ==  weapButton_2 ) then
 
 
triggerServerEvent("givem4",getLocalPlayer())
 
end
 
end
 
 
)
 
addEventHandler ("onClientGUIClick", getRootElement(),
 
function(button, state, absoluteX, absoluteY)
 
if ( source ==  weapButton_3 ) then
 
 
triggerServerEvent("givegrn",getLocalPlayer())
 
end
 
end
 
 
)
 
 
addEventHandler ("onClientGUIClick", getRootElement(),
 
function(button, state, absoluteX, absoluteY)
 
if ( source ==  weapButton_4 ) then
 
triggerServerEvent("givemk",getLocalPlayer())
 
end
 
end
 
 
Edited by Guest
Link to comment
طيب اخوي انا ابيك تصلح الشوب :)

وش الاخطاء الي فيها

الاخطاء فيه كثيرة

line 24 -- ماله داعي

line 108 to 109 -- التاب غير موجود اصلا

line 123 to 155 -- الكود منين جايبه ولآصقه اغلبه خطأ ونسخته ناقص

اخطاء الكلنت ^

نجي للسيرفر والاخطاء كثيرة حدث ولا حرج

ايضا بعض الأيفينت ليس لها شغلة ماسويت لها ترقير من الكلنت

    addEvent("health",true) 
    addEventHandler("health",getRootElement(), 
        function () 
           if getPlayerMoney(source) >= 2500 then 
           takePlayerMoney (source,2500) 
           setElementHealth(source,100) 
           outputChatBox("* #0099ccSuccessfully bought Health #000000[ #ff0000-$2500 #000000]#00ff00 !",source,0,255,0,true) 
           else getPlayerMoney(source) <= 2500 then -- هنا خطا في الجملة الشرطية 
           outputChatBox("* you Don't have enough Money !",source,255,0,0,true) 
           end 
        end 
    ) 

التصحيح حذف جميع الزوائد

getPlayerMoney(source) <= 2500 then 

Link to comment

طيب الحين فيه اخطاء ولالا ؟

client

  
    root = getRootElement()
localPlayer = getLocalPlayer()
 
outputChatBox("#990000**  Shop Panel by  SmoKing  - #c0c0c0Press F2 To Open it  **",0,255,0,true)
shopWindow = guiCreateWindow(170,50,530,510,"BaseModePanel",false)
guiSetVisible (shopWindow, false)
guiWindowSetSizable(shopWindow,false)
guiWindowSetMovable(shopWindow,true)
tabPanel = guiCreateTabPanel(11,23,599,499,false,shopWindow)
 
 
-------------------------------------------------------------------------------------------------------
 
tab1 = guiCreateTab("info",tabPanel)
-------------------------------------------------------------------------------------------------------
    addEvent('ServerName', true)
    addEventHandler('ServerName', root,
    function(name)
        guiSetText(ServerName,name)
        end
    )
 
  function()
   local localPlayerName = getPlayerName(getLocalPlayer())
   outputChatBox(localPlayerName)
  end
)
 
int getPlayerMoney ( )
 
function checkPing()
        local ping = getPlayerPing(getLocalPlayer())
        if (ping > 100) then
                outputChatBox("Your ping is pretty high! Please try to lower it if possible.")
        end
end
addCommandHandler("ping", checkPing)
-------------------------------------------------------------------------------------------------------
 
tab2 = guiCreateTab("Buy Weapons",tabPanel)
---------line 1 ----------------------------------------------------------------------------------------
guiCreateStaticImage( 10,10,90,75, "weapons/1.png", false,tab2 )
weapButton_1 = guiCreateButton(10,80,90,30,"$300        Deagle",false,tab2)
 
guiCreateStaticImage( 110,10,90,75, "weapons/2.png", false,tab2 )
weapButton_2 = guiCreateButton(110,80,90,30,"$350            M4",false,tab2)
 
guiCreateStaticImage( 110,10,90,75, "weapons/3.png", false,tab2 )
weapButton_3 = guiCreateButton(210,80,90,30,"$2000           Grenade ",false,tab2)
 
guiCreateStaticImage( 310,10,90,75, "weapons/4.png", false,tab2 )
weapButton_4 = guiCreateButton(310,80,90,30,"$350             AK-47",false,tab2)
 
guiCreateStaticImage( 410,10,90,75, "weapons/5.png", false,tab2 )
weapButton_5 = guiCreateButton(410,80,90,30,"$375              mp5",false,tab2)
 
-------------------------2 line-----------------------------------------------------------------------------------------------------------
guiCreateStaticImage( 10,110,90,80, "weapons/6.png", false,tab2 )
weapButton_6 = guiCreateButton(10,190,90,30,"$450                TEC-9",false,tab2 )
 
guiCreateStaticImage( 110,110,90,80, "weapons/7.png", false,tab2 )
weapButton_7 = guiCreateButton(110,190,90,30,"$650              Sniper",false,tab2)
 
guiCreateStaticImage( 210,110,90,80, "weapons/8.png", false,tab2 )
weapButton_8 = guiCreateButton(210,190,90,30,"$400               Uzi",false,tab2)
 
guiCreateStaticImage( 310,110,90,80, "weapons/9.png", false,tab2 )
weapButton_9 = guiCreateButton(310,190,90,30,"$500           Parachute ",false,tab2)
 
guiCreateStaticImage( 410,110,90,80, "weapons/10.png", false,tab2 )
weapButton_10 = guiCreateButton(410,190,90,30,"$450              ShotGun",false,tab2)
 
 
-------------------------------------------------------------------------- line 3
guiCreateStaticImage( 10,220,90,80, "weapons/11.png", false,tab2 )
weapButton_11 = guiCreateButton(10,300,90,30,"$750                      Sawn-Off",false,tab2 )
 
guiCreateStaticImage( 110,220,90,80, "weapons/12.png", false,tab2 )
weapButton_12 = guiCreateButton(110,300,90,30,"$500                      Combat",false,tab2 )
 
guiCreateStaticImage( 210,220,90,80, "weapons/13.png", false,tab2 )
weapButton_13 = guiCreateButton(210,300,90,30,"$500                    Knif",false,tab2 )
 
 
--------------------------------------------------------------------------------------line 4
 
 
 
 
 
 
guiCreateStaticImage( 10,330,90,80, "weapons/14.png", false,tab2 )
weapButton_14 = guiCreateButton(10,410,90,30,"$1500                    Tear Gas",false,tab2 )
 
guiCreateStaticImage( 110,330,90,80, "weapons/15.png", false,tab2 )
weapButton_15 = guiCreateButton(110,410,90,30,"$400                  Fire Extinguisher",false,tab2 )
 
guiCreateStaticImage( 410,330,90,80, "weapons/16.png", false,tab2 )
weapButton_16 = guiCreateButton(410,410,90,30,"$4900                     Minigun",false,tab2 )
 
guiCreateStaticImage( 310,330,90,80, "weapons/17.png", false,tab2 )
weapButton_17 = guiCreateButton(310,410,90,30,"$3000                     Satchel Charges",false,tab2 )
 
 
 
---------------------------------------------------------------------------------------------------------
 
tab3 = guiCreateTab("Shop",tabPanel)
---------------------------------------------------------------------------------------------------------
 
playerName = guiCreateLabel(115,101,209,20,"N/A",false,GUIEditor_Tab[3])
guiSetText ( playerName, getPlayerName(source))
 
addEventHandler ("onClientGUIClick", root,
    function()
        if ( source ==  HEALTH ) then
        triggerServerEvent("health", localPlayer)
       
        elseif ( source ==  ARMOR ) then
         triggerServerEvent("armor", localPlayer)
        end
    end
)  
 
---------------------------------------------------------------------------------------------------------
 
tab4 = guiCreateTab("Send Money",tabPanel)
---------------------------------------------------------------------------------------------------------
     gui["comboBox"] = guiCreateComboBox(50, 20, 191, 54,"Select a player to send", false,tab4)
   
    for id, player in ipairs(getElementsByType("player")) do
    guiComboBoxAddItem(gui["comboBox"], getPlayerName(player))
    end
 
 
 
    gui["label_2"] = guiCreateLabel(6, 20, 50, 13, "player :", false,tab4)
    guiLabelSetHorizontalAlign(gui["label_2"], "left", false)
    guiLabelSetVerticalAlign(gui["label_2"], "center")
                  guiLabelSetColor(gui["label_2"],0,255,0)
 
   
    gui["label_3"] = guiCreateLabel(20, 50, 50, 15, "Money :", false,tab4)
    guiLabelSetHorizontalAlign(gui["label_3"], "left", false)
    guiLabelSetVerticalAlign(gui["label_3"], "center")
                      guiLabelSetColor(gui["label_3"],255,0,255)
 
    gui["lineEdit"] = guiCreateEdit(80, 50, 101, 20, "", false,tab4)
    guiEditSetMaxLength(gui["lineEdit"],
 
     guiLabelSetHorizontalAlign(gui["label_4"], "left", false)
    guiLabelSetVerticalAlign(gui["label_4"], "center")
    guiSetFont(gui["label_4"],"default-smalls")
                  guiLabelSetColor(gui["label_4"],153,153,102)
 
    guiCreateStaticImage(6,160,320,70,"Send.png",false,tab4)
 
   
    gui["pushButton"] = guiCreateButton(40, 90, 331, 51, "Send", false,tab4)
 
-----------------------------------------------------------------------------------------------------------
 
bindKey ( "F2" , "down" , function()
 
if ( guiGetVisible ( shopWindow ) == true ) then
 guiSetVisible ( shopWindow ,false )
 showCursor (false )
 guiSetInputEnabled(false)
 
 elseif ( guiGetVisible ( shopWindow ) == false ) then
 guiSetVisible ( shopWindow ,true )
 showCursor (false )
 guiSetInputEnabled(true)
 playSound("S.mp3")
 
 end
 end
 )
 
 
 
 
 
 
------------------------------------------------------------------------------------------------------
 
 
 
 
 
------------------------------------------------------------------------------------------------------
addEventHandler ("onClientGUIClick", getRootElement(),
 
function(button, state, absoluteX, absoluteY)
 
if ( source ==  weapButton_1 ) then
 
 
 
 
triggerServerEvent("gived",getLocalPlayer())
 
end
 end
 
 
)
 
 
 
addEventHandler ("onClientGUIClick", getRootElement(),
 
function(button, state, absoluteX, absoluteY)
 
if ( source ==  weapButton_2 ) then
 
 
triggerServerEvent("givem4",getLocalPlayer())
 
end
 
end
 
 
)
 
addEventHandler ("onClientGUIClick", getRootElement(),
 
function(button, state, absoluteX, absoluteY)
 
if ( source ==  weapButton_3 ) then
 
 
triggerServerEvent("givegrn",getLocalPlayer())
 
end
 
end
 
 
)
 
 
addEventHandler ("onClientGUIClick", getRootElement(),
 
function(button, state, absoluteX, absoluteY)
 
if ( source ==  weapButton_4 ) then
 
triggerServerEvent("givemk",getLocalPlayer())
 
Link to comment

كلينت

سطر 1 + 2 + 3 + 4 مالهم داعي

وهنا ما حطيت أسم للفنكشن

  
  function() 
   local localPlayerName = getPlayerName(getLocalPlayer()) 
   outputChatBox(localPlayerName) 
  end 
) 
  

هذا ناسخه من الويكي؟ خخ

int getPlayerMoney ( ) 

ARMOR أو HEALTH هنا ما عندك زر أسمه

addEventHandler ("onClientGUIClick", root, 
    function() 
        if ( source ==  HEALTH ) then 
        triggerServerEvent("health", localPlayer) 
        
        elseif ( source ==  ARMOR ) then 
         triggerServerEvent("armor", localPlayer) 
        end 
    end 
)   

مو موجود gui و جدول بالأسم

     gui["comboBox"] = guiCreateComboBox(50, 20, 191, 54,"Select a player to send", false,tab4) 
    
    for id, player in ipairs(getElementsByType("player")) do 
    guiComboBoxAddItem(gui["comboBox"], getPlayerName(player)) 
    end 
  
  
  
    gui["label_2"] = guiCreateLabel(6, 20, 50, 13, "player :", false,tab4) 
    guiLabelSetHorizontalAlign(gui["label_2"], "left", false) 
    guiLabelSetVerticalAlign(gui["label_2"], "center") 
                  guiLabelSetColor(gui["label_2"],0,255,0) 
  
    
    gui["label_3"] = guiCreateLabel(20, 50, 50, 15, "Money :", false,tab4) 
    guiLabelSetHorizontalAlign(gui["label_3"], "left", false) 
    guiLabelSetVerticalAlign(gui["label_3"], "center") 
                      guiLabelSetColor(gui["label_3"],255,0,255) 
  
    gui["lineEdit"] = guiCreateEdit(80, 50, 101, 20, "", false,tab4) 
    guiEditSetMaxLength(gui["lineEdit"],8) 
  
     guiLabelSetHorizontalAlign(gui["label_4"], "left", false) 
    guiLabelSetVerticalAlign(gui["label_4"], "center") 
    guiSetFont(gui["label_4"],"default-smalls") 
                  guiLabelSetColor(gui["label_4"],153,153,102) 
  
    guiCreateStaticImage(6,160,320,70,"Send.png",false,tab4) 
  
    
    gui["pushButton"] = guiCreateButton(40, 90, 331, 51, "Send", false,tab4) 

سيرفر

ذولاً كلهم مالهم داعي

addCommandHandler("myname", 
  function(playerSource) 
    outputChatBox("Your name: "..getPlayerName(playerSource), playerSource) 
  end 
) 
  
------------------------- 
int/bool getPlayerMoney ( player thePlayer ) 
  
------------------------- 
function checkPing() 
    local ping = getPlayerPing(source)) 
    if (ping > 100) then 
        outputChatBox("Your ping is pretty high! Please try to lower it if possible.", source) 
    end 
end 
addEventHandler("onPlayerJoin", getRootElement(), checkPing) 
  
------------------------- 
function teamName ( source, key, newTeamName ) 
    local playerTeam = getPlayerTeam ( source ) 
    if ( playerTeam ) then 
        local oldTeamName = getTeamName ( playerTeam ) 
        setTeamName ( playerTeam, newTeamName ) 
        outputChatBox ( "Changed " .. getPlayerName ( source ).."'s team name from " .. oldTeamName .. " to " .. newTeamName ) 
    else 
        outputChatBox ( getPlayerName ( source ) .. " isn't on a team" ) 
    end 
end 
addCommandHandler ( "teamname", teamName ) 

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