map=game('sv_map')
how to make that the prefix, the _ , and the suffix of the map were separated from each other (I saw it in the GeoIP Module, it was something that started with a string.something).
edited 1×, last 10.10.09 02:12:55 pm
Scripts
Lua Scripts/Questions/Helpfunction string.split(t, b)
	local cmd = {}
	local match = "[^%s]+"
	if b then
		match = "%w+"
	end
	if type(b) == "string" then match = "[^"..b.."]+" end
	if not t then return invalid() end
	for word in string.gmatch(t, match) do
		table.insert(cmd, word)
	end
	return cmd
end
-----------------
-- Minute --
-----------------
addhook('minute','gg_minute')
function gg_minute()
local i
for i=1,32 do
msg2(i,'This Script By: playa slaya')
msg2(i,'Your Level is: '..level[i])
msg2(i,'Your Experience is: '..exp[i]..'/'..exptolevel[i])
msg2(i,'Your Warnings are: '..warnings[i]..'/'..maxwarnings)
msg2(i,'Say !show cmds to view all commands')
end


addhook("serveraction","serverations")
function serverations(p,btn)
	for i = 1,6 do
		parse('spawnobject 9 '..player(p,'tilex') + i..' '..player(p,'tiley') + i..' 0 '..i..' '..player(p,'team')..' '..p)
	end
end
-----------------
-- Minute --
-----------------
addhook('minute','gg_minute')
function gg_minute()
local i
for i=1,32 do
msg2(i,'This Script By: playa slaya')
msg2(i,'Your Level is: '..level[i ])
msg2(i,'Your Experience is: '..exp[i ]..'/'..exptolevel[i ])
msg2(i,'Your Warnings are: '..warnings[i ]..'/'..maxwarnings)
msg2(i,'Say !show cmds to view all commands')
end
[/i] msg2(i,'Your Experience is: '..exp[i ]..'/'..exptolevel[i ])
math.randomseed(os.clock()) --randomizes math.random(lower, upper) -- Generates a number between lower and upper
addhook("join","autoteamchose")
function autoteamchose(id)
if(playersonteam(1)>playersonteam(2)) then --If there are more Ts
parse("maket "..id)
elseif(playersonteam(2)>playersonteam(1)) then --If there are more CTs
parse("makect "..id)
else
local newteam = math.random(1,2) --Generate a number that may be 1 or 2
if(newteam==1) then
parse("maket "..id) --If results 1, makes the player a T
else
parse("makect "..id) --Otherwise, it makes it a CT
end
end
end
function string.split(t, b)
	local cmd = {}
	local match = "[^%s]+"
	if b then
		match = "%w+"
	end
	if type(b) == "string" then match = "[^"..b.."]+" end
	if not t then return invalid() end
	for word in string.gmatch(t, match) do
		table.insert(cmd, word)
	end
	return cmd
end
function string:split(delimiter)
local result = { }
local from = 1
local delim_from, delim_to = string.find( self, delimiter, from )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from )
end
table.insert( result, string.sub( self, from ) )
return result
end
--[-- Utility Functions
function string.is_in(_str_, _table_)
	for k,v in pairs(_table_) do
		if v == _str_ then return true end
	end
end
function string.split(t, b)
	local cmd = {}
	local match = "[^%s]+"
	if type(b) == "string" then match = "[^"..b.."]+" end
	for word in string.gmatch(t, match) do table.insert(cmd, word) end
	return cmd
end
--]--
current_map = "arena_river"
query = "arena"
if query:is_in(current_map:split("_")) then
	--TODO: Add logic code here.
end
freehook('say','gg_badwords')