• 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!

Select Pvp Option

Sync

Ø,ø
Joined
May 26, 2009
Messages
1,901
Reaction score
26
Location
Canada
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.

14c4c4j.jpg


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
 
wow, long ass scripts

I won't use it because it's soooooo long... but I really like your works and therefor you will get a rep :D
 
Back
Top