SuleymanM Posted March 9, 2013 Share Posted March 9, 2013 Hi, I add to my server this resource and i following steps: 1)Add this zip file or folder in /server/mods/deathmatch/resources2)Give admin rights to this resource 3)Find the race foloder in your resources: /resources/[gamemodes]/[race]/race Find there racevoting_server.lua and add there this code: addCommandHandler ( 'bm', function ( player, command, ... ) local query = #{...} > 0 and table.concat ( {...}, ' ' ) or nil if not query then if g_ForcedNextMap then outputDebugString ( 'Next map is ' .. getMapName ( g_ForcedNextMap ) ); else outputDebugString ( 'Next map is not set' ); end return end local map, errormsg = findMap ( query ); if not map then outputRace ( errormsg, player ); return end local account = getPlayerAccount ( player ); if ( isGuestAccount ( account ) == false ) then g_ForcedNextMap = map; outputChatBox ( '* ' .. getPlayerName ( player ) .. ' #ffffffhas bought as next map - #ABCDEF' .. getMapName ( g_ForcedNextMap ), g_Root, 0, 240, 0, true ); takePlayerMoney ( player, 5000 ); if account then setAccountData ( account, "money", tostring ( getPlayerMoney ( player ) ) ); end else outputChatBox ( '* Please #abcdefLogin #ffffffor #abcdefRegister!', player, 255, 255, 255, true ); end end ) 4)FOR TOPTIMES Find the race_toptimes foloder in your resources: /resources/[gamemodes]/[race]/[addons]/race_toptimes There toptimes_server.lua and add this code: function updateTextForPanel ( gMode, mapName ) local tName = getModeAndMap ( gMode, mapName ); local tSql = executeSQLQuery ( 'SELECT playerName AS pName, timeText AS txTTime FROM ' .. qsafetablename ( tName ) ); if not tSql or #tSql == 0 then return false end if type ( tSql ) == 'table' and #tSql > 0 then if tSql[1] then t1Nick = tSql[1].pName t1Time = tSql[1].txTTime else t1Nick = false t1Time = false end if tSql[2] then t2Nick = tSql[2].pName t2Time = tSql[2].txTTime else t2Nick = false t2Time = false end if tSql[3] then t3Nick = tSql[3].pName t3Time = tSql[3].txTTime else t3Nick = false t3Time = false end return { nick1 = t1Nick, time1 = t1Time, nick2 = t2Nick, time2 = t2Time, nick3 = t3Nick, time3 = t3Time }; end end function getModeAndMap ( gMode, mapName ) return 'race maptimes ' .. gMode .. ' ' .. mapName end 5)Write /start mapratings Its one problem when start server ... in racevoting_server: ERROR: :[gamemodes]/.....race_server.lua:227: attempt to call global "getMapInfo" (a nil value) Maybe Problem is racevoting_server ?: racevoting_server: LuaQ € A@ ¤ € ‡€ ¤@ ‡À ¤€ ‡ …@ Á€ œ@€…À Á œ@ …@ Á € dÁ œ@ ¤ ‡À ¤@ ‡ ¤€ ‡@ ƒ äÀ Ç€ ÅÀ Á Ü@ Å@ Á E \€ ¤ Ü@ ä@ Ç ÅÀ A Ü@ Å@ A E \€ ¤ Ü@ äÀ Ç€ ÅÀ Á Ü@ Å@ Á E \€ ¤ Ü@ Å@ dA Ü@€Å@ A d Ü@€äÀ Ç€ Å@ Á d Ü@€Å@ E \€ ¤A Ü@ ä€ Ç@ äÀ Ç€ à €$ Á $A $ A $Á € $ Á $A $ A $Á $ €Á $A A AA ¤ A€A A ¤Á A€$ Á $A $ A € * displayHilariarseMessage displayKillerPunchLine startMidMapVoteForRandomMap addCommandHandler new addEvent midMapVoteResult addEventHandler getRootElement startRandomMap outputRace problemChangingMap startNextMapVote onPollModified chooseRandomMap nextMapVoteResult startMidMapVoteForRestartMap midMapRestartVoteResult redo random maybeApplyForcedNextMap forcevote onResourceStart # getRandomMapCompatibleWithGamemode countSpawnPointsInMap getMapLastTimePlayed setMapLastTimePlayed getMapSpawnPointCount getMapInfo sqlString sqlInt getTableName ensureTableExists loadMapInfoAll saveMapInfoItem checkmap nextmap findMap findMaps getMapName # ( 3 @ € €A H €E@ € \€ Ä À€ €Ä € Ì€ÀÈ € Ä € ÀÀÀ €À € • €Ä € @Á €Á€ € AÁ •@ €Ä € ÀÀÀ €À € • @€À € A • @€Á€ È € H À € Á • Å Ü@ € getPlayerName ð? @# started a vote. Hardly a suprise. $@ Guess what! started ANOTHER vote! started another vote. % continues to abuse the vote system. started a vote. outputRace 0 4 D W À €E@ € Ä •À \@ € outputRace Offical news: Everybody hates = Z ? E \€€ Z €E@ K€À \€ ÀÀ À€ €E @ Å€ Ü€ Á • À \@€ € E € \@ E@ F€Â KÀ \@ E@ F€Â K à ÊÀ É€Ã†É Ä‡É€ÄˆÉ Å‰ € É Š A A Š܀ € "A É ‹ A AÁ A Š܀ EŽ"A É \€€Z € €…@ Á€ œ@ € stateAllowsRandomMapVote g_CurrentRaceMode getTimeRemaining LÝ@ outputRace % I'm afraid I can't let you do that, getPlayerName . displayHilariarseMessage exports votemanager stopPoll startPoll title ' Do you want to change to a random map? percentage €I@ timeout .@ allowchange visibleTo getRootElement ð? Yes midMapVoteResult @ No default gotoState MidMapVote e o E \€€ Z @€E@ € \@ € €EÀ \@€ @ €E \@€ € stateAllowsRandomMapVoteResult gotoState Running startRandomMap displayKillerPunchLine y Š & €€ € € @ E€ \€€ À Å Æ@ÁÚ € €Á€ Ú@ @ €ÅÀ Ü€€ € € E@ F€Â KÀ À B€ \€€Z@ @€E \@€ € €E@ € \@ € maybeApplyForcedNextMap # getRandomMapCompatibleWithGamemode getThisResource $@ g_GameOptions ghostmode getTotalPlayerCount g_IgnoreSpawnCountProblems exports mapmanager changeGamemodeMap problemChangingMap outputWarning startRandomMap failed ’ * Z@ €E …@ Å€ ÆÀÀ AA Ü œ E €€ \ ÀÁÀ €E € \A €EA @ € €E € \A E €€ \ €Â€ €AÁ € €E € À€ @€€ \A € g_Root getColorFromString string upper get color getElementType console outputServerLog rootElement player [PM] outputChatBox ¨ ³ A@ @ € À@ A € E@ F€Á À Á \€€K@ ä ÁBA A €A \@€ € outputRace $ Changing to random map in 5 seconds exports mapmanager getRunningGamemodeMap TimerManager createTimerFor resource mapproblem setTimer math random ”±@ |µ@ ð? ¬ ± E F@À K€À \€ @ @ €À @€ € exports mapmanager getRunningGamemodeMap startRandomMap Æ ˆ @@ €@ @ À €€ € € A @A …€ œ € € T @€ƒ@€E F@ …€ œ € \@ EÀ F à € Å Æ@à T Ü €\@ T ÀÁ Àü€€T Àà À €B … †@D^ €E€ € \ €… †ACÁ œ€Æ ‚ Àa€ ýJ@ I ʼn…€ œ€€ I€€ŠI Æ‹I€ÆŒI Ç…€ À œ À€ÅA A‚ Ü€ÚA € €ÅÁ Ü Â H@€ Š À€C Eƒ \ƒ€ € ¢B B€¡€ @ú… † A‹€Hœ€ š €€ÅÀ Æ È € J Á ÁA ‚ ‚€ @ bA Ü@€H Å A E €€ Ü@ D à €È Å Æ@ÀËÀÉ@€ Ü€€Ú € AA A AÁ … œ€ Å A Þ € - exports votemanager stopPoll maybeApplyForcedNextMap mapmanager getMapsCompatibleWithGamemode getThisResource @ math randomseed getTickCount table remove random ð? @ errorCode onlyOneCompatibleMap ipairs title Choose the next map: visibleTo getRootElement percentage €I@ timeout .@ allowchange getResourceInfo name getResourceName insert nextMapVoteResult getRunningGamemodeMap Play again triggerEvent onPollStarting g_Root startPoll gotoState NextMapVote addEventHandler onPollEnd chooseRandomMap € @ À€E \@€ E@ F€À …À œ € \@ E F@Á K€Á ÁÀ \@€E @ Å€ Ü€€ Á \@ € cancelEvent math randomseed getTickCount exports votemanager finishPoll ð? removeEventHandler onPollEnd getRootElement chooseRandomMap $ E \€€ Z €€E@ F€À KÀÀ À B€ \€€Z@ @ €E \@€ € stateAllowsNextMapVoteResult exports mapmanager changeGamemodeMap problemChangingMap - J : E \€€ Z@ À€ €E@ € ÅÀ Ü€ • À \@€ € E@ € \@ E€ FÀÁ K  \@ E€ FÀÁ K@ ÊÀ ÉÀB…É@C†ÉÀC‡É@DˆÁ € É ‰ AA ÅÁ Ü€ € "A É Š A A ÅÁ Ü€ AÄŒ"A É ‹\€€Z € €…€ ÁÀ œ@ € stateAllowsRestartMapVote outputRace % I'm afraid I can't let you do that, getPlayerName . displayHilariarseMessage exports votemanager stopPoll startPoll title ( Do you want to restart the current map? percentage €I@ timeout .@ allowchange visibleTo getRootElement ð? Yes midMapRestartVoteResult @ No default gotoState MidMapVote T ` E \€€ Z @€E@ € \@ €€EÀ F Á K@Á ÅÀ Æ ÁË€ÁÜ€ B€ \€€Z@ €EÀ \@€ @ €E \@€ € stateAllowsRandomMapVoteResult gotoState Running exports mapmanager changeGamemodeMap getRunningGamemodeMap problemChangingMap displayKillerPunchLine d r . Å EA FÀÜ€€Ú @€ÅÀ Æ ÁË@ÁÜ€ Ú €€ AÁ … À œ U…A Á  A‚ A Á AC€€Ã€€ €A À€A A€ € AÁ € A€À €Å€ @ Ü@€ € isPlayerInACLGroup g_GameOptions admingroup exports mapmanager getRunningGamemodeMap outputChatBox Map restarted by getPlayerName g_Root n@ changeGamemodeMap problemChangingMap outputRace 4 You can't restart the map because no map is running You are not an Admin w 4 Å EA FÀÜ€€Ú À €ÅÀ Ü€€ Ú €Å Ë@ÁÜ€ €Á €ÅÀ @ Ü@€@€Ê A A Á Á B A‚  Á â@ A A …Á †EÁA €œ€†Á  @ ‚ U‚… ÁA ‚ AB A Á A€ € isPlayerInACLGroup g_GameOptions admingroup stateAllowsRandomMapVote g_CurrentRaceMode getTimeRemaining @@ outputRace G Random command only works during a race and when no polls are running. curtailed cut short terminated given the heave ho dropkicked expunged put out of our misery got rid of outputChatBox Current map math random ð? by getPlayerName g_Root n@ startRandomMap Š » € €€ C € G @ E€ …À œ€€ Á A A € €Á A @ € € \€ G@ Z €G@ …€ ÁÀ € EA €€ \ œ@ …€ †ÀC‹ D C€‚€ œ€€š@ €…@ Á€ œ@ ‚ ž ‚ € ž €@ @€@ C € G@ @ E€ …À œ€€ Á A A € €Á A @ € € \€ G@ Z €G@ …€ ÁÀ € EA €€ \ œ@ …€ †ÀC‹ D C€‚€ œ€€š@ €…@ Á€ œ@ ‚ ž ‚ € ž € EÀ \€€ Å@ Æ€ÁÚ € €ÁÀ Ú@ @ €Å Ü€€ € @ €@ E€ À Š܀€ A @ \@ B ^ € g_ForcedNextMap2 g_IgnoreSpawnCountProblems # getRandomMapCompatibleWithGamemode getThisResource $@ g_GameOptions ghostmode getTotalPlayerCount g_ForcedNextMap triggerClientEvent setNextMap getRootElement getMapName exports mapmanager changeGamemodeMap outputWarning Forced next map failed Å Ê Å Ú@ À€Å@ E FÁÀÜ€€Ú@ € € Å Ü@€ € _TESTING isPlayerInACLGroup g_GameOptions admingroup startNextMapVote × Û E F@À K€À À \€€Z € €EÀ € \@ € exports mapmanager isMap setMapLastTimePlayed Þ % Æ Å Æ@ÀË€À@ Ü€€€À@@€ AA A€ EÁ €€\ €Š †‰B„†Å‚ €Ü‚ ‰Â‚„a ýEÁ FÀ ä \A€T …A †CÔ ÎA€ÏÁÃœ M… ÁA ‚ œA€… ÁA  A …B À œ‚ Á‚ C T ƒ Aà …C À€œƒ Á D T MDL„Á„ œA€…A †AFŠ܀ ÐÁÆœA ƒ Ô À@€ÅA ÆÇ €T Ü€ÂBš €EB € \‚ @€€E B Á ƒ EC …à À œ \ƒ ÅC D @ ܃ D ED …„ œ„€ Å„ Ü„ Ä \„ ÕB„\B€ š À€EB € \‚ …B À œ‚ €‚ €€ E B Á à EC …à À œ \ƒ ÅC D @ ܃ D ED …„ œ„€ Å„ Ü„ Ä \„ ÕB„\B€E FÉ€ À€\B€EB FBÉ€€Ô \‚€@€€èÅ B A ‚ ÅB à @ Ü‚ EC …C À œ \ƒ à ÅC „ „€ E„ € \„ D܃ UƒÜA€ž € ( exports mapmanager getMapsCompatibleWithGamemode outputDebugString - getRandomMapCompatibleWithGamemode: No maps. ð? ipairs map lastTimePlayed getMapLastTimePlayed table sort math floor Y@ outputDebug RANDMAP # getRandomMapCompatibleWithGamemode minSpawns: tostring nummaps: cutoff: poolsize: randomseed getTickCount jè@ random getMapSpawnPointCount ++ using map: getResourceName spawns: age: getRealTimeSeconds skip: remove min ** fallback map: ageLstPlyd: ð ð † @ Æ À X€€ €‚@ ‚ € ž € lastTimePlayed ) ; < A …@ Á€ Á @ A A Õ€œ€ š @€Å€ AÁ Ü€ Ú@ €Å€ A Ü€ €À €A @€ €EÁ € \A €€EA ÅÁ Ü @ •A\ Z À€… À€ @€ œ š @ €L@à €ý…Á À€œA ^ € xmlLoadFile : getResourceName / meta.xml xmlFindChild map race xmlNodeGetAttribute src xmlUnloadFile spawnpoint ð? B E E € \€ †@À š@ €€ ž € getMapInfo lastTimePlayed G M Z@ € €… œ€€ @ …@ À œ€ ‰@ ÆÀ@Ú@ €Á Ì@Á‰À€Å€ @ Ü@€ € getRealTimeSeconds getMapInfo lastTimePlayed playedCount ð? saveMapInfoItem O V E € \€ †@À š@ À€…€ À œ€ I€€€…À À € œ@€†@À ž € getMapInfo spawnPointCount countSpawnPointsInMap saveMapInfoItem X f D Z@ @ €E \@€ D F € Z@ € €D Š I€ D F € †@À Å€ Ü€ WÀ €…€ À œ€ I€€€I Á^ € loadMapInfoAll loadTime getResourceLoadTime spawnPointCount l o E € \€ @€ €@ A€ ‹À@ AA œ€ Á€ UÀ€ ^ € tostring ' gsub ([']) '' q s E € \€ Z@ €A@ ^ € tonumber u w E @ ] ^ € sqlString race_mapmanager_maps y ƒ E@ \€€ € ÁÀ AA ÁÁ AB @ E€ € \@ € CREATE TABLE IF NOT EXISTS getTableName ( resName TEXT UNIQUE , infoName TEXT , spawnPointCount INTEGER , playedCount INTEGER , lastTimePlayedText TEXT , lastTimePlayed INTEGER ) executeSQLQuery † ’ @€ @ A€ …À œ€€ U€€ € J H E € \ À€…A ÆÁœ š €€ÅÁ Ü ÂÉ„BÂÉ‚„a€ @ü € ensureTableExists executeSQLQuery SELECT * FROM getTableName ipairs getResourceFromName resName getMapInfo playedCount lastTimePlayed • ° _ … Á@ œ@ …€ œ@€ À Š܀€ A A …Á Å Ü œ ÁA  A‚ ‚ AB …‚ Á œ‚ ÁB ƒ Aà ƒ AC …à Áƒ œƒ ÁC „ AÄ „ A •@Å Ü@ Á@ € A Á ÅÁ @ B €Ü ‚ E‚ †ÂÄ \‚ Å‚ CÅ Ü‚ ƒ Eà †ÃÅ š @€†ÃÅ €ƒ…€€… ÅC ÄÅ Ü œƒ šC €ƒ \ƒ à Ń ÄŠ܃ AD …Ä Å Ü œ„ •€„Å Ü@ Å Ü@ € executeSQLQuery BEGIN TRANSACTION ensureTableExists INSERT OR IGNORE INTO getTableName VALUES ( sqlString getResourceName , sqlInt ) UPDATE SET infoName= getResourceInfo name ,spawnPointCount= spawnPointCount ,playedCount= playedCount ,lastTimePlayedText= lastTimePlayed getRealDateTimeString getRealTime - ,lastTimePlayed= WHERE resName= END TRANSACTION » Á Ê % â@ Ô €À € €Å@ Æ€À e "A AÁ Ü€€Ú@ €Ã €Ú €€ @€Á …A À€ œA€ € table concat findMap outputRace Å ô Ì Ê % â@ Ô €À € €Å@ Æ€À e "A AÁ Ü€€Ú@ €Ã €Ú@ €€ A € €A À€ AÁ … Å ÚA €ÅA œ U€ A€À € AA € A€ € @ …Á †C€ €€A @€Á A €€… ÛA€ €ÁÁ A Á € œA€ € … W @€… šA À€…A € … ÁA E ZB €EB ‚ Õ‚ A Á € œA€ € … ÁÁ ‚€ E € \ œA … ÁA E ‚ A‚ … À œ‚ Õ‚ A Á œA À€ @ …Á †AF€ € A €A @€Á A €€… ÛA€ €ÁÁ A Á € œA€ € …A € … Á E ZB €EB ‚ Õ‚ A Á € œA€ € … ÁÁ ‚€ E € \ œA … ÁA E ‚ A‚ … À œ‚ Õ‚ A Á œA € AÁ € Á A ‚€ A€À€ A € Á A ‚€ A€ € table concat g_ForcedNextMap2 g_ForcedNextMap outputRace Next map is getMapName Next map is not set isPlayerInACLGroup g_GameOptions admingroup findMap outputChatBox n@ Next map is already set to triggerClientEvent setNextMap getRootElement Next map set to by getPlayerName g_Root admingroup2 # Next map is already set to #ffffff Next map is already set. You are not an Admin. ø D E € \€ @ Ô € T€ ÀÀ€ €A ZA €AA •@ÁÀ ÁAA ”€ €AÁ à €À À@€ €B B €‚ A … Æ‚ œ‚ Á •À‚ß@üÔ € À „@€À A T€ M •€Ô € ÀÀ€Ã € A € ÁÁ ÁÞ €Ô € ÀÀ€ €ÆÀÀ Þ €Ô € À€€ €Ã € Þ € € findMaps Found match ð? es math min @ : , ' getMapName ( more) for ' $ 1 J … †@@À AÁ œ€ … Å@ Æ€ÁËÀÁE \€ Ü œ À€ÅA Ü ‚ @ ‚ WÀ @ € À €J€ € bB€ ^ E F‹Cœ‚ ËC Ü \‚ Z €EB F‚À€ À \B€¡€ @ø^ € string gsub $ ([%*%+%?%.%(%)%[%]%{%}%%/%|%^%$%-]) %%%1 ipairs exports mapmanager getMapsCompatibleWithGamemode getThisResource getResourceName getMapName find lower table insert & ( E € Á@ \€€Z@ @€E€ € \€ Z@ €AÀ ^ € getResourceInfo name getResourceName unknown addCommandHandler ( 'bm', function ( player, command, ... ) local query = #{...} > 0 and table.concat ( {...}, ' ' ) or nil if not query then if g_ForcedNextMap then outputDebugString ( 'Next map is ' .. getMapName ( g_ForcedNextMap ) ); else outputDebugString ( 'Next map is not set' ); end return end local map, errormsg = findMap ( query ); if not map then outputRace ( errormsg, player ); return end local account = getPlayerAccount ( player ); if ( isGuestAccount ( account ) == false ) then g_ForcedNextMap = map; outputChatBox ( '* ' .. getPlayerName ( player ) .. ' #ffffffhas bought as next map - #ABCDEF' .. getMapName ( g_ForcedNextMap ), g_Root, 0, 240, 0, true ); takePlayerMoney ( player, 5000 ); if account then setAccountData ( account, "money", tostring ( getPlayerMoney ( player ) ) ); end else outputChatBox ( '* Please #abcdefLogin #ffffffor #abcdefRegister!', player, 255, 255, 255, true ); end end ) How solve ? P.S= Mapping not started Link to comment
Sex* Posted March 23, 2013 Share Posted March 23, 2013 Your racevoting script is compiled, you cant add uncompiled stuff there. 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