Jump to content

(تصحيح كودين (ادخل مساعدا


#TeKa

Recommended Posts

اول شييء انا عملت مود تغير لون الاسم المفروض الكود 100% شغال بس المشكله بيجلي في debugscript

ERROR: Loading script failed: nametag/server.lua:6: unexpected symbol near

ERROR: Loading script failed: nametag/client.lua:2 '=' expected near 'guiWindowSetSizable'

حل سريع ارجوكم

server side

addEventHandler( 'onClientGUIClick', root, 
  
function() 
  
if (source == theNametagShopWindowAcceptButton) then 
     
   if (tonumber(guiGetText (theNametagShopWindowRedEdit)) ~= nil) and (tonumber(guiGetText (theNametagShopWindowGreenEdit)) ~= nil) and (tonumber(guiGetText (theNametagShopWindowBlueEdit)) ~= nil) then 
  
      guiSetVisible (theNametagShopWindow,false) 
  
      showCursor (false,false) 
  
      triggerServerEvent ("gameMenuButtonClick",getLocalPlayer(),"nametagShopAccept",tonumber(guiGetText (theNametagShopWindowRedEdit)),tonumber(guiGetText (theNametagShopWindowGreenEdit)),tonumber(guiGetText (theNametagShopWindowBlueEdit))) 
  
    end 
  
  elseif (source == theNametagShopWindowCloseButton) then 
  
    guiSetVisible (theNametagShopWindow,false) 
  
    showCursor (false,false) 
  elseif (buttonname == "theNametagShopWindowAcceptButton") then 
  
    if (getPlayerMoney (source) > 2499) then 
  
      local charactername = getPlayerNametagText (source) 
  
      local accountName = getAccountName(getPlayerAccount(source)) 
  
      local characterindex = getCharacterIndexByCharacterName (accountName,charactername) 
  
      local playerRoot = xmlFindChild (root,"player",findPlayerIndexByName (tostring(accountName))) 
   
      local characterRoot = xmlNodeGetChildren (playerRoot,tonumber(characterindex)-1) 
  
      if (characterRoot) then 
  
        setPlayerNametagColor (source,tonumber(arg1),tonumber(arg2),tonumber(arg3)) 
  
        triggerClientEvent ("lolmodOpenInfoWindow",source,"Nametag color succesfully bought!") 
  
        xmlNodeSetAttribute (characterRoot,"cr",tonumber(arg1)) 
  
        xmlNodeSetAttribute (characterRoot,"cg",tonumber(arg2)) 
  
        xmlNodeSetAttribute (characterRoot,"cb",tonumber(arg3)) 
  
        xmlSaveFile (root) 
  
        takePlayerMoney (source,1250) 
  
  end 
  
end 
  
end 
) 

client side

GUIEditor = { 
  
    edit = {}, 
  
    button = {}, 
  
    label = {}, 
  
    window = {}, 
  
} 
addEventHandler ("onClientResourceStart",getResourceRootElement(), 
function() 
        theNametagShopWindow = guiCreateWindow(0.0575,0.2917,0.1963,0.375,"Nametag Shop",true) 
  
        guiWindowSetSizable(GUIEditor.window[1], false) 
        theNametagShopWindowRedLabel = guiCreateLabel(0.051,0.1333,0.535,0.0933,"Red",true,theNametagShopWindow) 
   
        guiLabelSetColor(theNametagShopWindowRedLabel,255,255,255) 
   
        guiLabelSetVerticalAlign(theNametagShopWindowRedLabel,"top") 
   
        guiLabelSetHorizontalAlign(theNametagShopWindowRedLabel,"left",false) 
   
        theNametagShopWindowGreenLabel = guiCreateLabel(0.051,0.24,0.5096,0.1022,"Green",true,theNametagShopWindow) 
   
        guiLabelSetColor(theNametagShopWindowGreenLabel,255,255,255) 
  
        guiLabelSetVerticalAlign(theNametagShopWindowGreenLabel,"top") 
   
        guiLabelSetHorizontalAlign(theNametagShopWindowGreenLabel,"left",false) 
   
        theNametagShopWindowBlueLabel = guiCreateLabel(0.051,0.3511,0.5414,0.0978,"Blue",true,theNametagShopWindow) 
   
        guiLabelSetColor(theNametagShopWindowBlueLabel,255,255,255) 
  
        guiLabelSetVerticalAlign(theNametagShopWindowBlueLabel,"top") 
   
        guiLabelSetHorizontalAlign(theNametagShopWindowBlueLabel,"left",false) 
   
        theNametagShopWindowRedEdit = guiCreateEdit(0.6306,0.12,0.293,0.1022,"255",true,theNametagShopWindow) 
   
        theNametagShopWindowGreenEdit = guiCreateEdit(0.6306,0.2222,0.293,0.1022,"255",true,theNametagShopWindow) 
   
        theNametagShopWindowBlueEdit = guiCreateEdit(0.6306,0.3244,0.293,0.1022,"255",true,theNametagShopWindow) 
   
        guiEditSetMaxLength (theNametagShopWindowRedEdit,3) 
   
        guiEditSetMaxLength (theNametagShopWindowGreenEdit,3) 
   
        guiEditSetMaxLength (theNametagShopWindowBlueEdit,3) 
   
        theNametagShopWindowExampleTextLabel = guiCreateLabel(0.0573,0.4578,0.879,0.12,"Example Text",true,theNametagShopWindow) 
   
        guiLabelSetColor(theNametagShopWindowExampleTextLabel,255,255,255) 
   
        guiLabelSetVerticalAlign(theNametagShopWindowExampleTextLabel,"center") 
   
        guiLabelSetHorizontalAlign(theNametagShopWindowExampleTextLabel,"center",false) 
   
        theNametagShopWindowAcceptButton = guiCreateButton(0.0573,0.6089,0.8726,0.2089,"Buy Nametag\n1250$",true,theNametagShopWindow) 
   
        theNametagShopWindowCloseButton = guiCreateButton(0.0573,0.8356,0.8854,0.12,"Close",true,theNametagShopWindow) 
   
  
  
nametagshopMarker = createMarker (-1951.66,642.98,45.5625,"cylinder",2,0,255,255,127) 
  
createBlipAttachedTo(nametagshopMarker,30) 
  
  
  
  
---------- 
  
  
----marker 
addEventHandler ("onClientMarkerHit",getRootElement(), 
  
function(hitElement,matchingDimension) 
  
  if (getElementType (hitElement) == "player") and (hitElement == getLocalPlayer()) then 
  
    if (source == nametagshopMarker) then 
  
      showCursor (true,true) 
  
      guiSetVisible (theNametagShopWindow,true) 
  end 
  
end 
  
end 
) 

ثاني مود شغال و كل شييء بس لما اجي اشتري سلاح ما يشتغل

هو محل اسلحة حصري و جديد

ساعدوني بجي اشتري سلاح ما يشتري

client side

addEventHandler ("onClientResourceStart",getResourceRootElement(), 
function() 
  sx,sy = guiGetScreenSize () 
  
  ammunation_Window = {} 
  ammunation_Button = {} 
  ammunation_Grid = {} 
  ammunation_Image = {} 
  weapons = {{1,"Brass Knuckles",1,25},{2,"Golf club",1,50},{3,"Nightstick",1,50},{5,"Baseball Bat",1,50}, 
                            {6,"Shovel",1,50},{7,"Pool cue",1,50},{8,"Katana",1,1000},{9,"Chainsaw",1,1000}, 
                            {10,"Purple dildo",1,10},{11,"Short Dildo",1,5},{12,"Viberator",1,15},{13,"Flowers",1,10}, 
                            {15,"Cane",1,50},{16,"Grenade",3,2500},{17,"Tear Gas",3,2000},{18,"Molotov Cocktail",3,2000}, 
                            {39,"Satchel Charges",3,2500},{22,"Pistol",34,100},{24,"Desert Eagle",14,100},{25,"Shotgun",10,175}, 
                            {26,"Sawn-Off Shotgun",10,200},{27,"Spas-12",14,250},{28,"Uzi",100,160},{29,"MP5",60,200},{32,"Tec-9",100,120}, 
                            {30,"AK-47",30,200},{31,"M4",50,500},{33,"Country Rifle",10,100},{34,"Sniper Rifle",10,200}, 
                            --[[{35,"Rocket Launcher",1,7500},]]{37,"Flamethrower",50,500},{41,"Spraycan",500,25}, 
                            {42,"Fire Extinguisher",42,500,100},{43,"Camera",36,50},{44,"Night vision goggles",1,10},  
                            {45,"Infrared goggles",1,10},{46,"Parachute",1,25}} 
   
  ammunation_Window[1] = guiCreateWindow(sx*.5-200,sy*.5-167,399,334,"Ammu Nation",false) 
  guiSetVisible (ammunation_Window[1],false) 
  guiWindowSetSizable (ammunation_Window[1],false) 
  ammunation_Grid[1] = guiCreateGridList(11,28,203,294,false,ammunation_Window[1]) 
   
  guiGridListAddColumn(ammunation_Grid[1],"Weapon",0.55) 
  guiGridListAddColumn(ammunation_Grid[1],"Ammo",0.10) 
  guiGridListAddColumn(ammunation_Grid[1],"Price",0.15) 
  for i,v in pairs (weapons) do 
    local row = guiGridListAddRow (ammunation_Grid[1]) 
    guiGridListSetItemText (ammunation_Grid[1],row,1,v[2],false,false) 
    guiGridListSetItemText (ammunation_Grid[1],row,2,tostring(v[3]),false,true) 
    guiGridListSetItemText (ammunation_Grid[1],row,3,tostring(v[4]) .. "$",false,true) 
  end 
  ammunation_Button[1] = guiCreateButton(220,29,165,37,"Buy weapon",false,ammunation_Window[1]) 
  ammunation_Button[2] = guiCreateButton(220,70,165,37,"Close window",false,ammunation_Window[1]) 
  ammunation_Image[1] = guiCreateStaticImage(220,113,165,209,"ammu.png",false,ammunation_Window[1]) 
  
  ammunationmarkerpos = {{295.45,-38.21,1000.6,1},{295.56,-80.6,1000.6,4},{312.037,-165.84,998.7,6},{314.01,-133.72,998.7,7},{290.27,-109.57,1000.61,6}} 
  
  for i,v in pairs (ammunationmarkerpos) do 
    for j=1,12 do 
      local marker = createMarker (295.7265625,-79.8408203125,1000.515625,"cylinder",1,255,0,150) 
      setElementDimension( marker, 0) 
      setElementInterior( marker , 4 ) 
      setElementData(marker,"ammunation",j) 
    end 
  end   
   
end) 
  
addEventHandler ("onClientGUIClick",getRootElement(), 
function(button) 
  if button == "left" then 
    if source == ammunation_Button[1] then 
      local r,c = guiGridListGetSelectedItem (ammunation_Grid[1]) 
      if r then 
        local weapon = guiGridListGetItemText (ammunation_Grid[1],r,1) 
        local tableid = nil 
        local weaopnid = nil 
        for i,v in pairs (weapons) do 
          if weapon == v[2] then 
            weaponid = v[1] 
            tableid = i 
            break 
          end 
        end 
        if tableid then 
          local ammo = weapons[tableid][3] 
          local price = weapons[tableid][4] 
          triggerServerEvent ("ammunationBuy",getLocalPlayer(),weaponid,weapon,ammo,price) 
        else 
          exports.js_infowindow:showInfoWindow("You have to select a weapon first!") 
        end 
      else 
        exports.js_infowindow:showInfoWindow("You have to select a weapon first!") 
      end 
    elseif source == ammunation_Button[2] then 
      guiSetVisible (ammunation_Window[1],false) 
      showCursor (false,false) 
    end 
  end 
end) 
  
addEventHandler ("onClientMarkerHit",getRootElement(), 
function(hitElement,dimension) 
  if hitElement == getLocalPlayer() and dimension then 
    if getElementData (source,"ammunation") then 
      guiSetVisible (ammunation_Window[1],true) 
      showCursor (true,true) 
    end 
  end 
end) 
  

server side

  
  
----event2 
addEvent("ammunationBuy",root, 
addEventHandler("ammunationBuy",getRootElement(), 
function () 
local r,c = guiGridListGetSelectedItem (ammunation_Grid[1]) 
 if r then 
local weaponName = guiGridListGetItemText (ammunation_Grid[1],r,1) 
local weaponTable = findWeaponbyAmmuNationName (weaponName) 
if (weaponTable) then 
local weaponName = arg1 
local weaponAmmo = arg2 
local weaponCost = arg3 
local weaponID = arg4 
if (getPlayerMoney(source) >= tonumber(weaponCost)) then 
giveWeapon (source,tonumber(weaponID),tonumber(weaponAmmo),true) 
takePlayerMoney (source,tonumber(weaponCost)) 
outputChatBox("Succesfully bought/nWeapon:/n " ..weaponName.. "/n " .. weaponAmmo.. "ammo/n" ..weaponCost .."$/nCome back later.",getRootElement(),255,0,255) 
    else 
outputChatBox("Poor guy :<\nYou are too poor to buy this weapon!",getRootElement(),255,0,255) 
  end 
end) 

حل للمودين سريععععع

Link to comment
لمود الثاني أخطاء كثيرةةة ! مافي ترايقر , ليش ضايف فنكشنات الكلنت في السيرفر ؟

يا جماعه انا عاوز حل مش كل واحد يجي يكلم و خلاص

انا كاتب حل مش تتعرفو ع نفسكم في الموضوع

Link to comment

اكوادك هريسة صراحة

خابص كلينت مع سيرفر وسيرفر مع كلينت

في كل اكوادك

حاول تراجع الويكي اكثر واكثر

وميز بين انواع الفنكشنات

كذا ماراح تستفيد ولا تتعلم

بالتوفيق _

Link to comment
اكوادك هريسة صراحة

خابص كلينت مع سيرفر وسيرفر مع كلينت

في كل اكوادك

حاول تراجع الويكي اكثر واكثر

وميز بين انواع الفنكشنات

كذا ماراح تستفيد ولا تتعلم

بالتوفيق _

يعني وش قلتلو انا

يا طيب

Link to comment
اكوادك هريسة صراحة

خابص كلينت مع سيرفر وسيرفر مع كلينت

في كل اكوادك

حاول تراجع الويكي اكثر واكثر

وميز بين انواع الفنكشنات

كذا ماراح تستفيد ولا تتعلم

بالتوفيق _

يعني وش قلتلو انا

يا طيب

! والله مدري وش جابك هنا , شوف ردي زين وشوف ردك

Link to comment

ضيفه مع التاج

function Data(element,string,value,string1,value1,string2,value2) 
setElementData(element,string,value) 
setElementData(element,string1,value1) 
setElementData(element,string2,value2) 
end 
button = { 
    GUI = {} 
} 
label = { 
    GUI = {} 
} 
edit = { 
    GUI = {} 
} 
local screenW, screenH = guiGetScreenSize() 
window = guiCreateWindow((screenW - 215) / 2, (screenH - 135) / 2, 215, 135, "color name", false) 
guiWindowSetSizable(window, false) 
guiSetAlpha(window, 1.00) 
guiSetProperty(window, "CaptionColour", "FFBDB341") 
  
button.GUI['setcolor'] = guiCreateButton(10, 93, 195, 32, "Set Color", false, window) 
guiSetFont(button.GUI['setcolor'], "default-bold-small") 
guiSetProperty(button.GUI['setcolor'], "NormalTextColour", "FFD02D2D") 
edit.GUI['red'] = guiCreateEdit(10, 56, 65, 33, "255", false, window) 
guiSetProperty(edit.GUI['red'], "NormalTextColour", "FFFF0000") 
guiEditSetMaxLength(edit.GUI['red'], 3) 
edit.GUI['green'] = guiCreateEdit(75, 56, 65, 33, "255", false, window) 
guiSetProperty(edit.GUI['green'], "NormalTextColour", "FF008913") 
guiEditSetMaxLength(edit.GUI['green'], 3) 
edit.GUI['blue'] = guiCreateEdit(140, 56, 65, 33, "255", false, window) 
guiSetProperty(edit.GUI['blue'], "NormalTextColour", "FF001688") 
guiEditSetMaxLength(edit.GUI['blue'], 3) 
label.GUI['red'] = guiCreateLabel(10, 38, 60, 18, "Red", false, window) 
guiSetFont(label.GUI['red'], "default-bold-small") 
guiLabelSetColor(label.GUI['red'], 255, 0, 0) 
guiLabelSetHorizontalAlign(label.GUI['red'], "center", false) 
label.GUI['green'] = guiCreateLabel(75, 38, 60, 18, "Green", false, window) 
guiSetFont(label.GUI['green'], "default-bold-small") 
guiLabelSetColor(label.GUI['green'], 0, 255, 0) 
guiLabelSetHorizontalAlign(label.GUI['green'], "center", false) 
label.GUI['blue'] = guiCreateLabel(140, 38, 60, 18, "Blue", false, window) 
guiSetFont(label.GUI['blue'], "default-bold-small") 
guiLabelSetColor(label.GUI['blue'], 20, 73, 226) 
guiLabelSetHorizontalAlign(label.GUI['blue'], "center", false) 
------------------------------------- 
addEventHandler("onClientGUIClick", root,function () 
if(source == button.GUI['setcolor'] ) then 
red = guiGetText (edit.GUI['red']) 
green = guiGetText (edit.GUI['green']) 
blue = guiGetText (edit.GUI['blue']) 
if red ~= '' and green ~= '' and blue ~= '' then 
Data(localPlayer,'red',red,'green',green,'blue',blue) 
else 
outputChatBox("يجب ملئ جميع الفراغات") 
end 
end 
end) 

addEventHandler("onPlayerChat",root,function (msg)  
cancelEvent() 
red = getElementData(source,"red") or 255 
green = getElementData(source,"green") or 255 
blue = getElementData(source,"blue") or 255 
string = string.format("#%.2X%.2X%.2X",red,green,blue) 
outputChatBox(string ..''.. getPlayerName(source):gsub("#%x%x%x%x%x%x", "") .. ' #FFFFFF'.. msg,root, r, g, b, true) 
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...