Well i saw something with someone talking about how cool it would be to be able to select if your Character could be involved in PVP or Non Pvp on one world. So with some help from Syntax and the base code from Azi i've gotten this all together.
OTS_Player.php [Text was to long to paste on OTLAND]
accountmanagement.php [Text was to long to paste on OTLAND]
Sql Query
Creaturescripts.xml
login.lua
pvp.lua
OTS_Player.php [Text was to long to paste on OTLAND]
Code:
http://php.pastebin.com/0q2JKKcE
accountmanagement.php [Text was to long to paste on OTLAND]
Code:
http://php.pastebin.com/b88NF3nA
Sql Query
Code:
ALTER TABLE players ADD pvp int(11) NOT NULL
Creaturescripts.xml
Code:
<event type="attack" name="PvP" event="script" value="pvp.lua"/>
login.lua
Code:
registerCreatureEvent(cid, "PvP")
pvp.lua
Lua:
function getPlayerPVPMode(uid)
local result = db.getResult("SELECT `pvpmode` FROM `players` WHERE `name` = '" .. getPlayerName(uid) .. "' LIMIT 1;")
if(result:getID() ~= -1) then
local mode = result:getDataInt("pvpmode")
return mode
else
return FALSE
end
result:free()
end
function onCombat(cid, target)
if (getPlayerPVPMode(cid) == 1 and getPlayerPVPMode(target) == 1) or isPlayer(target) == FALSE then
return TRUE
else
doPlayerSendCancel(cid, "You cannot attack players which pvp mode is off.")
return FALSE
end
end