Jump to content

help in drug system


Recommended Posts

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

انا معي لوحة مخدرات جوي عدلتها لدي اكس

لكن هناك مشاكل

  
sec = {{{{{{},{},{},{}}}}}}
 
local sx, sy = guiGetScreenSize()
guiSetInputMode("no_binds_when_editing")
 
 
GUIEditor = {
    label = {}
}
 
DrugUseWindow = guiCreateWindow(227, 111, 357, 332, "", false)
guiWindowSetSizable(DrugUseWindow, false)
guiSetAlpha(DrugUseWindow, 0.00)
guiSetVisible(DrugUseWindow,false)
 
UseDrug = guiCreateButton(335, 370, 118, 73, "", false)
guiSetAlpha(UseDrug, 0.00)
 
 
GUIEditor.label[6] = guiCreateLabel(483, 415, 91, 18, "© Ja[b]er[X]Pro", false,DrugUseWindow)
 
 
WeedRadioButton = guiCreateCheckBox(236, 160, 189, 15, "Weed (جاذبية منخفضة)", false, DrugUseWindow)
guiSetFont(WeedRadioButton, "default-bold-small")
guiSetProperty(WeedRadioButton, "NormalTextColour", "FF50DD2F")
 
 
GodRadioButton = guiCreateCheckBox(236, 194, 189, 15, "God (دم 200)", false, DrugUseWindow)
guiSetFont(GodRadioButton, "default-bold-small")
guiSetProperty(GodRadioButton, "NormalTextColour", "FFFD0E0E")
 
 
SpeedRadioButton = guiCreateCheckBox(236, 227, 189, 15, "Speed (سرعة كبيرة)", false, DrugUseWindow)
guiSetFont(SpeedRadioButton, "default-bold-small")
guiSetProperty(SpeedRadioButton, "NormalTextColour", "FF2ACCE0")
 
 
LSDRadioButton = guiCreateCheckBox(236, 261, 189, 15, "LSD (تشويش الرؤية)", false, DrugUseWindow)
guiSetFont(LSDRadioButton, "default-bold-small")
guiSetProperty(LSDRadioButton, "NormalTextColour", "FF93B950")
 
 
SteroidsRadioButton = guiCreateCheckBox(236, 294, 189, 15, "Steroids (كل 8 تواني +2 دم)", false, DrugUseWindow)
guiSetFont(SteroidsRadioButton, "default-bold-small")
guiSetProperty(SteroidsRadioButton, "NormalTextColour", "FF1478F4")
 
 
HeroinRadioButton = guiCreateCheckBox(236, 328, 189, 15, "Herion (يجعل تقشيرك صعب)", false, DrugUseWindow)
guiSetFont(HeroinRadioButton, "default-bold-small")
guiSetProperty(HeroinRadioButton, "NormalTextColour", "FFEFE718")
 
 
 
 
 
bindKey("F2", "down",
function()
    if getPedOccupiedVehicle(localPlayer) and not guiGetVisible(DrugUseWindow) then
        outputChatBox("You can not use drugs while in a vehicle!",source, 255, 0, 0)
        return
    end
    dxDrawLine(228 - 1, 112 - 1, 228 - 1, 146, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(578, 112 - 1, 228 - 1, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(228 - 1, 146, 578, 146, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(578, 146, 578, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawRectangle(228, 112, 350, 34, tocolor(224, 226, 28, 255), true)
    dxDrawLine(229 - 1, 113 - 1, 229 - 1, 443, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(579, 113 - 1, 229 - 1, 113 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(229 - 1, 443, 579, 443, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(579, 443, 579, 113 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawRectangle(229, 113, 350, 330, tocolor(247, 17, 17, 100), false)
    dxDrawText("Drug System", 301, 103, 406, 141, tocolor(255, 255, 255, 255), 3.00, "default", "left", "top", false, false, true, false, false)
    dxDrawRectangle(340, 377, 103, 56, tocolor(239, 231, 24, 170), true)
    dxDrawText("Use", 368, 387, 473, 444, tocolor(183, 55, 207, 255), 2.00, "default", "left", "top", false, false, true, false, false)
        guiSetVisible(DrugUseWindow, not guiGetVisible(DrugUseWindow))
        showCursor(guiGetVisible(DrugUseWindow))
end)
 
DrugBuyWindow = guiCreateWindow(sx/2-(550/2), sy/2-(310/2), 600, 310, "Drugs by Price for GTW-RPG", false)
guiWindowSetSizable(DrugBuyWindow, false)
guiSetVisible(DrugBuyWindow, false)
guiSetAlpha(DrugBuyWindow, 0.98)
 
WeedBuyLabel = guiCreateLabel(25, 38, 205, 15, "Weed (Low gravity)", false, DrugBuyWindow)
WeedPriceLabel = guiCreateLabel(67.5, 58, 205, 15, "$900", false, DrugBuyWindow)
WeedBuyEdit = guiCreateEdit(47.5, 88, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(WeedBuyLabel, 251, 213, 3)
guiLabelSetColor(WeedPriceLabel, 0, 255, 0)
 
GodBuyLabel = guiCreateLabel(235, 38, 205, 15, "God (Increased max health)", false, DrugBuyWindow)
GodPriceLabel = guiCreateLabel(280, 58, 205, 15, "$3000", false, DrugBuyWindow)
GodBuyEdit = guiCreateEdit(260, 88, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(GodBuyLabel, 0, 253, 5)
guiLabelSetColor(GodPriceLabel, 0, 255, 0)
 
--
 
SpeedBuyLabel = guiCreateLabel(25, 125, 205, 15, "Speed (Faster action)", false, DrugBuyWindow)
SpeedPriceLabel = guiCreateLabel(67.5, 145, 205, 15, "$1100", false, DrugBuyWindow)
SpeedBuyEdit = guiCreateEdit(47.5, 175, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(SpeedBuyLabel, 250, 2, 194)
guiLabelSetColor(SpeedPriceLabel, 0, 255, 0)
 
LSDBuyLabel = guiCreateLabel(235, 125, 205, 15, "LSD (Hallucination)", false, DrugBuyWindow)
LSDPriceLabel = guiCreateLabel(280, 145, 205, 15, "$2000", false, DrugBuyWindow)
LSDBuyEdit = guiCreateEdit(260, 175, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(LSDBuyLabel, 0, 248, 251)
guiLabelSetColor(LSDPriceLabel, 0, 255, 0)
 
--
 
SteroidsBuyLabel = guiCreateLabel(25, 212, 205, 15, "Steroids (+2 hp every 8seconds)", false, DrugBuyWindow)
SteroidsPriceLabel = guiCreateLabel(67.5, 232, 205, 15, "$800", false, DrugBuyWindow)
SteroidsBuyEdit = guiCreateEdit(47.5, 262, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(SteroidsBuyLabel, 2, 248, 60)
guiLabelSetColor(SteroidsPriceLabel, 0, 255, 0)
 
HeroinBuyLabel = guiCreateLabel(235, 212, 205, 15, "Heroin (Semi invincibility)", false, DrugBuyWindow)
HeroinPriceLabel = guiCreateLabel(280, 232, 205, 15, "$4000", false, DrugBuyWindow)
HeroinBuyEdit = guiCreateEdit(260, 262, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(HeroinBuyLabel, 201, 48, 196)
guiLabelSetColor(HeroinPriceLabel, 0, 255, 0)
 
guiCreateStaticImage(450, 50, 125, 125, "drug.png", false, DrugBuyWindow)
 
Total = guiCreateLabel(410, 200, 35, 16, "Total:", false, DrugBuyWindow)
guiSetFont(Total, "default-bold-small")
TotalLabel = guiCreateLabel(450, 200, 94, 16, "$0", false, DrugBuyWindow)
guiSetFont(TotalLabel, "default-bold-small")
guiLabelSetColor(TotalLabel, 0, 255, 0)
 
BuyDrug = guiCreateButton(400, 250, 90, 35, "Buy", false, DrugBuyWindow)
CloseBuyDrugPanel = guiCreateButton(500, 250, 90, 35, "Close", false, DrugBuyWindow)
 
function showBuyDrug()
    guiSetText(TotalLabel, "$0")
    guiSetText(WeedBuyEdit, "0")
    guiSetText(GodBuyEdit, "0")
    guiSetText(SpeedBuyEdit, "0")
    guiSetText(LSDBuyEdit, "0")
    guiSetText(SteroidsBuyEdit, "0")
    guiSetText(HeroinBuyEdit, "0")
    guiSetVisible(DrugBuyWindow, true)
    showCursor(true)
    if drugDealer then
        guiSetText(DrugBuyWindow, "Buying drugs from "..getPlayerName(drugDealer))
    else
        guiSetText(DrugBuyWindow, "Buying drugs from drug Dealer Ped")
    end
end
 
addEventHandler("onClientGUIChanged", guiRoot,
function()
    if drugDealer then
        if getElementData(drugDealer, "DurgsDealer") then
            MaxWeed = (getElementData(drugDealer, "Weed") or 0) + (getElementData(localPlayer, "Weed") or 0)
            MaxGod = (getElementData(drugDealer, "God") or 0) + (getElementData(localPlayer, "God") or 0)
            MaxSpeed = (getElementData(drugDealer, "Speed") or 0) + (getElementData(localPlayer, "Speed") or 0)
            MaxLSD = (getElementData(drugDealer, "LSD") or 0) + (getElementData(localPlayer, "LSD") or 0)
            MaxSteroids = (getElementData(drugDealer, "Steroids") or 0) + (getElementData(localPlayer, "Steroids") or 0)
            MaxHeroin = (getElementData(drugDealer, "Heroin") or 0) + (getElementData(localPlayer, "Heroin") or 0)
        else
            exports.GTWtopbar:dm("This player does not sell drugs anymore!", 255, 0, 0)
            drugDealer = nil
            guiSetVisible(DrugBuyWindow, false)
            showCursor(false)
        end
    else
        MaxWeed = 10000
        MaxGod = 10000
        MaxSpeed = 10000
        MaxLSD = 10000
        MaxSteroids = 10000
        MaxHeroin = 10000
    end
    local Text = guiGetText(source)
    local Text = tonumber(Text)
    if source == WeedBuyEdit then
        local Amount = getElementData(localPlayer, "Weed") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxWeed then
            guiSetText(source, MaxWeed-Amount >= 0 and MaxWeed-Amount or "0")
        end
        WeedCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(WeedPriceLabel), 2))
    elseif source == GodBuyEdit then
        local Amount = getElementData(localPlayer, "God") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxGod then
            guiSetText(source, MaxGod-Amount >= 0 and MaxGod-Amount or "0")
        end
        GodCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(GodPriceLabel), 2))
    elseif source == SpeedBuyEdit then
        local Amount = getElementData(localPlayer, "Speed") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxSpeed then
            guiSetText(source, MaxSpeed-Amount >= 0 and MaxSpeed-Amount or "0")
        end
        SpeedCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(SpeedPriceLabel), 2))
    elseif source == LSDBuyEdit then
        local Amount = getElementData(localPlayer, "LSD") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxLSD then
            guiSetText(source, MaxLSD-Amount >= 0 and MaxLSD-Amount or "0")
        end
        LSDCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(LSDPriceLabel), 2))
    elseif source == SteroidsBuyEdit then
        local Amount = getElementData(localPlayer, "Steroids") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxSteroids then
            guiSetText(source, MaxSteroids-Amount >= 0 and MaxSteroids-Amount or "0")
        end
        SteroidsCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(SteroidsPriceLabel), 2))
    elseif source == HeroinBuyEdit then
        local Amount = getElementData(localPlayer, "Heroin") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxHeroin then
            guiSetText(source, MaxHeroin-Amount >= 0 and MaxHeroin-Amount or "0")
        end
        HeroinCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(HeroinPriceLabel), 2))
    end
    local TotalCost = (WeedCost or 0) + (GodCost or 0) + (SpeedCost or 0) + (LSDCost or 0) + (SteroidsCost or 0) + (HeroinCost or 0)
    guiSetText(TotalLabel, "$"..TotalCost)
end)
 
addEventHandler("onClientGUIClick", guiRoot,
function()
    if source == BuyDrug then
        local WeedAmount = tonumber(guiGetText(WeedBuyEdit))
        local GodAmount = tonumber(guiGetText(GodBuyEdit))
        local SpeedAmount = tonumber(guiGetText(SpeedBuyEdit))
        local LSDAmount = tonumber(guiGetText(LSDBuyEdit))
        local SteroidsAmount = tonumber(guiGetText(SteroidsBuyEdit))
        local HeroinAmount = tonumber(guiGetText(HeroinBuyEdit))
        local Cost = tonumber(string.sub(guiGetText(TotalLabel), 2))
        if Cost > 0 then
            if drugDealer then
                if getElementData(drugDealer, "DurgsDealer") then
                    MaxWeed = getElementData(drugDealer, "Weed") or 0
                    MaxGod = getElementData(drugDealer, "God") or 0
                    MaxSpeed = getElementData(drugDealer, "Speed") or 0
                    MaxLSD = getElementData(drugDealer, "LSD") or 0
                    MaxSteroids = getElementData(drugDealer, "Steroids") or 0
                    MaxHeroin = getElementData(drugDealer, "Heroin") or 0
                    if MaxWeed >= WeedAmount and MaxGod >= GodAmount and MaxSpeed >= SpeedAmount and MaxLSD >= LSDAmount and MaxSteroids >= SteroidsAmount and MaxHeroin >= HeroinAmount then
                       
Link to comment

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

انا معي لوحة مخدرات جوي عدلتها لدي اكس

لكن هناك مشاكل

  
sec = {{{{{{},{},{},{}}}}}}
 
local sx, sy = guiGetScreenSize()
guiSetInputMode("no_binds_when_editing")
 
 
GUIEditor = {
    label = {}
}
 
DrugUseWindow = guiCreateWindow(227, 111, 357, 332, "", false)
guiWindowSetSizable(DrugUseWindow, false)
guiSetAlpha(DrugUseWindow, 0.00)
guiSetVisible(DrugUseWindow,false)
 
UseDrug = guiCreateButton(335, 370, 118, 73, "", false)
guiSetAlpha(UseDrug, 0.00)
 
 
GUIEditor.label[6] = guiCreateLabel(483, 415, 91, 18, "© Ja[b]er[X]Pro", false,DrugUseWindow)
 
 
WeedRadioButton = guiCreateCheckBox(236, 160, 189, 15, "Weed (جاذبية منخفضة)", false, DrugUseWindow)
guiSetFont(WeedRadioButton, "default-bold-small")
guiSetProperty(WeedRadioButton, "NormalTextColour", "FF50DD2F")
 
 
GodRadioButton = guiCreateCheckBox(236, 194, 189, 15, "God (دم 200)", false, DrugUseWindow)
guiSetFont(GodRadioButton, "default-bold-small")
guiSetProperty(GodRadioButton, "NormalTextColour", "FFFD0E0E")
 
 
SpeedRadioButton = guiCreateCheckBox(236, 227, 189, 15, "Speed (سرعة كبيرة)", false, DrugUseWindow)
guiSetFont(SpeedRadioButton, "default-bold-small")
guiSetProperty(SpeedRadioButton, "NormalTextColour", "FF2ACCE0")
 
 
LSDRadioButton = guiCreateCheckBox(236, 261, 189, 15, "LSD (تشويش الرؤية)", false, DrugUseWindow)
guiSetFont(LSDRadioButton, "default-bold-small")
guiSetProperty(LSDRadioButton, "NormalTextColour", "FF93B950")
 
 
SteroidsRadioButton = guiCreateCheckBox(236, 294, 189, 15, "Steroids (كل 8 تواني +2 دم)", false, DrugUseWindow)
guiSetFont(SteroidsRadioButton, "default-bold-small")
guiSetProperty(SteroidsRadioButton, "NormalTextColour", "FF1478F4")
 
 
HeroinRadioButton = guiCreateCheckBox(236, 328, 189, 15, "Herion (يجعل تقشيرك صعب)", false, DrugUseWindow)
guiSetFont(HeroinRadioButton, "default-bold-small")
guiSetProperty(HeroinRadioButton, "NormalTextColour", "FFEFE718")
 
 
 
 
 
bindKey("F2", "down",
function()
    if getPedOccupiedVehicle(localPlayer) and not guiGetVisible(DrugUseWindow) then
        outputChatBox("You can not use drugs while in a vehicle!",source, 255, 0, 0)
        return
    end
    dxDrawLine(228 - 1, 112 - 1, 228 - 1, 146, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(578, 112 - 1, 228 - 1, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(228 - 1, 146, 578, 146, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(578, 146, 578, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawRectangle(228, 112, 350, 34, tocolor(224, 226, 28, 255), true)
    dxDrawLine(229 - 1, 113 - 1, 229 - 1, 443, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(579, 113 - 1, 229 - 1, 113 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(229 - 1, 443, 579, 443, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(579, 443, 579, 113 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawRectangle(229, 113, 350, 330, tocolor(247, 17, 17, 100), false)
    dxDrawText("Drug System", 301, 103, 406, 141, tocolor(255, 255, 255, 255), 3.00, "default", "left", "top", false, false, true, false, false)
    dxDrawRectangle(340, 377, 103, 56, tocolor(239, 231, 24, 170), true)
    dxDrawText("Use", 368, 387, 473, 444, tocolor(183, 55, 207, 255), 2.00, "default", "left", "top", false, false, true, false, false)
        guiSetVisible(DrugUseWindow, not guiGetVisible(DrugUseWindow))
        showCursor(guiGetVisible(DrugUseWindow))
end)
 
DrugBuyWindow = guiCreateWindow(sx/2-(550/2), sy/2-(310/2), 600, 310, "Drugs by Price for GTW-RPG", false)
guiWindowSetSizable(DrugBuyWindow, false)
guiSetVisible(DrugBuyWindow, false)
guiSetAlpha(DrugBuyWindow, 0.98)
 
WeedBuyLabel = guiCreateLabel(25, 38, 205, 15, "Weed (Low gravity)", false, DrugBuyWindow)
WeedPriceLabel = guiCreateLabel(67.5, 58, 205, 15, "$900", false, DrugBuyWindow)
WeedBuyEdit = guiCreateEdit(47.5, 88, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(WeedBuyLabel, 251, 213, 3)
guiLabelSetColor(WeedPriceLabel, 0, 255, 0)
 
GodBuyLabel = guiCreateLabel(235, 38, 205, 15, "God (Increased max health)", false, DrugBuyWindow)
GodPriceLabel = guiCreateLabel(280, 58, 205, 15, "$3000", false, DrugBuyWindow)
GodBuyEdit = guiCreateEdit(260, 88, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(GodBuyLabel, 0, 253, 5)
guiLabelSetColor(GodPriceLabel, 0, 255, 0)
 
--
 
SpeedBuyLabel = guiCreateLabel(25, 125, 205, 15, "Speed (Faster action)", false, DrugBuyWindow)
SpeedPriceLabel = guiCreateLabel(67.5, 145, 205, 15, "$1100", false, DrugBuyWindow)
SpeedBuyEdit = guiCreateEdit(47.5, 175, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(SpeedBuyLabel, 250, 2, 194)
guiLabelSetColor(SpeedPriceLabel, 0, 255, 0)
 
LSDBuyLabel = guiCreateLabel(235, 125, 205, 15, "LSD (Hallucination)", false, DrugBuyWindow)
LSDPriceLabel = guiCreateLabel(280, 145, 205, 15, "$2000", false, DrugBuyWindow)
LSDBuyEdit = guiCreateEdit(260, 175, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(LSDBuyLabel, 0, 248, 251)
guiLabelSetColor(LSDPriceLabel, 0, 255, 0)
 
--
 
SteroidsBuyLabel = guiCreateLabel(25, 212, 205, 15, "Steroids (+2 hp every 8seconds)", false, DrugBuyWindow)
SteroidsPriceLabel = guiCreateLabel(67.5, 232, 205, 15, "$800", false, DrugBuyWindow)
SteroidsBuyEdit = guiCreateEdit(47.5, 262, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(SteroidsBuyLabel, 2, 248, 60)
guiLabelSetColor(SteroidsPriceLabel, 0, 255, 0)
 
HeroinBuyLabel = guiCreateLabel(235, 212, 205, 15, "Heroin (Semi invincibility)", false, DrugBuyWindow)
HeroinPriceLabel = guiCreateLabel(280, 232, 205, 15, "$4000", false, DrugBuyWindow)
HeroinBuyEdit = guiCreateEdit(260, 262, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(HeroinBuyLabel, 201, 48, 196)
guiLabelSetColor(HeroinPriceLabel, 0, 255, 0)
 
guiCreateStaticImage(450, 50, 125, 125, "drug.png", false, DrugBuyWindow)
 
Total = guiCreateLabel(410, 200, 35, 16, "Total:", false, DrugBuyWindow)
guiSetFont(Total, "default-bold-small")
TotalLabel = guiCreateLabel(450, 200, 94, 16, "$0", false, DrugBuyWindow)
guiSetFont(TotalLabel, "default-bold-small")
guiLabelSetColor(TotalLabel, 0, 255, 0)
 
BuyDrug = guiCreateButton(400, 250, 90, 35, "Buy", false, DrugBuyWindow)
CloseBuyDrugPanel = guiCreateButton(500, 250, 90, 35, "Close", false, DrugBuyWindow)
 
function showBuyDrug()
    guiSetText(TotalLabel, "$0")
    guiSetText(WeedBuyEdit, "0")
    guiSetText(GodBuyEdit, "0")
    guiSetText(SpeedBuyEdit, "0")
    guiSetText(LSDBuyEdit, "0")
    guiSetText(SteroidsBuyEdit, "0")
    guiSetText(HeroinBuyEdit, "0")
    guiSetVisible(DrugBuyWindow, true)
    showCursor(true)
    if drugDealer then
        guiSetText(DrugBuyWindow, "Buying drugs from "..getPlayerName(drugDealer))
    else
        guiSetText(DrugBuyWindow, "Buying drugs from drug Dealer Ped")
    end
end
 
addEventHandler("onClientGUIChanged", guiRoot,
function()
    if drugDealer then
        if getElementData(drugDealer, "DurgsDealer") then
            MaxWeed = (getElementData(drugDealer, "Weed") or 0) + (getElementData(localPlayer, "Weed") or 0)
            MaxGod = (getElementData(drugDealer, "God") or 0) + (getElementData(localPlayer, "God") or 0)
            MaxSpeed = (getElementData(drugDealer, "Speed") or 0) + (getElementData(localPlayer, "Speed") or 0)
            MaxLSD = (getElementData(drugDealer, "LSD") or 0) + (getElementData(localPlayer, "LSD") or 0)
            MaxSteroids = (getElementData(drugDealer, "Steroids") or 0) + (getElementData(localPlayer, "Steroids") or 0)
            MaxHeroin = (getElementData(drugDealer, "Heroin") or 0) + (getElementData(localPlayer, "Heroin") or 0)
        else
            exports.GTWtopbar:dm("This player does not sell drugs anymore!", 255, 0, 0)
            drugDealer = nil
            guiSetVisible(DrugBuyWindow, false)
            showCursor(false)
        end
    else
        MaxWeed = 10000
        MaxGod = 10000
        MaxSpeed = 10000
        MaxLSD = 10000
        MaxSteroids = 10000
        MaxHeroin = 10000
    end
    local Text = guiGetText(source)
    local Text = tonumber(Text)
    if source == WeedBuyEdit then
        local Amount = getElementData(localPlayer, "Weed") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxWeed then
            guiSetText(source, MaxWeed-Amount >= 0 and MaxWeed-Amount or "0")
        end
        WeedCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(WeedPriceLabel), 2))
    elseif source == GodBuyEdit then
        local Amount = getElementData(localPlayer, "God") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxGod then
            guiSetText(source, MaxGod-Amount >= 0 and MaxGod-Amount or "0")
        end
        GodCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(GodPriceLabel), 2))
    elseif source == SpeedBuyEdit then
        local Amount = getElementData(localPlayer, "Speed") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxSpeed then
            guiSetText(source, MaxSpeed-Amount >= 0 and MaxSpeed-Amount or "0")
        end
        SpeedCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(SpeedPriceLabel), 2))
    elseif source == LSDBuyEdit then
        local Amount = getElementData(localPlayer, "LSD") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxLSD then
            guiSetText(source, MaxLSD-Amount >= 0 and MaxLSD-Amount or "0")
        end
        LSDCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(LSDPriceLabel), 2))
    elseif source == SteroidsBuyEdit then
        local Amount = getElementData(localPlayer, "Steroids") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxSteroids then
            guiSetText(source, MaxSteroids-Amount >= 0 and MaxSteroids-Amount or "0")
        end
        SteroidsCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(SteroidsPriceLabel), 2))
    elseif source == HeroinBuyEdit then
        local Amount = getElementData(localPlayer, "Heroin") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxHeroin then
            guiSetText(source, MaxHeroin-Amount >= 0 and MaxHeroin-Amount or "0")
        end
        HeroinCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(HeroinPriceLabel), 2))
    end
    local TotalCost = (WeedCost or 0) + (GodCost or 0) + (SpeedCost or 0) + (LSDCost or 0) + (SteroidsCost or 0) + (HeroinCost or 0)
    guiSetText(TotalLabel, "$"..TotalCost)
end)
 
addEventHandler("onClientGUIClick", guiRoot,
function()
    if source == BuyDrug then
        local WeedAmount = tonumber(guiGetText(WeedBuyEdit))
        local GodAmount = tonumber(guiGetText(GodBuyEdit))
        local SpeedAmount = tonumber(guiGetText(SpeedBuyEdit))
        local LSDAmount = tonumber(guiGetText(LSDBuyEdit))
        local SteroidsAmount = tonumber(guiGetText(SteroidsBuyEdit))
        local HeroinAmount = tonumber(guiGetText(HeroinBuyEdit))
        local Cost = tonumber(string.sub(guiGetText(TotalLabel), 2))
        if Cost > 0 then
            if drugDealer then
                if getElementData(drugDealer, "DurgsDealer") then
                    MaxWeed = getElementData(drugDealer, "Weed") or 0
                    MaxGod = getElementData(drugDealer, "God") or 0
                    MaxSpeed = getElementData(drugDealer, "Speed") or 0
                    MaxLSD = getElementData(drugDealer, "LSD") or 0
                    MaxSteroids = getElementData(drugDealer, "Steroids") or 0
                    MaxHeroin = getElementData(drugDealer, "Heroin") or 0
                    if MaxWeed >= WeedAmount and MaxGod >= GodAmount and MaxSpeed >= SpeedAmount and MaxLSD >= LSDAmount and MaxSteroids >= SteroidsAmount and MaxHeroin >= HeroinAmount then
                       
Link to comment
addEventHandler -- 'onClientRender' 

مو موجود

هكذا ؟

  
sec = {{{{{{},{},{},{}}}}}}
 
local sx, sy = guiGetScreenSize()
guiSetInputMode("no_binds_when_editing")
 
 
GUIEditor = {
    label = {}
}
 
DrugUseWindow = guiCreateWindow(227, 111, 357, 332, "", false)
guiWindowSetSizable(DrugUseWindow, false)
guiSetAlpha(DrugUseWindow, 0.00)
guiSetVisible(DrugUseWindow,false)
 
UseDrug = guiCreateButton(335, 370, 118, 73, "", false)
guiSetAlpha(UseDrug, 0.00)
 
 
GUIEditor.label[6] = guiCreateLabel(483, 415, 91, 18, "© Ja[b]er[X]Pro", false,DrugUseWindow)
 
 
WeedRadioButton = guiCreateCheckBox(236, 160, 189, 15, "Weed (جاذبية منخفضة)", false, DrugUseWindow)
guiSetFont(WeedRadioButton, "default-bold-small")
guiSetProperty(WeedRadioButton, "NormalTextColour", "FF50DD2F")
 
 
GodRadioButton = guiCreateCheckBox(236, 194, 189, 15, "God (دم 200)", false, DrugUseWindow)
guiSetFont(GodRadioButton, "default-bold-small")
guiSetProperty(GodRadioButton, "NormalTextColour", "FFFD0E0E")
 
 
SpeedRadioButton = guiCreateCheckBox(236, 227, 189, 15, "Speed (سرعة كبيرة)", false, DrugUseWindow)
guiSetFont(SpeedRadioButton, "default-bold-small")
guiSetProperty(SpeedRadioButton, "NormalTextColour", "FF2ACCE0")
 
 
LSDRadioButton = guiCreateCheckBox(236, 261, 189, 15, "LSD (تشويش الرؤية)", false, DrugUseWindow)
guiSetFont(LSDRadioButton, "default-bold-small")
guiSetProperty(LSDRadioButton, "NormalTextColour", "FF93B950")
 
 
SteroidsRadioButton = guiCreateCheckBox(236, 294, 189, 15, "Steroids (كل 8 تواني +2 دم)", false, DrugUseWindow)
guiSetFont(SteroidsRadioButton, "default-bold-small")
guiSetProperty(SteroidsRadioButton, "NormalTextColour", "FF1478F4")
 
 
HeroinRadioButton = guiCreateCheckBox(236, 328, 189, 15, "Herion (يجعل تقشيرك صعب)", false, DrugUseWindow)
guiSetFont(HeroinRadioButton, "default-bold-small")
guiSetProperty(HeroinRadioButton, "NormalTextColour", "FFEFE718")
 
addEventHandler("onClientRender",root,
function()
    dxDrawLine(228 - 1, 112 - 1, 228 - 1, 146, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(578, 112 - 1, 228 - 1, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(228 - 1, 146, 578, 146, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(578, 146, 578, 112 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawRectangle(228, 112, 350, 34, tocolor(224, 226, 28, 255), false)
    dxDrawLine(229 - 1, 113 - 1, 229 - 1, 443, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(579, 113 - 1, 229 - 1, 113 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(229 - 1, 443, 579, 443, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(579, 443, 579, 113 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawRectangle(229, 113, 350, 330, tocolor(247, 17, 17, 100), false)
    dxDrawText("Drug System", 301, 103, 406, 141, tocolor(255, 255, 255, 255), 3.00, "default", "left", "top", false, false, false, false, false)
    dxDrawRectangle(340, 377, 103, 56, tocolor(239, 231, 24, 170), false)
    dxDrawText("Use", 368, 387, 473, 444, tocolor(183, 55, 207, 255), 2.00, "default", "left", "top", false, false, false, false, false)   
end)
 
 
 
bindKey("F2", "down",
function()
    if getPedOccupiedVehicle(localPlayer) and not guiGetVisible(DrugUseWindow) then
        outputChatBox("You can not use drugs while in a vehicle!",source, 255, 0, 0)
        return
    end
    dxDrawLine(228 - 1, 112 - 1, 228 - 1, 146, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(578, 112 - 1, 228 - 1, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(228 - 1, 146, 578, 146, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(578, 146, 578, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawRectangle(228, 112, 350, 34, tocolor(224, 226, 28, 255), true)
    dxDrawLine(229 - 1, 113 - 1, 229 - 1, 443, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(579, 113 - 1, 229 - 1, 113 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(229 - 1, 443, 579, 443, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(579, 443, 579, 113 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawRectangle(229, 113, 350, 330, tocolor(247, 17, 17, 100), true)
    dxDrawText("Drug System", 301, 103, 406, 141, tocolor(255, 255, 255, 255), 3.00, "default", "left", "top", false, false, true, false, false)
    dxDrawRectangle(340, 377, 103, 56, tocolor(239, 231, 24, 170), true)
    dxDrawText("Use", 368, 387, 473, 444, tocolor(183, 55, 207, 255), 2.00, "default", "left", "top", false, false, true, false, false)
        guiSetVisible(DrugUseWindow, not guiGetVisible(DrugUseWindow))
        showCursor(guiGetVisible(DrugUseWindow))
end)
 
DrugBuyWindow = guiCreateWindow(sx/2-(550/2), sy/2-(310/2), 600, 310, "Drugs by Price for GTW-RPG", false)
guiWindowSetSizable(DrugBuyWindow, false)
guiSetVisible(DrugBuyWindow, false)
guiSetAlpha(DrugBuyWindow, 0.98)
 
WeedBuyLabel = guiCreateLabel(25, 38, 205, 15, "Weed (Low gravity)", false, DrugBuyWindow)
WeedPriceLabel = guiCreateLabel(67.5, 58, 205, 15, "$900", false, DrugBuyWindow)
WeedBuyEdit = guiCreateEdit(47.5, 88, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(WeedBuyLabel, 251, 213, 3)
guiLabelSetColor(WeedPriceLabel, 0, 255, 0)
 
GodBuyLabel = guiCreateLabel(235, 38, 205, 15, "God (Increased max health)", false, DrugBuyWindow)
GodPriceLabel = guiCreateLabel(280, 58, 205, 15, "$3000", false, DrugBuyWindow)
GodBuyEdit = guiCreateEdit(260, 88, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(GodBuyLabel, 0, 253, 5)
guiLabelSetColor(GodPriceLabel, 0, 255, 0)
 
--
 
SpeedBuyLabel = guiCreateLabel(25, 125, 205, 15, "Speed (Faster action)", false, DrugBuyWindow)
SpeedPriceLabel = guiCreateLabel(67.5, 145, 205, 15, "$1100", false, DrugBuyWindow)
SpeedBuyEdit = guiCreateEdit(47.5, 175, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(SpeedBuyLabel, 250, 2, 194)
guiLabelSetColor(SpeedPriceLabel, 0, 255, 0)
 
LSDBuyLabel = guiCreateLabel(235, 125, 205, 15, "LSD (Hallucination)", false, DrugBuyWindow)
LSDPriceLabel = guiCreateLabel(280, 145, 205, 15, "$2000", false, DrugBuyWindow)
LSDBuyEdit = guiCreateEdit(260, 175, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(LSDBuyLabel, 0, 248, 251)
guiLabelSetColor(LSDPriceLabel, 0, 255, 0)
 
--
 
SteroidsBuyLabel = guiCreateLabel(25, 212, 205, 15, "Steroids (+2 hp every 8seconds)", false, DrugBuyWindow)
SteroidsPriceLabel = guiCreateLabel(67.5, 232, 205, 15, "$800", false, DrugBuyWindow)
SteroidsBuyEdit = guiCreateEdit(47.5, 262, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(SteroidsBuyLabel, 2, 248, 60)
guiLabelSetColor(SteroidsPriceLabel, 0, 255, 0)
 
HeroinBuyLabel = guiCreateLabel(235, 212, 205, 15, "Heroin (Semi invincibility)", false, DrugBuyWindow)
HeroinPriceLabel = guiCreateLabel(280, 232, 205, 15, "$4000", false, DrugBuyWindow)
HeroinBuyEdit = guiCreateEdit(260, 262, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(HeroinBuyLabel, 201, 48, 196)
guiLabelSetColor(HeroinPriceLabel, 0, 255, 0)
 
guiCreateStaticImage(450, 50, 125, 125, "drug.png", false, DrugBuyWindow)
 
Total = guiCreateLabel(410, 200, 35, 16, "Total:", false, DrugBuyWindow)
guiSetFont(Total, "default-bold-small")
TotalLabel = guiCreateLabel(450, 200, 94, 16, "$0", false, DrugBuyWindow)
guiSetFont(TotalLabel, "default-bold-small")
guiLabelSetColor(TotalLabel, 0, 255, 0)
 
BuyDrug = guiCreateButton(400, 250, 90, 35, "Buy", false, DrugBuyWindow)
CloseBuyDrugPanel = guiCreateButton(500, 250, 90, 35, "Close", false, DrugBuyWindow)
 
function showBuyDrug()
    guiSetText(TotalLabel, "$0")
    guiSetText(WeedBuyEdit, "0")
    guiSetText(GodBuyEdit, "0")
    guiSetText(SpeedBuyEdit, "0")
    guiSetText(LSDBuyEdit, "0")
    guiSetText(SteroidsBuyEdit, "0")
    guiSetText(HeroinBuyEdit, "0")
    guiSetVisible(DrugBuyWindow, true)
    showCursor(true)
    if drugDealer then
        guiSetText(DrugBuyWindow, "Buying drugs from "..getPlayerName(drugDealer))
    else
        guiSetText(DrugBuyWindow, "Buying drugs from drug Dealer Ped")
    end
end
 
addEventHandler("onClientGUIChanged", guiRoot,
function()
    if drugDealer then
        if getElementData(drugDealer, "DurgsDealer") then
            MaxWeed = (getElementData(drugDealer, "Weed") or 0) + (getElementData(localPlayer, "Weed") or 0)
            MaxGod = (getElementData(drugDealer, "God") or 0) + (getElementData(localPlayer, "God") or 0)
            MaxSpeed = (getElementData(drugDealer, "Speed") or 0) + (getElementData(localPlayer, "Speed") or 0)
            MaxLSD = (getElementData(drugDealer, "LSD") or 0) + (getElementData(localPlayer, "LSD") or 0)
            MaxSteroids = (getElementData(drugDealer, "Steroids") or 0) + (getElementData(localPlayer, "Steroids") or 0)
            MaxHeroin = (getElementData(drugDealer, "Heroin") or 0) + (getElementData(localPlayer, "Heroin") or 0)
        else
            exports.GTWtopbar:dm("This player does not sell drugs anymore!", 255, 0, 0)
            drugDealer = nil
            guiSetVisible(DrugBuyWindow, false)
            showCursor(false)
        end
    else
        MaxWeed = 10000
        MaxGod = 10000
        MaxSpeed = 10000
        MaxLSD = 10000
        MaxSteroids = 10000
        MaxHeroin = 10000
    end
    local Text = guiGetText(source)
    local Text = tonumber(Text)
    if source == WeedBuyEdit then
        local Amount = getElementData(localPlayer, "Weed") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxWeed then
            guiSetText(source, MaxWeed-Amount >= 0 and MaxWeed-Amount or "0")
        end
        WeedCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(WeedPriceLabel), 2))
    elseif source == GodBuyEdit then
        local Amount = getElementData(localPlayer, "God") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxGod then
            guiSetText(source, MaxGod-Amount >= 0 and MaxGod-Amount or "0")
        end
        GodCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(GodPriceLabel), 2))
    elseif source == SpeedBuyEdit then
        local Amount = getElementData(localPlayer, "Speed") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxSpeed then
            guiSetText(source, MaxSpeed-Amount >= 0 and MaxSpeed-Amount or "0")
        end
        SpeedCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(SpeedPriceLabel), 2))
    elseif source == LSDBuyEdit then
        local Amount = getElementData(localPlayer, "LSD") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxLSD then
            guiSetText(source, MaxLSD-Amount >= 0 and MaxLSD-Amount or "0")
        end
        LSDCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(LSDPriceLabel), 2))
    elseif source == SteroidsBuyEdit then
        local Amount = getElementData(localPlayer, "Steroids") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxSteroids then
            guiSetText(source, MaxSteroids-Amount >= 0 and MaxSteroids-Amount or "0")
        end
        SteroidsCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(SteroidsPriceLabel), 2))
    elseif source == HeroinBuyEdit then
        local Amount = getElementData(localPlayer, "Heroin") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxHeroin then
            guiSetText(source, MaxHeroin-Amount >= 0 and MaxHeroin-Amount or "0")
        end
        HeroinCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(HeroinPriceLabel), 2))
    end
    local TotalCost = (WeedCost or 0) + (GodCost or 0) + (SpeedCost or 0) + (LSDCost or 0) + (SteroidsCost or 0) + (HeroinCost or 0)
    guiSetText(TotalLabel, "$"..TotalCost)
end)
 
addEventHandler("onClientGUIClick", guiRoot,
function()
    if source == BuyDrug then
        local WeedAmount = tonumber(guiGetText(WeedBuyEdit))
       
Link to comment
addEventHandler -- 'onClientRender' 

مو موجود

هكذا ؟

  
sec = {{{{{{},{},{},{}}}}}}
 
local sx, sy = guiGetScreenSize()
guiSetInputMode("no_binds_when_editing")
 
 
GUIEditor = {
    label = {}
}
 
DrugUseWindow = guiCreateWindow(227, 111, 357, 332, "", false)
guiWindowSetSizable(DrugUseWindow, false)
guiSetAlpha(DrugUseWindow, 0.00)
guiSetVisible(DrugUseWindow,false)
 
UseDrug = guiCreateButton(335, 370, 118, 73, "", false)
guiSetAlpha(UseDrug, 0.00)
 
 
GUIEditor.label[6] = guiCreateLabel(483, 415, 91, 18, "© Ja[b]er[X]Pro", false,DrugUseWindow)
 
 
WeedRadioButton = guiCreateCheckBox(236, 160, 189, 15, "Weed (جاذبية منخفضة)", false, DrugUseWindow)
guiSetFont(WeedRadioButton, "default-bold-small")
guiSetProperty(WeedRadioButton, "NormalTextColour", "FF50DD2F")
 
 
GodRadioButton = guiCreateCheckBox(236, 194, 189, 15, "God (دم 200)", false, DrugUseWindow)
guiSetFont(GodRadioButton, "default-bold-small")
guiSetProperty(GodRadioButton, "NormalTextColour", "FFFD0E0E")
 
 
SpeedRadioButton = guiCreateCheckBox(236, 227, 189, 15, "Speed (سرعة كبيرة)", false, DrugUseWindow)
guiSetFont(SpeedRadioButton, "default-bold-small")
guiSetProperty(SpeedRadioButton, "NormalTextColour", "FF2ACCE0")
 
 
LSDRadioButton = guiCreateCheckBox(236, 261, 189, 15, "LSD (تشويش الرؤية)", false, DrugUseWindow)
guiSetFont(LSDRadioButton, "default-bold-small")
guiSetProperty(LSDRadioButton, "NormalTextColour", "FF93B950")
 
 
SteroidsRadioButton = guiCreateCheckBox(236, 294, 189, 15, "Steroids (كل 8 تواني +2 دم)", false, DrugUseWindow)
guiSetFont(SteroidsRadioButton, "default-bold-small")
guiSetProperty(SteroidsRadioButton, "NormalTextColour", "FF1478F4")
 
 
HeroinRadioButton = guiCreateCheckBox(236, 328, 189, 15, "Herion (يجعل تقشيرك صعب)", false, DrugUseWindow)
guiSetFont(HeroinRadioButton, "default-bold-small")
guiSetProperty(HeroinRadioButton, "NormalTextColour", "FFEFE718")
 
addEventHandler("onClientRender",root,
function()
    dxDrawLine(228 - 1, 112 - 1, 228 - 1, 146, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(578, 112 - 1, 228 - 1, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(228 - 1, 146, 578, 146, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(578, 146, 578, 112 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawRectangle(228, 112, 350, 34, tocolor(224, 226, 28, 255), false)
    dxDrawLine(229 - 1, 113 - 1, 229 - 1, 443, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(579, 113 - 1, 229 - 1, 113 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(229 - 1, 443, 579, 443, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(579, 443, 579, 113 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawRectangle(229, 113, 350, 330, tocolor(247, 17, 17, 100), false)
    dxDrawText("Drug System", 301, 103, 406, 141, tocolor(255, 255, 255, 255), 3.00, "default", "left", "top", false, false, false, false, false)
    dxDrawRectangle(340, 377, 103, 56, tocolor(239, 231, 24, 170), false)
    dxDrawText("Use", 368, 387, 473, 444, tocolor(183, 55, 207, 255), 2.00, "default", "left", "top", false, false, false, false, false)   
end)
 
 
 
bindKey("F2", "down",
function()
    if getPedOccupiedVehicle(localPlayer) and not guiGetVisible(DrugUseWindow) then
        outputChatBox("You can not use drugs while in a vehicle!",source, 255, 0, 0)
        return
    end
    dxDrawLine(228 - 1, 112 - 1, 228 - 1, 146, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(578, 112 - 1, 228 - 1, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(228 - 1, 146, 578, 146, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(578, 146, 578, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawRectangle(228, 112, 350, 34, tocolor(224, 226, 28, 255), true)
    dxDrawLine(229 - 1, 113 - 1, 229 - 1, 443, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(579, 113 - 1, 229 - 1, 113 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(229 - 1, 443, 579, 443, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(579, 443, 579, 113 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawRectangle(229, 113, 350, 330, tocolor(247, 17, 17, 100), true)
    dxDrawText("Drug System", 301, 103, 406, 141, tocolor(255, 255, 255, 255), 3.00, "default", "left", "top", false, false, true, false, false)
    dxDrawRectangle(340, 377, 103, 56, tocolor(239, 231, 24, 170), true)
    dxDrawText("Use", 368, 387, 473, 444, tocolor(183, 55, 207, 255), 2.00, "default", "left", "top", false, false, true, false, false)
        guiSetVisible(DrugUseWindow, not guiGetVisible(DrugUseWindow))
        showCursor(guiGetVisible(DrugUseWindow))
end)
 
DrugBuyWindow = guiCreateWindow(sx/2-(550/2), sy/2-(310/2), 600, 310, "Drugs by Price for GTW-RPG", false)
guiWindowSetSizable(DrugBuyWindow, false)
guiSetVisible(DrugBuyWindow, false)
guiSetAlpha(DrugBuyWindow, 0.98)
 
WeedBuyLabel = guiCreateLabel(25, 38, 205, 15, "Weed (Low gravity)", false, DrugBuyWindow)
WeedPriceLabel = guiCreateLabel(67.5, 58, 205, 15, "$900", false, DrugBuyWindow)
WeedBuyEdit = guiCreateEdit(47.5, 88, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(WeedBuyLabel, 251, 213, 3)
guiLabelSetColor(WeedPriceLabel, 0, 255, 0)
 
GodBuyLabel = guiCreateLabel(235, 38, 205, 15, "God (Increased max health)", false, DrugBuyWindow)
GodPriceLabel = guiCreateLabel(280, 58, 205, 15, "$3000", false, DrugBuyWindow)
GodBuyEdit = guiCreateEdit(260, 88, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(GodBuyLabel, 0, 253, 5)
guiLabelSetColor(GodPriceLabel, 0, 255, 0)
 
--
 
SpeedBuyLabel = guiCreateLabel(25, 125, 205, 15, "Speed (Faster action)", false, DrugBuyWindow)
SpeedPriceLabel = guiCreateLabel(67.5, 145, 205, 15, "$1100", false, DrugBuyWindow)
SpeedBuyEdit = guiCreateEdit(47.5, 175, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(SpeedBuyLabel, 250, 2, 194)
guiLabelSetColor(SpeedPriceLabel, 0, 255, 0)
 
LSDBuyLabel = guiCreateLabel(235, 125, 205, 15, "LSD (Hallucination)", false, DrugBuyWindow)
LSDPriceLabel = guiCreateLabel(280, 145, 205, 15, "$2000", false, DrugBuyWindow)
LSDBuyEdit = guiCreateEdit(260, 175, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(LSDBuyLabel, 0, 248, 251)
guiLabelSetColor(LSDPriceLabel, 0, 255, 0)
 
--
 
SteroidsBuyLabel = guiCreateLabel(25, 212, 205, 15, "Steroids (+2 hp every 8seconds)", false, DrugBuyWindow)
SteroidsPriceLabel = guiCreateLabel(67.5, 232, 205, 15, "$800", false, DrugBuyWindow)
SteroidsBuyEdit = guiCreateEdit(47.5, 262, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(SteroidsBuyLabel, 2, 248, 60)
guiLabelSetColor(SteroidsPriceLabel, 0, 255, 0)
 
HeroinBuyLabel = guiCreateLabel(235, 212, 205, 15, "Heroin (Semi invincibility)", false, DrugBuyWindow)
HeroinPriceLabel = guiCreateLabel(280, 232, 205, 15, "$4000", false, DrugBuyWindow)
HeroinBuyEdit = guiCreateEdit(260, 262, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(HeroinBuyLabel, 201, 48, 196)
guiLabelSetColor(HeroinPriceLabel, 0, 255, 0)
 
guiCreateStaticImage(450, 50, 125, 125, "drug.png", false, DrugBuyWindow)
 
Total = guiCreateLabel(410, 200, 35, 16, "Total:", false, DrugBuyWindow)
guiSetFont(Total, "default-bold-small")
TotalLabel = guiCreateLabel(450, 200, 94, 16, "$0", false, DrugBuyWindow)
guiSetFont(TotalLabel, "default-bold-small")
guiLabelSetColor(TotalLabel, 0, 255, 0)
 
BuyDrug = guiCreateButton(400, 250, 90, 35, "Buy", false, DrugBuyWindow)
CloseBuyDrugPanel = guiCreateButton(500, 250, 90, 35, "Close", false, DrugBuyWindow)
 
function showBuyDrug()
    guiSetText(TotalLabel, "$0")
    guiSetText(WeedBuyEdit, "0")
    guiSetText(GodBuyEdit, "0")
    guiSetText(SpeedBuyEdit, "0")
    guiSetText(LSDBuyEdit, "0")
    guiSetText(SteroidsBuyEdit, "0")
    guiSetText(HeroinBuyEdit, "0")
    guiSetVisible(DrugBuyWindow, true)
    showCursor(true)
    if drugDealer then
        guiSetText(DrugBuyWindow, "Buying drugs from "..getPlayerName(drugDealer))
    else
        guiSetText(DrugBuyWindow, "Buying drugs from drug Dealer Ped")
    end
end
 
addEventHandler("onClientGUIChanged", guiRoot,
function()
    if drugDealer then
        if getElementData(drugDealer, "DurgsDealer") then
            MaxWeed = (getElementData(drugDealer, "Weed") or 0) + (getElementData(localPlayer, "Weed") or 0)
            MaxGod = (getElementData(drugDealer, "God") or 0) + (getElementData(localPlayer, "God") or 0)
            MaxSpeed = (getElementData(drugDealer, "Speed") or 0) + (getElementData(localPlayer, "Speed") or 0)
            MaxLSD = (getElementData(drugDealer, "LSD") or 0) + (getElementData(localPlayer, "LSD") or 0)
            MaxSteroids = (getElementData(drugDealer, "Steroids") or 0) + (getElementData(localPlayer, "Steroids") or 0)
            MaxHeroin = (getElementData(drugDealer, "Heroin") or 0) + (getElementData(localPlayer, "Heroin") or 0)
        else
            exports.GTWtopbar:dm("This player does not sell drugs anymore!", 255, 0, 0)
            drugDealer = nil
            guiSetVisible(DrugBuyWindow, false)
            showCursor(false)
        end
    else
        MaxWeed = 10000
        MaxGod = 10000
        MaxSpeed = 10000
        MaxLSD = 10000
        MaxSteroids = 10000
        MaxHeroin = 10000
    end
    local Text = guiGetText(source)
    local Text = tonumber(Text)
    if source == WeedBuyEdit then
        local Amount = getElementData(localPlayer, "Weed") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxWeed then
            guiSetText(source, MaxWeed-Amount >= 0 and MaxWeed-Amount or "0")
        end
        WeedCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(WeedPriceLabel), 2))
    elseif source == GodBuyEdit then
        local Amount = getElementData(localPlayer, "God") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxGod then
            guiSetText(source, MaxGod-Amount >= 0 and MaxGod-Amount or "0")
        end
        GodCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(GodPriceLabel), 2))
    elseif source == SpeedBuyEdit then
        local Amount = getElementData(localPlayer, "Speed") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxSpeed then
            guiSetText(source, MaxSpeed-Amount >= 0 and MaxSpeed-Amount or "0")
        end
        SpeedCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(SpeedPriceLabel), 2))
    elseif source == LSDBuyEdit then
        local Amount = getElementData(localPlayer, "LSD") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxLSD then
            guiSetText(source, MaxLSD-Amount >= 0 and MaxLSD-Amount or "0")
        end
        LSDCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(LSDPriceLabel), 2))
    elseif source == SteroidsBuyEdit then
        local Amount = getElementData(localPlayer, "Steroids") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxSteroids then
            guiSetText(source, MaxSteroids-Amount >= 0 and MaxSteroids-Amount or "0")
        end
        SteroidsCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(SteroidsPriceLabel), 2))
    elseif source == HeroinBuyEdit then
        local Amount = getElementData(localPlayer, "Heroin") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxHeroin then
            guiSetText(source, MaxHeroin-Amount >= 0 and MaxHeroin-Amount or "0")
        end
        HeroinCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(HeroinPriceLabel), 2))
    end
    local TotalCost = (WeedCost or 0) + (GodCost or 0) + (SpeedCost or 0) + (LSDCost or 0) + (SteroidsCost or 0) + (HeroinCost or 0)
    guiSetText(TotalLabel, "$"..TotalCost)
end)
 
addEventHandler("onClientGUIClick", guiRoot,
function()
    if source == BuyDrug then
        local WeedAmount = tonumber(guiGetText(WeedBuyEdit))
       
Link to comment
  
 
sec = {{{{{{},{},{},{}}}}}}
 
local sx, sy = guiGetScreenSize()
guiSetInputMode("no_binds_when_editing")
 
 
GUIEditor = {
    label = {}
}
 
DrugUseWindow = guiCreateWindow(227, 111, 357, 332, "", false)
guiWindowSetSizable(DrugUseWindow, false)
guiSetAlpha(DrugUseWindow, 0.00)
guiSetVisible(DrugUseWindow,false)
 
UseDrug = guiCreateButton(335, 370, 118, 73, "", false)
guiSetAlpha(UseDrug, 0.00)
 
 
GUIEditor.label[6] = guiCreateLabel(483, 415, 91, 18, "© Ja[b]er[X]Pro", false,DrugUseWindow)
 
 
WeedRadioButton = guiCreateCheckBox(236, 160, 189, 15, "Weed (جاذبية منخفضة)", false, DrugUseWindow)
guiSetFont(WeedRadioButton, "default-bold-small")
guiSetProperty(WeedRadioButton, "NormalTextColour", "FF50DD2F")
 
 
GodRadioButton = guiCreateCheckBox(236, 194, 189, 15, "God (دم 200)", false, DrugUseWindow)
guiSetFont(GodRadioButton, "default-bold-small")
guiSetProperty(GodRadioButton, "NormalTextColour", "FFFD0E0E")
 
 
SpeedRadioButton = guiCreateCheckBox(236, 227, 189, 15, "Speed (سرعة كبيرة)", false, DrugUseWindow)
guiSetFont(SpeedRadioButton, "default-bold-small")
guiSetProperty(SpeedRadioButton, "NormalTextColour", "FF2ACCE0")
 
 
LSDRadioButton = guiCreateCheckBox(236, 261, 189, 15, "LSD (تشويش الرؤية)", false, DrugUseWindow)
guiSetFont(LSDRadioButton, "default-bold-small")
guiSetProperty(LSDRadioButton, "NormalTextColour", "FF93B950")
 
 
SteroidsRadioButton = guiCreateCheckBox(236, 294, 189, 15, "Steroids (كل 8 تواني +2 دم)", false, DrugUseWindow)
guiSetFont(SteroidsRadioButton, "default-bold-small")
guiSetProperty(SteroidsRadioButton, "NormalTextColour", "FF1478F4")
 
 
HeroinRadioButton = guiCreateCheckBox(236, 328, 189, 15, "Herion (يجعل تقشيرك صعب)", false, DrugUseWindow)
guiSetFont(HeroinRadioButton, "default-bold-small")
guiSetProperty(HeroinRadioButton, "NormalTextColour", "FFEFE718")
 
 
 
 
 
bindKey("F2", "down",
function DxOpen()
    if getPedOccupiedVehicle(localPlayer) and not guiGetVisible(DrugUseWindow) then
        outputChatBox("You can not use drugs while in a vehicle!",source, 255, 0, 0)
        return
    end
    dxDrawLine(228 - 1, 112 - 1, 228 - 1, 146, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(578, 112 - 1, 228 - 1, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(228 - 1, 146, 578, 146, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(578, 146, 578, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawRectangle(228, 112, 350, 34, tocolor(224, 226, 28, 255), true)
    dxDrawLine(229 - 1, 113 - 1, 229 - 1, 443, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(579, 113 - 1, 229 - 1, 113 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(229 - 1, 443, 579, 443, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(579, 443, 579, 113 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawRectangle(229, 113, 350, 330, tocolor(247, 17, 17, 100), false)
    dxDrawText("Drug System", 301, 103, 406, 141, tocolor(255, 255, 255, 255), 3.00, "default", "left", "top", false, false, true, false, false)
    dxDrawRectangle(340, 377, 103, 56, tocolor(239, 231, 24, 170), true)
    dxDrawText("Use", 368, 387, 473, 444, tocolor(183, 55, 207, 255), 2.00, "default", "left", "top", false, false, true, false, false)
        guiSetVisible(DrugUseWindow, not guiGetVisible(DrugUseWindow))
        showCursor(guiGetVisible(DrugUseWindow))
end
)
addEventHandler("onClientRender", root, DxOpen)
 
DrugBuyWindow = guiCreateWindow(sx/2-(550/2), sy/2-(310/2), 600, 310, "Drugs by Price for GTW-RPG", false)
guiWindowSetSizable(DrugBuyWindow, false)
guiSetVisible(DrugBuyWindow, false)
guiSetAlpha(DrugBuyWindow, 0.98)
 
WeedBuyLabel = guiCreateLabel(25, 38, 205, 15, "Weed (Low gravity)", false, DrugBuyWindow)
WeedPriceLabel = guiCreateLabel(67.5, 58, 205, 15, "$900", false, DrugBuyWindow)
WeedBuyEdit = guiCreateEdit(47.5, 88, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(WeedBuyLabel, 251, 213, 3)
guiLabelSetColor(WeedPriceLabel, 0, 255, 0)
 
GodBuyLabel = guiCreateLabel(235, 38, 205, 15, "God (Increased max health)", false, DrugBuyWindow)
GodPriceLabel = guiCreateLabel(280, 58, 205, 15, "$3000", false, DrugBuyWindow)
GodBuyEdit = guiCreateEdit(260, 88, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(GodBuyLabel, 0, 253, 5)
guiLabelSetColor(GodPriceLabel, 0, 255, 0)
 
--
 
SpeedBuyLabel = guiCreateLabel(25, 125, 205, 15, "Speed (Faster action)", false, DrugBuyWindow)
SpeedPriceLabel = guiCreateLabel(67.5, 145, 205, 15, "$1100", false, DrugBuyWindow)
SpeedBuyEdit = guiCreateEdit(47.5, 175, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(SpeedBuyLabel, 250, 2, 194)
guiLabelSetColor(SpeedPriceLabel, 0, 255, 0)
 
LSDBuyLabel = guiCreateLabel(235, 125, 205, 15, "LSD (Hallucination)", false, DrugBuyWindow)
LSDPriceLabel = guiCreateLabel(280, 145, 205, 15, "$2000", false, DrugBuyWindow)
LSDBuyEdit = guiCreateEdit(260, 175, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(LSDBuyLabel, 0, 248, 251)
guiLabelSetColor(LSDPriceLabel, 0, 255, 0)
 
--
 
SteroidsBuyLabel = guiCreateLabel(25, 212, 205, 15, "Steroids (+2 hp every 8seconds)", false, DrugBuyWindow)
SteroidsPriceLabel = guiCreateLabel(67.5, 232, 205, 15, "$800", false, DrugBuyWindow)
SteroidsBuyEdit = guiCreateEdit(47.5, 262, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(SteroidsBuyLabel, 2, 248, 60)
guiLabelSetColor(SteroidsPriceLabel, 0, 255, 0)
 
HeroinBuyLabel = guiCreateLabel(235, 212, 205, 15, "Heroin (Semi invincibility)", false, DrugBuyWindow)
HeroinPriceLabel = guiCreateLabel(280, 232, 205, 15, "$4000", false, DrugBuyWindow)
HeroinBuyEdit = guiCreateEdit(260, 262, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(HeroinBuyLabel, 201, 48, 196)
guiLabelSetColor(HeroinPriceLabel, 0, 255, 0)
 
guiCreateStaticImage(450, 50, 125, 125, "drug.png", false, DrugBuyWindow)
 
Total = guiCreateLabel(410, 200, 35, 16, "Total:", false, DrugBuyWindow)
guiSetFont(Total, "default-bold-small")
TotalLabel = guiCreateLabel(450, 200, 94, 16, "$0", false, DrugBuyWindow)
guiSetFont(TotalLabel, "default-bold-small")
guiLabelSetColor(TotalLabel, 0, 255, 0)
 
BuyDrug = guiCreateButton(400, 250, 90, 35, "Buy", false, DrugBuyWindow)
CloseBuyDrugPanel = guiCreateButton(500, 250, 90, 35, "Close", false, DrugBuyWindow)
 
function showBuyDrug()
    guiSetText(TotalLabel, "$0")
    guiSetText(WeedBuyEdit, "0")
    guiSetText(GodBuyEdit, "0")
    guiSetText(SpeedBuyEdit, "0")
    guiSetText(LSDBuyEdit, "0")
    guiSetText(SteroidsBuyEdit, "0")
    guiSetText(HeroinBuyEdit, "0")
    guiSetVisible(DrugBuyWindow, true)
    showCursor(true)
    if drugDealer then
        guiSetText(DrugBuyWindow, "Buying drugs from "..getPlayerName(drugDealer))
    else
        guiSetText(DrugBuyWindow, "Buying drugs from drug Dealer Ped")
    end
end
 
addEventHandler("onClientGUIChanged", guiRoot,
function()
    if drugDealer then
        if getElementData(drugDealer, "DurgsDealer") then
            MaxWeed = (getElementData(drugDealer, "Weed") or 0) + (getElementData(localPlayer, "Weed") or 0)
            MaxGod = (getElementData(drugDealer, "God") or 0) + (getElementData(localPlayer, "God") or 0)
            MaxSpeed = (getElementData(drugDealer, "Speed") or 0) + (getElementData(localPlayer, "Speed") or 0)
            MaxLSD = (getElementData(drugDealer, "LSD") or 0) + (getElementData(localPlayer, "LSD") or 0)
            MaxSteroids = (getElementData(drugDealer, "Steroids") or 0) + (getElementData(localPlayer, "Steroids") or 0)
            MaxHeroin = (getElementData(drugDealer, "Heroin") or 0) + (getElementData(localPlayer, "Heroin") or 0)
        else
            exports.GTWtopbar:dm("This player does not sell drugs anymore!", 255, 0, 0)
            drugDealer = nil
            guiSetVisible(DrugBuyWindow, false)
            showCursor(false)
        end
    else
        MaxWeed = 10000
        MaxGod = 10000
        MaxSpeed = 10000
        MaxLSD = 10000
        MaxSteroids = 10000
        MaxHeroin = 10000
    end
    local Text = guiGetText(source)
    local Text = tonumber(Text)
    if source == WeedBuyEdit then
        local Amount = getElementData(localPlayer, "Weed") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxWeed then
            guiSetText(source, MaxWeed-Amount >= 0 and MaxWeed-Amount or "0")
        end
        WeedCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(WeedPriceLabel), 2))
    elseif source == GodBuyEdit then
        local Amount = getElementData(localPlayer, "God") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxGod then
            guiSetText(source, MaxGod-Amount >= 0 and MaxGod-Amount or "0")
        end
        GodCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(GodPriceLabel), 2))
    elseif source == SpeedBuyEdit then
        local Amount = getElementData(localPlayer, "Speed") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxSpeed then
            guiSetText(source, MaxSpeed-Amount >= 0 and MaxSpeed-Amount or "0")
        end
        SpeedCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(SpeedPriceLabel), 2))
    elseif source == LSDBuyEdit then
        local Amount = getElementData(localPlayer, "LSD") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxLSD then
            guiSetText(source, MaxLSD-Amount >= 0 and MaxLSD-Amount or "0")
        end
        LSDCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(LSDPriceLabel), 2))
    elseif source == SteroidsBuyEdit then
        local Amount = getElementData(localPlayer, "Steroids") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxSteroids then
            guiSetText(source, MaxSteroids-Amount >= 0 and MaxSteroids-Amount or "0")
        end
        SteroidsCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(SteroidsPriceLabel), 2))
    elseif source == HeroinBuyEdit then
        local Amount = getElementData(localPlayer, "Heroin") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxHeroin then
            guiSetText(source, MaxHeroin-Amount >= 0 and MaxHeroin-Amount or "0")
        end
        HeroinCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(HeroinPriceLabel), 2))
    end
    local TotalCost = (WeedCost or 0) + (GodCost or 0) + (SpeedCost or 0) + (LSDCost or 0) + (SteroidsCost or 0) + (HeroinCost or 0)
    guiSetText(TotalLabel, "$"..TotalCost)
end)
 
addEventHandler("onClientGUIClick", guiRoot,
function()
    if source == BuyDrug then
        local WeedAmount = tonumber(guiGetText(WeedBuyEdit))
        local GodAmount = tonumber(guiGetText(GodBuyEdit))
        local SpeedAmount = tonumber(guiGetText(SpeedBuyEdit))
        local LSDAmount = tonumber(guiGetText(LSDBuyEdit))
        local SteroidsAmount = tonumber(guiGetText(SteroidsBuyEdit))
        local HeroinAmount = tonumber(guiGetText(HeroinBuyEdit))
        local Cost = tonumber(string.sub(guiGetText(TotalLabel), 2))
        if Cost > 0 then
            if drugDealer then
                if getElementData(drugDealer, "DurgsDealer") then
                    MaxWeed = getElementData(drugDealer, "Weed") or 0
                    MaxGod = getElementData(drugDealer, "God") or 0
                    MaxSpeed = getElementData(drugDealer, "Speed") or 0
                    MaxLSD =
Link to comment
  
 
sec = {{{{{{},{},{},{}}}}}}
 
local sx, sy = guiGetScreenSize()
guiSetInputMode("no_binds_when_editing")
 
 
GUIEditor = {
    label = {}
}
 
DrugUseWindow = guiCreateWindow(227, 111, 357, 332, "", false)
guiWindowSetSizable(DrugUseWindow, false)
guiSetAlpha(DrugUseWindow, 0.00)
guiSetVisible(DrugUseWindow,false)
 
UseDrug = guiCreateButton(335, 370, 118, 73, "", false)
guiSetAlpha(UseDrug, 0.00)
 
 
GUIEditor.label[6] = guiCreateLabel(483, 415, 91, 18, "© Ja[b]er[X]Pro", false,DrugUseWindow)
 
 
WeedRadioButton = guiCreateCheckBox(236, 160, 189, 15, "Weed (جاذبية منخفضة)", false, DrugUseWindow)
guiSetFont(WeedRadioButton, "default-bold-small")
guiSetProperty(WeedRadioButton, "NormalTextColour", "FF50DD2F")
 
 
GodRadioButton = guiCreateCheckBox(236, 194, 189, 15, "God (دم 200)", false, DrugUseWindow)
guiSetFont(GodRadioButton, "default-bold-small")
guiSetProperty(GodRadioButton, "NormalTextColour", "FFFD0E0E")
 
 
SpeedRadioButton = guiCreateCheckBox(236, 227, 189, 15, "Speed (سرعة كبيرة)", false, DrugUseWindow)
guiSetFont(SpeedRadioButton, "default-bold-small")
guiSetProperty(SpeedRadioButton, "NormalTextColour", "FF2ACCE0")
 
 
LSDRadioButton = guiCreateCheckBox(236, 261, 189, 15, "LSD (تشويش الرؤية)", false, DrugUseWindow)
guiSetFont(LSDRadioButton, "default-bold-small")
guiSetProperty(LSDRadioButton, "NormalTextColour", "FF93B950")
 
 
SteroidsRadioButton = guiCreateCheckBox(236, 294, 189, 15, "Steroids (كل 8 تواني +2 دم)", false, DrugUseWindow)
guiSetFont(SteroidsRadioButton, "default-bold-small")
guiSetProperty(SteroidsRadioButton, "NormalTextColour", "FF1478F4")
 
 
HeroinRadioButton = guiCreateCheckBox(236, 328, 189, 15, "Herion (يجعل تقشيرك صعب)", false, DrugUseWindow)
guiSetFont(HeroinRadioButton, "default-bold-small")
guiSetProperty(HeroinRadioButton, "NormalTextColour", "FFEFE718")
 
 
 
 
 
bindKey("F2", "down",
function DxOpen()
    if getPedOccupiedVehicle(localPlayer) and not guiGetVisible(DrugUseWindow) then
        outputChatBox("You can not use drugs while in a vehicle!",source, 255, 0, 0)
        return
    end
    dxDrawLine(228 - 1, 112 - 1, 228 - 1, 146, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(578, 112 - 1, 228 - 1, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(228 - 1, 146, 578, 146, tocolor(0, 0, 0, 255), 1, true)
    dxDrawLine(578, 146, 578, 112 - 1, tocolor(0, 0, 0, 255), 1, true)
    dxDrawRectangle(228, 112, 350, 34, tocolor(224, 226, 28, 255), true)
    dxDrawLine(229 - 1, 113 - 1, 229 - 1, 443, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(579, 113 - 1, 229 - 1, 113 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(229 - 1, 443, 579, 443, tocolor(0, 0, 0, 255), 1, false)
    dxDrawLine(579, 443, 579, 113 - 1, tocolor(0, 0, 0, 255), 1, false)
    dxDrawRectangle(229, 113, 350, 330, tocolor(247, 17, 17, 100), false)
    dxDrawText("Drug System", 301, 103, 406, 141, tocolor(255, 255, 255, 255), 3.00, "default", "left", "top", false, false, true, false, false)
    dxDrawRectangle(340, 377, 103, 56, tocolor(239, 231, 24, 170), true)
    dxDrawText("Use", 368, 387, 473, 444, tocolor(183, 55, 207, 255), 2.00, "default", "left", "top", false, false, true, false, false)
        guiSetVisible(DrugUseWindow, not guiGetVisible(DrugUseWindow))
        showCursor(guiGetVisible(DrugUseWindow))
end
)
addEventHandler("onClientRender", root, DxOpen)
 
DrugBuyWindow = guiCreateWindow(sx/2-(550/2), sy/2-(310/2), 600, 310, "Drugs by Price for GTW-RPG", false)
guiWindowSetSizable(DrugBuyWindow, false)
guiSetVisible(DrugBuyWindow, false)
guiSetAlpha(DrugBuyWindow, 0.98)
 
WeedBuyLabel = guiCreateLabel(25, 38, 205, 15, "Weed (Low gravity)", false, DrugBuyWindow)
WeedPriceLabel = guiCreateLabel(67.5, 58, 205, 15, "$900", false, DrugBuyWindow)
WeedBuyEdit = guiCreateEdit(47.5, 88, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(WeedBuyLabel, 251, 213, 3)
guiLabelSetColor(WeedPriceLabel, 0, 255, 0)
 
GodBuyLabel = guiCreateLabel(235, 38, 205, 15, "God (Increased max health)", false, DrugBuyWindow)
GodPriceLabel = guiCreateLabel(280, 58, 205, 15, "$3000", false, DrugBuyWindow)
GodBuyEdit = guiCreateEdit(260, 88, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(GodBuyLabel, 0, 253, 5)
guiLabelSetColor(GodPriceLabel, 0, 255, 0)
 
--
 
SpeedBuyLabel = guiCreateLabel(25, 125, 205, 15, "Speed (Faster action)", false, DrugBuyWindow)
SpeedPriceLabel = guiCreateLabel(67.5, 145, 205, 15, "$1100", false, DrugBuyWindow)
SpeedBuyEdit = guiCreateEdit(47.5, 175, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(SpeedBuyLabel, 250, 2, 194)
guiLabelSetColor(SpeedPriceLabel, 0, 255, 0)
 
LSDBuyLabel = guiCreateLabel(235, 125, 205, 15, "LSD (Hallucination)", false, DrugBuyWindow)
LSDPriceLabel = guiCreateLabel(280, 145, 205, 15, "$2000", false, DrugBuyWindow)
LSDBuyEdit = guiCreateEdit(260, 175, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(LSDBuyLabel, 0, 248, 251)
guiLabelSetColor(LSDPriceLabel, 0, 255, 0)
 
--
 
SteroidsBuyLabel = guiCreateLabel(25, 212, 205, 15, "Steroids (+2 hp every 8seconds)", false, DrugBuyWindow)
SteroidsPriceLabel = guiCreateLabel(67.5, 232, 205, 15, "$800", false, DrugBuyWindow)
SteroidsBuyEdit = guiCreateEdit(47.5, 262, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(SteroidsBuyLabel, 2, 248, 60)
guiLabelSetColor(SteroidsPriceLabel, 0, 255, 0)
 
HeroinBuyLabel = guiCreateLabel(235, 212, 205, 15, "Heroin (Semi invincibility)", false, DrugBuyWindow)
HeroinPriceLabel = guiCreateLabel(280, 232, 205, 15, "$4000", false, DrugBuyWindow)
HeroinBuyEdit = guiCreateEdit(260, 262, 75, 18, "0", false, DrugBuyWindow)
guiLabelSetColor(HeroinBuyLabel, 201, 48, 196)
guiLabelSetColor(HeroinPriceLabel, 0, 255, 0)
 
guiCreateStaticImage(450, 50, 125, 125, "drug.png", false, DrugBuyWindow)
 
Total = guiCreateLabel(410, 200, 35, 16, "Total:", false, DrugBuyWindow)
guiSetFont(Total, "default-bold-small")
TotalLabel = guiCreateLabel(450, 200, 94, 16, "$0", false, DrugBuyWindow)
guiSetFont(TotalLabel, "default-bold-small")
guiLabelSetColor(TotalLabel, 0, 255, 0)
 
BuyDrug = guiCreateButton(400, 250, 90, 35, "Buy", false, DrugBuyWindow)
CloseBuyDrugPanel = guiCreateButton(500, 250, 90, 35, "Close", false, DrugBuyWindow)
 
function showBuyDrug()
    guiSetText(TotalLabel, "$0")
    guiSetText(WeedBuyEdit, "0")
    guiSetText(GodBuyEdit, "0")
    guiSetText(SpeedBuyEdit, "0")
    guiSetText(LSDBuyEdit, "0")
    guiSetText(SteroidsBuyEdit, "0")
    guiSetText(HeroinBuyEdit, "0")
    guiSetVisible(DrugBuyWindow, true)
    showCursor(true)
    if drugDealer then
        guiSetText(DrugBuyWindow, "Buying drugs from "..getPlayerName(drugDealer))
    else
        guiSetText(DrugBuyWindow, "Buying drugs from drug Dealer Ped")
    end
end
 
addEventHandler("onClientGUIChanged", guiRoot,
function()
    if drugDealer then
        if getElementData(drugDealer, "DurgsDealer") then
            MaxWeed = (getElementData(drugDealer, "Weed") or 0) + (getElementData(localPlayer, "Weed") or 0)
            MaxGod = (getElementData(drugDealer, "God") or 0) + (getElementData(localPlayer, "God") or 0)
            MaxSpeed = (getElementData(drugDealer, "Speed") or 0) + (getElementData(localPlayer, "Speed") or 0)
            MaxLSD = (getElementData(drugDealer, "LSD") or 0) + (getElementData(localPlayer, "LSD") or 0)
            MaxSteroids = (getElementData(drugDealer, "Steroids") or 0) + (getElementData(localPlayer, "Steroids") or 0)
            MaxHeroin = (getElementData(drugDealer, "Heroin") or 0) + (getElementData(localPlayer, "Heroin") or 0)
        else
            exports.GTWtopbar:dm("This player does not sell drugs anymore!", 255, 0, 0)
            drugDealer = nil
            guiSetVisible(DrugBuyWindow, false)
            showCursor(false)
        end
    else
        MaxWeed = 10000
        MaxGod = 10000
        MaxSpeed = 10000
        MaxLSD = 10000
        MaxSteroids = 10000
        MaxHeroin = 10000
    end
    local Text = guiGetText(source)
    local Text = tonumber(Text)
    if source == WeedBuyEdit then
        local Amount = getElementData(localPlayer, "Weed") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxWeed then
            guiSetText(source, MaxWeed-Amount >= 0 and MaxWeed-Amount or "0")
        end
        WeedCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(WeedPriceLabel), 2))
    elseif source == GodBuyEdit then
        local Amount = getElementData(localPlayer, "God") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxGod then
            guiSetText(source, MaxGod-Amount >= 0 and MaxGod-Amount or "0")
        end
        GodCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(GodPriceLabel), 2))
    elseif source == SpeedBuyEdit then
        local Amount = getElementData(localPlayer, "Speed") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxSpeed then
            guiSetText(source, MaxSpeed-Amount >= 0 and MaxSpeed-Amount or "0")
        end
        SpeedCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(SpeedPriceLabel), 2))
    elseif source == LSDBuyEdit then
        local Amount = getElementData(localPlayer, "LSD") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxLSD then
            guiSetText(source, MaxLSD-Amount >= 0 and MaxLSD-Amount or "0")
        end
        LSDCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(LSDPriceLabel), 2))
    elseif source == SteroidsBuyEdit then
        local Amount = getElementData(localPlayer, "Steroids") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxSteroids then
            guiSetText(source, MaxSteroids-Amount >= 0 and MaxSteroids-Amount or "0")
        end
        SteroidsCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(SteroidsPriceLabel), 2))
    elseif source == HeroinBuyEdit then
        local Amount = getElementData(localPlayer, "Heroin") or 0
        if not Text then
            guiSetText(source, "0")
        elseif Text+Amount > MaxHeroin then
            guiSetText(source, MaxHeroin-Amount >= 0 and MaxHeroin-Amount or "0")
        end
        HeroinCost = tonumber(guiGetText(source)) * tonumber(string.sub(guiGetText(HeroinPriceLabel), 2))
    end
    local TotalCost = (WeedCost or 0) + (GodCost or 0) + (SpeedCost or 0) + (LSDCost or 0) + (SteroidsCost or 0) + (HeroinCost or 0)
    guiSetText(TotalLabel, "$"..TotalCost)
end)
 
addEventHandler("onClientGUIClick", guiRoot,
function()
    if source == BuyDrug then
        local WeedAmount = tonumber(guiGetText(WeedBuyEdit))
        local GodAmount = tonumber(guiGetText(GodBuyEdit))
        local SpeedAmount = tonumber(guiGetText(SpeedBuyEdit))
        local LSDAmount = tonumber(guiGetText(LSDBuyEdit))
        local SteroidsAmount = tonumber(guiGetText(SteroidsBuyEdit))
        local HeroinAmount = tonumber(guiGetText(HeroinBuyEdit))
        local Cost = tonumber(string.sub(guiGetText(TotalLabel), 2))
        if Cost > 0 then
            if drugDealer then
                if getElementData(drugDealer, "DurgsDealer") then
                    MaxWeed = getElementData(drugDealer, "Weed") or 0
                    MaxGod = getElementData(drugDealer, "God") or 0
                    MaxSpeed = getElementData(drugDealer, "Speed") or 0
                    MaxLSD =
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...