-
Posts
220 -
Joined
-
Last visited
Posts posted by =KoG=Rouche
-
-
I'm ok with that Brian Nice to see you here
-
Hi all,
I try to make the Buy Map function of my userpanel working.
I know i've to edit something in racevoting_server.lua but can't remember what.
There is nothing in Debugscript .
Does anyone have an idea ?
racevoting_server.lua
function buyMap(player, ...) if mapAllow ~= true then outputChatBox('* You are not allowed to buy map right now!', player, 255, 0, 0, true) return end local query = #{...}>0 and table.concat({...},' ') or nil if not query then if g_ForcedNextMap then outputRace( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) else outputRace( 'Next map is not set', player ) end return end local map, errormsg = findMap( query ) if not map then outputRace( errormsg, player ) return end if g_ForcedNextMap == map then outputRace( 'Next map is already set to ' .. getMapName( g_ForcedNextMap ), player ) return end if g_ForcedNextMap ~= nil then table.insert(mapQueue, map) outputChatBox('* ' .. getMapName( map ) .. ' has been bought and added to queue by ' .. getPlayerName( player ), g_Root, 0, 240, 0) else g_ForcedNextMap = map outputChatBox('* Next map has been bought and set to ' .. getMapName( map ) .. ' by ' .. getPlayerName( player ), g_Root, 0, 240, 0) end end addEvent("buyMap", true) addEventHandler("buyMap", root, buyMap) --Find a map which matches, or nil and a text message if there is not one match function findMap( query ) local maps = findMaps( query ) -- Make status string local status = "Found " .. #maps .. " match" .. ( #maps==1 and "" or "es" ) for i=1,math.min(5,#maps) do status = status .. ( i==1 and ": " or ", " ) .. "'" .. getMapName( maps[i] ) .. "'" end if #maps > 5 then status = status .. " (" .. #maps - 5 .. " more)" end if #maps == 0 then return nil, status .. " for '" .. query .. "'" end if #maps == 1 then return maps[1], status end if #maps > 1 then return nil, status end end -- Find all maps which match the query string function findMaps( query ) local results = {} --escape all meta chars query = string.gsub(query, "([%*%+%?%.%(%)%[%]%{%}%\%/%|%^%$%-])","%%%1") -- Loop through and find matching maps for i,resource in ipairs(exports.mapmanager:getMapsCompatibleWithGamemode(getThisResource())) do local resName = getResourceName( resource ) local infoName = getMapName( resource ) -- Look for exact match first if query == resName or query == infoName then return {resource} end -- Find match for query within infoName if string.find( infoName:lower(), query:lower() ) then table.insert( results, resource ) end end return results end function getMapName( map ) return getResourceInfo( map, "name" ) or getResourceName( map ) or "unknown" end addCommandHandler('buymap', function( player, command, ... ) local query = #{...}>0 and table.concat({...},' ') or nil if not query then if g_ForcedNextMap then outputRace( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) else outputRace( 'Next map is not set', player ) end return end local map, errormsg = findMap( query ) if not map then outputRace( errormsg, player ) return end if g_ForcedNextMap == map then outputRace( 'Next map is already set to ' .. getMapName( g_ForcedNextMap ), player ) return end g_ForcedNextMap = map outputChatBox('' .. getPlayerName( player )..' Buy Next map ' .. getMapName( g_ForcedNextMap ) .. '', g_Root, 255, 200, 0) end )
Thanks for helping.
-
I add to :
dpkg -i --arch-structure i386
apt-get install ia32-libs (need to add a old depository in /etc/apt/source.list)
Then add your file in usr/lib32
Thank you.
-
Found the problem.
I use Debian 64bits.
[2015-12-02 19:42:42] MODULE: Unable to load mods/deathmatch/modules/mta_mysql.so (libmysqlclient.so.15: wrong ELF class: ELFCLASS64)
[2015-12-02 19:42:42] MODULE: Loaded "Sockets Module" (1.30) by "Gamesnert, MCvarial & x86"
Does someone have the file for 64 ?
libmysqlclient.so.15
-
(Copy and Paste make more line than normal)
Modules are loaded in mtaserv.conf
and result of netstat is :
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
I tried with :
local con = dbConnect("mysql","dbname=MYDBNAME;host=127.0.0.1;port=3306", "DBUSER", "DBPASS", "share=1")
-
Thank you. Resolved.
-
Hi all,
I'm back into Scripting.
I have a new problem with my dbconnect function.
Here is my code :
server.lua
---- MYSQL Connection ---- -- Create an connection object for the Database function connectDB() local con = dbConnect("mysql","dbname=MYDBNAME;host=127.0.0.1", "DBUSER", "DBPASS", "share=1") if (con) then outputDebugString("Connection OK !") else outputDebugString("Connection to Database failled !") end return con end ------- VARIABLES ------- rootElement = getRootElement() local connect = connectDB()
When i try this it says :
ERROR : line4 : dbConnect failed. Could not connect
Do you see any error ?
Thanks for helping.
-
-
Here is the first screenshot : http://hpics.li/db4bfc9
The second one : http://hpics.li/2e73ee7
-
Hi all I'm back on MTA.
I tried to play MTA on my new monitor (4K x 2K - 3840 x 2160)
I use the last DirectX for my GTX980.
When i start MTA, i change the resolution in parameters to 3840 x 2160.
Then i restart my MTA.
The screen is now stuck in the upper left corner and i can't use all the menu with my mouse. Mouse is stuck and monitor is not well used.
I tried with 1920 x 1440 and another problem appear.
Now i've 2 black borders on both side (left and right).
What can i do ?
Monitor : Acer S277HK 27 inch.
I use Display Port.
Thank for you help.
-
Back. Nice Work
-
You have to use "Screen".
apt-get install screen
screen -S MTA (create a screen named MTA)
Go to the path where u can find mta-server script.
Type ./mta-server (it start the server)
Later if you want be reattached to the screen you can use screen -r to list all screens and screen -rd MTA to reattach it.
To stop it just type exit or quit.
-
Can't wait for the release of this version !
Youtube integration will be fun. Got lot of script idea.
Thanks to all dev team.
-
Thank you. Problem Resolved
-
Problème résolu ici : https://forum.multitheftauto.com/viewtopic.php?f=91&t=83960
-
I just re-installed the server from scratch.
-- Buy a next map function buyMap(mapName) local account = getPlayerAccount(source) local cash = getAccountData(account, "cash") local level = getAccountData(account, "level") if mapIsAlreadySet == false or not getElementData (getRootElement(),"mapIsAlreadySet") == true then if not (mapName == "") then if not (isGuestAccount(getPlayerAccount(source))) then if tonumber(level) >= 15 then if tonumber(cash) >= 2000 then outputChatBox("#FFFFFF[userpanel] #FF9900"..getPlayerName(source).."#FF9900 set a map for #FFFFFF 2000$",getRootElement(),255,255,255,true) outputChatBox("#FFFFFF[userpanel] #FF9900Next map: #FFFFFF"..tostring(mapName).." !",getRootElement(),255,255,255,true) executeCommandHandler("buymap", source, mapName) addStat(account, "cash", -2000) else outputChatBox("#FFFFFF[userpanel] #FF9900You don't have enough money to set a map ! (2000$)",source,255,255,255,true) end else outputChatBox("#FFFFFF[userpanel] #FF9900You need to be level #FFFFFF15 #FF9900to buy maps!",source,255,255,255,true) end end else outputChatBox("#FFFFFF[userpanel] #FF9900Please select a map from the list first!",source,255,255,255,true) end end end addEvent("triggerbuyMap",true) addEventHandler( "triggerbuyMap", getRootElement(),buyMap ) function onBuyMapReady() local account = getPlayerAccount(source) addStat(account,"cash",-1500) end addEvent("setCashofBuyMap",true) addEventHandler( "setCashofBuyMap", getRootElement(), onBuyMapReady ) --end MAP
-
Merci de ton aide.
EN effet je n'ai pas pu répondre rapidement car absent de MTA quelques temps.
Chatbox.
Debugscript 3
-
Here is the debugscript 3.
-
Voici le "debugscript3"
-
Voici une partie du code :
Problème : le "BuyMap" de mon Userpanel ne marche plus.
-- Buy a next map function buyMap(mapName) local account = getPlayerAccount(source) local cash = getAccountData(account, "cash") local level = getAccountData(account, "level") if mapIsAlreadySet == false or not getElementData (getRootElement(),"mapIsAlreadySet") == true then if not (mapName == "") then if not (isGuestAccount(getPlayerAccount(source))) then if tonumber(level) >= 15 then if tonumber(cash) >= 2000 then outputChatBox("#FFFFFF[userpanel] #FF9900"..getPlayerName(source).."#FF9900 set a map for #FFFFFF 2000$",getRootElement(),255,255,255,true) outputChatBox("#FFFFFF[userpanel] #FF9900Next map: #FFFFFF"..tostring(mapName).." !",getRootElement(),255,255,255,true) executeCommandHandler("buymap", source, mapName) addStat(account, "cash", -2000) else outputChatBox("#FFFFFF[userpanel] #FF9900You don't have enough money to set a map ! (2000$)",source,255,255,255,true) end else outputChatBox("#FFFFFF[userpanel] #FF9900You need to be level #FFFFFF15 #FF9900to buy maps!",source,255,255,255,true) end end else outputChatBox("#FFFFFF[userpanel] #FF9900Please select a map from the list first!",source,255,255,255,true) end end end addEvent("triggerbuyMap",true) addEventHandler( "triggerbuyMap", getRootElement(),buyMap ) function onBuyMapReady() local account = getPlayerAccount(source) addStat(account,"cash",-1500) end addEvent("setCashofBuyMap",true) addEventHandler( "setCashofBuyMap", getRootElement(), onBuyMapReady ) --end MAP
Avez vous une idée de où ça pourait venir ?
-
-
Hi all,
I've an userpanel with a function to buy map.
Unfortunately since an update its not working anyway.
What to i have to change in racevoting.lua to make the Buy Map working.
I think it's about nextmap function ?
My userpanel dysplay that the player has buy the map but when the previous map end nothing happend except random map.
Can someone help me with racevoting.lua ?
racevoting_server.lua
I tried to put some lines in commentary.
Becaus ethe script was checking if the player is in an admin group.
But it doesn't work :-/
--------------------------------------------------------------------------- -- -- More things that should go in mapmanager -- --------------------------------------------------------------------------- addCommandHandler('checkmap', function( player, command, ... ) local query = #{...}>0 and table.concat({...},' ') or nil if query then local map, errormsg = findMap( query ) outputRace( errormsg, player ) end end ) addCommandHandler('nextmap', function( player, command, ... ) local query = #{...}>0 and table.concat({...},' ') or nil if not query then if g_ForcedNextMap then outputRace( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) else outputRace( 'Next map is not set', player ) end return end --if not _TESTING and not isPlayerInACLGroup(player, g_GameOptions.admingroup) then -- return --end local map, errormsg = findMap( query ) if not map then outputRace( errormsg, player ) return end if g_ForcedNextMap == map then outputRace( 'Next map is already set to ' .. getMapName( g_ForcedNextMap ), player ) return end g_ForcedNextMap = map outputChatBox('Next map set to ' .. getMapName( g_ForcedNextMap ) .. ' by ' .. getPlayerName( player ), g_Root, 0, 240, 0) end ) --Find a map which matches, or nil and a text message if there is not one match function findMap( query ) local maps = findMaps( query ) -- Make status string local status = "Found " .. #maps .. " match" .. ( #maps==1 and "" or "es" ) for i=1,math.min(5,#maps) do status = status .. ( i==1 and ": " or ", " ) .. "'" .. getMapName( maps[i] ) .. "'" end if #maps > 5 then status = status .. " (" .. #maps - 5 .. " more)" end if #maps == 0 then return nil, status .. " for '" .. query .. "'" end if #maps == 1 then return maps[1], status end if #maps > 1 then return nil, status end end -- Find all maps which match the query string function findMaps( query ) local results = {} --escape all meta chars query = string.gsub(query, "([%*%+%?%.%(%)%[%]%{%}%\%/%|%^%$%-])","%%%1") -- Loop through and find matching maps for i,resource in ipairs(exports.mapmanager:getMapsCompatibleWithGamemode(getThisResource())) do local resName = getResourceName( resource ) local infoName = getMapName( resource ) -- Look for exact match first if query == resName or query == infoName then return {resource} end -- Find match for query within infoName if string.find( infoName:lower(), query:lower() ) then table.insert( results, resource ) end end return results end function getMapName( map ) return getResourceInfo( map, "name" ) or getResourceName( map ) or "unknown" end
-
Here is what i did to made it work.
I can't see any difference except a "OutputDebugScript" moved 0.o
Maybe its better to let a little commentary when u change something.
-- Check if a user already exsit in database function checkIfUserExist() outputDebugString("Check if in checkIfUserExist Function - OK") local theAccount = getPlayerAccount(source) local account = getAccountName(theAccount) local query = dbQuery(connect, "SELECT account FROM Player WHERE account = ?", account) local result = dbPoll(query, -1) local compare = result[1] if compare then local compAccount = compare.account outputDebugString(compAccount) if compAccount == account then return 1 -- User already exist in DB else return 0 -- User doesn't exist in DB end else return 0 end end
-
Why did u just copied the code ? Without edit 0.o
MTASA wiki - offline copies / online mirrors
in Site/Forum/Discord/Mantis/Wiki related
Posted
Thank you CiBeR. Usefull link.