HeberPcL
[PowerOT.com.br]
Capture Frag
Keraxel, can adapt to your system Team?
PHP:
local increasingItemID = {416, 446, 3216}
local decreasingItemID = {417, 447, 3217}
function onStepIn(cid, item, position, fromPosition)
if item.itemid == 426 then
doTransformItem(item.uid, 425)
end
doTeleportThing(cid, fromPosition, TRUE)
if getGlobalStorageValue(STORAGE_GLOBAL_GAME_TYPE) == 2 and isPlayer(cid) == TRUE then
if item.actionid == 11111 then
if getPlayerAccount(cid) == 1 then
if getFlag1Owner() == 0 then -- flag on spawn
if getFlag2Owner() == cid then -- player have flag
setFlag2Owner(0)
setTeam1Points(getTeam1Points()+15)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have captured the flag!")
broadcastMessage(getCreatureName(cid) .. " capture flag! Team " .. TEAM1_NAME .. " receive 15 points!",MESSAGE_INFO_DESCR)
else -- player don't have flag
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are on spawn of your team flag! You can\'t get your flag!")
end
else -- enemy have flag
if getFlag2Owner() == cid then
if CTF == "normal" then
setFlag2Owner(0)
setTeam1Points(getTeam1Points()+15)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have captured the flag!")
broadcastMessage(getCreatureName(cid) .. " capture flag! Team " .. TEAM1_NAME .. " receive 15 points!",MESSAGE_INFO_DESCR)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, getCreatureName(getFlag1Owner()) .. " stolen your team flag! You can\'t capture enemy flag until your team flag come back!")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are on spawn of your team flag! " .. getCreatureName(getFlag1Owner()) .. " stolen you team flag! Find him and kill him!!")
end
end
elseif getPlayerAccount(cid) == 2 then
if getFlag1Owner() == 0 then -- flag on spawn
setFlag1Owner(cid)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You stole the ENEMY flag!")
broadcastMessage(getCreatureName(cid) .. " stolen " .. TEAM1_NAME .. " team flag!", MESSAGE_INFO_DESCR)
else -- someone from your team have flag
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are on spawn of ENEMY flag! " .. getCreatureName(getFlag1Owner()) .. " from your team stolen enemy flag!")
end
end
elseif item.actionid == 22222 then
if getPlayerAccount(cid) == 2 then
if getFlag2Owner() == 0 then -- flag on spawn
if getFlag1Owner() == cid then -- player have flag
setFlag1Owner(0)
setTeam2Points(getTeam2Points()+15)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have captured the flag!")
broadcastMessage(getCreatureName(cid) .. " capture flag! Team " .. TEAM2_NAME .. " receive 15 points!",MESSAGE_INFO_DESCR)
else -- player don't have flag
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are on spawn of your team flag! You can\'t get your flag!")
end
else -- enemy have flag
if getFlag1Owner() == cid then
if CTF == "normal" then
setFlag1Owner(0)
setTeam2Points(getTeam2Points()+15)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have captured the flag!")
broadcastMessage(getCreatureName(cid) .. " capture flag! Team " .. TEAM2_NAME .. " receive 15 points!", MESSAGE_INFO_DESCR)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, getCreatureName(getFlag1Owner()) .. " stolen your team flag! You can\'t capture enemy flag until your team flag come back!")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are on spawn of your team flag! " .. getCreatureName(getFlag2Owner()) .. " stolen you team flag! Find him and kill him!!")
end
end
elseif getPlayerAccount(cid) == 1 then
if getFlag2Owner() == 0 then -- flag on spawn
setFlag2Owner(cid)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You stolen the ENEMY flag!")
broadcastMessage(getCreatureName(cid) .. " stolen " .. TEAM2_NAME .. " team flag!",MESSAGE_INFO_DESCR)
else -- someone from your team have flag
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are on spawn of ENEMY flag! " .. getCreatureName(getFlag2Owner()) .. " from your team stolen enemy flag!")
end
end
end
end
if getGlobalStorageValue(STORAGE_GLOBAL_GAME_TYPE) == 3 and isPlayer(cid) == TRUE then
if item.actionid == 11111 then
broadcastMessage(TEAM1_NAME .. " TEAM WIN! " .. getCreatureName(cid) .. " did quest first!",MESSAGE_INFO_DESCR)
setMap(getNextMapID())
elseif item.actionid == 22222 then
broadcastMessage(TEAM2_NAME .. " TEAM WIN! " .. getCreatureName(cid) .. " did quest first!",MESSAGE_INFO_DESCR)
setMap(getNextMapID())
end
end
return TRUE
end
function onStepOut(cid, item, position, fromPosition)
if item.itemid == 425 then
doTransformItem(item.uid, item.itemid + 1)
end
return TRUE
end
Keraxel, can adapt to your system Team?