Trying to write some commands.

Results 1 to 4 of 4
  1. #1
    Member BlackPaper is offline
    MemberRank
    Jun 2016 Join Date
    75Posts

    Trying to write some commands.

    void BuyCommand(int aIndex,char* Message){
    OBJECTSTRUCT* gObj = (OBJECTSTRUCT*)(aIndex * OBJECT_SIZE + OBJECT_BASE);


    if(strlen(Message) < 1)
    {
    GCServerMsgStringSend("Usage: /buy knightblade",aIndex,1);
    }



    if(strcmp(Message, "knightblade")==0) {


    ItemSerialCreateSend(aIndex,gObj->MapNumber,gObj->X,gObj->Y,20,13,0,1,1,7,aIndex,63,0);

    GCServerMsgStringSend("Enjoy your Knight Blade.",aIndex,1);


    return;
    }



    }



    - - - Updated - - -

    Okay I got it to work.
    I want now that the command will check whether the player has 20 PCPoints/resets/anything before it gives him the knight blade, and if he doesn't have 20 he won't get the knight blade.

    any help on this one?
    I need to get some data from SQL but I don't exactly know how..
    Last edited by BlackPaper; 16-08-16 at 12:00 AM.


  2. #2
    Member BlackPaper is offline
    MemberRank
    Jun 2016 Join Date
    75Posts

    Re: Trying to write some commands.

    Up.. why can't people help?
    I feel like some people know MU coding and they just don't want anybody else to know so they can make money from it.

    - - - Updated - - -

    Will this check work?
    if(lpObj->Reset < 20) {
    GCServerMsgStringSend("You don't have 20 resets.",aIndex,1);
    return;
    }

  3. #3
    Don't be afraid to ask! RevolGaming is offline
    MemberRank
    Jun 2012 Join Date
    1,458Posts

    Re: Trying to write some commands.

    GCServerMsgStringSend("You don't have 20 resets.",aIndex,1);

    This is a text send for the user, so it will display this "error message" for the user.


    lpObj->Reset is the character reset.

    if you find anywhere in the source some kind of like this for example

    lpObj->Wcoin

    Than you can make this

    if(lpObj->Wcoin<=20){
    Give knightblade -> you can drop it with item creator code (so the server will give him drop to the floor)
    }

  4. #4
    Member BlackPaper is offline
    MemberRank
    Jun 2016 Join Date
    75Posts

    Re: Trying to write some commands.

    Quote Originally Posted by RevolGaming View Post
    GCServerMsgStringSend("You don't have 20 resets.",aIndex,1);

    This is a text send for the user, so it will display this "error message" for the user.


    lpObj->Reset is the character reset.

    if you find anywhere in the source some kind of like this for example

    lpObj->Wcoin

    Than you can make this

    if(lpObj->Wcoin<=20){
    Give knightblade -> you can drop it with item creator code (so the server will give him drop to the floor)
    }
    I've got a problem. I wrote this command:
    case 218:{
    if(lpObj->Resets < 20)
    {
    GCServerMsgStringSend("You don't have 20 resets.",aIndex,1);
    return FALSE;
    } else {

    GCServerMsgStringSend("Congratulations, you've bought a Knight Blade.",aIndex,1);
    lpObj->Resets -= 20;
    ItemSerialCreateSend(aIndex, gObj[aIndex].MapNumber, gObj[aIndex].X, gObj[aIndex].Y, 20,13,255,1,1,7,aIndex,63,0);
    return 1;
    }


    }
    Now I opened a 21 reset player.
    First time using the command, it gives me the item.
    second time using it it says that I don't have 20 resets - until here everything is fine.
    If I switch or disconnect and connect again, however, I still have 21 resets and I can buy another knight blade.

    Do you have any idea?

    In this source, when they take money for post, after the -=postcost line they have this :
    GCMoneySend(lpObj->m_Index,lpObj->Money);
    now I tried to use the same line with resets:
    GCResetsSend(lpObj->m_Index,lpObj->Resets);
    but it doesn't work.
    So I want to add this function :
    GCResetSend
    do you know how do I do that?

    okay nevermind, theard can be closed, I read ResetSystem in order to get how they update the resets of a character and found it :)
    Last edited by BlackPaper; 16-08-16 at 01:52 PM.



Advertisement