Jump to content

تصحيح كود


Recommended Posts

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

الحين انا مسوي لوحه

تعطي فيب مقابل داتا معينه

الحين انا شغلته الدي بق تمام مافيه شي

الحين القريد ليست يكون فيها اشياء لكن ماهي ظاهره

ثانيه

الحين

لم اضغط علي الزر

يسحب الداتا ومايعطيه الشي المراد 

الدي بق مايطلع شي الاكواد --

-C

local Admin = {
{"VIP","20"},
}

--------------------
GUIEditor = {
    gridlist = {},
    label = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        window_system_vip = guiCreateWindow(123, 39, 460, 446, "[نظام الشراء العضويه الخاصه | System Buy Vip]", false)
        guiWindowSetSizable(window_system_vip, false)
        guiSetAlpha(window_system_vip, 1.00)
        guiSetVisible(window_system_vip, false)
        guiWindowSetSizable(window_system_vip, false) 
        guiWindowSetMovable(window_system_vip, true)
        logo_vip = guiCreateStaticImage(45, 88, 142, 122, "Back.png", false, window_system_vip)
        logo_dimaond = guiCreateStaticImage(260, 88, 130, 122, "guest.png", false, window_system_vip)
        GUIEditor.label[1] = guiCreateLabel(201, 128, 53, 37, "And", false, window_system_vip)
        guiSetFont(GUIEditor.label[1], "sa-header")
        GUIEditor.label[2] = guiCreateLabel(331, 46, 119, 21, "نظام الشراء بل جواهر", false, window_system_vip)
        guiLabelSetColor(GUIEditor.label[2], 1, 253, 238)
        GUIEditor.label[3] = guiCreateLabel(45, 63, 426, 15, "تحذير اذا قمت بل شراء مرتين متتالين سوف يتم خصم الجواهر وعدم اعطائك شي", false, window_system_vip)
        guiLabelSetColor(GUIEditor.label[3], 252, 0, 0)
        logo_war = guiCreateStaticImage(9, 52, 41, 42, "warning.png", false, window_system_vip)
        buttonbuy = guiCreateButton(302, 352, 148, 32, "شراء العضويه الخاصه (VIP)", false, window_system_vip)
        guiSetProperty(buttonbuy, "NormalTextColour", "FF2FFD00")
        GUIEditor.gridlist[1] = guiCreateGridList(14, 326, 236, 110, false, window_system_vip)
        guiGridListAddColumn(GUIEditor.gridlist[1], "#", 0.5)
        guiGridListAddColumn(GUIEditor.gridlist[1], "Diamond", 0.5)
        CLOSE = guiCreateButton(407, 413, 43, 23, "X", false, window_system_vip)
        guiSetProperty(CLOSE, "NormalTextColour", "FFFC0017")    
    end
)


-------------------Clos-----------------
addEventHandler ("onClientGUIClick", root,
        function()
        if (source == CLOSE) then
         guiSetVisible(window_system_vip, false)
         showCursor(false)
         guiSetInputEnabled(false)
        end
    end
)
------------------------------------------
for k,v in ipairs ( Admin ) do
row = guiGridListAddRow(GUIEditor.gridlist[1]);
guiGridListSetItemText(GUIEditor.gridlist[1],row,1,v[1],false,false);
guiGridListSetItemText(GUIEditor.gridlist[1],row,2,v[2],false,false);
guiGridListSetItemColor(GUIEditor.gridlist[1],row,1,math.random(0,255),math.random(0,255),math.random(0,255))
guiGridListSetItemColor(GUIEditor.gridlist[1],row,2,math.random(0,255),math.random(0,255),math.random(0,255))
end

xMainFunctions_ = function ( )
 local row, col = guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ) 
local Group = tostring ( guiGridListGetItemText(GUIEditor.gridlist[1],row,1 ));
local Price = tostring ( guiGridListGetItemText(GUIEditor.gridlist[1],row,2 ));
   if ( row and col and row ~= -1 and col ~= -1 ) then
triggerServerEvent("Accept:the:request",localPlayer,Group,Price);
  else
  outputChatBox("تـــم سحب منك 20 جوهرة . اقراء الكلام مره اخري",math.random(0,255),math.random(0,255),math.random(0,255),true);
  end
end
-----------------------------------------
addEventHandler ("onClientGUIClick", getRootElement(),
function(button, state, absoluteX, absoluteY)
    if ( source ==  buttonbuy ) then
    triggerServerEvent("VIP",getLocalPlayer())  
    end
end
)

        addCommandHandler("byvip",function ()
        if guiGetVisible(window_system_vip) == true then
        guiSetVisible(window_system_vip, false)
        showCursor(false)
        guiSetInputEnabled(false)
  else
        if guiGetVisible(window_system_vip) == false then
        guiSetVisible(window_system_vip, true)
        showCursor(false)
        guiSetInputEnabled(true)
        playSound("sound.wav")
    end
  end
end
)

 

-S

xAddToGroupFunction_ = function ( Group,Price )
	local account = getAccountName(getPlayerAccount(source));
    if isGuestAccount(getPlayerAccount(source)) then return outputChatBox("#You must register first To By VIP",source,255,0,255,true); end
	if isObjectInACLGroup("user."..account, aclGetGroup(tostring(Group))) then return outputChatBox("You Have VIP",source,255,0,255,true); end
    local sValue = getElementData( source,'Diamond' )
	if not sValue then sValue = '0:0:0' end
	local data = split(sValue,':')
	local hour = tonumber( data[1] )  
	if hour == nil or not tonumber(hour) then hour = 0 end
	if ( hour >= tonumber(Price))  then
		aclGroupAddObject (aclGetGroup( tostring(Group)),"user."..account);
		outputChatBox("You Bought VIP 7 Days "..Name,source,255,0,255,true);
	else
		outputChatBox("VIP = 20 Diamond ",source,0,255,255,true);
    end
end
addEvent("Accept:the:request",true)
addEventHandler("Accept:the:request",root,xAddToGroupFunction_)


addEventHandler("onPlayerJoin",root,
function()
setElementData(source,"Diamond",0)
end)


function takePlayerDiamond(thePlayer, number)
     if ( getElementType ( thePlayer ) == "player" ) then
         setElementData(thePlayer,"Diamond",getElementData(thePlayer, "Diamond")-tonumber(number))
     end
end

function setPlayerDiamond(thePlayer, number)
     if ( getElementType ( thePlayer ) == "player" ) then
         setElementData(thePlayer,"Diamond",tonumber(number))
     end
end

function givePlayerDiamond(thePlayer, number)
     if ( getElementType ( thePlayer ) == "player" ) then
         setElementData(thePlayer,"Diamond",getElementData(thePlayer, "Diamond")+tonumber(number))
     end
end


function getPlayerDiamond(thePlayer)
    local data = getElementData(thePlayer, "Diamond")
    thePoints = tonumber(data)
	return thePoints
end


------------------------


addEvent("VIP",true)
addEventHandler("VIP",root,
function()
local PlayerDiamond = getPlayerCoin(source)
    if ( PlayerDiamond >= 70) then
    takePlayerCoin(source,70)           
    local name = getPlayerName(source)
    else

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