MTASA TÜRK
Türkiye'nin En Güncel MTA Platformu


[YARDIM] Skin Shop

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı HaYaLeTCoCuK

  • Yeni Üye
  • *
    • İleti: 6
: 02 Ocak 2019, 20:43:34
Merhaba arkadaşlar öncelikle selamun aleyküm allah rızası için yardım edin şimdiden teşekkürler.
Hata: Ekran geliyor skini satın almıyor bir problem var ve fiyat çıkmıyor.

Örnek resim:



Client kodları:

Kod
local sx,sy = guiGetScreenSize()
local font = dxCreateFont("files/font.ttf",16)
local isMarker = false
local gender = 0 --1,Bay| 2,Bayan
local tempPed = nil
local selected = 0
local playerInterior = 0
local shopMarkers = {
--{x,y,z, interior, dimesion},
{210.142578125, -157.099609375, 1000.5234375, 283, 14}
}
local skins = {
[1] = { --Bay
--ID,Fiyat
{1,150},
{2,150},
{7, 150},
{19, 150},
{20,150},
{21,150},
{22,150},
{23,150},
{24,150},
{29,150},
{36,150},
{296,150},
{46,150},
{59,150},
{67,150},
{68,150},
{73,150},
{79,150},
{82,150},
},
[2] = { --Bayan
--ID,Fiyat
{12,150},
{13,150},
{38, 150},
{39, 150},
{41, 150},
{64, 150},
{148, 150},
{169, 150},
{190, 150},
{192, 150},
{193, 150},
{197, 150},
},
}

addEventHandler("onClientResourceStart",resourceRoot,function()
for k,v in pairs(shopMarkers) do
local mark = createMarker(v[1],v[2],v[3]-1,"cylinder",1.2,0, 174, 239,50)
setElementInterior ( mark, v[4] )
setElementDimension ( mark, v[5])
setElementData(mark,"skinshop",true)
end
end)

addEventHandler("onClientMarkerHit",root,function(hit)
if hit == localPlayer and not isMarker then
if getElementData(source,"skinshop") then
isMarker = true
playerInterior = getElementInterior ( localPlayer )
removeEventHandler("onClientRender",root,drawShop)
addEventHandler("onClientRender",root,drawShop)
setElementFrozen(localPlayer,true)
showCursor(true)
showChat(false)
setElementData(localPlayer,"togHUD",false)
if isElement(tempPed) then
destroyElement(tempPed)
end
end
end
end)

function drawShop()
dxDrawText("Olivia Roleplay-Binco",0,sy-140,sx,0,tocolor(255,255,255,255),1,font,"center",nil)
dxDrawRectangle(sx/2-100,sy-110,200,100,tocolor(0,0,0,120))

if isInSlot(sx/2-70,sy-100,140,30) then
dxDrawRectangle(sx/2-70,sy-100,140,30,exports.ice_core:getServerRGB()) --Bay Skin
else
dxDrawRectangle(sx/2-70,sy-100,140,30,tocolor(255,255,255,120)) --Bay Skin
end
dxDrawText("Bay Bölümü",sx/2-70,sy-100,sx/2-70+140,sy-100+30,tocolor(255,255,255,255),0.8,font,"center","center")

if isInSlot(sx/2-70,sy-50,140,30) then
dxDrawRectangle(sx/2-70,sy-50,140,30,exports.ice_core:getServerRGB()) --Bayan Skin
else
dxDrawRectangle(sx/2-70,sy-50,140,30,tocolor(255,255,255,120)) --Bayan Skin
end
dxDrawText("Bayan Bölümü",sx/2-70,sy-50,sx/2-70+140,sy-50+30,tocolor(255,255,255,255),0.8,font,"center","center")
end

function drawSkinDatas()
dxDrawRectangle(sx-300,sy/2-50,300,100,tocolor(0,0,0,120))
if gender == 1 then
dxDrawText("Bay Elbiseleri",sx-300,sy/2-40,sx,0,tocolor(255,255,255,255),0.9,font,"center")
else
dxDrawText("Bayan Elbiseleri",sx-300,sy/2-40,sx,0,tocolor(255,255,255,255),0.9,font,"center")
end
dxDrawText("Fiyat:",sx-300,sy/2-10,sx,0,tocolor(255,255,255,255),0.9,font,"center")
dxDrawText("$ "..exports.ice_core:getServerColor("server")..skins[gender][selected][2],sx-300,sy/2+15,sx,0,tocolor(255,255,255,255),0.9,font,"center",nil,false,false,false,true)
dxDrawText("Ok Tuşlarını Kullanarak"..exports.ice_core:getServerColor("server").." #FFFFFF Kıyafetler Arasında Gezinin.",sx-300,sy/2+55,sx,0,tocolor(255,255,255,255),0.55,font,"center",nil,false,false,false,true)
dxDrawText("Çıkmak İçin "..exports.ice_core:getServerColor("server").."backspace'ye #FFFFFF Basın.",sx-300,sy/2+70,sx,0,tocolor(255,255,255,255),0.55,font,"center",nil,false,false,false,true)
dxDrawText("Satın Almak İçin"..exports.ice_core:getServerColor("server").." enter'a#FFFFFF Basın.",sx-300,sy/2+90,sx,0,tocolor(255,255,255,255),0.75,font,"center",nil,false,false,false,true)
end

addEventHandler("onClientKey",root,function(button,state)
if isMarker then
if button == "backspace" and state then
isMarker = false
removeEventHandler("onClientRender",root,drawShop)
setElementFrozen(localPlayer,false)
showCursor(false)
showChat(true)
setElementData(localPlayer,"togHUD",true)
setElementInterior ( localPlayer, playerInterior )
if isElement(tempPed) then
destroyElement(tempPed)
end
setCameraTarget(localPlayer)
removeEventHandler("onClientRender",root,drawSkinDatas)
elseif button == "mouse1" and state then
if isInSlot(sx/2-70,sy-100,140,30) then --Bay Skin
gender = 1
removeEventHandler("onClientRender",root,drawShop)
selected = 1
tempPed = createPed(skins[gender][selected][1],1548.5915527344, -1364.7681884766, 326.2109375,180)
setElementData(tempPed,"ped>noname",true)
setElementFrozen(tempPed,true)
setElementDimension ( tempPed, getElementDimension ( localPlayer ) )
setPedAnimation(tempPed,"gangs","dealer_idle",-1,true,false)
setElementInterior ( localPlayer, 0 )
setCameraMatrix(1548.9757080078,-1367.5662841797,326.84750366211,1548.9399414063,-1366.5743408203,326.72616577148)
removeEventHandler("onClientRender",root,drawSkinDatas)
addEventHandler("onClientRender",root,drawSkinDatas)
elseif isInSlot(sx/2-70,sy-50,140,30) then --Bayan Skin
gender = 2
removeEventHandler("onClientRender",root,drawShop)
selected = 1
tempPed = createPed(skins[gender][selected][1],1548.5915527344, -1364.7681884766, 326.2109375,180)
setElementData(tempPed,"ped>noname",true)
setElementFrozen(tempPed,true)
setElementInterior ( localPlayer, 0 )
setPedAnimation(tempPed,"gangs","dealer_idle",-1,true,false)
setElementDimension ( tempPed, getElementDimension ( localPlayer ) )
setCameraMatrix(1548.9757080078,-1367.5662841797,326.84750366211,1548.9399414063,-1366.5743408203,326.72616577148)
removeEventHandler("onClientRender",root,drawSkinDatas)
addEventHandler("onClientRender",root,drawSkinDatas)
end
elseif button == "arrow_l" and state then --Sola Kaydır
if gender == 1 or gender == 2 then
local next = selected - 1
if next ~= 0 then
selected = selected - 1
else
selected = #skins[gender]
end
setElementModel(tempPed,skins[gender][selected][1])
end
elseif button == "arrow_r" and state then --Sola Kaydır
if gender == 1 or gender == 2 then
local next = selected + 1
if next ~= (#skins[gender]+1) then
selected = selected + 1
else
selected = 1
end
setElementModel(tempPed,skins[gender][selected][1])
end
elseif ( button == "enter" and state ) and gender > 0 then
local buyskin = getElementModel(tempPed)
local cost = skins[gender][selected][2]
triggerServerEvent("skinshop>buyskin",localPlayer,localPlayer,buyskin,cost)
end
end
end)

addEvent("skinshop>buyskin",true)
addEventHandler("skinshop>buyskin",root,function()
isMarker = false
removeEventHandler("onClientRender",root,drawShop)
setElementFrozen(localPlayer,false)
showCursor(false)
showChat(true)
setElementInterior ( localPlayer, playerInterior )
setElementData(localPlayer,"togHUD",true)
if isElement(tempPed) then
destroyElement(tempPed)
end
setCameraTarget(localPlayer)
removeEventHandler("onClientRender",root,drawSkinDatas)
end)


--İçerik
function isInSlot(xS,yS,wS,hS)
if(isCursorShowing()) then
XY = {guiGetScreenSize()}
local cursorX, cursorY = getCursorPosition()
cursorX, cursorY = cursorX*XY[1], cursorY*XY[2]
if(isInBox(xS,yS,wS,hS, cursorX, cursorY)) then
return true
else
return false
end
end
end

function isInBox(dX, dY, dSZ, dM, eX, eY)
if(eX >= dX and eX <= dX+dSZ and eY >= dY and eY <= dY+dM) then
return true
else
return false
end
end

Server kodları:

Kod
addEvent("skinshop>buyskin",true)
addEventHandler("skinshop>buyskin",root,function(player,skin,cost)
if source == player and source == client and isElement(source) then
if getElementData(client,"char>money") >= cost then
setElementData(client,"char>money",getElementData(client,"char>money")-cost)
setElementModel(client,skin)
exports.ice_infobox:addNotiS(client,"Kıyafeti Başarıyla Satın Aldın","Başarı")
triggerClientEvent(client,"skinshop>buyskin",client)
else
exports.ice_infobox:addNotiS(client,"Satın Almak İçin Yeterli Paranız Bulunmamaktadır.","Başarısızlık")
end
end
end)
« Son Düzenleme: 08 Ocak 2019, 09:21:30 Gönderen: Narkoz »
 


MTASA TÜRK

[YARDIM] Skin Shop
« : 02 Ocak 2019, 20:43:34 »

Çevrimdışı Paradox

  • Kurucu
  • *
    • İleti: 732
  • SH Gaming
Yanıtla #1 : 04 Ocak 2019, 14:08:07
Debug'da olan hatayı atar mısın?
 


Çevrimdışı HaYaLeTCoCuK

  • Yeni Üye
  • *
    • İleti: 6
Yanıtla #2 : 04 Ocak 2019, 18:15:55
Linki görebilmek için Kayıt olun yada Giriş yapın.
Debug'da olan hatayı atar mısın?

Sunucu 1.4 Debug hattası göstermiyor