Tete omar Posted March 26, 2014 Share Posted March 26, 2014 There isn't a problem with bumping an old topic up as long as the reason of the bumping is useful, Mя.SнαяιQ. Link to comment
aintaro Posted April 7, 2014 Share Posted April 7, 2014 The Interfaces look very nice man, keep up the great work Link to comment
Anuar002 Posted December 20, 2014 Share Posted December 20, 2014 This system is very good but need help on that mod and smod can modify the actions of all businesses bone they can change the cost, the owner is a bit cloying and want someone to help me on that please Link to comment
JR10 Posted March 19, 2015 Author Share Posted March 19, 2015 A new version is released Version 1.3.0 Fully rewritten in OOP New directx user interface with the dxGUI library Can now use MySQL or SQLite Several bug fixes The resource needs some performance optimizations, unfortunately, this is all I had time for. I will be working on this in the future, perhaps adding interactive businesses. Link to comment
JR10 Posted March 20, 2015 Author Share Posted March 20, 2015 Take a look at the screenshots for the new user interface. Link to comment
Birkin Posted April 7, 2015 Share Posted April 7, 2015 addEventHandler("onResourceStart", resourceRoot, function() if (settings.database == "mysql") then local host, db, username, password, port, socket = unpack(settings.database_data); if not (host and db and username and password) then outputDebugString("Business: Failed to connect to the MySQL server - The data is invalid"); return; end if (tonumber(port)) then port = "port="..port..";"; else port = ""; end if (socket and socket ~= "") then socket = "socket="..socket..";"; else socket = ""; end database = Connection("mysql", "host="..host..";dbname="..db..";"..port..socket, username, password); if (not database) then outputDebugString("Business: Failed to connect to the MySQL server"); return; end else database = Connection("sqlite", "files/business.db"); if (not database) then outputDebugString("Business: Failed to connect to the SQLite file"); return; end end database:exec("CREATE TABLE IF NOT EXISTS business(id INT, name TEXT, owner TEXT, cost INT, pos TEXT, payout INT, payout_time INT, payout_otime INT, payout_unit TEXT, payout_cur_time INT, bank INT)"); database:query(dbCreateBusinessesCallback, "SELECT * FROM business"); end); Where i must paste my MySQL data information? Link to comment
JR10 Posted April 7, 2015 Author Share Posted April 7, 2015 There's a setting for it in meta.xml Link to comment
Birkin Posted April 10, 2015 Share Posted April 10, 2015 i have one problem with disappearing and appearing on-screen cursor who know to fix it? Link to comment
JR10 Posted April 10, 2015 Author Share Posted April 10, 2015 I'm guessing you removed the classlib file. Just remove the Cursor.lua file from the meta.xml and try again. If it still spits errors, just download the latest version and don't mess with the meta.xml. If you haven't removed anything, I guess I will have to take a look. Link to comment
FelipeMallmann Posted April 21, 2015 Share Posted April 21, 2015 I'm getting some errors, I cant create a business.. the resource name is 'business' and it's at acl group admin, when I type /business it works good but after pick the coords and set prices, when I click CREATE BUSINESS, the sound plays but nothing happens, the business doesn't create.. the only warning it shows is WARNING: business\scripts\core.server.lua:28: Bad argument @ 'query' [Expected string at argument 2, got function] Link to comment
JR10 Posted April 21, 2015 Author Share Posted April 21, 2015 Make sure you have the latest MTA server version and re-download the latest version of the resource. The resource is tested in the latest version, everything should work fine. Link to comment
FelipeMallmann Posted April 21, 2015 Share Posted April 21, 2015 I tested it at map editor, and worked fine, but when I try to use this resource in my current server, this problem appears what can it be? Link to comment
Businessman Posted May 21, 2015 Share Posted May 21, 2015 well hi JR10 i have 2 suggestion.... first please remove the marker or make it invesible and add T-shirt pickup to it. this pickup should be the blue / green pickup if it was for sale then green / if owned then blue pickup : and second thing is edit the GUI panel and make it look like housing panel with less buttons...and or when you click owner options panel ( you only can access it as the business owner ) with all stuff inside like ( put for sale , bank ..etc ) and remove blips as it's not good for RP Link to comment
Best-Killer1 Posted September 6, 2015 Share Posted September 6, 2015 you don't have access to this command -.- i add it in acl but (name the acl not admin) name Level 5 Link to comment
BluntZ Posted September 6, 2015 Share Posted September 6, 2015 add in level 5 group : resource. and then try command Link to comment
JR10 Posted September 7, 2015 Author Share Posted September 7, 2015 The player must have access to function.banPlayer, which the Admin group by default has access to. Link to comment
Best-Killer1 Posted October 6, 2015 Share Posted October 6, 2015 why the sample players can't open the gui windows when press N the windows not showing Link to comment
KariiiM Posted October 6, 2015 Share Posted October 6, 2015 why the sample players can't open the gui windows when press N the windows not showing Read the topic well and follow what JR10 said Link to comment
Best-Killer1 Posted October 6, 2015 Share Posted October 6, 2015 i didn't understand what i need do Link to comment
Best-Killer1 Posted October 6, 2015 Share Posted October 6, 2015 i fix it but now i can't deposit / withdraw money from the bank Code : local _settings = get(""); local settings = {}; for k, v in pairs(_settings) do k = split(k, ".")[2]; settings[k] = v; end if (settings.key:len() < 1 or settings.key:len() > 1) then settings.key = "N"; end if (not settings.blip or tonumber(settings.blip) == nil) then settings.blip = false; end addEventHandler("onResourceStart", resourceRoot, function() if (settings.database == "mysql") then local host, db, username, password, port, socket = unpack(settings.database_data); if not (host and db and username and password) then outputDebugString("Business: Failed to connect to the MySQL server - The data is invalid"); return; end if (tonumber(port)) then port = "port="..port..";"; else port = ""; end if (socket and socket ~= "") then socket = "socket="..socket..";"; else socket = ""; end database = Connection("mysql", "host="..host..";dbname="..db..";"..port..socket, username, password); if (not database) then outputDebugString("Business: Failed to connect to the MySQL server"); return; end else database = Connection("sqlite", "files/business.db"); if (not database) then outputDebugString("Business: Failed to connect to the SQLite file"); return; end end database:exec("CREATE TABLE IF NOT EXISTS business(id INT, name TEXT, owner TEXT, cost INT, pos TEXT, payout INT, payout_time INT, payout_otime INT, payout_unit TEXT, payout_cur_time INT, bank INT)"); database:query(dbCreateBusinessesCallback, "SELECT * FROM business"); end); function dbCreateBusinessesCallback(query_handle) local sql = query_handle:poll(0); if (sql and #sql > 0) then for index, row in ipairs(sql) do local pos = split(row["pos"], ","); local b_marker = Marker(pos[1], pos[2], pos[3], "cylinder", 1.5, settings.marker_color[1], settings.marker_color[2], settings.marker_color[3], settings.marker_color[4]); b_marker.interior = pos[4]; b_marker.dimension = pos[5]; if (settings.blip ~= false) then if (row["owner"] == "For Sale") then local b_blip = Blip.createAttachedTo(b_marker, settings.blip, 2, 255, 0, 0, 255, 0, 100.0); b_blip.interior = pos[4]; b_blip.dimension = pos[5]; else local b_blip = Blip.createAttachedTo(b_marker, settings.blip, 2, 255, 0, 0, 255, 0, 100.0); b_blip.interior = pos[4]; b_blip.dimension = pos[5]; end end addEventHandler("onMarkerHit", b_marker, onBusinessMarkerHit); addEventHandler("onMarkerLeave", b_marker, onBusinessMarkerLeave); local timer = Timer(businessPayout, row["payout_cur_time"] , 1, b_marker); b_marker:setData("b_data", {row["id"], row["name"], row["owner"], row["cost"], row["payout"], row["payout_time"], row["payout_otime"], row["payout_unit"], row["bank"], timer}); end end end addCommandHandler("business", function(player) if (ACL.hasObjectPermissionTo(player, "function.banPlayer")) then triggerClientEvent(player, "business.showCreateBusinessWindow", player); else player:outputMessage("Business: You don't have access to this command.", 255, 0, 0); end end); function Player:outputMessage(message, r, g, b) if (settings.info_messages_type == "dx") then dxOutputMessage(message, self, r, g, b); else self:outputChat(message, r, g, b, true); end end function outputMessage(message, player, r, g, b) if (settings.info_messages_type == "dx") then dxOutputMessage(message, player, r, g, b); else player:outputChat(message, r, g, b, true); end end function dxOutputMessage(message, player, r, g, b) triggerClientEvent(player, "business.dxOutputMessage", player, message, r, g, b); end addEvent("business.outputMessage", true); addEventHandler("business.outputMessage", root, function(message, r, g, b) source:outputMessage(message, r, g, b); end); addEvent("business.createBusiness", true); addEventHandler("business.createBusiness", root, function(x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit) database:query(dbCreateBusinessCallback, {client, x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit}, "SELECT * FROM business"); end); function dbCreateBusinessCallback(query_handle, client, x, y, z, interior, dimension, name, cost, payout, payout_time, payout_unit) local sql = query_handle:poll(0); if (sql) then local id; if (#sql > 0) then id = sql[#sql]["id"] + 1; else id = 1; end local unit; if (payout_unit == "Seconds") then unit = 1000; elseif (payout_unit == "Minutes") then unit = 60000; elseif (payout_unit == "Hours") then unit = 3600000; elseif (payout_unit == "Days") then unit = 86400000; end x = tonumber(x); y = tonumber(y); z = tonumber(z); interior = tonumber(interior); dimension = tonumber(dimension); cost = tonumber(cost); payout = tonumber(payout); payout_time = tonumber(payout_time); z = z - 1; database:exec("INSERT INTO business(id,name,owner,cost,pos,payout,payout_time,payout_otime,payout_unit,payout_cur_time,bank) VALUES(?,?,?,?,?,?,?,?,?,?,?)", id, name, "For Sale", cost, x..","..y..","..z..","..interior..","..dimension, payout, payout_time * unit, payout_time, payout_unit, payout_time * unit, 0); local b_marker = Marker(x, y, z, "cylinder", 1.5, settings.marker_color[1], settings.marker_color[2], settings.marker_color[3], settings.marker_color[4]); b_marker.interior = interior; b_marker.dimension = dimension; if (settings.blip ~= false) then local b_blip = Blip.createAttachedTo(b_marker, settings.blip, 2, 255, 0, 0, 255, 0, 100.0); b_blip.interior = interior; b_blip.dimension = dimension; end local timer = Timer(businessPayout, payout_time * unit , 1, b_marker); b_marker:setData("b_data", {id, name, "For Sale", cost, payout, payout_time * unit, payout_time, payout_unit, 0, timer}); addEventHandler("onMarkerHit", b_marker, onBusinessMarkerHit); addEventHandler("onMarkerLeave", b_marker, onBusinessMarkerLeave); if (#tostring(id) == 1) then id = "0".. tostring(id) end client:outputMessage("Business: Business(ID #"..id..") has been created successfully", 0, 255, 0); end end function onBusinessMarkerHit(hElement, mDim) if (hElement:getType() ~= "player") then return; end if (hElement:isInVehicle()) then return; end if (not mDim) then return; end triggerClientEvent(hElement, "business.showInstructions", hElement); end function onBusinessMarkerLeave(hElement, mDim) if (hElement:getType() ~= "player") then return; end if (hElement:isInVehicle()) then return; end if (not mDim) then return; end triggerClientEvent(hElement, "business.hideInstructions", hElement); end function businessPayout(b_marker) local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (owner ~= "For Sale") then bank = bank + payout; database:exec("UPDATE business SET bank = ? WHERE id = ?", bank, id); if (settings.inform_player_of_payout) then local account = Account(owner); if (account) then local player = account:getPlayer(); if (player and player.isElement) then player:outputMessage("Business: Business \" "..name.." \" has paid out($"..payout..")", 0, 255, 0); end end end end timer = Timer(businessPayout, payout_time, 1, b_marker); b_marker:setData("b_data", {id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}); end addEventHandler("onResourceStop", resourceRoot, function() for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (timer and timer:isValid()) then local left = timer:getDetails(); if (left >= 50) then database:exec("UPDATE business SET payout_cur_time = ? WHERE id = ?", left, id); else database:exec("UPDATE business SET payout_cur_time = ? WHERE id = ?", payout_time, id); end end end end); function Ped:isInMarker(marker) local colshape = marker.colShape; return self:isWithinColShape(colshape); end addEventHandler("onResourceStart", resourceRoot, function() for index, player in ipairs(Element.getAllByType("player")) do bindKey(player, settings.key, "up", onPlayerAttemptToOpenBusiness); end end); addEventHandler("onPlayerJoin", root,function() bindKey(source, settings.key, "up", onPlayerAttemptToOpenBusiness); end); function onPlayerAttemptToOpenBusiness(player) for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do if (player:isInMarker(b_marker)) then local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); triggerClientEvent(player, "business.showBusinessWindow", player, b_marker, getAccountName(getPlayerAccount(player)) == Owner, ACL.hasObjectPermissionTo(player, "function.showbus")); break; end end end function Ped:getMarker() for index, b_marker in ipairs(Element.getAllByType("marker", resourceRoot)) do if (self:isInMarker(b_marker)) then return b_marker; end end end addEvent("business.buy", true); addEventHandler("business.buy", root, function() local account = client.account; if (not account or account:isGuest()) then return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); local id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer = unpack(b_data); if (owner ~= "For Sale") then client:outputMessage("Business: This business is owned", 255, 0, 0); return; end database:query(dbBuyBusinessCallback, {client, b_marker, id, name, owner, cost, payout, payout_time, payout_otime, payout_unit, bank, timer}, "SELECT * FROM business WHERE owner = ?", account.name); end); addEvent("business.sell", true); addEventHandler("business.sell", root, function() local account = client.account; if (not account or account:isGuest()) then return; end local b_marker = client:getMarker(); if (not isElement(b_marker)) then return; end local b_data = b_marker:getData("b_data"); Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now