• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

totally invisible players

Tymofek

New Member
Joined
May 12, 2011
Messages
86
Reaction score
3
Location
Santiago - CHILE
i ripped this from the source, and i think that may work, not as i wish, but the best i can xD

i want to insert this (that i ripped) just before the ghost part

the idea is that if in DB in table players column invisible the value is 0 when use the command
player get invisible,
and change the value to 1
else if the value is 1 then
go back to normal
and change the value to 0

i inserted the "conditions" in this code, but am sure they are no supposed to be like that

the lines that for sure are not gonna work and need to be helped are:

inv = (SELECT `invisible` FROM `players` WHERE `id` = "..getPlayerName(cid)..");
if (inv = 1 )


(UPDATE `players` SET `invisible` = 0 WHERE `id` = "..getPlayerId(cid).." )


else if (inv = 0 )
{

(UPDATE `players` SET `invisible` = 1 WHERE `id` = "..getPlayerId(cid).." )




i hope you can finish what i think i have started xD

telme how do i insert the condition like this

[CPP]
bool TalkAction::playerghost(Creature* creature, const std::string&, const std::string&)
{
Player* player = creature->getPlayer();
if(!player)
return false;
inv = (SELECT `invisible` FROM `players` WHERE `id` = "..getPlayerName(cid)..");
if (inv = 1 )

{

(UPDATE `players` SET `invisible` = 0 WHERE `id` = "..getPlayerId(cid).." )

IOLoginData::getInstance()->updateOnlineStatus(player->getGUID(), true);
for(AutoList<Player>::iterator pit = Player::autoList.begin(); pit != Player::autoList.end(); ++pit)
{
if(!pit->second->canSeeCreature(player))
pit->second->notifyLogIn(player);
}

for(it = list.begin(); it != list.end(); ++it)
{
if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->canSeeCreature(player))
tmpPlayer->sendMagicEffect(player->getPosition(), MAGIC_EFFECT_TELEPORT);
}

player->removeCondition(condition);
g_game.internalCreatureChangeVisible(creature, VISIBLE_GHOST_APPEAR);

}

SpectatorVec::iterator it;
SpectatorVec list = g_game.getSpectators(player->getPosition());
Player* tmpPlayer = NULL;

Condition* condition = NULL;

else if (inv = 0 )
{

(UPDATE `players` SET `invisible` = 1 WHERE `id` = "..getPlayerId(cid).." )

player->addCondition(condition);
g_game.internalCreatureChangeVisible(creature, VISIBLE_GHOST_DISAPPEAR);
for(it = list.begin(); it != list.end(); ++it)
{
if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->canSeeCreature(player))
tmpPlayer->sendMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
}

for(AutoList<Player>::iterator pit = Player::autoList.begin(); pit != Player::autoList.end(); ++pit)
{
if(!pit->second->canSeeCreature(player))
pit->second->notifyLogOut(player);
}

IOLoginData::getInstance()->updateOnlineStatus(player->getGUID(), false);
if(player->isTrading())
g_game.internalCloseTrade(player);

player->clearPartyInvitations();
if(player->getParty())
player->getParty()->leave(player);


}

return true;
}
[/CPP]
 
thats not true, you are confused, i have tried in the past to execute this kind of sentences and works perfectly instant.

what you mean is that the DB editation need the player to re-login to get the changes.

but in this case when a SQL sentence is made the change in the data base Column is instant

try this.

add a new column in the player table

SQL:
(ALTER TABLE players ADD COLUMN test INT DEFAULT 0)

now you have the new column, then

create an action script like this:

paste this inside "/data/actions/actions.xml":
XML:
<action itemid="7315" event="script" value="test.lua"/>


paste this inside "/data/actions/scripts/test.lua":
LUA:
function onUse(cid, item, frompos, item2, topos)

asd = db.getResult("SELECT `test` FROM `players` WHERE `id` = "..getPlayerGUID(cid)..";")
test =  asd:getDataInt("test")

if test == 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "i was wrong")
db.executeQuery("UPDATE `players` SET  `test` = 1 WHERE `id` = "..getPlayerGUID(cid)..";")
elseif test == 1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "you were right")
db.executeQuery("UPDATE `players` SET  `test` = 0 WHERE `id` = "..getPlayerGUID(cid)..";")
end
end


this little test is so usefull! you could get impressed! xD
think about the possibilities
npcs!
languages!
quests
this is like storages but better!
you could store something for the entire account not just in the player like the storages....
anyway ;p this proffs that sql in the c++ function its a great idea ;D


now can we go back to my script :D? i know nothing about C++ thats why i need help with this,
as i sayed before i did my best but need HALP!
 
Why not just add it to the creature attributes? So much simpler. Chuck it in under hpMax or mana or wherever you want, and then you won't have to worry about any complex scenarios. Then just copying that style create an isInvisible() check, and in Lua get/setCreatureInvisible()
 
go ahead script it :D

i made this post with some code to start, because there was no answer on all my threads about this xD

i got none idea of what you say :D

it really took me VERY long to find this piece of code that "i believe" its the /ghost script xD

but if there is another way xD

go ahead!
 
Back
Top