hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.28. 21:20



Jelenlévő felhasználók

Jelenleg 211 felhasználó van jelen :: 2 regisztrált, 0 rejtett és 209 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot], Google [Bot] az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: PaintBall fegyver
HozzászólásElküldve: 2016.04.29. 18:59 
Offline
Senior Tag

Csatlakozott: 2015.08.11. 14:21
Hozzászólások: 215
Megköszönt másnak: 50 alkalommal
Megköszönték neki: 6 alkalommal
A paintball módban a fegyvernek, hogy csináljak alapból 400speedet.Már felvettem a server.cfg-ben 400ra... Válaszokat előre is köszönöm!


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: PaintBall fegyver
HozzászólásElküldve: 2016.04.29. 19:36 
Offline
Jómunkásember

Csatlakozott: 2015.11.29. 17:07
Hozzászólások: 375
Megköszönt másnak: 76 alkalommal
Megköszönték neki: 53 alkalommal
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <fakemeta>
  4. #include <hamsandwich>
  5.  
  6. #define PLUGIN_NAME "Real Weapon Speed"
  7. #define PLUGIN_VERSION  "1.0"
  8. #define PLUGIN_AUTHOR   "Numb"
  9.  
  10. //#define DEBUG
  11.  
  12. #define PDWeaponType    43
  13. #define PDNextSecAttack 47
  14. #define PDActiveItem    373
  15.  
  16. #define WEIGHT_GLOCK18      0.900
  17. #define WEIGHT_USP          1.000
  18. #define WEIGHT_DEAGLE       1.800
  19. #define WEIGHT_P228         1.030
  20. #define WEIGHT_ELITE        1.150
  21. #define WEIGHT_FIVESEVEN    0.618
  22. #define WEIGHT_M3           3.500
  23. #define WEIGHT_XM1014       4.000
  24. #define WEIGHT_MP5NAVY      3.420
  25. #define WEIGHT_MAC10        3.820
  26. #define WEIGHT_TMP          1.300
  27. #define WEIGHT_P90          3.000
  28. #define WEIGHT_UMP45        2.270
  29. #define WEIGHT_GALIL        4.350
  30. #define WEIGHT_FAMAS        3.400
  31. #define WEIGHT_AK47         4.790
  32. #define WEIGHT_M4A1         3.220
  33. #define WEIGHT_SG552        3.100
  34. #define WEIGHT_AUG          4.090
  35. #define WEIGHT_G3SG1        4.410
  36. #define WEIGHT_SG550        7.020
  37. #define WEIGHT_SCOUT        3.300
  38. #define WEIGHT_AWP          6.000
  39. #define WEIGHT_M249         6.000
  40. #define WEIGHT_FLASHBANG    0.350
  41. #define WEIGHT_HEGRENADE    0.350
  42. #define WEIGHT_SMOKEGRENADE 0.350
  43. #define WEIGHT_C4           2.000
  44. #define WEIGHT_KNIFE        0.200
  45. #define WEIGHT_SHIELD       5.000
  46. #define WEIGHT_USP_S        0.200
  47. #define WEIGHT_M4A1_S       0.200
  48.  
  49. #define SPEED_BONUCE_SHIELD 50
  50. #define SPEED_BONUCE_ZOOM1  20
  51. #define SPEED_BONUCE_ZOOM2  40
  52. #define SPEED_BONUCE_ZOOM3  80
  53.  
  54.  
  55. new const Float:fWeaponWeights[] =
  56. {
  57.     0.0,
  58.     WEIGHT_P228,
  59.     0.0,
  60.     WEIGHT_SCOUT,
  61.     WEIGHT_HEGRENADE,
  62.     WEIGHT_XM1014,
  63.     WEIGHT_C4,
  64.     WEIGHT_MAC10,
  65.     WEIGHT_AUG,
  66.     WEIGHT_SMOKEGRENADE,
  67.     WEIGHT_ELITE,
  68.     WEIGHT_FIVESEVEN,
  69.     WEIGHT_UMP45,
  70.     WEIGHT_SG550,
  71.     WEIGHT_GALIL,
  72.     WEIGHT_FAMAS,
  73.     WEIGHT_USP,
  74.     WEIGHT_GLOCK18,
  75.     WEIGHT_AWP,
  76.     WEIGHT_MP5NAVY,
  77.     WEIGHT_M249,
  78.     WEIGHT_M3,
  79.     WEIGHT_M4A1,
  80.     WEIGHT_TMP,
  81.     WEIGHT_G3SG1,
  82.     WEIGHT_FLASHBANG,
  83.     WEIGHT_DEAGLE,
  84.     WEIGHT_SG552,
  85.     WEIGHT_AK47,
  86.     WEIGHT_KNIFE,
  87.     WEIGHT_P90,
  88. };
  89.  
  90. new Float:g_fOldNextSecAttack;
  91.  
  92. new g_iCvarP_MinSpeed;
  93. new g_iCvarP_MaxSpeed;
  94. new g_iCvarP_MinGrav;
  95. new g_iCvarP_MaxGrav;
  96.  
  97. public plugin_init()
  98. {
  99.     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
  100.    
  101.     g_iCvarP_MinSpeed = register_cvar("rw_min_speed",            "400.0");
  102.     g_iCvarP_MaxSpeed = register_cvar("rw_max_speed",            "400.0");
  103.     g_iCvarP_MinGrav  = register_cvar("rw_highest_gravity_proc", "0.81");
  104.     g_iCvarP_MaxGrav  = register_cvar("rw_lowest_gravity_proc",  "1.01");
  105.    
  106.     new const iWeaponList[29][] =
  107.     {
  108.         "weapon_glock18",
  109.         "weapon_usp",
  110.         "weapon_deagle",
  111.         "weapon_p228",
  112.         "weapon_elite",
  113.         "weapon_fiveseven",
  114.         "weapon_m3",
  115.         "weapon_xm1014",
  116.         "weapon_mp5navy",
  117.         "weapon_mac10",
  118.         "weapon_tmp",
  119.         "weapon_p90",
  120.         "weapon_ump45",
  121.         "weapon_galil",
  122.         "weapon_famas",
  123.         "weapon_ak47",
  124.         "weapon_m4a1",
  125.         "weapon_sg552",
  126.         "weapon_aug",
  127.         "weapon_g3sg1",
  128.         "weapon_sg550",
  129.         "weapon_scout",
  130.         "weapon_awp",
  131.         "weapon_m249",
  132.         "weapon_flashbang",
  133.         "weapon_hegrenade",
  134.         "weapon_smokegrenade",
  135.         "weapon_knife",
  136.         "weapon_c4"
  137.     };
  138.    
  139.     for( new iTemp; iTemp<29; iTemp++ )
  140.     {
  141.         RegisterHam(Ham_Item_Deploy,         iWeaponList[iTemp], "Ham_Item_Deploy_Post",    1);
  142.         RegisterHam(Ham_CS_Item_GetMaxSpeed, iWeaponList[iTemp], "Ham_GetItemMaxSpeed_Pre", 0);
  143.     }
  144.    
  145.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_usp",   "Ham_SecondaryAttack_Pre",  0);
  146.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_m4a1",  "Ham_SecondaryAttack_Pre",  0);
  147.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_sg552", "Ham_SecondaryAttack_Pre",  0);
  148.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_aug",   "Ham_SecondaryAttack_Pre",  0);
  149.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_g3sg1", "Ham_SecondaryAttack_Pre",  0);
  150.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_sg550", "Ham_SecondaryAttack_Pre",  0);
  151.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_scout", "Ham_SecondaryAttack_Pre",  0);
  152.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_awp",   "Ham_SecondaryAttack_Pre",  0);
  153.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_usp",   "Ham_SecondaryAttack_Post", 1);
  154.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_m4a1",  "Ham_SecondaryAttack_Post", 1);
  155.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_sg552", "Ham_SecondaryAttack_Post", 1);
  156.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_aug",   "Ham_SecondaryAttack_Post", 1);
  157.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_g3sg1", "Ham_SecondaryAttack_Post", 1);
  158.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_sg550", "Ham_SecondaryAttack_Post", 1);
  159.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_scout", "Ham_SecondaryAttack_Post", 1);
  160.     RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_awp",   "Ham_SecondaryAttack_Post", 1);
  161.    
  162.     RegisterHam(Ham_AddPlayerItem, "player", "Ham_AddPlayerItem_Post", 1);
  163.     RegisterHam(Ham_Spawn,         "player", "Ham_Spawn_player_Post",  1);
  164.    
  165. #if defined DEBUG
  166.     register_forward(FM_PlayerPreThink, "FM_PlayerPreThink_Post", 1);
  167. #endif
  168. }
  169.  
  170. #if defined DEBUG
  171. public FM_PlayerPreThink_Post(iPlrId)
  172. {
  173.     if( is_user_alive(iPlrId) )
  174.     {
  175.         static Float:s_fVelocity[3];
  176.         pev(iPlrId, pev_velocity, s_fVelocity);
  177.         client_print(iPlrId, print_center, "Speed: %f", vector_length(s_fVelocity));
  178.     }
  179. }
  180. #endif
  181.  
  182. public Ham_Item_Deploy_Post(iEnt)
  183. {
  184.     if( !pev_valid(iEnt) )
  185.         return HAM_IGNORED;
  186.    
  187.     new iPlrId = pev(iEnt, pev_owner);
  188.     if( !is_user_alive(iPlrId) )
  189.         return HAM_IGNORED;
  190.    
  191.     new iCsWeaponType = get_pdata_int(iEnt, PDWeaponType, 4);
  192.     if( iCsWeaponType<1 || iCsWeaponType==2 || iCsWeaponType>30 )
  193.         return HAM_IGNORED;
  194.    
  195.     new Float:fWeight = fWeaponWeights[iCsWeaponType];
  196.     if( cs_get_user_shield(iPlrId) && (iCsWeaponType==CSW_KNIFE || iCsWeaponType==CSW_GLOCK18 || iCsWeaponType==CSW_USP
  197.      || iCsWeaponType==CSW_DEAGLE || iCsWeaponType==CSW_P228 || iCsWeaponType==CSW_FIVESEVEN
  198.      || iCsWeaponType==CSW_FLASHBANG || iCsWeaponType==CSW_HEGRENADE || iCsWeaponType==CSW_SMOKEGRENADE) )
  199.         fWeight += WEIGHT_SHIELD;
  200.     else if( cs_get_weapon_silen(iEnt) )
  201.         fWeight += ((iCsWeaponType==CSW_USP)?WEIGHT_USP_S:WEIGHT_M4A1_S);
  202.    
  203.    
  204.     new Float:fSpeed;
  205.     pev(iPlrId, pev_maxspeed, fSpeed);
  206.     if( fSpeed!=1.0 )
  207.     {
  208.         fSpeed = float(floatround(get_speed_by_weight(fWeight)));
  209.         engfunc(EngFunc_SetClientMaxspeed, iPlrId, fSpeed);
  210.         set_pev(iPlrId, pev_maxspeed, fSpeed);
  211.     }
  212.     set_gravity_by_weight(iPlrId, fWeight);
  213.    
  214.     return HAM_IGNORED;
  215. }
  216.  
  217. public Ham_GetItemMaxSpeed_Pre(iEnt, Float:fSpeed)
  218. {
  219.     new iPlrId = pev(iEnt, pev_owner);
  220.     if( !is_user_alive(iPlrId) )
  221.         return HAM_IGNORED;
  222.    
  223.     new iCsWeaponType = get_pdata_int(iEnt, PDWeaponType, 4);
  224.     if( iCsWeaponType<1 || iCsWeaponType==2 || iCsWeaponType>30 )
  225.         return HAM_IGNORED;
  226.    
  227.     if( cs_get_user_shield(iPlrId) && (iCsWeaponType==CSW_KNIFE || iCsWeaponType==CSW_GLOCK18 || iCsWeaponType==CSW_USP
  228.      || iCsWeaponType==CSW_DEAGLE || iCsWeaponType==CSW_P228 || iCsWeaponType==CSW_FIVESEVEN
  229.      || iCsWeaponType==CSW_FLASHBANG || iCsWeaponType==CSW_HEGRENADE || iCsWeaponType==CSW_SMOKEGRENADE) )
  230.     {
  231.         new Float:fSpeed;
  232.         ExecuteHam(Ham_CS_Item_GetMaxSpeed, iEnt, fSpeed);
  233.         if( fSpeed==180.0 )
  234.             SetHamReturnFloat(float(floatround(get_speed_by_weight(fWeaponWeights[iCsWeaponType]+WEIGHT_SHIELD)-SPEED_BONUCE_SHIELD)));
  235.         else
  236.             SetHamReturnFloat(float(floatround(get_speed_by_weight(fWeaponWeights[iCsWeaponType]+WEIGHT_SHIELD))));
  237.        
  238.         return HAM_SUPERCEDE;
  239.     }
  240.     else
  241.     {
  242.         if( cs_get_weapon_silen(iEnt) )
  243.         {
  244.             SetHamReturnFloat(float(floatround(get_speed_by_weight(fWeaponWeights[iCsWeaponType]+((iCsWeaponType==CSW_USP)?WEIGHT_USP_S:WEIGHT_M4A1_S)))));
  245.                
  246.             return HAM_SUPERCEDE;
  247.         }
  248.         else
  249.         {
  250.             switch( cs_get_user_zoom(iPlrId) )
  251.             {
  252.                 case CS_SET_AUGSG552_ZOOM: SetHamReturnFloat(float(floatround(get_speed_by_weight(fWeaponWeights[iCsWeaponType])-SPEED_BONUCE_ZOOM1)));
  253.                 case CS_SET_FIRST_ZOOM:    SetHamReturnFloat(float(floatround(get_speed_by_weight(fWeaponWeights[iCsWeaponType])-SPEED_BONUCE_ZOOM2)));
  254.                 case CS_SET_SECOND_ZOOM:   SetHamReturnFloat(float(floatround(get_speed_by_weight(fWeaponWeights[iCsWeaponType])-SPEED_BONUCE_ZOOM3)));
  255.                 default:                   SetHamReturnFloat(float(floatround(get_speed_by_weight(fWeaponWeights[iCsWeaponType]))));
  256.             }
  257.            
  258.             return HAM_SUPERCEDE;
  259.         }
  260.     }
  261.    
  262.     return HAM_IGNORED;
  263. }
  264.  
  265. public Ham_SecondaryAttack_Pre(iEnt)
  266.     g_fOldNextSecAttack = get_pdata_float(iEnt, PDNextSecAttack, 4);
  267.  
  268. public Ham_SecondaryAttack_Post(iEnt)
  269. {
  270.     if( !pev_valid(iEnt) )
  271.         return HAM_IGNORED;
  272.    
  273.     if( g_fOldNextSecAttack==get_pdata_float(iEnt, PDNextSecAttack, 4) )
  274.         return HAM_IGNORED;
  275.    
  276.     new iPlrId = pev(iEnt, pev_owner);
  277.     if( !is_user_alive(iPlrId) )
  278.         return HAM_IGNORED;
  279.    
  280.     new iCsWeaponType = get_pdata_int(iEnt, PDWeaponType, 4);
  281.     if( iCsWeaponType<1 || iCsWeaponType==2 || iCsWeaponType>30 )
  282.         return HAM_IGNORED;
  283.    
  284.     if( cs_get_user_shield(iPlrId) && iCsWeaponType==CSW_USP )
  285.         return HAM_IGNORED;
  286.    
  287.     new Float:fSpeed, Float:fWeight = fWeaponWeights[iCsWeaponType];
  288.     pev(iPlrId, pev_maxspeed, fSpeed);
  289.     if( iCsWeaponType==CSW_USP || iCsWeaponType==CSW_M4A1 )
  290.     {
  291.         if( cs_get_weapon_silen(iEnt) )
  292.             fWeight += ((iCsWeaponType==CSW_USP)?WEIGHT_USP_S:WEIGHT_M4A1_S);
  293.         if( fSpeed!=1.0 )
  294.         {
  295.             fSpeed = float(floatround(get_speed_by_weight(fWeight)));
  296.             engfunc(EngFunc_SetClientMaxspeed, iPlrId, fSpeed);
  297.             set_pev(iPlrId, pev_maxspeed, fSpeed);
  298.         }
  299.         set_gravity_by_weight(iPlrId, fWeight);
  300.     }
  301.     else if( fSpeed!=1.0 )
  302.     {
  303.         switch( cs_get_user_zoom(iPlrId) )
  304.         {
  305.             case CS_SET_AUGSG552_ZOOM: fSpeed = float(floatround(get_speed_by_weight(fWeaponWeights[iCsWeaponType])-SPEED_BONUCE_ZOOM1));
  306.             case CS_SET_FIRST_ZOOM:    fSpeed = float(floatround(get_speed_by_weight(fWeaponWeights[iCsWeaponType])-SPEED_BONUCE_ZOOM2));
  307.             case CS_SET_SECOND_ZOOM:   fSpeed = float(floatround(get_speed_by_weight(fWeaponWeights[iCsWeaponType])-SPEED_BONUCE_ZOOM3));
  308.             default:                   fSpeed = float(floatround(get_speed_by_weight(fWeaponWeights[iCsWeaponType])));
  309.         }
  310.         engfunc(EngFunc_SetClientMaxspeed, iPlrId, fSpeed);
  311.         set_pev(iPlrId, pev_maxspeed, fSpeed);
  312.     }
  313.    
  314.     return HAM_IGNORED;
  315. }
  316.  
  317. public Ham_AddPlayerItem_Post(iPlrId, iEnt)
  318. {
  319.     if( !is_user_alive(iPlrId) )
  320.         return HAM_IGNORED;
  321.    
  322.     if( !pev_valid(iEnt) )
  323.         return HAM_IGNORED;
  324.    
  325.     if( iEnt!=get_pdata_cbase(iPlrId, PDActiveItem, 4) )
  326.         return HAM_IGNORED;
  327.    
  328.     new iCsWeaponType = get_pdata_int(iEnt, PDWeaponType, 4);
  329.     if( iCsWeaponType<1 || iCsWeaponType==2 || iCsWeaponType>30 )
  330.         return HAM_IGNORED;
  331.    
  332.     new Float:fWeight = fWeaponWeights[iCsWeaponType];
  333.     if( cs_get_user_shield(iPlrId) && (iCsWeaponType==CSW_KNIFE || iCsWeaponType==CSW_GLOCK18 || iCsWeaponType==CSW_USP
  334.      || iCsWeaponType==CSW_DEAGLE || iCsWeaponType==CSW_P228 || iCsWeaponType==CSW_FIVESEVEN
  335.      || iCsWeaponType==CSW_FLASHBANG || iCsWeaponType==CSW_HEGRENADE || iCsWeaponType==CSW_SMOKEGRENADE) )
  336.         fWeight += WEIGHT_SHIELD;
  337.     else if( cs_get_weapon_silen(iEnt) )
  338.         fWeight += ((iCsWeaponType==CSW_USP)?WEIGHT_USP_S:WEIGHT_M4A1_S);
  339.    
  340.    
  341.     new Float:fSpeed;
  342.     pev(iPlrId, pev_maxspeed, fSpeed);
  343.     if( fSpeed!=1.0 )
  344.     {
  345.         fSpeed = float(floatround(get_speed_by_weight(fWeight)));
  346.         engfunc(EngFunc_SetClientMaxspeed, iPlrId, fSpeed);
  347.         set_pev(iPlrId, pev_maxspeed, fSpeed);
  348.     }
  349.     set_gravity_by_weight(iPlrId, fWeight);
  350.    
  351.     return HAM_IGNORED;
  352. }
  353.  
  354. public Ham_Spawn_player_Post(iPlrId)
  355. {
  356.     if( !is_user_alive(iPlrId) )
  357.         return HAM_IGNORED;
  358.    
  359.     new iEnt = get_pdata_cbase(iPlrId, PDActiveItem, 4);
  360.     if( !pev_valid(iEnt) )
  361.         return HAM_IGNORED;
  362.    
  363.     new iCsWeaponType = get_pdata_int(iEnt, PDWeaponType, 4);
  364.     if( iCsWeaponType<1 || iCsWeaponType==2 || iCsWeaponType>30 )
  365.         return HAM_IGNORED;
  366.    
  367.     new Float:fWeight = fWeaponWeights[iCsWeaponType];
  368.     if( cs_get_user_shield(iPlrId) && (iCsWeaponType==CSW_KNIFE || iCsWeaponType==CSW_GLOCK18 || iCsWeaponType==CSW_USP
  369.      || iCsWeaponType==CSW_DEAGLE || iCsWeaponType==CSW_P228 || iCsWeaponType==CSW_FIVESEVEN
  370.      || iCsWeaponType==CSW_FLASHBANG || iCsWeaponType==CSW_HEGRENADE || iCsWeaponType==CSW_SMOKEGRENADE) )
  371.         fWeight += WEIGHT_SHIELD;
  372.     else if( cs_get_weapon_silen(iEnt) )
  373.         fWeight += ((iCsWeaponType==CSW_USP)?WEIGHT_USP_S:WEIGHT_M4A1_S);
  374.    
  375.    
  376.     new Float:fSpeed;
  377.     pev(iPlrId, pev_maxspeed, fSpeed);
  378.     if( fSpeed!=1.0 )
  379.     {
  380.         fSpeed = float(floatround(get_speed_by_weight(fWeight)));
  381.         engfunc(EngFunc_SetClientMaxspeed, iPlrId, fSpeed);
  382.         set_pev(iPlrId, pev_maxspeed, fSpeed);
  383.     }
  384.     set_gravity_by_weight(iPlrId, fWeight);
  385.    
  386.     return HAM_IGNORED;
  387. }
  388.  
  389. Float:clamp_f(Float:Value, Float:MinValue, Float:MaxValue)
  390. {
  391.     if( Value<=MinValue )
  392.     {
  393.         return MinValue;
  394.     }
  395.    
  396.     if( Value>=MaxValue )
  397.     {
  398.         return MaxValue;
  399.     }
  400.    
  401.     return Value;
  402. }
  403.  
  404. Float:get_cvar_float_minspeed()
  405.     return clamp_f(get_pcvar_float(g_iCvarP_MinSpeed), 2.0, 400.0);
  406.  
  407. Float:get_cvar_float_maxspeed()
  408.     return clamp_f(get_pcvar_float(g_iCvarP_MaxSpeed), 2.0, 400.0);
  409.  
  410. Float:get_cvar_float_mingravp()
  411.     return clamp_f(get_pcvar_float(g_iCvarP_MinGrav), 0.0, 150.0);
  412.  
  413. Float:get_cvar_float_maxgravp()
  414.     return clamp_f(get_pcvar_float(g_iCvarP_MaxGrav), 0.0, 150.0);
  415.  
  416. bool:set_gravity_by_weight(iPlrId, Float:fWeight)
  417. {
  418.     if( fWeight<=0.0 )
  419.         set_pev(iPlrId, pev_gravity, 1.0);
  420.     else
  421.     {
  422.         new Float:fMinValue = get_cvar_float_mingravp();
  423.         new Float:fMaxValue = get_cvar_float_maxgravp();
  424.        
  425.         if( !fMinValue )
  426.             fMinValue = 1.0;
  427.        
  428.         if( !fMaxValue )
  429.             fMaxValue = 1.0;
  430.        
  431.         if( fMinValue==fMaxValue )
  432.         {
  433.             set_pev(iPlrId, pev_gravity, fMinValue);
  434.             return true;
  435.         }
  436.         else if( fMinValue>fMaxValue )
  437.         {
  438.             new Float:fTempValue = fMaxValue;
  439.             fMaxValue = fMinValue;
  440.             fMinValue = fTempValue;
  441.         }
  442.        
  443. #if defined DEBUG
  444.         client_print(iPlrId, print_chat, "set grav: %f", (1.0+(1.0-(fMaxValue-((fMaxValue-fMinValue)*fWeight/7.02)))));
  445. #endif
  446.         set_pev(iPlrId, pev_gravity, (1.0+(1.0-(fMaxValue-((fMaxValue-fMinValue)*fWeight/7.02)))));
  447.         return true;
  448.     }
  449.    
  450.     return false;
  451. }
  452.  
  453. Float:get_speed_by_weight(Float:fWeight)
  454. {
  455.     if( fWeight<=0.0 )
  456.         return get_cvar_float_maxspeed();
  457.    
  458.     new Float:fMinValue = get_cvar_float_minspeed();
  459.     new Float:fMaxValue = get_cvar_float_maxspeed();
  460.    
  461.     if( fMinValue==fMaxValue )
  462.         return fMinValue;
  463.     else if( fMinValue>fMaxValue )
  464.     {
  465.         new Float:fTempValue = fMaxValue;
  466.         fMaxValue = fMinValue;
  467.         fMinValue = fTempValue;
  468.     }
  469.    
  470.     return (fMaxValue-((fMaxValue-fMinValue)*fWeight/7.02));
  471. }
  472.  
  473. /*
  474. 3.51*100%/7.02 = 50%
  475.  
  476. (260-210)*50%/100% = 25
  477.  
  478. 260-25 = 235
  479. */

Ők köszönték meg Krisznitro nek ezt a hozzászólást: CoopCola (2016.04.29. 19:40)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 2 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 10 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole