تسلملي يالغالي لكن ما زبط لو تبي اعرض كامل الاكواد ما عندي مشكله
server side
##########
addEvent("onFlip", true)
addEventHandler("onFlip", root,
function()
local veh = getPedOccupiedVehicle(client)
if veh then
if getPlayerMoney(client) >= 1500 then
if not getElementData(client, "isBuyFlip") then
takePlayerMoney(client, 1500)
local rx, ry, rz = getElementRotation(veh)
setElementRotation(veh, 0, 0, rx > 90 and rx < 279 and rz + 180 or rz)
setElementData(client, "isBuyFlip", true)
setTimer(function(player) setElementData(player, "isBuyFlip", false) end, 5000, 1, client)
outputChatBox("#555555 [ ShopSystem ]#999999 You Have Been Bought Flip", client, 255, 255, 255, true)
else
outputChatBox("#555555 [ ShopSystem ]#999999 Wait 5 Seconds To Buy Flip !", client, 255, 0,0, true)
end
else
outputChatBox("#555555 [ ShopSystem ]#999999 You don't have enough money !", client, 255, 0,0, true)
end
else
outputChatBox("#555555 [ ShopSystem ]#999999 You Are Not In Vehicle", client, 255, 0, 0, true)
end
end)
addEvent("onRepair", true)
addEventHandler("onRepair", root,
function()
local veh = getPedOccupiedVehicle(client)
if veh then
if getPlayerMoney(client) >= 2500 then
if not getElementData(client, "isBuyRepair") then
takePlayerMoney(client, 2500)
local rx, ry, rz = getElementRotation(veh)
fixVehicle( getPedOccupiedVehicle ( client ) )
setElementData ( client, "isBuyRepair", true )
setTimer ( function ( player ) setElementData ( player, "isBuyRepair", false ) end, 5000, 1, client )
outputChatBox ( "#555555 [ ShopSystem ]#999999 You Have Been Bought Repair", client, 255, 255, 255, true )
else
outputChatBox("#555555 [ ShopSystem ]#999999 Wait 5 Seconds To Buy Repair !", client, 255, 0,0, true)
end
else
outputChatBox("#555555 [ ShopSystem ]#999999 You don't have enough money !", client, 255, 0,0, true)
end
else
outputChatBox("#555555 [ ShopSystem ]#999999 You Are Not In Vehicle", client, 255, 0, 0, true)
end
end)
addEvent("onNitro", true)
addEventHandler("onNitro", root,
function()
local veh = getPedOccupiedVehicle(client)
if veh then
if getPlayerMoney(client) >= 500 then
if not getElementData(client, "isBuyNitro") then
takePlayerMoney(client, 500)
local rx, ry, rz = getElementRotation(veh)
addVehicleUpgrade ( getPedOccupiedVehicle ( client ), 1007 )
triggerClientEvent(client,"onflip2", client,veh)
setElementData ( client, "isBuyNitro", true )
setTimer ( function ( player ) setElementData ( player, "isBuyNitro", false ) end, 5000, 1, client )
outputChatBox ( "#555555 [ ShopSystem ]#999999You Have Been Bought Nitro", client, 255, 255, 255, true )
else
outputChatBox("#555555 [ ShopSystem ]#999999 Wait 5 Seconds To Buy Nitro !", client, 255, 0,0, true)
end
else
outputChatBox("#555555 [ ShopSystem ]#999999 You don't have enough money !", client, 255, 0,0, true)
end
else
outputChatBox("#555555 [ ShopSystem ]#999999 You Are Not In Vehicle", client, 255, 0, 0, true)
end
end)
client side
#################
--[[
// copyrights //
Shop Race System v1.0 By AboShanab
Welcome In My Script :p
// copyrights //
--]]
local sX, sY = guiGetScreenSize ()
local direction = "right"
local rot = 0
local draw = false
local a1 = 79
local a2 = 79
local a3 = 79
local scale = 0.98
local copyrightscale = 1.15
local itemscale = 1.10
addEventHandler("onClientResourceStart", resourceRoot,
function ()
if ( sX == 800 ) then
scale = 0.98
copyrightscale = 1.15
itemscale = 1.10
elseif ( sX == 1024 ) then
scale = 1.05
copyrightscale = 1.20
itemscale = 1.18
elseif ( sX == 1152 ) then
scale = 1.10
copyrightscale = 1.28
itemscale = 1.25
elseif ( sX == 1280 ) then
scale = 1.10
copyrightscale = 1.32
elseif ( sX == 1360 ) then
scale = 1.25
copyrightscale = 1.35
itemscale = 1.38
elseif ( sX == 1366 ) then
scale = 1.28
copyrightscale = 1.40
itemscale = 1.42
elseif ( sX == 1440 ) then
scale = 1.27
copyrightscale = 1.39
itemscale = 1.42
elseif ( sX == 1600 ) then
scale = 1.30
copyrightscale = 1.43
itemscale = 1.45
end
end
)
function move ()
if ( rot == 15 ) then
direction = "right"
elseif ( rot == -15 ) then
direction = "left"
end
if ( direction == "left" ) then
rot = rot + 0.5
elseif ( direction == "right" ) then
rot = rot - 0.5
end
end
function mouse ( _, _, x, y )
if ( x >= sX * 0.24 and y >= sY * 0.70 and x <= ( sX * 0.24 + sX * 0.14 ) and y <= ( sY * 0.70 + sY * 0.05 ) ) then
a1 = 255
elseif ( x >= sX * 0.42 and y >= sY * 0.70 and x <= ( sX * 0.42 + sX * 0.14 ) and y <= ( sY * 0.70 + sY * 0.05 ) ) then
a2 = 255
elseif ( x >= sX * 0.60 and y >= sY * 0.70 and x <= ( sX * 0.56 + sX * 0.14 ) and y <= ( sY * 0.70 + sY * 0.05 ) ) then
a3 = 255
else
a1 = 79
a2 = 79
a3 = 79
end
end
function click ( _, _, x, y,thePlayer )
if ( x >= sX * 0.24 and y >= sY * 0.70 and x <= ( sX * 0.24 + sX * 0.14 ) and y <= ( sY * 0.70 + sY * 0.05 ) ) then
triggerServerEvent("onFlip", localPlayer)
removeEventHandler("onClientRender", root, drawShop)
removeEventHandler("onClientRender", root, move)
removeEventHandler("onClientClick", root, click)
removeEventHandler("onClientCursorMove", root, mouse)
showCursor ( false )
draw = false
elseif ( x >= sX * 0.42 and y >= sY * 0.70 and x <= ( sX * 0.42 + sX * 0.14 ) and y <= ( sY * 0.70 + sY * 0.05 ) ) then
triggerServerEvent("onRepair", localPlayer)
removeEventHandler("onClientRender", root, drawShop)
removeEventHandler("onClientRender", root, move)
removeEventHandler("onClientClick", root, click)
removeEventHandler("onClientCursorMove", root, mouse)
showCursor ( false )
draw = false
elseif ( x >= sX * 0.60 and y >= sY * 0.70 and x <= ( sX * 0.56 + sX * 0.14 ) and y <= ( sY * 0.70 + sY * 0.05 ) ) then
triggerServerEvent("onNitro", localPlayer)
removeEventHandler("onClientRender", root, drawShop)
removeEventHandler("onClientRender", root, move)
removeEventHandler("onClientClick", root, click)
removeEventHandler("onClientCursorMove", root, mouse)
showCursor ( false )
draw = false
end
end
function drawShop ()
local name = getPlayerName ( localPlayer )
local money = getPlayerMoney ( )
local level = getElementData ( localPlayer, "Level" ) or "#555555SoOoN"
local xp = getElementData ( localPlayer, "Exp" ) or "#555555SoOoN"
dxDrawRectangle(sX * 0.20, sY * 0.20, sX * 0.57, sY * 0.62, tocolor(0, 0, 0, 156), true)
dxDrawText("#555555Welcome To MXA Shop System", sX * 0.40, sY * 0.20, sX * 0.60, sY * 0.10, tocolor(255, 255, 255, 255), copyrightscale, "default-bold", "center", "top", false, false, true, true, false)
dxDrawText("#555555Have A Fun", sX * 0.21, sY * 0.25, sX * 0.41, sY * 0.30, tocolor(255, 255, 255, 255), scale, "default-bold", "left", "top", false, false, true, true, false)
dxDrawText("#999999Repair Cost : 2500$", sX * 0.24, sY * 0.37, sX * 0.40, sY * 0.47, tocolor(255, 255, 255, 255), scale, "default-bold", "left", "top", false, false, true, true, false)
dxDrawText("#999999Flip Cost : 1500$", sX * 0.24, sY * 0.41, sX * 0.40, sY * 0.50, tocolor(255, 255, 255, 255), scale, "default-bold", "left", "top", false, false, true, true, false)
dxDrawText("#999999Your Name :- ".. name, sX * 0.21, sY * 0.29, sX * 0.41, sY * 0.40, tocolor(255, 255, 255, 255), scale, "default-bold", "left", "top", false, false, true, true, false)
dxDrawText("#999999Nitro Cost : 500$", sX * 0.24, sY * 0.33, sX * 0.40, sY * 0.44, tocolor(255, 255, 255, 255), scale, "default-bold", "left", "top", false, false, true, true, false)
dxDrawText("#999999Shop Items :-", sX * 0.21, sY * 0.45, sX * 0.41, sY * 0.56, tocolor(255, 255, 255, 255), scale, "default-bold", "left", "top", false, false, true, true, false)
dxDrawImage(sX * 0.24, sY * 0.52, sX * 0.14, sY * 0.16, "images/Flip.png", rot, 0, 0, tocolor(255, 255, 255, 255), true)
dxDrawRectangle(sX * 0.24, sY * 0.70, sX * 0.14, sY * 0.05, tocolor(51, 51, 51, a1), true)
dxDrawText("Flip", sX * 0.30, sY * 0.70, sX * 0.60, sY * 0.74, tocolor(255, 255, 255, 255), itemscale, "default-bold", "left", "bottom", false, false, true, true, false)
dxDrawImage(sX * 0.42, sY * 0.52, sX * 0.14, sY * 0.16, "images/Repair.png", rot, 0, 0, tocolor(255, 255, 255, 255), true)
dxDrawRectangle(sX * 0.42, sY * 0.70, sX * 0.14, sY * 0.05, tocolor(51, 51, 51, a2), true)
dxDrawText("Repair", sX * 0.38, sY * 0.71, sX * 0.60, sY * 0.74, tocolor(255, 255, 255, 255), itemscale, "default-bold", "center", "bottom", false, false, true, true, false)
dxDrawImage(sX * 0.60, sY * 0.52, sX * 0.14, sY * 0.16, "images/Nitro.png", rot, 0, 0, tocolor(255, 255, 255, 255), true)
dxDrawRectangle(sX * 0.60, sY * 0.70, sX * 0.14, sY * 0.05, tocolor(51, 51, 51, a3), true)
dxDrawText("Nitro", sX * 0.52, sY * 0.71, sX * 0.69, sY * 0.74, tocolor(255, 255, 255, 255), itemscale, "default-bold", "right", "bottom", false, false, true, true, false)
dxDrawText("#999999By : #33FF00Mas#000000ter", sX * 0.21, sY * 0.75, sX * 0.41, sY * 0.80, tocolor(255, 255, 255, 255), scale, "default-bold", "left", "bottom", false, false, true, true, false)
end
bindKey ("F1", "down",
function ()
if ( draw == false ) then
addEventHandler("onClientRender", root, drawShop)
addEventHandler("onClientRender", root, move)
addEventHandler("onClientClick", root, click)
addEventHandler("onClientCursorMove", root, mouse)
showCursor ( true )
draw = true
else
removeEventHandler("onClientRender", root, drawShop)
removeEventHandler("onClientRender", root, move)
removeEventHandler("onClientClick", root, click)
removeEventHandler("onClientCursorMove", root, mouse)
showCursor ( false )
draw = false
end
end
)
addEvent("onflip2", true)
addEventHandler("onflip2", root,
function(veh)
setVehicleNitroCount(veh, 1)
end)