hlmod.hu
https://hlmod.hu/

Szerver Bolt [Bug Fix + Új verzió]
https://hlmod.hu/viewtopic.php?f=29&t=5899
Oldal: 1 / 1

Szerző:  csmania991 [2012.09.09. 10:51 ]
Hozzászólás témája:  Szerver Bolt [Bug Fix + Új verzió]

Csáó

Itt egy SMA, valaki ki tudná szedni belőle az utolsó négy cuccot hogy csak a csavarhúzó maradjon?
A csavarhúzó sebzése legyen 100 kicsivel és naggyal is és 1 körig tartson..
15 pontba kerüljön...
1 ellenfél ölésért 5 pontot lehessen kapni...

Kód:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <hamsandwich>
#include <colorchat>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "HunGamer"

new g_pontok[33];
new bool:g_csavar[33];
new shop1;
new shop2;
new shop3;
new shop4;
new shop5;
new syncObjp;

new VIEW_MODELCSAVAR[]       = "models/v_csavarhuzo.mdl";
new PLAYER_MODELCSAVAR[]    = "models/p_csavarhuzo.mdl";

public plugin_init()
{
   register_plugin(PLUGIN, VERSION, AUTHOR);
   
   register_event("DeathMsg", "Death", "a");
   register_event("CurWeapon",    "Change_Weapon", "be", "1=1");
   
   register_clcmd("say /bolt", "boltmenu");
   
   RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1);
   RegisterHam(Ham_TakeDamage, "player", "TakeDamage", 0);
   
   shop1 = register_cvar("shop_1", "5");
   shop2 = register_cvar("shop_2", "10");
   shop3 = register_cvar("shop_3", "15");
   shop4 = register_cvar("shop_4", "20");
   shop5 = register_cvar("shop_5", "35");
   syncObjp = CreateHudSyncObj();
}
public plugin_precache()
{
    precache_model(VIEW_MODELCSAVAR);
    precache_model(PLAYER_MODELCSAVAR);
}
public Death()
{
   new id = read_data(2);
   new attacker = read_data(1);
   
   if(!is_user_alive(attacker))
      return PLUGIN_CONTINUE;
   
   if(get_user_team(id) != get_user_team(attacker))
   {
      g_pontok[attacker]+=1;
   }
   
   return PLUGIN_CONTINUE;
}
public boltmenu(id)
{
   if(get_user_team(id) == 1)
   {
      if(is_user_alive(id))
      {
         static opcion[64];
         
         formatex(opcion, charsmax(opcion),"\yBolt");
         new iMenu = menu_create(opcion, "boltmenuh");
         
         formatex(opcion, charsmax(opcion),"\wCsavarhuzo \r%d pont", get_pcvar_num(shop1));
         menu_additem(iMenu, opcion, "1");
         
         formatex(opcion, charsmax(opcion),"\wPajzs \r%d pont", get_pcvar_num(shop2));
         menu_additem(iMenu, opcion, "2");
         
         formatex(opcion, charsmax(opcion),"\wGranatok \r%d pont", get_pcvar_num(shop3));
         menu_additem(iMenu, opcion, "3");
         
         formatex(opcion, charsmax(opcion),"\wElet(+50) \r%d pont", get_pcvar_num(shop4));
         menu_additem(iMenu, opcion, "4");
         
         formatex(opcion, charsmax(opcion),"\wUsp \r%d pont", get_pcvar_num(shop5));
         menu_additem(iMenu, opcion, "5");
         
         menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL);
         menu_display(id, iMenu, 0);
      }
      else
      {
         ColorChat(id, GREEN, "Csak elok hasznalhatjak a boltot");
      }
   }
   else
   {
      ColorChat(id, GREEN, "Csak terroristak hasznalhatjak a boltot");
   }
                 
   return PLUGIN_HANDLED;
}

public boltmenuh(id, menu, item)
{
   
   if (item == MENU_EXIT)
   {
      menu_destroy(menu);
      return PLUGIN_HANDLED;
   }
   
   new Data[6], Name[64];
   new Access, Callback;
   
   menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback);
   
   new elo    = is_user_alive(id);
   new item_ar1    = get_pcvar_num(shop1);
   new item_ar2    = get_pcvar_num(shop2);
   new item_ar3    = get_pcvar_num(shop3);
   new item_ar4    = get_pcvar_num(shop4);
   new item_ar5    = get_pcvar_num(shop5);
   
   new Key = str_to_num(Data);
   
   switch (Key)
   {
      case 1:
      {
         if (g_pontok[id]>= item_ar1 && elo)
         {
            g_pontok[id] -= item_ar1;
            g_csavar[id] = true;
         }
      }
      case 2:
      {
         if (g_pontok[id]>= item_ar2 && elo)
         {
            g_pontok[id] -= item_ar2;
            set_user_armor(id, 100);
         }
      }
      case 3:
      {
         if (g_pontok[id]>= item_ar3 && elo)
         {
            g_pontok[id] -= item_ar3;
            give_item(id, "weapon_hegrenade");
            give_item(id, "weapon_flashbang");
            give_item(id, "weapon_flashbang");
            give_item(id, "weapon_smokegrenade");
         }
      }
      case 4:
      {
         if (g_pontok[id]>= item_ar4 && elo)
         {
            g_pontok[id] -= item_ar4;
            set_user_health(id, get_user_health(id)+50);
         }
      }
      case 5:
      {
         if (g_pontok[id]>= item_ar5 && elo)
         {
            g_pontok[id] -= item_ar5;
            give_item(id, "weapon_usp");
            give_item(id, "ammo_45acp");
            give_item(id, "ammo_45acp");
            give_item(id, "ammo_45acp");
         }
      }
   }
   
   menu_destroy(menu);
   return PLUGIN_HANDLED;
}
public Change_Weapon(id)
{
      new weaponID = read_data(2);
     
      if(get_user_team(id) == 1)
      {
            if(weaponID == CSW_KNIFE && g_csavar[id])
            {
               entity_set_string(id, EV_SZ_viewmodel, VIEW_MODELCSAVAR);
               entity_set_string(id, EV_SZ_weaponmodel, PLAYER_MODELCSAVAR);
            }
      }
      return PLUGIN_CONTINUE;
}
public PlayerSpawn(id)
{
   if (is_user_alive(id))
   {
      if(get_user_team(id) == 1)
         boltmenu(id);
   }
}
public TakeDamage(victim, inflictor, attacker, Float:damage, damage_bits)
{
   if(get_user_weapon(attacker) == CSW_KNIFE)   
   {
      if(get_user_team(attacker) == 1 && g_csavar[attacker])
      {
         SetHamParamFloat(4, 50.0);
      }
   }
   return HAM_IGNORED;
}
public client_PreThink(id)
{
   if(get_user_team(id) == 1)
   {
      set_hudmessage(255, 255, 255, 0.9, 0.8, 0, 6.0, 4.5);
      ShowSyncHudMsg(id, syncObjp,"Pontjaid: %i", g_pontok[id]);
   }
   return PLUGIN_CONTINUE;
}

Szerző:  HunGamer [2012.09.09. 11:28 ]
Hozzászólás témája:  Re: Szerver Bolt [Bug Fix + Új verzió]

Try:
SMA Forráskód: [ Mindet kijelol ]
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <fun>
  6. #include <engine>
  7. #include <hamsandwich>
  8. #include <colorchat>
  9.  
  10. #define PLUGIN "New Plug-In"
  11. #define VERSION "1.0"
  12. #define AUTHOR "HunGamer"
  13.  
  14. new g_pontok[33];
  15. new bool:g_csavar[33];
  16. new shop1;
  17. new syncObjp;
  18.  
  19. new VIEW_MODELCSAVAR[] = "models/v_csavarhuzo.mdl";
  20. new PLAYER_MODELCSAVAR[] = "models/p_csavarhuzo.mdl";
  21.  
  22. public plugin_init()
  23. {
  24. register_plugin(PLUGIN, VERSION, AUTHOR);
  25.  
  26. register_event("DeathMsg", "Death", "a");
  27. register_event("CurWeapon", "Change_Weapon", "be", "1=1");
  28. register_logevent("Event_Roundend", 2, "1=Round_End")
  29.  
  30. register_clcmd("say /bolt", "boltmenu");
  31.  
  32. RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1);
  33. RegisterHam(Ham_TakeDamage, "player", "TakeDamage", 0);
  34.  
  35. shop1 = register_cvar("shop_1", "15");
  36. syncObjp = CreateHudSyncObj();
  37. }
  38. public plugin_precache()
  39. {
  40. precache_model(VIEW_MODELCSAVAR);
  41. precache_model(PLAYER_MODELCSAVAR);
  42. }
  43. public Event_Roundend()
  44. {
  45. new players[32], pnum, tempid;
  46. get_players(players, pnum, "c");
  47.  
  48. for(new i; i<pnum; i++)
  49. {
  50. tempid = players[i];
  51. g_csavar[tempid] = false;
  52. }
  53. }
  54. public Death()
  55. {
  56. new id = read_data(2);
  57. new attacker = read_data(1);
  58.  
  59. if(!is_user_alive(attacker))
  60. return PLUGIN_CONTINUE;
  61.  
  62. if(get_user_team(id) != get_user_team(attacker))
  63. {
  64. g_pontok[attacker]+=5;
  65. }
  66.  
  67. return PLUGIN_CONTINUE;
  68. }
  69. public boltmenu(id)
  70. {
  71. if(get_user_team(id) == 1)
  72. {
  73. if(is_user_alive(id))
  74. {
  75. static opcion[64];
  76.  
  77. formatex(opcion, charsmax(opcion),"\yBolt");
  78. new iMenu = menu_create(opcion, "boltmenuh");
  79.  
  80. formatex(opcion, charsmax(opcion),"\wCsavarhuzo \r%d pont", get_pcvar_num(shop1));
  81. menu_additem(iMenu, opcion, "1");
  82.  
  83. menu_setprop(iMenu, MPROP_EXIT, MEXIT_ALL);
  84. menu_display(id, iMenu, 0);
  85. }
  86. else
  87. {
  88. ColorChat(id, GREEN, "Csak elok hasznalhatjak a boltot");
  89. }
  90. }
  91. else
  92. {
  93. ColorChat(id, GREEN, "Csak terroristak hasznalhatjak a boltot");
  94. }
  95.  
  96. return PLUGIN_HANDLED;
  97. }
  98.  
  99. public boltmenuh(id, menu, item)
  100. {
  101.  
  102. if (item == MENU_EXIT)
  103. {
  104. menu_destroy(menu);
  105. return PLUGIN_HANDLED;
  106. }
  107.  
  108. new Data[6], Name[64];
  109. new Access, Callback;
  110.  
  111. menu_item_getinfo(menu, item, Access, Data,5, Name, 63, Callback);
  112.  
  113. new elo = is_user_alive(id);
  114. new item_ar1 = get_pcvar_num(shop1);
  115.  
  116. new Key = str_to_num(Data);
  117.  
  118. switch (Key)
  119. {
  120. case 1:
  121. {
  122. if (g_pontok[id]>= item_ar1 && elo)
  123. {
  124. g_pontok[id] -= item_ar1;
  125. g_csavar[id] = true;
  126. entity_set_string(id, EV_SZ_viewmodel, VIEW_MODELCSAVAR);
  127. entity_set_string(id, EV_SZ_weaponmodel, PLAYER_MODELCSAVAR);
  128. }
  129. }
  130. }
  131.  
  132. menu_destroy(menu);
  133. return PLUGIN_HANDLED;
  134. }
  135. public Change_Weapon(id)
  136. {
  137. new weaponID = read_data(2);
  138.  
  139. if(get_user_team(id) == 1)
  140. {
  141. if(weaponID == CSW_KNIFE && g_csavar[id])
  142. {
  143. entity_set_string(id, EV_SZ_viewmodel, VIEW_MODELCSAVAR);
  144. entity_set_string(id, EV_SZ_weaponmodel, PLAYER_MODELCSAVAR);
  145. }
  146. }
  147. return PLUGIN_CONTINUE;
  148. }
  149. public PlayerSpawn(id)
  150. {
  151. if (is_user_alive(id))
  152. {
  153. if(get_user_team(id) == 1)
  154. boltmenu(id);
  155. }
  156. }
  157. public TakeDamage(victim, inflictor, attacker, Float:damage, damage_bits)
  158. {
  159. if(get_user_weapon(attacker) == CSW_KNIFE)
  160. {
  161. if(get_user_team(attacker) == 1 && g_csavar[attacker])
  162. {
  163. SetHamParamFloat(4, 100.0);
  164. }
  165. }
  166. return HAM_IGNORED;
  167. }
  168. public client_PreThink(id)
  169. {
  170. if(get_user_team(id) == 1)
  171. {
  172. set_hudmessage(255, 255, 255, 0.9, 0.8, 0, 6.0, 4.5);
  173. ShowSyncHudMsg(id, syncObjp,"Pontjaid: %i", g_pontok[id]);
  174. }
  175. return PLUGIN_CONTINUE;
  176. }

Szerző:  csmania991 [2012.09.09. 12:40 ]
Hozzászólás témája:  Re: Szerver Bolt [Bug Fix + Új verzió]

Azt írja amxx formátumba konvertálásnál hogy hiba...
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
edit:
Aj hoppá semmi xd semmi megy csak én voltam hülye... Köszi

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/