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

C++ / Login position ..

El Man

«لَا إِلَٰهَ إِلَّا ٱللَّٰهُ»
Joined
Mar 23, 2013
Messages
161
Reaction score
33
-when logout in anyposition .. character save this position and when die . back to the logout position how to solve it ..

-should be back to townid when dead . .not to logout position
 
In the first place, what you are saying is not very well understood.
Second the thread title does not describe any problem If you want help, please write a better explanation, and if you don't know how to explain it, maybe you can describe the steps to reproduce your problem

Example:
1. Login
2. Go to a far away place and let a monster kill you
3. When connecting the character appears in the city of the devil, but should appear in his city of residence
4. When reconnecting the character continues to appear in the city of the demon and never appears in his city of residence

:D
 
In the first place, what you are saying is not very well understood.
Second the thread title does not describe any problem If you want help, please write a better explanation, and if you don't know how to explain it, maybe you can describe the steps to reproduce your problem

Example:
1. Login
2. Go to a far away place and let a monster kill you
3. When connecting the character appears in the city of the devil, but should appear in his city of residence
4. When reconnecting the character continues to appear in the city of the demon and never appears in his city of residence

:D
num 3-4 that i talk about

and srry for bad eng ;/
 
-when logout in anyposition .. character save this position and when die . back to the logout position how to solve it ..

-should be back to townid when dead . .not to logout position
In your request you don't need c++ edits at all, all you want just teleporting the player in his town as i understood what u need "you need to teleport him to his town id while he is dead"
you can use this:
Lua:
function onDeath(cid, corpse, killer)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
return true
end
Lua:
registerCreatureEvent(cid, "teleport_to_town")
XML:
 <event type="death" name="teleport_to_town" event="script" value="balbala.lua"/>
but I'm sure u have a bug somewhere in your creaturescripts it blocks player from saving or smth. you need also to mention your Tfs/engine version to provide more help.
 
In your request you don't need c++ edits at all, all you want just teleporting the player in his town as i understood what u need "you need to teleport him to his town id while he is dead"
you can use this:
Lua:
function onDeath(cid, corpse, killer)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
return true
end
Lua:
registerCreatureEvent(cid, "teleport_to_town")
XML:
 <event type="death" name="teleport_to_town" event="script" value="balbala.lua"/>
but I'm sure u have a bug somewhere in your creaturescripts it blocks player from saving or smth. you need also to mention your Tfs/engine version to provide more help.

this is not a good idea
because that lines are gonna make the player not die normally,not loose any looot, he will just get teleported to temple when HP is 0 like death on events.
 
-when logout in anyposition .. character save this position and when die . back to the logout position how to solve it ..

-should be back to townid when dead . .not to logout position
this is not a good idea
because that lines are gonna make the player not die normally,not loose any looot, he will just get teleported to temple when HP is 0 like death on events.
Well but i did what he wants there's another solution he could use this instead this will check player postion then it willl teleport him to his town if he isn't there
Lua:
function onLogin(cid)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
return true
end
PS: if u used this you don't need to register into login.lua anymore.
 
Well but i did what he wants there's another solution he could use this instead this will check player postion then it willl teleport him to his town if he isn't there
Lua:
function onLogin(cid)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
return true
end
PS: if u used this you don't need to register into login.lua anymore.
maaan, this will teleport any player to temple after relog
so if u logout on dp, and came back you will be on temple
this could be used on war map
 
if you dont understand what i post about dont post about anything from your mind

-- my problem in player.cpp
player when logout . - character save in this position
and after he got die by '" he is return to the logout position

that i mean!!

and ty for your help!
This what he wants already..
 
if you dont understand what i post about dont post about anything from your mind

-- my problem in player.cpp
player when logout . - character save in this position
and after he got die by '" he is return to the logout position

that i mean!!

and ty for your help!
Excuse me but you need to speak more clearly or giving some examples as what Sarah said because your request is really identical to my script.
also it maybe not from player.cpp have u checked your map ? is your map really defined putting town as 1 .
also to better help you should provide your engine / Tfst version if the issue was really related with sources because there's more sources u will not have the right code .
 
if you dont understand what i post about dont post about anything from your mind

-- my problem in player.cpp
player when logout . - character save in this position
and after he got die by '" he is return to the logout position

that i mean!!

and ty for your help!
can you mention the one you talks to?
also can you learn some english so we understand your problem?
otherwise im trying to help!
 
Excuse me but you need to speak more clearly or giving some examples as what Sarah said because your request is really identical to my script.
also it maybe not from player.cpp have u checked your map ? is your map really defined putting town as 1 .
also to better help you should provide your engine / Tfst version if the issue was really related with sources because there's more sources u will not have the right code .
2. Go to a far away place and let a monster kill you
3. When connecting the character appears in the city of the devil, but should appear in his city of residence
4. When reconnecting the character continues to appear in the city of the demon and never appears in his city of residence
as -Sarah- said !!
this problem i have not by townid .. because i make citizen to townid temple position and not fixed!
 

Have you ever opened player.cpp?
We can’t help you fix your code if you don’t provide your code so we can find the issue in it.

Since you don’t say what engine you use I will assume TFS1.3, so the problem will be in this function:
void Player::death(Creature* lastHitCreature)
 
DEVLAND that i used

void Player::eek:nDie()
Have you ever opened player.cpp?
We can’t help you fix your code if you don’t provide your code so we can find the issue in it.

Since you don’t say what engine you use I will assume TFS1.3, so the problem will be in this function:
void Player::death(Creature* lastHitCreature)
Post automatically merged:

C++:
void Player::eek:nDie()
{
    Creature::eek:nDie();
    sendTextMessage(MSG_EVENT_ADVANCE, "You are dead.");
    NetworkMessage msg;
    msg.AddByte(0x28);
    client->WriteBuffer(msg);
    loginPosition = masterPos;
   
    if(skillLoss){
    //Magic level loss
    uint32_t sumMana = 0;
    int32_t lostMana = 0;
  
    //sum up all the mana
    for(int32_t i = 1; i <= magLevel; ++i){
        sumMana += vocation->getReqMana(i);
    }
    sumMana += manaSpent;
    lostMana = (int32_t)std::ceil(sumMana * ((double)lossPercent[LOSS_MANASPENT]/100));
 
Idk what that's about, it's the classic Tibia client, so I can't do much there to help.

Might be internal video card settings. Heard of issues before with Inte and nVidia control panels

DEVLAND that i used

void Player::eek:nDie()

Post automatically merged:

C++:
void Player::eek:nDie()
{
    Creature::eek:nDie();
    sendTextMessage(MSG_EVENT_ADVANCE, "You are dead.");
    NetworkMessage msg;
    msg.AddByte(0x28);
    client->WriteBuffer(msg);
    loginPosition = masterPos;
  
    if(skillLoss){
    //Magic level loss
    uint32_t sumMana = 0;
    int32_t lostMana = 0;
 
    //sum up all the mana
    for(int32_t i = 1; i <= magLevel; ++i){
        sumMana += vocation->getReqMana(i);
    }
    sumMana += manaSpent;
    lostMana = (int32_t)std::ceil(sumMana * ((double)lossPercent[LOSS_MANASPENT]/100));

So try this

C++:
void Player::die()
{
    Creature::die();

    sendTextMessage(MSG_EVENT_ADVANCE, "You are dead.");
    NetworkMessage msg;
    msg.AddByte(0x28);
    client->WriteBuffer(msg);
    loginPosition = getTown()->getTemplePosition();
 
So try this

C++:
void Player::die()
{
    Creature::die();

    sendTextMessage(MSG_EVENT_ADVANCE, "You are dead.");
    NetworkMessage msg;
    msg.AddByte(0x28);
    client->WriteBuffer(msg);
    loginPosition = getTown()->getTemplePosition();
player.cpp base operand of `->' is not a pointer
bug
Post automatically merged:

Tried my previous post?
when add this (( make error
loginPosition = getTown()->getTemplePosition();
 
Last edited:
Back
Top