Results 1 to 5 of 5

Thread: [RESOLVED] Return false

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    524

    Resolved [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);
    	}
    }

  2. #2
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,621

    Re: Return false

    are object_min and max assigned somewhere else? they aren't in that code
    My light show youtube page (it's made the news) www.youtube.com/@artnet2twinkly
    Contact me on the socials www.facebook.com/lordorwell

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    524

    Re: Return false

    in user.h
    #define OBJECT_MIN 0x20D0
    #define OBJECT_MAX 0x24B8

  4. #4
    Fanatic Member 2kaud's Avatar
    Join Date
    May 2014
    Location
    England
    Posts
    1,000

    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)

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2009
    Posts
    524

    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
  •  



Click Here to Expand Forum to Full Width