-
Posts
265 -
Joined
-
Last visited
Everything posted by Fury
-
GameServers4You, for all your gameserver needs.
Fury replied to GameServers4You's topic in Hosting solutions
i cant order any server. when will be activate order system? -
function getAliveRacePlayers() local alivePlayers = 0 for index,player in ipairs(getElementsByType("player")) do if getElementData(player,"state") == "alive" then alivePlayers = alivePlayers + 1 end end return alivePlayers end function getDeadRacePlayers() local deadPlayers = 0 for index,player in ipairs(getElementsByType("player")) do if getElementData(player,"state") == "dead" then deadPlayers = deadPlayers + 1 end end return deadPlayers end function loadPlayerData ( player, datatype ) if ( not player or not isElement( player ) ) then return false end local playerIP = getPlayerSerial ( player ) if ( playerIP ) then local root = xmlLoadFile ("users.xml") if ( root ) then local usersNode = xmlFindChild ( root, "user", 0 ) if ( usersNode ) then local playerRootNode = xmlFindChild ( usersNode, "SERIAL_" .. getPlayerSerial(player), 0 ) if not ( playerRootNode == false ) then local playerData = xmlNodeGetAttribute ( playerRootNode, datatype ) if ( playerData ) then xmlUnloadFile ( root ) return playerData else xmlNodeSetAttribute ( playerRootNode, datatype, 0 ) xmlSaveFile ( root ) xmlUnloadFile ( root ) return 0 end else local playerRootNode = xmlCreateChild ( usersNode, "SERIAL_" .. getPlayerSerial(player) ) xmlNodeSetAttribute ( playerRootNode, datatype, 0 ) xmlSaveFile ( root ) xmlUnloadFile ( root ) return 0 end end end end end function savePlayerData ( player, datatype, newvalue ) if ( not player or not isElement( player ) ) then return false end local playerIP = getPlayerSerial (player) if ( playerIP ) then local root = xmlLoadFile ("users.xml") if ( root ) then local usersNode = xmlFindChild ( root, "user", 0 ) if ( usersNode ) then local playerRootNode = xmlFindChild ( usersNode, "SERIAL_" .. getPlayerSerial(player), 0 ) if not ( playerRootNode == false ) then local newNodeValue = xmlNodeSetAttribute ( playerRootNode, datatype, newvalue ) xmlSaveFile ( root ) xmlUnloadFile ( root ) return newNodeValue else local playerRootNode = xmlCreateChild ( usersNode, "SERIAL_" .. getPlayerSerial(player) ) local newNodeValue = xmlNodeSetAttribute ( playerRootNode, datatype, newvalue ) xmlSaveFile ( root ) xmlUnloadFile ( root ) return newNodeValue end end end end end addEvent("onPlayerDestructionDerbyWin",true) addEventHandler("onPlayerDestructionDerbyWin",getRootElement(), function (winnar) if ( getPlayerCount() >= 2 )then local dPlayers = getDeadRacePlayers() local aPlayers = getAliveRacePlayers() local cashToWin = 1 local playerCash = tonumber( loadPlayerData( winnar, "wins" ) ) savePlayerData( winnar, "wins", playerCash + cashToWin ) local pointsToWin = math.floor(100*(dPlayers + aPlayers)) local playerPoints = tonumber ( loadPlayerData( winnar, "points" ) ) savePlayerData( winnar, "points", playerPoints + pointsToWin ) outputChatBox ( "#c0c0c0* #abcdef"..string.gsub(getPlayerName (winnar),"#%x%x%x%x%x%x","").." #c0c0c0has win this round and gets 30 points!", root, 255, 255, 255, true ) else outputChatBox( "#c0c0c0* Not enough players to earn point - #ABCDEF2 players #c0c0c0required.", winnar, 255, 255, 255, true ) scoreboardRefresh ( winnar ) refreshStats ( winnar ) progressBarUpdate ( winnar ) totalMoneyAchievements ( winnar ) end end ) what is wrong with this code? its not working and dont give any error.
-
server side: exports.scoreboard:addScoreboardColumn('country') countryNames = { ['AD'] = 'Andorra', ['AE'] = 'United Arab Emirates', ['AF'] = 'Afghanistan', ['AG'] = 'Antigua and Barbuda', ['AI'] = 'Anguilla', ['AL'] = 'Albania', ['AM'] = 'Armenia', ['AO'] = 'Angola', ['AP'] = 'ARIPO', ['AR'] = 'Argentina', ['AT'] = 'Austria', ['AU'] = 'Australia', ['AW'] = 'Aruba', ['AZ'] = 'Azerbaijan', ['BA'] = 'Bosnia and Herzegovina', ['BB'] = 'Barbados', ['BD'] = 'Bangladesh', ['BE'] = 'Belgium', ['BF'] = 'Burkina Faso', ['BG'] = 'Bulgaria', ['BH'] = 'Bahrain', ['BI'] = 'Burundi', ['BJ'] = 'Benin', ['BM'] = 'Bermuda', ['BN'] = 'Brunei Darussalam', ['BO'] = 'Bolivia', ['BQ'] = 'Bonaire', ['BR'] = 'Brazil', ['BS'] = 'Bahamas', ['BT'] = 'Bhutan', ['BV'] = 'Bouvet Island', ['BW'] = 'Botswana', ['BY'] = 'Belarus', ['BZ'] = 'Belize', ['CA'] = 'Canada', ['CD'] = 'Congo', ['CF'] = 'Central African Republic', ['CG'] = 'Congo', ['CH'] = 'Switzerland', ['CI'] = 'Cote d?Ivoire', ['CK'] = 'Cook Islands', ['CL'] = 'Chile', ['CM'] = 'Cameroon', ['CN'] = 'China', ['CO'] = 'Colombia', ['CR'] = 'Costa Rica', ['CU'] = 'Cuba', ['CV'] = 'Cape Verde', ['CW'] = 'Curacao', ['CY'] = 'Cyprus', ['CZ'] = 'Czech Republic', ['DE'] = 'Germany', ['DJ'] = 'Djibouti', ['DK'] = 'Denmark', ['DM'] = 'Dominica', ['DO'] = 'Dominican Republic', ['DZ'] = 'Algeria', ['EC'] = 'Ecuador', ['EE'] = 'Estonia', ['EG'] = 'Egypt', ['EH'] = 'Western Sahara', ['ER'] = 'Eritrea', ['ES'] = 'Spain', ['ET'] = 'Ethiopia', ['FI'] = 'Finland', ['FJ'] = 'Fiji', ['FK'] = 'Malvinas', ['FO'] = 'Faroe Islands', ['FR'] = 'France', ['GA'] = 'Gabon', ['GB'] = 'United Kingdom', ['GD'] = 'Grenada', ['GE'] = 'Georgia', ['GG'] = 'Guernsey', ['GH'] = 'Ghana', ['GI'] = 'Gibraltar', ['GL'] = 'Greenland', ['GM'] = 'Gambia', ['GN'] = 'Guinea', ['GQ'] = 'Equatorial Guinea', ['GR'] = 'Greece', ['GT'] = 'Guatemala', ['GW'] = 'Guinea-Bissau', ['GY'] = 'Guyana', ['HN'] = 'Honduras', ['HR'] = 'Croatia', ['HT'] = 'Haiti', ['HU'] = 'Hungary', ['ID'] = 'Indonesia', ['IE'] = 'Ireland', ['IL'] = 'Israel', ['IM'] = 'Isle of Man', ['IN'] = 'India', ['IQ'] = 'Iraq', ['IR'] = 'Iran', ['IS'] = 'Iceland', ['IT'] = 'Italy', ['JE'] = 'Jersey', ['JM'] = 'Jamaica', ['JO'] = 'Jordan', ['JP'] = 'Japan', ['KE'] = 'Kenya', ['KG'] = 'Kyrgyzstan', ['KH'] = 'Cambodia', ['KI'] = 'Kiribati', ['KM'] = 'Comoros', ['KN'] = 'Saint Kitts and Nevis', ['KP'] = 'Korea', ['KR'] = 'Korea', ['KW'] = 'Kuwait', ['KY'] = 'Cayman Islands', ['KZ'] = 'Kazakhstan', ['LA'] = 'Lao People?s Republic', ['LB'] = 'Lebanon', ['LC'] = 'Saint Lucia', ['LI'] = 'Liechtenstein', ['LK'] = 'Sri Lanka', ['LR'] = 'Liberia', ['LS'] = 'Lesotho', ['LT'] = 'Lithuania', ['LU'] = 'Luxembourg', ['LV'] = 'Latvia', ['LY'] = 'Libyan Arab Jamahiriya', ['MA'] = 'Morocco', ['MC'] = 'Monaco', ['MD'] = 'Moldova', ['ME'] = 'Montenegro', ['MG'] = 'Madagascar', ['MK'] = 'Macedonia', ['ML'] = 'Mali', ['MM'] = 'Myanmar', ['MN'] = 'Mongolia', ['MO'] = 'Macao', ['MP'] = 'Northern Mariana Islands', ['MR'] = 'Mauritania', ['MS'] = 'Montserrat', ['MT'] = 'Malta', ['MU'] = 'Mauritius', ['MV'] = 'Maldives', ['MW'] = 'Malawi', ['MX'] = 'Mexico', ['MY'] = 'Malaysia', ['MZ'] = 'Mozambique', ['NA'] = 'Namibia', ['NE'] = 'Niger', ['NG'] = 'Nigeria', ['NI'] = 'Nicaragua', ['NL'] = 'Netherlands', ['NO'] = 'Norway', ['NP'] = 'Nepal', ['NR'] = 'Nauru', ['NZ'] = 'New Zealand', ['OM'] = 'Oman', ['PA'] = 'Panama', ['PE'] = 'Peru', ['PG'] = 'Papua New Guinea', ['PH'] = 'Philippines', ['PK'] = 'Pakistan', ['PL'] = 'Poland', ['PT'] = 'Portugal', ['PW'] = 'Palau', ['PY'] = 'Paraguay', ['QA'] = 'Qatar', ['RO'] = 'Romania', ['RS'] = 'Serbia', ['RU'] = 'Russian Federation', ['RW'] = 'Rwanda', ['SA'] = 'Saudi Arabia', ['SB'] = 'Solomon Islands', ['SC'] = 'Seychelles', ['SD'] = 'Sudan', ['SE'] = 'Sweden', ['SG'] = 'Singapore', ['SH'] = 'Saint Helena', ['SI'] = 'Slovenia', ['SK'] = 'Slovakia', ['SL'] = 'Sierra Leone', ['SM'] = 'San Marino', ['SN'] = 'Senegal', ['SO'] = 'Somalia', ['SR'] = 'Suriname', ['ST'] = 'Sao Tome and Principe', ['SV'] = 'Salvador', ['SX'] = 'Sint Maarten (Dutch part)', ['SY'] = 'Syrian Arab Republic', ['SZ'] = 'Swaziland', ['TC'] = 'Turks and Caicos Islands', ['TD'] = 'Chad', ['TG'] = 'Togo', ['TH'] = 'Thailand', ['TJ'] = 'Tajikistan', ['TL'] = 'Timor?Leste', ['TM'] = 'Turkmenistan', ['TN'] = 'Tunisia', ['TO'] = 'Tonga', ['TR'] = 'Turkey', ['TT'] = 'Trinidad and Tobago', ['TV'] = 'Tuvalu', ['TW'] = 'Taiwan', ['TZ'] = 'Tanzania', ['UA'] = 'Ukraine', ['UG'] = 'Uganda', ['US'] = 'United States of America', ['UY'] = 'Uruguay', ['UZ'] = 'Uzbekistan', ['VA'] = 'Holy See', ['VC'] = 'Saint Vincent', ['VE'] = 'Venezuela', ['VG'] = 'Virgin Islands', ['VN'] = 'Viet Nam', ['VU'] = 'Vanuatu', ['WS'] = 'Samoa', ['YE'] = 'Yemen', ['ZA'] = 'South Africa', ['ZZ'] = 'n/a', ['ZM'] = 'Zambia', } function showHome () local countryCode = exports["admin"]:getPlayerCountry(source) setElementData(source,"country",countryNames[countryCode]) triggerClientEvent ( "onJoin", getRootElement(), ".. tostring(countryNames[countryCode]) .." ) end addEventHandler("onPlayerJoin",getRootElement(),showHome) client side: function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font ) ax = ax + w color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then cap = str:sub( last ) local w = dxGetTextWidth( cap, scale, font ) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font, left, top, clip, wordbreak, postGUI ) end end local messageJoin = "" x,y = guiGetScreenSize() function renderPlayerJoined ( ) dxDrawColorText("#c0c0c0".. messageJoin,20,y/2-20,574.0,20.0,tocolor(200,0,0,255),1,"default-bold","left","top",false,false,false) end function greetingHandler ( ulke ) messageJoin = "#abcdef"..getPlayerName(source) .. " #c0c0c0has Joined the server from #abcdef" ..ulke.. "#c0c0c0." addEventHandler ( "onClientRender", root, renderPlayerJoined ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerJoined ) end ,6000,1 ) end addEvent( "onGJoin", true ) addEventHandler( "onJoin", root, greetingHandler ) addEventHandler('onClientPlayerJoin', root, greetingHandler ) what is wrong?
-
what the hell are you talking about? be more clever show us your script...
-
http://www.lua.org/manual/5.1/manual.ht ... table.sort also 50p's post:
-
you can use table.sort for the list.
-
you mean that? function ANANZAA() local playerCash = tonumber( loadPlayerData ( source, "cash" ) ) setElementData ( source, "cash", playerCash ) local playerPoint = tonumber( loadPlayerData ( source, "points" ) ) setElementData ( source, "points", playerPoint ) end addEventHandler ( "onPlayerJoin", getRootElement(), ANANZAA) addEventHandler ( "onPlayerWasted", getRootElement(), ANANZAA) call(getResourceFromName("scoreboard"), "addScoreboardColumn", "cash") call(getResourceFromName("scoreboard"), "addScoreboardColumn", "points")
-
-- Database connection info sqlHostname = "***" sqlUsername = "***" sqlPassword = "***" sqlDefaultDatabase = "***" sqlDefaultTable = "userdata" -- Connect to the database function mySQLConnect() sqlConnection = mysql_connect(sqlHostname,sqlUsername,sqlPassword,sqlDefaultDatabase) end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),mySQLConnect) -- Make a new entry to the mySQL database function checkSqlData(source) if (sqlConnection == nil) then mySQLConnect() end local player = source local serial = getPlayerSerial(player) local entryCheck = sqlConnection:query("SELECT serial FROM "..sqlDefaultTable.." WHERE serial='"..serial.."'") if (entryCheck) then local result = mysql_result(entryCheck,1,1) if (result == "") or (result == nil) then outputDebugString("New entry added to the mySQL database!") sqlConnection:query("INSERT INTO "..sqlDefaultTable.." (serial) VALUES ('"..serial.."')") sqlConnection:query("UPDATE "..sqlDefaultTable.." SET playerName='"..string.gsub(getPlayerName(player),"#%x%x%x%x%x%x", "").."' WHERE serial='"..serial.."'") end else outputDebugString("New entry added to the mySQL database!") sqlConnection:query("INSERT INTO "..sqlDefaultTable.." (serial) VALUES ('"..serial.."')") sqlConnection:query("UPDATE "..sqlDefaultTable.." SET playerName='"..string.gsub(getPlayerName(player),"#%x%x%x%x%x%x", "").."' WHERE serial='"..serial.."'") end end addEventHandler("onPlayerJoin",getRootElement(),checkSqlData) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() for i,player in ipairs (getElementsByType("player")) do checkSqlData(player) end end) -- Load data from the database function loadPlayerData (player,datatype) if (sqlConnection == nil) then restartResource(getThisResource()) end if (player) and (datatype) then local serial = getPlayerSerial(player) local findQuery = sqlConnection:query("SELECT "..datatype.." FROM "..sqlDefaultTable.." WHERE serial='"..serial.."'") if (findQuery) then local result = mysql_result(findQuery,1,1) if not (result == nil) then if not (result == "") then mysql_free_result(findQuery) return result else mysql_free_result(findQuery) return 0 end else return 0 end else outputDebugString("Failed to get "..datatype.." for player "..getPlayerName(player).." @ findQuery") outputDebugString("mysql_query failed: (" .. mysql_errno(sqlConnection) .. ") " .. mysql_error(sqlConnection)) end end end -- Save data to the database function savePlayerData (player,datatype,newvalue) if (sqlConnection == nil) then restartResource(getThisResource()) end if (player) and (datatype) and (newvalue) then local serial = getPlayerSerial(player) local saveData = sqlConnection:query("UPDATE "..sqlDefaultTable.." SET "..datatype.."='"..newvalue.."' WHERE serial='"..serial.."'") if (saveData == nil) then outputDebugString("Error executing the save query: (" .. mysql_errno(sqlConnection) .. ") " .. mysql_error(sqlConnection)) end end end what is wrong with this? code by: NeXtReMe
-
i just need to convert this two function and make mysql connect. i wont give you 10$ for that. maybe 4-5$.
-
well thats a another option too. but i dont know anything about mysql. if somebody can make it...
-
lol you will just convert two function; function loadPlayerData ( player, datatype ) if ( not player or not isElement( player ) ) then return false end local playerIP = getPlayerSerial ( player ) if ( playerIP ) then local root = xmlLoadFile ("users.xml") if ( root ) then local usersNode = xmlFindChild ( root, "user", 0 ) if ( usersNode ) then local playerRootNode = xmlFindChild ( usersNode, "SERIAL_" .. getPlayerSerial(player), 0 ) if not ( playerRootNode == false ) then local playerData = xmlNodeGetAttribute ( playerRootNode, datatype ) if ( playerData ) then xmlUnloadFile ( root ) return playerData else xmlNodeSetAttribute ( playerRootNode, datatype, 0 ) xmlSaveFile ( root ) xmlUnloadFile ( root ) return 0 end else local playerRootNode = xmlCreateChild ( usersNode, "SERIAL_" .. getPlayerSerial(player) ) xmlNodeSetAttribute ( playerRootNode, datatype, 0 ) xmlSaveFile ( root ) xmlUnloadFile ( root ) return 0 end end end end end function savePlayerData ( player, datatype, newvalue ) if ( not player or not isElement( player ) ) then return false end local playerIP = getPlayerSerial (player) if ( playerIP ) then local root = xmlLoadFile ("users.xml") if ( root ) then local usersNode = xmlFindChild ( root, "user", 0 ) if ( usersNode ) then local playerRootNode = xmlFindChild ( usersNode, "SERIAL_" .. getPlayerSerial(player), 0 ) if not ( playerRootNode == false ) then local newNodeValue = xmlNodeSetAttribute ( playerRootNode, datatype, newvalue ) xmlSaveFile ( root ) xmlUnloadFile ( root ) return newNodeValue else local playerRootNode = xmlCreateChild ( usersNode, "SERIAL_" .. getPlayerSerial(player) ) local newNodeValue = xmlNodeSetAttribute ( playerRootNode, datatype, newvalue ) xmlSaveFile ( root ) xmlUnloadFile ( root ) return newNodeValue end end end end end 10$ is too much for it!
-
hello guys, i have made xml stats system. i need to convert it to mysql, i dont know it. so i need to convert it to mysql. who can make it for me for fair price?
-
+ must be a "uncompiled" for edit the text position ps: good job
-
im using 51 on my server, i dont have any fps lag. i think 51 is enough.
-
maybe its about your server's fps limit. you can change it on mtaserver.conf. find <fpslimit>36</fpslimit> and change it to <fpslimit>51</fpslimit>
-
you can disable clouds at race settings.