• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

MoveEvent FootBall , automatic. [0.3.6 + 0.4]-Updated-

Thx damadger, i go try this...
And Znote, it's a great idea!! :D

Make a Top Soccer player's x]

I was think to made a Super Onze server :S
Super onze is a japonese serie of soccer, it's fantastic *_*'

Gogogo Fubuki rs'

~~
'i dont downloaded the map, but is better if you put pz or no-pvp zone in the pitch!
Again, i dont downloaded the map :s'
 
Can you fix so you can not walk southeast, southwest, northwest or northeast?

Its so annoying players walking those directions :p For etc laptop users, its annoying having some players able to walk 3sqm. :p

What is this?
Code:
	 BLUE_SCORE = 1223,
 
	 RED_SCORE = 1224,
Shall I make red/blue goal action id 1223 and 1224?
How can I tell the script where red and blue goals are?

This is how my field looks like:
fokx6o.png


Ahh downloaded your map:

7070 = goal
7071 = goal
7072 = item removing system

2275 = lever

2330(4)-(6) team 1
2330(7)-(9) team 2
 
Last edited:
hmm, okay .. The west goal should have this actionid [7071] while east one should have [7070]

While the filed itself should the actionid [7072] --each tile in the pitch

About the walking thing, i dont have a clue about how to make that :p

And for the blue and red scores they are the globalstorages where the goals are stored

@topic

The site part will be released soon [modern/gesior] i was sleeping :)
 
When pull lever, there should be level requirements. (in case someone are pvp protected and users can ghost walk them).

Tested on a TFS 0.4 server.

They did not change outfit.
They did not get same base speed.

But there was no console errors. :S

Check out yourself: http://customera.sytes.net
 
Last edited:
I will in the update realease of site as whole mod will be different
 
Oo'
My script's not working, LOL !!

I cannot begin a game, i have 3 player of each team in sqm, I pull the lever and msg appear: 'you need 6 players to play' Oo'
I can play with 1x1, but we're teleported, and the game not runs! (global events, etc...)

:S
No errors in console '-'

~~
Znote, nice camp xD
 
Dude i donnno what you do . Others have it worked..

You need to check that team1pos (which are the pos of players when they stand to push lever are true)
 
@Znot

I will check for the outfit thing,

But for speed it should be in the action id.., when you through item on floor what happens?

Edit : aha my fault forgot to edit the new aid, as it was different befoe will fix that now :)
 
Damadger, what is it?
Unique IDS:
23305
23306
23307
23308
23309

Have this on the sqms if the player need be stay to pull the lever...
have 6 sqms and 5 unique ids :S
 
Yeah its a bug, one title it has unique ID 0

you should add unique ID 23304 to the missing title.

So we got:

team 1:
23304
23305
23306

team 2:
23307
23308
23309
 
Hmm, thanks Znote! ;*

i'm going test it

~~
Edit, Damadger, the return item script works perfect !
 
Last edited:
Edit fixed : (Please recopy mod)

1- speed [miss actionis]

2- player outfit [it supposed to be pid , not cid ]

Todo :
1- fix player speed back to normal when he finish the event ( will be fixed in 2 hours ~)

@znote

Actually there is no need to add any uid except on the filed as you said before[both goals-pitch]..Remove anyther uids or leave them as they wont differ in anything, it was like that when i copied the map from gesior i think.
 
Last edited:
Tested and aproved !! (y

I have to change this line:
<globalevent name="timer" interval="1000" event="script"><![CDATA[
for this:
<globalevent name="timer" interval="1" event="script"><![CDATA[

To check the restant time and goals...

And it works perfectly :p


You're creating the sql query for this lines (i don't know the name x] ) ?
function ScoreGoal(cid)
return db.executeQuery("UPDATE `players` SET `goals` = `goals` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end

. . .

cya!
 
Updated, fixed every thing please recopy mod,

Next update will be the site part . :)
 
What is the sql structure you are using?

You should show it in main post, I assume it won't install automatic? :p

ALTER TABLE players ADD win int(11);
ALTER TABLE players ADD losses int(11);
ALTER TABLE players ADD goals int(11);
ALTER TABLE players ADD own int(11);
?

What is own for? To get to know how many games he have participated in total?

Or goals means team goals, while own means your own goals?
 
Last edited:
It isnt done yet, but it wont harm you if you leave it there , i was still working on it when you reported the bug :)

And it will be like that :

Goals : for your own goals ( this is how the descendng will be in site)

Own : it is the goals which the players scored in his teams (own goals!)

Total : all matches he participated

Wins & loses : the match he won and lost

:)
 
Will you sort it like a highscore?

Etc the player who have played 20+ games that has highest win/loose ratio (in %)

(Player X, win 50 games, loose 30)
50 + 30 = 80 games total
50 / 80 = 0.625 = 52.5% win chance.

(Player Y, win 80 games, loose 20)
80 + 20 = 10 games total
80 / 100 = 0.8 = 80% win chance.

(Player Z, win 30 games, loose 50)
30 + 50 = 80 games total
30 / 80 = 0.375 = 37.5% win chance.

Highscore Results:
Rank 1: Player Y with 80%
Rank 2: Player X with 52.5%
Rank 3: Player Z with 37.5%

Basically, the math formula is:
Win + Loose = total
win / total = factor
factor * 100 = win %

(Don't display users who have less than 20 max games, because then ratio gets unserious)

example: 1 user play 1 game, and win, I don't want him to be 1st rank only because he have 1:0 = 100% win chance.

If you want to make it more advanced:
2 players have 40% win chance, who shall be at top?

Then its time to check the players goals that he have.
Player 1: win 40% 55 total goals
player 2: win 40% 53 total goals

Player 1 should be at top. :p
 
Last edited:
NIce idea. If i can concentrate well with these numbers i will make it. :)

Edit : after some thinking, I think can be done easily :p
 
Last edited:
When I am updating the code, I can leave my configuration part as it is, and just update the main stuff?

Like this:
Lua:
<lib name="football-lib"><![CDATA[
 
function getSpeed(cid,level)
   value = (220 +(2 *(level -1)))
  return value
end
function ScoreGoal(cid)
	return db.executeQuery("UPDATE `players` SET `goals` = `goals` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
 function ScoreOwn(cid)
    return db.executeQuery("UPDATE `players` SET `own` = `own` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
function Win(cid)
   return db.executeQuery("UPDATE `players` SET `wins` = `wins` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
function Lose(cid)
     return db.executeQuery("UPDATE `players` SET `losses` = `losses` + " .. 1 .. " WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
end
 
function getGoal(cid)
	local res = db.getResult("SELECT `goals` FROM `players` WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
	local value = 0
	if(res:getID() ~= -1) then
		value = res:getDataInt("field")
		res:free()
	end
	return value
end
 
function getOwn(cid)
	local res = db.getResult("SELECT `own` FROM `players` WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
	local value = 0
	if(res:getID() ~= -1) then
		value = res:getDataInt("own")
		res:free()
	end
	return value
end
 
function getWin(cid)
	local res = db.getResult("SELECT `wins` FROM `players` WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
	local value = 0
	if(res:getID() ~= -1) then
		value = res:getDataInt("wins")
		res:free()
	end
	return value
end
 
function getLoss(cid)
	local res = db.getResult("SELECT `losses` FROM `players` WHERE `id`= '" .. getPlayerGUID(cid) .. "' LIMIT 1;")
	local value = 0
	if(res:getID() ~= -1) then
		value = res:getDataInt("losses")
		res:free()
	end
	return value
end
 
]]></lib>
<action actionid="2275" event="script"> <![CDATA[
		domodlib('tutorial_m')
		domodlib('football-lib')
local bmale = createConditionObject(CONDITION_OUTFIT)
setConditionParam(bmale, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(bmale, {lookType = math.random(128,134), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88, lookTypeEx = 0, lookAddons = 3})
 
local bfemale = createConditionObject(CONDITION_OUTFIT)
setConditionParam(bfemale, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(bfemale, {lookType = math.random(136,142), lookHead = 88, lookBody = 88, lookLegs = 88, lookFeet = 88, lookTypeEx = 0, lookAddons = 3})
 
local rmale = createConditionObject(CONDITION_OUTFIT)
setConditionParam(rmale, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(rmale, {lookType = math.random(128,134), lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})
 
local rfemale = createConditionObject(CONDITION_OUTFIT)
setConditionParam(rfemale, CONDITION_PARAM_TICKS, -1)
addOutfitCondition(rfemale, {lookType = math.random(136,142),lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = 3})
 
 
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local n = 1
    if getGlobalStorageValue(1222) > 0 then
       doPlayerSendCancel(cid,"There is a on going match right now, please come again later.")
    return true
    end
 local players = {}
	for _, position in ipairs(c.team1pos) do
		local pid = getTopCreature(position).uid
		if(pid == 0 or not isPlayer(pid)) then
			doPlayerSendCancel(cid, "You need ".. c.players * 2 .." players to start the match.")
			return true
		end
 
		table.insert(players, pid)
 
	end
 
	for i, pid in ipairs(players) do
	    setPlayerStorageValue(pid,c.storage,n)
	     n = n+1
		doTeleportThing(pid, c.destination[getPlayerStorageValue(pid,c.storage)], false)
		doSendMagicEffect(c.destination[i], CONST_ME_ENERGYAREA)
 
	end
	for i, pid in ipairs(players) do
	    if getPlayerStorageValue(pid,c.storage) > 0 and getPlayerStorageValue(pid,c.storage) <= c.players then
		      doAddCondition(pid, ( getPlayerSex(cid) == 1 and bmale or bfemale) )
	    elseif getPlayerStorageValue(pid,c.storage) > c.players  then
			   doAddCondition(pid, ( getPlayerSex(cid) == 1 and rmale or rfemale) )
	     end
 
	end
 
    setGlobalStorageValue(1222,c.original)
 
	return item.itemid == 1945 and doTransformItem(item.uid,1946) or doTransformItem(item.uid,1945)
end
]]> </action>
<movevent type="AddItem" tileitem="1" fromaid="7070" toaid="7072" event="script"><![CDATA[
		domodlib('tutorial_m')
 
 
		function onAddItem(moveitem, tileitem, position, cid)
 
if(moveitem.itemid ~= 2109) then
	 if getItemDescriptionsById(moveitem.itemid).type == ITEM_TYPE_MAGICFIELD then
	      doRemoveItem(moveitem.uid)
	  else
	   doPlayerAddItem(cid, moveitem.itemid,1)
	   doRemoveItem(moveitem.uid)
 
  	  end
else
   if getGlobalStorageValue(1222) < 0 then
 
	     doTeleportThing(moveitem.uid,c.ballpos)
	else
	      if tileitem.actionid == 7070 then
	             if getGlobalStorageValue(1222) >= c.original/2 then -- blue goal
                      if getPlayerStorageValue(cid,c.storage) > 0 then      
	                         doTeleportThing(moveitem.uid,c.ballpos,false)
		                     addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) > c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) > c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
				             setGlobalStorageValue( c.RED_SCORE, getGlobalStorageValue(c.RED_SCORE) +1)
 
		                             for _,tid in ipairs(getPlayersOnline()) do
					                      if getPlayerStorageValue(tid,c.storage) > 0 then
		                                       doTeleportThing(tid,c.destination[getPlayerStorageValue(tid,c.storage)])
                                                    for i = 1, #c.destination do
		                                                   doSendMagicEffect(c.destination[i],10)
		                                            end
		                                  end    
		                             end
                      end
	             elseif getGlobalStorageValue(1222) < c.original/2 then -- red goal
	                  if getPlayerStorageValue(cid,c.storage) > 0 then      
	                       doTeleportThing(moveitem.uid,c.ballpos,false)
		                   addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) <= c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) <= c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
				           setGlobalStorageValue( c.BLUE_SCORE, getGlobalStorageValue(c.BLUE_SCORE) +1)
 
		                             for _,tid in ipairs(getPlayersOnline()) do
 
					                      if getPlayerStorageValue(tid,c.storage) > 0 then
		                                       doTeleportThing(tid, (getPlayerStorageValue(tid,c.storage) <= c.players and c.destination[getPlayerStorageValue(tid,c.storage)+c.players] or c.destination[getPlayerStorageValue(tid,c.storage)-c.players]))
                                                    for i = 1, #c.destination do
		                                                   doSendMagicEffect(c.destination[i],10)
		                                            end
		                                  end    
		                             end
                     end
	             end
          elseif tileitem.actionid == 7071 then	
                if getGlobalStorageValue(1222) >= c.original/ 2 then --red goal
                    if getPlayerStorageValue(cid,c.storage) > 0 then      
	                      doTeleportThing(moveitem.uid,c.ballpos,false)
		                  addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) <= c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) <= c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
				          setGlobalStorageValue( c.BLUE_SCORE, getGlobalStorageValue(c.BLUE_SCORE) +1)
 
		                            for _,tid in ipairs(getPlayersOnline()) do
					                     if getPlayerStorageValue(tid,c.storage) > 0 then
		                                      doTeleportThing(tid,c.destination[getPlayerStorageValue(tid,c.storage)])
                                                    for i = 1, #c.destination do
		                                                   doSendMagicEffect(c.destination[i],10)
		                                            end
		                                 end    
		                            end
                    end
	            elseif getGlobalStorageValue(1222) < c.original / 2 then --blue
	                if getPlayerStorageValue(cid,c.storage) > 0 then      
	                      doTeleportThing(moveitem.uid,c.ballpos,false)
		                  addEvent(doSendAnimatedText,20,c.ballpos,getPlayerStorageValue(cid,c.storage) > c.players and "Goal!" or "Own goal!",getPlayerStorageValue(cid,c.storage) > c.players and TEXTCOLOR_LIGHTBLUE or TEXTCOLOR_RED)
				          setGlobalStorageValue( c.RED_SCORE, getGlobalStorageValue(c.RED_SCORE) +1)
								for _,tid in ipairs(getPlayersOnline()) do
					                   if getPlayerStorageValue(tid,c.storage) > 0 then
		                                      doTeleportThing(tid, (getPlayerStorageValue(tid,c.storage) <= c.players and c.destination[getPlayerStorageValue(tid,c.storage)+c.players] or c.destination[getPlayerStorageValue(tid,c.storage)-c.players]))
                                                    for i = 1, #c.destination do
		                                                   doSendMagicEffect(c.destination[i],10)
		                                            end
		                               end    
		                        end
                    end
	            end	
          end
     end		  
 
end
 
return true
end
 
]]> </movevent>
 
<movevent type="StepIn" actionid="7072" event="script">
<![CDATA[
		domodlib('tutorial_m')
		function onStepIn(cid, item, position, fromPosition)
   if(getCreatureSpeed(cid) ~= speed) then 
            doRemoveCondition(cid, CONDITION_HASTE) 
            doChangeSpeed(cid, c.speed - getCreatureSpeed(cid)) 
    end 
return true
end
 
 
]]> </movevent>
<globalevent name="timer" interval="1" event="script"><![CDATA[
		domodlib('tutorial_m')
		domodlib('football-lib')
function onThink(cid,interval)
local half = c.original/2
local random_item = c.rewards_id[math.random(1, #c.rewards_id)]
   if getGlobalStorageValue(1222) >= 0 then
            setGlobalStorageValue(1222,getGlobalStorageValue(1222) - 1)
   else
   	 	    setGlobalStorageValue(c.BLUE_SCORE,0)
	        setGlobalStorageValue(c.RED_SCORE,0)
   end
   for _,cid in ipairs(getPlayersOnline()) do
            if getGlobalStorageValue(1222) >= 0 and getGlobalStorageValue(1222) < half then
			   if getPlayerStorageValue(cid,c.storage) > 0 then
                     doPlayerSendCancel(cid, "Time per half : "..( os.date("%M : %S",half)).."   |   Second half : "..( os.date("%M : %S",getGlobalStorageValue(1222))).."   |    Red : "..getGlobalStorageValue(c.RED_SCORE).." goals  *  Blue : "..getGlobalStorageValue(c.BLUE_SCORE).." goals")
               end           
		   elseif getGlobalStorageValue(1222) >= half and getGlobalStorageValue(1222) <= c.original then
		         if getPlayerStorageValue(cid,c.storage) > 0 then
                     doPlayerSendCancel(cid, "Time per half : "..( os.date("%M : %S", half )).."   |   First half : "..( os.date("%M : %S",getGlobalStorageValue(1222))).."   |    Red : "..getGlobalStorageValue(c.RED_SCORE).." goals  *  Blue : "..getGlobalStorageValue(c.BLUE_SCORE).." goals")
                 end
			end
            if getPlayerStorageValue(cid,c.storage) > 0 then
                   if getGlobalStorageValue(1222) < 0 then
				     doChangeSpeed(cid, getSpeed(cid, getPlayerLevel(cid)) - getCreatureSpeed(cid))
	                     if c.rewards == true then
	                          if getGlobalStorageValue(c.RED_SCORE) > getGlobalStorageValue(c.BLUE_SCORE) then
		                             if getPlayerStorageValue(cid,c.storage) > c.players then
			                               doPlayerSendTextMessage(cid,25, "Your teams won the match. And recieved a ["..getItemNameById(random_item).."].")
                                           doPlayerAddItem(cid,random_item,1)
 
			                         elseif getPlayerStorageValue(cid,c.storage) <= c.players then
			                               doPlayerSendTextMessage(cid,22,"You team have lost. No reward for you!")
			                         end
		                      elseif getGlobalStorageValue(c.BLUE_SCORE) > getGlobalStorageValue(c.RED_SCORE) then
		                             if getPlayerStorageValue(cid,c.storage) <= c.players then
			                               doPlayerSendTextMessage(cid,25, "Your teams won the match. And recieved a ["..getItemNameById(random_item).."].")
                                           doPlayerAddItem(cid,random_item,1)
			                         elseif getPlayerStorageValue(cid,c.storage) > c.players then
			                               doPlayerSendTextMessage(cid,22,"You team have lost. No reward for you!")
			                         end
		                      else
		                           doPlayerSendTextMessage(cid,22,"Neither of teams won. No rewards!")
 
		                       end
		                  end
						          doRemoveConditions(cid, FALSE)
 
                                  doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
	                              doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)
	                              setPlayerStorageValue(cid,c.storage,-1)
                                           for i = c.pitchpos.fromy, c.pitchpos.toy do
		                                          for j = c.pitchpos.fromx, c.pitchpos.tox do
			                                            local pos = {x = j, y = i, z = c.pitchpos.z, stackpos = 253}
			                                                       local ball = getTileItemById(pos,2109)
			                                                           if getTileItemById(c.ballpos,2109).uid < 1 then
			                                                                  if ball.uid > 0 then
			                                                                       doTeleportThing(ball.uid,c.ballpos)
			                                                                  end
			                                                           end
		                                           end
		                                  end
 
                    elseif getGlobalStorageValue(1222) == half then
	                            doTeleportThing(cid, (getPlayerStorageValue(cid,c.storage) <= c.players and c.destination[getPlayerStorageValue(cid,c.storage)+c.players] or c.destination[getPlayerStorageValue(cid,c.storage)-c.players]))
                                doPlayerSendTextMessage(cid,22,"Refree : Second half begins.")
		                                for i = 1, #c.destination do
		                                        doSendMagicEffect(c.destination[i],10)
		                                end
		                                for i = c.pitchpos.fromy, c.pitchpos.toy do
		                                        for j = c.pitchpos.fromx, c.pitchpos.tox do
			                                              local pos = {x = j, y = i, z = c.pitchpos.z, stackpos = 253}
			                                              local ball = getTileItemById(pos,2109)
			                                                   if getTileItemById(c.ballpos,2109).uid < 1 then
			                                                          if ball.uid > 0 then
			                                                                 doTeleportThing(ball.uid,c.ballpos)
			                                                          end
			                                                   end
		                                        end
		                                end
 
	                end
            end
    end
return true
end
]]></globalevent>
<globalevent name="tim" type="start" event="script"><![CDATA[
		domodlib('tutorial_m')
		function onStartup()
		 setGlobalStorageValue(c.BLUE_SCORE,0)
	        setGlobalStorageValue(c.RED_SCORE,0)
		if getTileItemById(c.ballpos,2109).uid < 1 then
		  doCreateItem(2109,1,c.ballpos)
		end
		return true
		end
]]></globalevent>
</mod>

Or is there someone I'm missing or that is misspelled in the config?
 
Ye i wont add any more config to be edited, but if you copyed the new mod then make sure you have "speed" varible in configuration for you to edit the speed of players

@topic

I will update the site part tonight :)
 
Back
Top