addCommandHandler ( "bm",
function( thePlayer, command, ... )
local mapName = #{...}>0 and table.concat({...},' ') or nil
if mapbought == false then
local cash = tonumber( getElementData( thePlayer, "Cash" ) )
if cash >= mapcost then
buymap = executeCommandHandler("asdasdfavaginabomb", thePlayer, mapName )
if ( buymap ) then
setElementData ( thePlayer, "Cash", cash-mapcost )
mapbought = thePlayer
end
else
outputChatBox("#ff8900[iNFO] #ffffffYou don't have enough money to set a map.", thePlayer, 255, 255, 255, true )
end
else
outputChatBox("#ff8900[iNFO] #ffffffA map has been already set. Please try again later.", thePlayer, 255, 255, 255,true )
end
end
)
addCommandHandler ( "ubm",
function ( thePlayer )
if mapbought ~= false then
if mapbought == thePlayer then
unbuy = executeCommandHandler( "asdasdfavaginabomb", thePlayer, nil )
if ( unbuy ) then
local cash = tonumber( getElementData( thePlayer, "Cash" ) )
outputChatBox("#ff8900[iNFO] #ffffff"..getPlayerName( thePlayer ).. " #ffffffhas unbought next map",getRootElement(),255,255,255,true)
mapbought = false
setElementData ( thePlayer, "Cash", cash+mapcost )
end
end
end
end
)
This is the stats system part and bellow is the racevoting_server.lua or whatever part :
addCommandHandler('asdasdfavaginabomb',
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( "#ff8900[iNFO] #ffffff"..getPlayerName( player ).." #ffffffhas bought next map.", getRootElement(), 255, 255, 255, true)
outputChatBox( "#ff8900[iNFO] #ffffffNext map : #ff8900 "..getMapName( g_ForcedNextMap ), getRootElement(), 255, 255, 255, true )
end
)