[Help] Command Add Points

Results 1 to 16 of 16
  1. #1
    Enthusiast RealCoderZ is offline
    MemberRank
    Apr 2015 Join Date
    29Posts

    sad [Help] Command Add Points

    I am trying to make Add Points Command but when i refresh LevelUpPoints the GS Crash due to DataSend Loop gives error due to exceeded Buffer Size but the buffer size is not the problem... anyway is there another way to refresh leveluppoints after add ?!


  2. #2
    C++ Developer zipper20032 is offline
    MemberRank
    Oct 2006 Join Date
    0x198837ADLocation
    671Posts

    Re: [Help] Command Add Points

    What server files and source are you using? (A link to those server files with source would be great.)

  3. #3
    Enthusiast RealCoderZ is offline
    MemberRank
    Apr 2015 Join Date
    29Posts

    Re: [Help] Command Add Points

    I am using GameServer Source of Season 12

    https://forum.ragezone.com/f508/deve...rc-gs-1193275/

  4. #4
    C++ Developer zipper20032 is offline
    MemberRank
    Oct 2006 Join Date
    0x198837ADLocation
    671Posts

    Re: [Help] Command Add Points

    Post your code here and how you've done it, because I think you sent a request packet from DS and the server is looping or something.

  5. #5
    Enthusiast RealCoderZ is offline
    MemberRank
    Apr 2015 Join Date
    29Posts

    Re: [Help] Command Add Points

    using that gObjLevelUpPointAdd in for loop at size of points count

  6. #6
    C++ Developer zipper20032 is offline
    MemberRank
    Oct 2006 Join Date
    0x198837ADLocation
    671Posts

    Re: [Help] Command Add Points

    Make a new function for gObjLevelUpPointAdd.

    The gObjLevelUpPointAdd you are trying to use is only for single attribute point adding (clicking the + button to add single point).

    Also, what information you gave me is not helping me to see where or how you made the adding for commands for attributes.

    - - - Updated - - -

    Link removed
    Last edited by zipper20032; 07-12-21 at 11:23 AM.

  7. #7
    Enthusiast RealCoderZ is offline
    MemberRank
    Apr 2015 Join Date
    29Posts

    Re: [Help] Command Add Points

    Can you share me Source of
    Make a new function for gObjLevelUpPointAdd.
    I have many modifications in the source so i cant run that Gameserver
    Last edited by RealCoderZ; 07-12-21 at 10:24 AM.

  8. #8
    C++ Developer zipper20032 is offline
    MemberRank
    Oct 2006 Join Date
    0x198837ADLocation
    671Posts

    Re: [Help] Command Add Points

    In the user.h add:

    Code:
    extern BOOL CommandAddPoints(BYTE type, LPOBJECTSTRUCT lpObj, int points);
    In user.cpp add:

    Code:
    BOOL CommandAddPoints(BYTE type, LPOBJECTSTRUCT lpObj, int points)
    {if (lpObj->Type > OBJTYPE_NPC)
    {LogAddC(LOGC_RED, lMsg.Get(521), lpObj->AccountID, lpObj->Name, __FILE__, __LINE__); return FALSE;    }
    
    if (lpObj->LevelUpPoint < points)    {
            LogAddChar("AddPointsCmd", lpObj, "You don't have %d - Current points: %d", points, lpObj->LevelUpPoint);        return FALSE;    }
    
    switch (type)
    {
    case 0: lpObj->Strength += points; break;
    case 1: lpObj->Dexterity += points; break;
    case 2: lpObj->Vitality += points;
    lpObj->MaxLife += lpObj->VitalityToLife;
     gObjCalcMaxLifePower(lpObj->m_Index); break;
    case 3:lpObj->Energy += points;lpObj->MaxMana += lpObj->EnergyToMana; break;
    case 4:lpObj->Leadership += points; break;
        }
    
    lpObj->LevelUpPoint -= points;
    
    gObjCalCharacter(lpObj->m_Index, 1);
    return TRUE;}

  9. #9
    Enthusiast RealCoderZ is offline
    MemberRank
    Apr 2015 Join Date
    29Posts

    Re: [Help] Command Add Points

    I used this method before, the problem that LevelupPoints doesnt affect just only after relog

  10. #10
    C++ Developer zipper20032 is offline
    MemberRank
    Oct 2006 Join Date
    0x198837ADLocation
    671Posts

    Re: [Help] Command Add Points

    The refresher is this one: gObjCalCharacter(lpObj->m_Index, 1); Try using it with byType parameter 0 and 2 too.


  11. #11
    Enthusiast RealCoderZ is offline
    MemberRank
    Apr 2015 Join Date
    29Posts

    Re: [Help] Command Add Points

    nothing :(((

  12. #12
    C++ Developer zipper20032 is offline
    MemberRank
    Oct 2006 Join Date
    0x198837ADLocation
    671Posts

    Re: [Help] Command Add Points

    I will try to set up a testing environment for that S12 and see what's the problem with it.

    - - - Updated - - -

    Meanwhile, post your code of:
    - How are you adding the commands
    - How are you using the functions
    - How you defined the commands

    Otherwise, I can't guess what you've done there.

  13. #13
    Enthusiast RealCoderZ is offline
    MemberRank
    Apr 2015 Join Date
    29Posts

    Re: [Help] Command Add Points

    INSIDE ->> BOOL CGMMng::ManagementProc(LPOBJECTSTRUCT lpObj, char* szCmd, int aIndex)
    case ADD_STRENGTH_CMD: { gCommand.AddPointsCommand(lpObj, GetTokenNumber(), 0); } break; and others same with changing CommandType From 0 to 4
    ------------------------------------------------------------------------------------------------------------------------
    VOID CCommands::AddPointsCommand(LPOBJECTSTRUCT lpObj, INT Points, DWORD CmdStatsType)
    {
    LPPMSG_LVPOINTADD lpMsg;
    PHeadSubSetB((LPBYTE)&lpMsg, 0xF3, 0x06, sizeof(LPPMSG_LVPOINTADD));
    lpMsg->Type = CmdStatsType;
    for (int i=0; i<Points; i++)
    {
    g_Function.LevelUpPointAdd(lpMsg, lpObj->m_Index);
    }

    lpObj->Money -= lpAddPointsInfo.nReqZen;

    GCMoneySend(lpObj->m_Index, lpObj->Money);
    }
    -------------------------------------------------------------------------------------------------------------------------

    Please If there any contact better :)

    Discord or Skype or Whatsapp
    Last edited by RealCoderZ; 07-12-21 at 11:20 PM.

  14. #14
    if(!caffeine) continue; leorond is offline
    MemberRank
    Jul 2012 Join Date
    Czech RepublicLocation
    491Posts

    Re: [Help] Command Add Points

    At least guide you in the right direction.

    I have used this feature for years and it is 100% functional.

    PHP Code:
    void CCommands::AddStats(int aIndexLPCSTR AddPointsDWORD Type)
    {
        
    char Message[255];

        
    int Points atoi(AddPoints);
        if(
    Points 1) return;

        
    LPOBJ lpObj = &gObj[aIndex];
        
        if(
    g_Configs.AddStatsEnable == 0) return;
        
        if(
    Points g_Configs.AddStatsMaxPoints)
        {
            
    sprintf(Message,"You can add %d point(s)",g_Configs.AddStatsMaxPoints);
            
    GCServerMsgStringSend(Message,aIndex,1);
            return;
        }

        if(
    g_Configs.AddStatsLevel lpObj->Level)
        {
            
    sprintf(Message,"You must be %d level to use this command",g_Configs.AddStatsLevel);
            
    GCServerMsgStringSend(Message,aIndex,1);
            return;
        }

        if(
    g_Configs.AddStatsCost lpObj->Money)
        {
            
    sprintf(Message,"You need %d of Zen to use this command",g_Configs.AddStatsCost);
            
    GCServerMsgStringSend(Message,aIndex,1);
            return;
        }

        if(
    Type == && lpObj->Class != CLASS_DARKLORD)
        {
            
    GCServerMsgStringSend("Command is only to DarkLord",aIndex,1);
            return;
        }

        if(
    lpObj->LevelUpPoint Points)
        {
            
    GCServerMsgStringSend("Don't have you sufficient points",aIndex,1);
            return;
        }

        
    int maxStr Points lpObj->Strength;
        if (
    Type == 3) {
            if (
    maxStr g_Configs.MaxStats) {
                
    sprintf(Message"Max stats is %d point(s)"g_Configs.MaxStats);
                
    GCServerMsgStringSend(MessageaIndex1);
                return;
            }
        }
        
    int maxAgi Points lpObj->Dexterity;
        if (
    Type == 2) {
            if (
    maxAgi g_Configs.MaxStats) {
                
    sprintf(Message"Max stats is %d point(s)"g_Configs.MaxStats);
                
    GCServerMsgStringSend(MessageaIndex1);
                return;
            }
        }
        
    int maxVit Points lpObj->Vitality;
        if (
    Type == 1) {
            if (
    maxVit g_Configs.MaxStats) {
                
    sprintf(Message"Max stats is %d point(s)"g_Configs.MaxStats);
                
    GCServerMsgStringSend(MessageaIndex1);
                return;
            }
        }
        
    int maxEne Points lpObj->Energy;
        if (
    Type == 0) {
            if (
    maxEne g_Configs.MaxStats) {
                
    sprintf(Message"Max stats is %d point(s)"g_Configs.MaxStats);
                
    GCServerMsgStringSend(MessageaIndex1);
                return;
            }
        }
        
    int maxCmd Points lpObj->Leadership;
        if (
    Type == 4) {
            if (
    maxCmd g_Configs.MaxStatsCmd) {
                
    sprintf(Message"Max stats is %d point(s)"g_Configs.MaxStatsCmd);
                
    GCServerMsgStringSend(MessageaIndex1);
                return;
            }
        }

        
    lpObj->Money -= g_Configs.AddStatsCost;
        
    GCMoneySend(aIndexlpObj->Money);

        switch(
    Type)
        {
            case 
    3:
                
    lpObj->Strength += Points;
            break;
            case 
    2:
                
    lpObj->Dexterity += Points;
            break;
            case 
    1:
                
    lpObj->Vitality += Points;
                
    lpObj->MaxLife += lpObj->VitalityToLife Points;
                
    GCReFillSend(lpObj->m_Index,lpObj->MaxLife lpObj->AddLife,0xFE,0,lpObj->iMaxShield+lpObj->iAddShield);
            break;
            case 
    0:
                
    lpObj->Energy += Points;
                
    lpObj->MaxMana += lpObj->EnergyToMana Points;
                
    gObjSetBP(lpObj->m_Index);
                
    GCManaSend(lpObj->m_Index,lpObj->MaxMana lpObj->AddMana,0xFE,0,lpObj->MaxBP);
            break;
            case 
    4:
                
    lpObj->Leadership += Points;
            break;
        }
        
    // =================================================
        //    YOU NEED THIS FOR CORRECT SENDING FUNCTION.
        // =================================================
        
    BYTE PMSG_USE_STAT_FRUIT[8] = { 0xC1,0x08,0x2C,0x00,0x01,0x00,0x03,0x00 };
        
    PMSG_USE_STAT_FRUIT[4] = LOBYTE(Points);
        
    PMSG_USE_STAT_FRUIT[5] = HIBYTE(Points);
        
    PMSG_USE_STAT_FRUIT[6] = (BYTE)Type;
        
    DataSend(aIndex,(unsigned char*)PMSG_USE_STAT_FRUIT,8);
        
    // =================================================
        
    lpObj->LevelUpPoint -= Points;
        
    GCLevelUpMsgSend(lpObj->m_Index,1);
        
    // ----
        
    gObjCalCharacter(aIndex);
        
    // ----
        
    sprintf(Message,"%d Added points!",Points);
        
    GCServerMsgStringSend(Message,aIndex,1);
        
    sprintf(Message,"Already have you %d Points",lpObj->LevelUpPoint);
        
    GCServerMsgStringSend(Message,aIndex,1);


  15. #15
    C++ Developer zipper20032 is offline
    MemberRank
    Oct 2006 Join Date
    0x198837ADLocation
    671Posts

    Re: [Help] Command Add Points

    Oh that's good. The stats refresher of the fruit attribute.

  16. #16
    Enthusiast RealCoderZ is offline
    MemberRank
    Apr 2015 Join Date
    29Posts

    ! Re: [Help] Command Add Points

    Thanks alot for your help, but am sorry cant use GCLevelUpMsgSend it sends level up effect + differs the experience of the character.



Advertisement