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

[Request]Onlook With Pvp Mode By Azi

FeragonOnline

Im Bored!
Joined
Jan 19, 2010
Messages
98
Reaction score
1
Location
USA
Example:
Lua:
function onLook(cid, thing, position, lookDistance)
        if(isPlayer(thing.uid) == true) then
                    if (getPlayerPVPMode(cid) == 1 and getPlayerPVPMode(target) == 1) or isPlayer(target) == FALSE then
					else
                        doPlayerSendCancel(cid, "He Is Pvp Disabled.")
					end
        return true
    end
i dont know if this script work xD
 
getPlayerPVPMode(cid)

is that a custom function or is it from tfs's? otherwise you would need to load it (doFile)

:s no entiendo el objetivo del script, creo q le falta una linea
 
Last edited:
this is the function of the script by azi
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 setPlayerPVPMode(uid, value)
  if (value >= 0 and value <= 1) then
   if isPlayer(uid) == TRUE then
    db.executeQuery("UPDATE `players` SET `pvpmode` = " .. value .. " WHERE `name`='" .. getPlayerName(uid) .. "' LIMIT 1;")
    return TRUE
   else
    return FALSE
   end
  else
   return FALSE
  end
 end

el objetivo es que al darle ver al jugador diga pvp enabled o pvp disabled
the goal when the player look other player send message if pvp disabled or pvp enabled
 
its way easier to make it in source as I know, because onLook yo need to rewrite all onLook function I guess(I may be wrong ofc)
yes, that should be request to Elf
deprecate the original(main) onLook script to LUA ^^
 
player.cpp:
Code:
std::string storage;
getStorage(storage_number, storage);
ss << "\nHe's PvP << " (storage == "1" ? "enabled" : "disabled") << ".";

Then modify function to set storage instead of query.
 
@Chojrak: can you help me do that for my rep system?
@zakius: that can be easily done as a "doPlayerSendMessage"
 
@zakius ofc i will work, but not the green message over the player
just the orange or blue msg
my rep system is like that
 
well, I integrated my ranks with green msg in source and its good, ofc because I'm bad in c++ its about 10x longer than lua one will be but looks way better
 
take a look(old 0.2 cpp code):

std::string Player::getPVPRank(uint32_t level) const
{
std::string rank = "Noob [======|======]";
int32_t intValue = 0;
if(getStorageValue(2010, intValue))
{
if(intValue <= -5000)
rank = "Power Abuser [***==========]";
else if(intValue >= -2000 && intValue < -1500)
rank = "Evil [=**==========]";
else if(intValue >= -1500 && intValue < -1000)
rank = "Gangster [==*==========]";
else if(intValue >= -1000 && intValue < -500)
rank = "Villain [===|=========]";
else if(intValue >= -500 && intValue < -300)
rank = "PK [====|========]";
else if(intValue >= -300 && intValue < 0)
rank = "Bad Guy [=====|=======]";
else if(intValue >= 0 && intValue < 300)
rank = "Noob [======|======]";
else if(intValue >= 300 && intValue < 500)
rank = "Well-Known [=======|=====]";
else if(intValue >= 500 && intValue < 1000)
rank = "Popular [========|====]";
else if(intValue >= 1000 && intValue < 1500)
rank = "Hailed [=========|===]";
else if(intValue >= 1500 && intValue < 2000)
rank = "The Best [==========+==]";
else if(intValue >= 2000 && intValue < 5000)
rank = "Hero [==========++=]";
else if(intValue >= 5000)
rank = "Legendary Hero [==========+++]";
else
rank = "Noob [======|======]";
};
return rank;
}
 
@topic

this LUA should do it

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 onLook(cid, thing, position, lookDistance)
    local t = { [0] = ""..getPlayerName(cid).." is Pvp Disabled.",
                [1] = ""..getPlayerName(cid).." is Pvp Enabled." }

    if (isPlayer(thing)) then
        doPlayerSendCancel(cid, t[getPlayerPVPMode(thing.uid)])
    end
return true
end
 
Back
Top