• 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 Soccer system

This is the 1° script that I catch and the right, Thanks for sharing. TFS 3.0 Gold
 
Hello

I have a problem, beacouse i realy want to use this script, but im using tfs 0.2 Mystic Spirit and its not working.
I've changed some functions in this script like doBroadcastMessage to BroadcastMessage and now the script is working in 50%, beacouse its teleporting players and sending broadcast, but they cant get a goal and nothing happend when the ball goes into the teams gate.
For 100% i've configured everything good in all scripts.

For more info its the screen of my error:


I think its beacouse in TFS 0.2 i must use another function, not getPlayerGUIDByName but i dont know what function :p

Its my football.lua from actions:
function onUse(cid, item, fromPosition, itemEx, toPosition)
--script maked by Fare, for otland community.
--position of players when pressing switch, change to yourselfs coordinates
local pos1 = {x=875, y=556, z=7, stackpos=1}
local pos2 = {x=874, y=557, z=7, stackpos=1}
local pos3 = {x=874, y=555, z=7, stackpos=1}
local pos4 = {x=910, y=556, z=7, stackpos=1}
local pos5 = {x=911, y=557, z=7, stackpos=1}
local pos6 = {x=911, y=555, z=7, stackpos=1}
-- end of positions
local player1 = getThingfromPos(pos1)
local player2 = getThingfromPos(pos2)
local player3 = getThingfromPos(pos3)
local player4 = getThingfromPos(pos4)
local player5 = getThingfromPos(pos5)
local player6 = getThingfromPos(pos6)
local teleportpos = {x=892, y=556, z=7, stackpos=1} --middle of your soccer field, ball will spawn here
local getteleport = getThingfromPos(teleportpos)
if getteleport.itemid == 1387 then
if isPlayer(player1.uid) == TRUE and isPlayer(player2.uid) == TRUE and isPlayer(player3.uid) == TRUE and isPlayer(player4.uid) == TRUE and isPlayer(player5.uid) == TRUE and isPlayer(player6.uid) == TRUE then
local pos11 = {x=884, y=556, z=7, stackpos=1}
local pos22 = {x=883, y=557, z=7, stackpos=1}
local pos33 = {x=883, y=555, z=7, stackpos=1}
local pos44 = {x=900, y=556, z=7, stackpos=1}
local pos55 = {x=901, y=557, z=7, stackpos=1}
local pos66 = {x=901, y=555, z=7, stackpos=1}
local team1 = getPlayerGUIDByName(getCreatureName(player1.uid))
local team2 = getPlayerGUIDByName(getCreatureName(player4.uid))
setGlobalStorageValue(15024, 0)
setGlobalStorageValue(15025, 0)
setGlobalStorageValue(15026, team1)
setGlobalStorageValue(15027, team2)
setGlobalStorageValue(15029, 0)
broadcastMessage("Football match with "..getPlayerName(player1.uid).."s team and "..getPlayerName(player4.uid).."s team started!", MESSAGE_EVENT_ADVANCE)
doTeleportThing(player1.uid,pos11,0)
doTeleportThing(player2.uid,pos22,0)
doTeleportThing(player3.uid,pos33,0)
doTeleportThing(player4.uid,pos44,0)
doTeleportThing(player5.uid,pos55,0)
doTeleportThing(player6.uid,pos66,0)
doRemoveItem(getteleport.uid,1)
doCreateItem(2109,1,teleportpos)
else
doPlayerSendTextMessage(cid, 22, "You need 2 teams, 3 players in each team, to start the match!")
end
else
doPlayerSendTextMessage(cid, 22, "Need wait until previous command will end the match!")
end
end
 
damn, I can't test it with 0.2 ;< Anybody knows, did 0.2 have getPlayerGUIDByName or smth like this? xD
 
@Up
I dont know too ;/

It will work if i change getPlayerGUIDByName to getPlayerName or getCreatureName ?

your actions is fine, it's movements ;>
try this one, movements/scripts/football.lua:
PHP:
function onAddItem(moveitem, tileitem, position)
-- middle pos of soccers  field, change it to position where ust be your ball spawned!
local ballpos = {x=72, y=384, z=7, stackpos=1}
local ball = getThingfromPos(ballpos)
local komanda1 = "First team"
local komanda2 = "Second team"
if tileitem.actionid == 15027 and moveitem.itemid == 2109 then 
local wet = getGlobalStorageValue(15025) + 1
local wet2 = getGlobalStorageValue(15024)
doRemoveItem(moveitem.uid, 1)
doSendMagicEffect(ballpos, 5)
setGlobalStorageValue(15025, wet)
if getGlobalStorageValue(15025) ~= 3 then
doCreateItem(2109, 1, ballpos)
end
doBroadcastMessage("GOOL!!! "..komanda2.."'s team score! "..wet2.." : " ..wet.. " !", MESSAGE_EVENT_ADVANCE)	
	if getGlobalStorageValue(15025) == 3 then
	doBroadcastMessage("Game over! "..komanda2.."'s team win! "..wet2.." : " ..wet.. " !", MESSAGE_EVENT_ADVANCE)	
	doSetItemActionId(doCreateItem(8058, 1, ballpos), 15029)
	end

elseif tileitem.actionid == 15028 and moveitem.itemid == 2109 then
local wet3 = getGlobalStorageValue(15024) + 1
local wet4 = getGlobalStorageValue(15025)
doRemoveItem(moveitem.uid, 1)
doSendMagicEffect(ballpos, 5)
setGlobalStorageValue(15024, wet3)
if getGlobalStorageValue(15024) ~= 3 then
doCreateItem(2109, 1, ballpos)
end
doBroadcastMessage("GOOL!!! "..komanda1.."'s team score! "..wet3.." : " ..wet4.. " !", MESSAGE_EVENT_ADVANCE)	
	if getGlobalStorageValue(15024) == 3 then
	doBroadcastMessage("Game over! "..komanda1.."'s team win! "..wet3.." : " ..wet4.. " !", MESSAGE_EVENT_ADVANCE)
	doSetItemActionId(doCreateItem(8058, 1, ballpos), 15029)
	end
end
return TRUE
end
But it will don't show, name of team which is scores or win...For example in 0.3 it will be like:
Fare's and ScorpiOOn93's teams started the match!
Fare's team scores! 1:0
Fare's team scores! 2:0
Game over! Fare's team wins! 3:0

With this script, in 0.2 will be:
Fare's and ScorpiOOn93's teams started the match!
First team scores! 1:0
First team scores! 2:0
Second team scores! 2:1
Game over! First team wins! 3:1


can you put the map to download?

here it is, in attachments :> if you still needs it ;)
 
Code:
[30/12/2003  11:15:25] Lua Script Error: [MoveEvents Interface] 
[30/12/2003  11:15:25] data/movements/scripts/football.lua:onAddItem

[30/12/2003  11:15:25] luaGetThingfromPos(). Tile not found

[30/12/2003  11:15:25] Lua Script Error: [MoveEvents Interface] 
[30/12/2003  11:15:25] data/movements/scripts/football.lua:onAddItem

[30/12/2003  11:15:25] data/movements/scripts/football.lua:5: attempt to call global 'getPlayerNameByGUID' (a nil value)
[30/12/2003  11:15:25] stack traceback:
[30/12/2003  11:15:25] 	data/movements/scripts/football.lua:5: in function <data/movements/scripts/football.lua:1>
Who help me?:|
 
Code:
[30/12/2003  11:15:25] Lua Script Error: [MoveEvents Interface] 
[30/12/2003  11:15:25] data/movements/scripts/football.lua:onAddItem

[30/12/2003  11:15:25] luaGetThingfromPos(). Tile not found

[30/12/2003  11:15:25] Lua Script Error: [MoveEvents Interface] 
[30/12/2003  11:15:25] data/movements/scripts/football.lua:onAddItem

[30/12/2003  11:15:25] data/movements/scripts/football.lua:5: attempt to call global 'getPlayerNameByGUID' (a nil value)
[30/12/2003  11:15:25] stack traceback:
[30/12/2003  11:15:25] 	data/movements/scripts/football.lua:5: in function <data/movements/scripts/football.lua:1>
Who help me?:|

TFS 0.2? try the movement which I posted before this post
 
Code:
[30/12/2003  19:27:12] Lua Script Error: [Action Interface] 
[30/12/2003  19:27:12] data/actions/scripts/football.lua:onUse

[30/12/2003  19:27:12] data/actions/scripts/football.lua:34: attempt to call global 'doBroadcastMessage' (a nil value)
[30/12/2003  19:27:12] stack traceback:
[30/12/2003  19:27:12] 	data/actions/scripts/football.lua:34: in function <data/actions/scripts/football.lua:1>
Whats now?! :-(
Help plix, I make Football Event :p
EDITED.
 
Last edited:
Code:
[30/12/2003  19:27:12] Lua Script Error: [Action Interface] 
[30/12/2003  19:27:12] data/actions/scripts/football.lua:onUse

[30/12/2003  19:27:12] data/actions/scripts/football.lua:34: attempt to call global 'doBroadcastMessage' (a nil value)
[30/12/2003  19:27:12] stack traceback:
[30/12/2003  19:27:12] 	data/actions/scripts/football.lua:34: in function <data/actions/scripts/football.lua:1>
Whats now?! :-(
Help plix, I make Football Event :p
EDITED.

what server do you use? it have "doBroadcastMessage" function?
 
Try replacing
Code:
      doBroadcastMessage("Football match with "..getPlayerName(player1.uid).."'s team and "..getPlayerName(player4.uid).."'s team started!", MESSAGE_EVENT_ADVANCE)
with
Code:
      broadcastMessage("Football match with "..getPlayerName(player1.uid).."'s team and "..getPlayerName(player4.uid).."'s team started!", MESSAGE_EVENT_ADVANCE)

If MESSAGE_EVENT_ADVANCE doesn't work, try MESSAGE_STATUS_RED
 
Back
Top