搜索
查看: 2388|回复: 0

【自己解决】关于魔兽232修改cs_get_user_money2的问题

[复制链接]
发表于 2009-8-13 05:20:48 | 显示全部楼层 |阅读模式 来自 中国–山东–济南
本帖最后由 masher0782 于 2009-8-13 05:33 编辑

服务器安装了war3ft和无限金钱2
将stocks中的
cs_get_user_money改成cs_get_user_money2
cs_set_user_money改成cs_set_user_money2
然后编译出现一个warning,从未使用的变量Lang_GetSkillInfo
然后插件正常运行,但是购买物品时,当金钱大于16000还是当做16000对待,比如本来有10w,买了个突袭,就变成0了,而且插件是用的cs_set_user_money2改变的金钱数量,本人小白,求解?

=============================
已经自己解决了,stocks.inc里有一段血法师吸钱吸到16000就不吸了的代码,删除问题解决,下面是stocks.inc的代码,兼容无限金钱2插件,下面的压缩包就是stocks.inc,想省钱可以不下。
  1. stock diff(num,num2){
  2.         if(num>num2)
  3.                 return (num-num2)
  4.         else
  5.                 return (num2-num)
  6.         return 0
  7. }

  8. stock find_target(id,const arg[]) {
  9. new player = find_player("bl",arg)
  10. if(player){
  11. if ( player != find_player("blj",arg) ){
  12. console_print(id,"%L",id,"THERE_ARE_MORE")
  13. return 0
  14. }
  15. }
  16. else if((player = find_player("c",arg) )==0 && arg[0]=='#' && arg[1] )
  17. player = find_player("k",str_to_num(arg[1]))
  18. if(!player){
  19. console_print(id,"%L",id,"CLIENT_NOT_FOUND")
  20. return 0
  21. }

  22. return player
  23. }

  24. stock isPrimary(weapon){
  25.         if(weapon==CSW_GALIL||weapon==CSW_FAMAS||weapon==CSW_M3||weapon==CSW_XM1014||weapon==CSW_MP5NAVY||weapon==CSW_TMP ||weapon==CSW_P90||weapon==CSW_MAC10||weapon==CSW_UMP45||weapon==CSW_AK47||weapon==CSW_SG552||weapon==CSW_M4A1||weapon==CSW_AUG||weapon==CSW_SCOUT ||weapon==CSW_AWP||weapon==CSW_G3SG1||weapon==CSW_SG550||weapon==CSW_M249)
  26.                 return true

  27.         return false
  28. }

  29. stock isSecondary(weapon){
  30.         if(weapon==CSW_P228||weapon==CSW_ELITE||weapon==CSW_FIVESEVEN||weapon==CSW_USP||weapon==CSW_GLOCK18||weapon==CSW_DEAGLE)
  31.                 return true

  32.         return false
  33. }

  34. stock find_free_spawn(id, iTeamNumber, Float:spawnOrigin[3], Float:spawnAngle[3]){
  35.         new iSpawn
  36.         if(iTeamNumber == CTS)
  37.                 iSpawn=0
  38.         else
  39.                 iSpawn=1

  40.         const maxSpawns = 128
  41.         new spawnPoints[maxSpawns]
  42.         new ent = -1, spawnsFound = 0

  43.         /* Find all of the spawn points */
  44.         do {
  45.                 ent = find_ent_by_class(ent,spawnEntString[iSpawn])
  46.                 if (ent != 0) {
  47.                         spawnPoints[spawnsFound] = ent
  48.                         spawnsFound++
  49.                 }
  50.         }
  51.         while (ent && spawnsFound < maxSpawns)

  52.         new bool:foundFreeSpawn
  53.         new Float:vicinity = 96.0                //(32x32x96)
  54.         new i
  55.         new playersInVicinity
  56.         new entList[1]
  57.        
  58.         /* Loop through all the spawn points */
  59.         for (i = 0;i < spawnsFound && !foundFreeSpawn;i++) {

  60.                 if(spawnPoints[i] != 0 && !spawnPointsused[i]){
  61.                         /* Get the origin of the spawn point */
  62.                         entity_get_vector(spawnPoints[i],EV_VEC_origin,spawnOrigin)

  63.                         /* Determine if a player is in this vicinity */
  64.                         playersInVicinity = find_sphere_class(0, "player", vicinity, entList, 1, spawnOrigin)

  65.                         /* If not, we want to transport the player here */
  66.                         if (playersInVicinity == 0){
  67.                                 foundFreeSpawn = true
  68.                                 spawnPointsused[i] = true
  69.                         }
  70.                         /* Otherwise we don't */
  71.                         else{
  72.                                 foundFreeSpawn = false
  73.                         }
  74.                 }
  75.                 #if DEBUG
  76.                         console_print(id, "[WAR3FT][%d] Searching %d, used: %d, found:%d", i, spawnPoints[i], spawnPointsused[i], foundFreeSpawn)
  77.                 #endif
  78.                 id--

  79.         }

  80.         if( foundFreeSpawn && spawnPoints[i] ){
  81.                 entity_get_vector(spawnPoints[i], EV_VEC_angles, spawnAngle)

  82.                 return spawnPoints[i]
  83.         }

  84.         return -1
  85. }

  86. stock get_user_actualhealth(id){

  87.         new health = get_user_health(id)

  88.         // Player has god mode

  89.         if ( health > 1500 )
  90.                 return health - 2048

  91.         // Player will evade the next shot

  92.         if ( health > 500 )
  93.                 return health - 1024


  94.         return health
  95. }

  96. stock get_user_maxhealth(id){

  97.         new maxHealth = 100

  98.         // Human Devotion Skill

  99.         if ( Verify_Skill(id, RACE_HUMAN, SKILL2) ){
  100.                 maxHealth += (p_devotion[p_data[id][P_SKILL2]-1] - 100)
  101.         }

  102.         // Player has a health bonus from the Periapt of Health

  103.         if ( p_data[id][P_ITEM]==ITEM_HEALTH ){
  104.                 maxHealth += iCvar[FT_HEALTH_BONUS]
  105.         }

  106.         return maxHealth
  107. }

  108. stock Verify_Race(id, race){

  109.         if( id == 0 )
  110.                 return false
  111.        
  112.         if( p_data[id][P_RACE] == race )
  113.                 return true

  114.         else if( (p_data[id][P_RACE] == 9) ){
  115.                 if ( race9Options[1] == race )
  116.                         return true
  117.                 if ( race9Options[2] == race )
  118.                         return true
  119.                 if ( race9Options[3] == race )
  120.                         return true
  121.                 if ( race9Options[4] == race )
  122.                         return true
  123.         }

  124.         return false
  125. }

  126. stock Verify_Skill(id, race, skill){

  127.         if( id == 0 )
  128.                 return false

  129.         if( ((p_data[id][P_RACE] == 9 && race9Options[skill] == race) || p_data[id][P_RACE] == race) && p_data[id][skill] )
  130.                 return true

  131.         return false
  132. }

  133. stock Status_Text(id, szMessage[], Float:fDuration, Float:iYPos){
  134.         #if ADVANCED_DEBUG
  135.                 writeDebugInfo("WAR3_status_text",0)
  136.         #endif

  137.         #if MOD == 1
  138.                 Create_HudText(id, szMessage, 1)
  139.                 iYPos--
  140.         #else
  141.                 set_hudmessage(255, 208, 0, HUDMESSAGE_POS_CENTER, iYPos, 0, 6.0, fDuration, 0.1, 0.5, HUDMESSAGE_CHAN_STATUS)
  142.                 show_hudmessage(id, szMessage)
  143.         #endif

  144.     // Print important messages to console
  145.     if ( fDuration > 4.0 ){
  146.         console_print( id, "%s %s", g_MODclient, szMessage )
  147.     }
  148. }

  149. stock race9_randomize(){
  150.         #if ADVANCED_DEBUG
  151.                 writeDebugInfo("race9_randomize",0)
  152.         #endif

  153.         if (iCvar[FT_RACES] == 9){
  154.                 if (iCvar[FT_RACE9_RANDOM]){
  155.                         new myintvallocal = 0
  156.                         // loop through all four skill options (3 + ultimate) pick a new race at random and update the skill
  157.                         while (myintvallocal < 4){
  158.                                 race9Options[myintvallocal + 1] = random_num(1,8)
  159.                                 ++myintvallocal
  160.                         }
  161.                 }
  162.         }
  163. }

  164. stock set_user_money(id, money, show = 1){
  165.         #if ADVANCED_DEBUG
  166.                 writeDebugInfo("set_user_money",id)
  167.         #endif

  168.         if(!p_data_b[id][PB_ISCONNECTED])
  169.                 return PLUGIN_CONTINUE

  170.         #if MOD == 0
  171.                 cs_set_user_money2(id,money,show)
  172.         #endif
  173.         #if MOD == 1
  174.                 show--
  175.                 new parm[3]
  176.                 parm[0] = id
  177.                 parm[1] = 1
  178.                 parm[2] = money - get_user_money(id)

  179.                 p_data[id][P_MONEY]=money
  180.                 _DOD_showMoney(parm)
  181.         #endif
  182.         return PLUGIN_CONTINUE
  183. }

  184. stock get_user_money(id){
  185.         #if ADVANCED_DEBUG
  186.                 writeDebugInfo("get_user_money",id)
  187.         #endif

  188.         if(!p_data_b[id][PB_ISCONNECTED])
  189.                 return PLUGIN_CONTINUE

  190.         #if MOD == 0
  191.                 new money = cs_get_user_money2(id)
  192.                        
  193.                 return money
  194.         #endif
  195.         #if MOD == 1
  196.                 return p_data[id][P_MONEY]
  197.         #endif
  198. }
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表