[Request]Onlook With Pvp Mode By Azi

FeragonOnline

Im Bored!
Joined
Jan 19, 2010
Messages
98
Best answers
0
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
 

cbrm

Top Class brunet scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,585
Best answers
3
Reaction score
853
Location
Caribbean Sea
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:
OP
FeragonOnline

FeragonOnline

Im Bored!
Joined
Jan 19, 2010
Messages
98
Best answers
0
Reaction score
1
Location
USA
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
 

cbrm

Top Class brunet scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,585
Best answers
3
Reaction score
853
Location
Caribbean Sea
what do you want the script to do?
 
OP
FeragonOnline

FeragonOnline

Im Bored!
Joined
Jan 19, 2010
Messages
98
Best answers
0
Reaction score
1
Location
USA
when you look the player if pvp 0 send message to player
He is Pvp Disabled
and if pvp 1
He Is Pvp Enabled
With the script of Azi
 

zakius

Enter the Ninja!
Joined
Apr 30, 2009
Messages
2,635
Best answers
0
Reaction score
61
Location
with Taiga
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)
 
OP
FeragonOnline

FeragonOnline

Im Bored!
Joined
Jan 19, 2010
Messages
98
Best answers
0
Reaction score
1
Location
USA
xD, i know if it is easier but i dont know sources or programming xD
 

cbrm

Top Class brunet scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,585
Best answers
3
Reaction score
853
Location
Caribbean Sea
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 ^^
 

zakius

Enter the Ninja!
Joined
Apr 30, 2009
Messages
2,635
Best answers
0
Reaction score
61
Location
with Taiga
well, if pvpmode will be stored in storage I can make it, this way its too hard for me
 

chojrak

Banned User
Joined
Oct 25, 2008
Messages
5,832
Best answers
2
Reaction score
159
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.
 

cbrm

Top Class brunet scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,585
Best answers
3
Reaction score
853
Location
Caribbean Sea
@Chojrak: can you help me do that for my rep system?
@zakius: that can be easily done as a "doPlayerSendMessage"
 

zakius

Enter the Ninja!
Joined
Apr 30, 2009
Messages
2,635
Best answers
0
Reaction score
61
Location
with Taiga
doPlayerSendMessage wont show it correctly, you have to rewrite all onLook or send 2 messages at same time I think
 

cbrm

Top Class brunet scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,585
Best answers
3
Reaction score
853
Location
Caribbean Sea
@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
 

zakius

Enter the Ninja!
Joined
Apr 30, 2009
Messages
2,635
Best answers
0
Reaction score
61
Location
with Taiga
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
 

cbrm

Top Class brunet scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,585
Best answers
3
Reaction score
853
Location
Caribbean Sea
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;
}
 

zakius

Enter the Ninja!
Joined
Apr 30, 2009
Messages
2,635
Best answers
0
Reaction score
61
Location
with Taiga
yeah, in lua I'd use array with that shit, but in c++ it looks almost like yours :D(just I'm using storage instead of custom function)
 

cbrm

Top Class brunet scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,585
Best answers
3
Reaction score
853
Location
Caribbean Sea
@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
 
Top