下面這段是小弟設計解決身上金錢過多 而開出金錢道具時會消失的辦法 直接存入個人銀行
#ifdef _ITEM_GOLD void ITEM_Gold( int charaindex, int toindex, int haveitemindex) { int itemindex = CHAR_getItemIndex( charaindex, haveitemindex); char itemarg[10]; int fd = getfdFromCharaIndex( charaindex); Char *chwk; chwk = CHAR_getCharPointer( toindex); char token[64]; int gold = 0; BOOL bPutToBank = FALSE; strcpy(itemarg,ITEM_getChar(itemindex,ITEM_ARGUMENT)); gold = atoi(itemarg); bPutToBank = FALSE; if(CHAR_getInt(charaindex ,CHAR_GOLD) + gold>CHAR_getMaxHaveGold(charaindex)){ if(CHAR_getInt(charaindex,CHAR_BANKGOLD) + gold > 10000000){ sprintf( token, "你身上及個人銀行存款已滿", atoi(itemarg)); CHAR_talkToCli( charaindex, -1, token, CHAR_COLORRED ); return; } bPutToBank = TRUE; } if (!chwk) return; CHAR_charSaveFromConnectAndChar( fd, chwk ,FALSE ); if(bPutToBank) CHAR_setInt(charaindex,CHAR_BANKGOLD, CHAR_getInt(charaindex,CHAR_BANKGOLD) + gold); else CHAR_setInt( charaindex , CHAR_GOLD,CHAR_getInt(charaindex,CHAR_GOLD) + gold); CHAR_complianceParameter( charaindex); CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD); if(bPutToBank)sprintf( token, "%dS已存入個人銀行", atoi(itemarg)); else sprintf( token, "你的石幣增加%dS", atoi(itemarg)); CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW ); CHAR_talkToCli(charaindex, -1, "系統自動為您存檔!", CHAR_COLORRED); CHAR_DelItem( charaindex, haveitemindex); } #endif |