-
May 14th, 2014, 03:12 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Return false
Why im getting always returned IsFind = 0 message is offline
Code:
void ChatGmove(int aIndex,char* msg)
{
OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
char Player[16] = {0};
int Map = 0;
int MapX = 100;
int MapY = 100;
int isFind = 0;
//========================================================================================================================
if(gObj->Authority != 32)
{
MsgNormal(aIndex,"[Gmove] : Command only for GM's");
return;
}
//========================================================================================================================
if(!g_GMConfig.CheckIsGM(gObj->Name,11))
{
MsgNormal(aIndex,"[Gmove] Only GM from list can use this command.");
return;
}
//========================================================================================================================
sscanf(msg,"%s %d %d %d",&Player,&Map,&MapX,&MapY);
DWORD PlayerID = SQL.GetaIndexPlayer(Player);
//========================================================================================================================
if((PlayerID>=OBJECT_MIN) && (PlayerID<=OBJECT_MAX))
{
OBJECTSTRUCT * sObj = (OBJECTSTRUCT*)OBJECT_POINTER(PlayerID);
gObjTeleport(PlayerID,Map,MapX,MapY);
isFind = 1;
}
//========================================================================================================================
if(isFind == 1)
{
MsgNormal(aIndex,"[Gmove] %s moved to %d %d %d " ,Player,Map,MapX,MapY);
}
else
{
MsgNormal(aIndex,"[Gmove] Player: %s is offline",Player);
}
}
-
May 14th, 2014, 03:29 AM
#2
Re: Return false
are object_min and max assigned somewhere else? they aren't in that code
-
May 14th, 2014, 06:41 AM
#3
Thread Starter
Fanatic Member
Re: Return false
in user.h
#define OBJECT_MIN 0x20D0
#define OBJECT_MAX 0x24B8
-
May 14th, 2014, 07:02 AM
#4
Re: Return false
Code:
if((PlayerID>=OBJECT_MIN) && (PlayerID<=OBJECT_MAX))
and when you use the debugger to debug this code, the value of PlayerID is what?
All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 14th, 2014, 07:30 AM
#5
Thread Starter
Fanatic Member
Re: Return false
i rebuild it like this now it works normal
Code:
{
/*variaveis*/
int Map,XPos,YPos,bIndex;
char Nome[11];
char MensagemSender[255];
/*OBJCETSTRUCT GM*/
OBJECTSTRUCT*lpObj = (OBJECTSTRUCT*)OBJECT_POINTER(gObjId);
//OBJECTSTRUCT * gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);
NCONFIGS lpObjEx;
lpObjEx = &cConfigs[lpObj->m_Index];
/*OBJCETSTRUCT Char*/
sscanf(msg,"%s %d %d %d",&Nome,&Map,&XPos,&YPos);
bIndex = MygObjFind(Nome);
OBJECTSTRUCT*eObj = (OBJECTSTRUCT*)OBJECT_POINTER(bIndex);
NCONFIGS eObjEx;
eObjEx = &cConfigs[eObj->m_Index];
if(lpObj->Authority == 32)
//if(gObj->Authority != 32)
{
if(eObj->Connected == 3)
{
gObjTeleport(eObj->m_Index,Map,XPos,YPos);
//sprintf(MensagemSender,"[MOVEGM]: %s was moved by GM %s",eObj->Name,lpObj->Name);
MsgNormal(gObjId,"[Gmove] %s was moved by GM %s " ,eObj->Name,lpObj->Name);
//sscanf(msg,"%s %d %d %d",&Player,&Map,&MapX,&MapY);
GCServerMsgStringSend(MensagemSender,gObjId,1);
//LogAddFunc(MensagemSender,1);
}
else{
GCServerMsgStringSend("[MOVEGM]: user is offline",gObjId,1);
return;
}
}
else
{
GCServerMsgStringSend("[MOVEGM]: Only Admins use this command",gObjId,1);
return;
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|