Buenas soy principiante en la creacion de servidores de MTA, me gusta mucho el RP y llevo unos dias experimentando con un amigo en mi pc con servidores MTA.
Hoy logre hacer funcionaar el GameMod "basicrp" .... la mayoria de los sistemas los he entendido al leerlos y tal... lo que me cuesta es entender como funciona el sistema de las tiendas...
Lo que hice fue crear el interior con /createinterior 24/7-1 "costo" Business "nombre" , por ejemplo, luego una vez dentro creo el negocio en si... con /Createshop [iD] en este caso es el de "General Store", el problema es que a partir de aqui no se como comprar los articulos estuve viendo en el sistema y aparece algo de darle ckick... pero nose como funciona...
esto
-- Functions
function createShopList(type)
shop_window = guiCreateWindow((sx - 490) / 2, (sy - 300) / 2, 393, 310, types[tonumber(type)][1], false)
guiWindowSetSizable(shop_window, false)
shop_list = guiCreateGridList(17, 28, 358, 224, false, shop_window)
guiGridListSetSelectionMode(shop_list, 0)
guiGridListSetSortingEnabled(shop_list, false)
local itemColumn = guiGridListAddColumn(shop_list, "Item", 0.2)
local priceColumn = guiGridListAddColumn(shop_list, "Price", 0.1)
local descriptionColumn = guiGridListAddColumn(shop_list, "Description", 1.0)
for i,v in ipairs(items) do
local row = guiGridListAddRow(shop_list)
if items[i][3] == tonumber(type) then
guiGridListSetItemText(shop_list, row, itemColumn, items[i][1], false, false)
guiGridListSetItemText(shop_list, row, priceColumn, "$" .. items[i][7], false, false)
guiGridListSetItemText(shop_list, row, descriptionColumn, items[i][2], false, false)
end
end
shop_buy = guiCreateButton(17, 257, 171, 38, "Buy Item", false, shop_window)
guiSetFont(shop_buy, "clear-normal")
shop_close = guiCreateButton(204 ,257, 171, 38, "Close Window", false, shop_window)
guiSetFont(shop_close, "clear-normal")
addEventHandler("onClientGUIClick", shop_buy, buyItem, false)
addEventHandler("onClientGUIClick", shop_close, closeShop, false)
end
o esto ya que hay dos archivos distintos
addEvent("onItemBuy", true)
addEventHandler("onItemBuy", root,
function(item, price)
outputServerLog("[sHOPS] [PLA/BUY]: " .. getPlayerName(source) .. " bought '" .. item .. "' for $" .. price .. ".")
takePlayerMoney(source, price)
end
)
addEvent("onWeaponBuy", true)
addEventHandler("onWeaponBuy", root,
function(weapon, ammo)
giveWeapon(source, weapon, ammo, true)
outputServerLog("[sHOPS] [PLA/BUYINFO]: Additional information: [Weapon ID: " .. weapon .. "] [Ammo Amount: " .. ammo .. "].")
end
)
addEventHandler("onMarkerHit", root,
function(hitElement, matchingDimension)
if getElementType(hitElement) == "player" then
if matchingDimension then
if getElementData(source, "shops.id") then
setElementData(hitElement, "shops.in", getElementData(source, "shops.id"))
end
end
end
end
)
addEventHandler("onMarkerLeave", root,
function(hitElement, matchingDimension)
if getElementType(hitElement) == "player" then
if matchingDimension then
if getElementData(source, "shops.id") then
removeElementData(hitElement, "shops.in")
end
end
end
end
)
addEventHandler("onResourceStart", resourceRoot,
function()
for i,v in ipairs(getElementsByType("shop")) do
local ped = createPed(getElementData(v, "skin"), getElementData(v, "posx"), getElementData(v, "posy"), getElementData(v, "posz"), getElementData(v, "rotation"))
setElementInterior(ped, getElementData(v, "interior"))
setElementDimension(ped, getElementData(v, "dimension"))
setElementFrozen(ped, true)
setElementData(ped, "shops.id", getElementData(v, "id"))
setElementData(ped, "shops.type", getElementData(v, "type"))
local marker = createMarker(getElementData(v, "posx"), getElementData(v, "posy"), getElementData(v, "posz") - 1, "cylinder", 5, 255, 0, 0, 70)
setElementInterior(marker, getElementData(v, "interior"))
setElementDimension(marker, getElementData(v, "dimension"))
setElementData(marker, "shops.id", getElementData(v, "id"))
setElementData(marker, "shops.type", getElementData(v, "type"))
end
outputServerLog("[sHOPS] [AUTO/SPAWN] All shops spawned as the resource started.")
end
)