Jump to content

Denis

Banned
  • Posts

    1031
  • Joined

  • Last visited

  • Days Won

    53
  • Feedback

    0%

Posts posted by Denis

  1.  

     

    Take a look at this example:

    std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery("SELECT coins FROM account.account WHERE id = 1"));
    
    if (msg->Get()->uiNumRows == 0)
    {
    	return 0;
    }
    
    int coins = 0;
    
    MYSQL_ROW row = mysql_fetch_row(msg->Get()->pSQLResult);
    str_to_number(coins, row[0]);
    

    char szQuery[512];
    snprintf(szQuery,sizeof(szQuery),"SELECT coins FROM account WHERE id = %u",ch->GetAID());
    std::auto_ptr<SQLMsg> pMsg(CDBManager::instance().DirectQuery(szQuery,SQL_ACCOUNT));
    
    if(pMsg->Get()->uiNumRows > 0)
    {
    	int iCoins = 0;
    	MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);
    	str_to_number(iCoins,row[0]);
    }
    

    Kind Regards

    Zerelth ~ Ellie

     

     

    Your point?

  2. struct DanceCommand
    {
        DanceCommand() :
        {
        }
    
        void operator () (LPENTITY ent)
        {
            if (!ent->IsType(ENTITY_CHARACTER))
                return;
    
            LPCHARACTER pkChr = (LPCHARACTER) ent;
            
            const char* command = "dance 5"; // if it won't work try to replace dance 5 with /dance 5
            size_t len = strlen(command);
            interpret_command(pkChr, command, len);
        }
    };
    
    ACMD(do_new_command)
    {
        char arg1[256];
        one_argument(argument, arg1, sizeof(arg1));
    
        DanceCommand func(ch);
    
        LPSECTREE sectree = ch->GetSectree();
        if (sectree)
        {
            sectree->ForEachAround(func);
        }
        else
        {
            sys_err("PURGE_ERROR.NULL_SECTREE(mapIndex=%d, pos=(%d, %d)", ch->GetMapIndex(), ch->GetX(), ch->GetY());
        }
    }
    
    
    • Love 2
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.