This script is really cool but i don't see any use in this since if players want to BOT they just need to set PVP OFF and their free to bot without any1 killin them xd so i'll not use this. Anyway thanks for uploading ; )
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 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")
result:free()
return mode
end
return FALSE
end
[01/07/2009 21:12:47] mysql_real_query(): SELECT `pvpmode` FROM `players` WHERE `name` ='Death's Touch' LIMIT 1; - MYSQL ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's Touch' LIMIT 1' at line 1 (1064)
Happens when players have a ' in their name. Not sure how to fix this?
function onCombat(cid, target)
if isMonster(target) == TRUE then
return TRUE
elseif (getPlayerPVPMode(cid) == 1 and getPlayerPVPMode(target) == 1) or isPlayer(target) == FALSE then
return TRUE
else
doPlayerSendCancel(cid, "You cannot attack players who have PVP mode turned off.")
return FALSE
end
end
function getPlayerPVPMode(uid)
local result = db.getResult("SELECT `pvpmode` FROM `players` WHERE `id` = " .. getPlayerGUID(uid) .. " LIMIT 1;")
if(result:getID() ~= -1) then
local mode = result:getDataInt("pvpmode")
return mode
else
return FALSE
end
result:free()
end
function setPlayerPVPMode(uid, value)
if (value >= 0 and value <= 1) then
if isPlayer(uid) == TRUE then
db.executeQuery("UPDATE `players` SET `pvpmode` = " .. value .. " WHERE `id` = " .. getPlayerGUID(uid) .. " LIMIT 1;")
return TRUE
else
return FALSE
end
else
return FALSE
end
end
function getPlayerPVPMode(cid) return getPlayerStorageValue(cid, 2062) end
function setPlayerPVPMode(cid, value) return setPlayerStorageValue(cid, 2062, tonumber(value)) end