Something with the source [C++].

Results 1 to 4 of 4
  1. #1
    Apprentice alonalon04 is offline
    MemberRank
    Sep 2013 Join Date
    12Posts

    cool Something with the source [C++].

    Hey guys i need help with a little something,
    i want to equal argv[1] of the command to 'thisischar' , then turn it to an int.
    Take a look:

    Code:
    ZCharacter* pCharacter = ZGetGame()->m_pMyCharacter;
    char* thisischar = argv[1]; 
    pCharacter->GetStatus().Ref().theNumber = int(thisischar);
    And when i do the command:
    /xxx 100

    The game crashes.
    any help?
    i sure the error is in those lines^^^^^

    many thanks.


  2. #2
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Something with the source [C++].

    atoi(thischaracter)

  3. #3
    Apprentice alonalon04 is offline
    MemberRank
    Sep 2013 Join Date
    12Posts

    Re: Something with the source [C++].

    Quote Originally Posted by qet123 View Post
    atoi(thischaracter)
    Crashes again.
    Im trying to update the gravity by a command
    /gravity 500
    and then i do this:

    Code:
    void ZModule_Movable::UpdateGravity(float fDelta)
    {
    	ZCharacter* pCharacter = ZGetGame()->m_pMyCharacter;
          
    	if(pCharacter->GetStatus().Ref().isFLY == 1)
    	{
    		#define GRAVITY_NEWNEW 1.f
    	
    		int newgravity2 = pCharacter->GetStatus().Ref().isFLYNUMBER;
    	
    	
    	
    	if(newgravity2 != 0)
    		m_Velocity.z = max( m_Velocity.z - (GRAVITY_NEWNEW+newgravity2)*fDelta,-MAX_FALL_SPEED);
    	else
    		m_Velocity.z = max( m_Velocity.z - GRAVITY_CONSTANT*fDelta,-MAX_FALL_SPEED);
    	
    
    
    	}
    	else
    	{
    	
    
    
    	#define GRAVITY_NEW 1.f
    	
    	int newgravity = 0;
    	
    	sscanf(ZGetGameClient()->GetStageName(), "[G=%i]", &newgravity);
    	
    	if(newgravity != 0)
    		m_Velocity.z = max( m_Velocity.z - (GRAVITY_NEW+newgravity)*fDelta,-MAX_FALL_SPEED);
    	else
    		m_Velocity.z = max( m_Velocity.z - GRAVITY_CONSTANT*fDelta,-MAX_FALL_SPEED);
    	}
    }

  4. #4
    Wait wut PenguinGuy is offline
    MemberRank
    Apr 2010 Join Date
    United StatesLocation
    765Posts

    Re: Something with the source [C++].

    Look into the admin_mute command. Same thing for your problem.

    Also, not sure if you or MAIET, but I see no sanity check for ZCharacter. This could all be because of an invalid pointer.
    Code:
    if( pCharacter )
    {
        if( pCharacter->GetStatus().Ref().IsFly )
        {
            .....
        }
    }



Advertisement