Re: command problem trace
Well the code looks correct
Code:
bool cChat::TraceCommand(LPOBJ gObj, char *Msg)
{
if(CheckCommand(gObj, 1, GmSystem.cTrace, 0, 0, 0, 0, 1, 1, "Trace", "/trace <name>", Msg))
return true;
char Target[11];
sscanf(Msg, "%s", &Target);
int Index = Utilits.GetPlayerIndex(Target);
OBJECTSTRUCT *tObj = (OBJECTSTRUCT*)OBJECT_POINTER(Index);
gObjTeleport(gObj->m_Index, tObj->MapNumber, (int)tObj->X, (int)tObj->Y);
MessageLog(1, c_Green, t_GM, gObj, "[Trace] You successfully traced to %s",Target);
return true;
}
Re: command problem trace
Quote:
Originally Posted by
KarLi
Well the code looks correct
Code:
bool cChat::TraceCommand(LPOBJ gObj, char *Msg)
{
if(CheckCommand(gObj, 1, GmSystem.cTrace, 0, 0, 0, 0, 1, 1, "Trace", "/trace <name>", Msg))
return true;
char Target[11];
sscanf(Msg, "%s", &Target);
int Index = Utilits.GetPlayerIndex(Target);
OBJECTSTRUCT *tObj = (OBJECTSTRUCT*)OBJECT_POINTER(Index);
gObjTeleport(gObj->m_Index, tObj->MapNumber, (int)tObj->X, (int)tObj->Y);
MessageLog(1, c_Green, t_GM, gObj, "[Trace] You successfully traced to %s",Target);
return true;
}
not change anything.
what happens is that if the character is offline, the trace becomes equal to 0.0 lorencia.
I want to make a condition of entry that name, to see if there is online and do the trace.
https://forum.ragezone.com/cache.php...%2Fo355pnL.png
Re: command problem trace
Quote:
Originally Posted by
erikgaston
Just change that in your code :
Code:
if(gObjIsConnected(tObj->m_Index)
{
gObjTeleport(gObj->m_Index, tObj->MapNumber, (int)tObj->X, (int)tObj->Y);
MessageLog(1, c_Green, t_GM, gObj, "[Trace] You successfully traced to %s",Target);
return true;
}
return false;
Re: command problem trace
Quote:
Originally Posted by
brunohkbx
Just change that in your code :
Code:
if(gObjIsConnected(tObj->m_Index)
{
gObjTeleport(gObj->m_Index, tObj->MapNumber, (int)tObj->X, (int)tObj->Y);
MessageLog(1, c_Green, t_GM, gObj, "[Trace] You successfully traced to %s",Target);
return true;
}
return false;
problem if(gObjIsConnected(tObj->m_Index).
It does not take me like I is defined gObjIsConnected
Solution: Utilits.gObjIsConnected(tObj->m_Index)
uses another class with these attributes and behaviors.
thanks :D