hlmod.hu
https://hlmod.hu/

ReAPI - Oops!
https://hlmod.hu/viewtopic.php?f=134&t=30529
Oldal: 1 / 1

Szerző:  theglorious [ 2020.07.24. 19:56 ]
Hozzászólás témája:  ReAPI - Oops!

ReAPI - Oops!
Leírás:
  • A sok guggolástól x eséllyel egy fing hang játszódik le
Cvar / Beállítás:
  • #define AUTO_CFG - Automatikusan bekerül az amxx menü cvar listába (?)
  • oops_fart_chance "10" - X esély a fingáshoz
  • oops_duck_break "0.2" - X másodpercig kell guggolni a fingáshoz (?)
Telepítés:
  • A pluginhoz tartozik hang fájl. A hang (wav) fájlt a sound mappába kell helyezni.
    Csatolmány:
    oops_plugin-sounds.rar [11.18 KiB]
    Letöltve 111 alkalommal.
Verzió:
  • v0.1 beta
Követelmények:
  • ReHLDS
  • ReGameDLL
  • ReAPI
Kompatibilis:
  • Amx Mod X 1.9.0
  • Amx Mod X 1.10.0 dev
Eredeti link:
Készítő:
  • CHEL74
Plugin:
  1. #include <amxmodx>
  2. #include <reapi>
  3.  
  4. #define AUTO_CFG
  5.  
  6. enum Cvars {
  7.     FART_CHANCE,
  8.     Float:DUCK_BREAK
  9. }
  10.  
  11. new g_eCvar[Cvars]
  12.  
  13. new g_iFartChance
  14.  
  15. new const g_szFartingSounds[][] = {
  16.     "farting/farting1.wav",
  17.     "farting/farting2.wav",
  18.     "farting/farting3.wav",
  19.     "farting/farting4.wav",
  20.     "farting/farting5.wav"
  21. }
  22.  
  23. public plugin_precache() {
  24.     for(new i; i < sizeof(g_szFartingSounds); i++) {
  25.         precache_sound(g_szFartingSounds[i])
  26.     }
  27. }
  28.  
  29. public plugin_init() {
  30.     register_plugin("Oops!", "1.0", "CHEL74")
  31.    
  32.     RegisterHookChain(RG_CBasePlayer_Duck, "Duck_Post", true)
  33.    
  34.     bind_pcvar_num(create_cvar("oops_fart_chance", "10",
  35.     .description = "X esĂ©ly a fingáshoz"),
  36.     g_eCvar[FART_CHANCE])
  37.     bind_pcvar_float(create_cvar("oops_duck_break", "0.2",
  38.     .description = "X másodpercig kell guggolni a fingáshoz"),
  39.     g_eCvar[DUCK_BREAK])
  40.    
  41.     #if defined AUTO_CFG
  42.         AutoExecConfig()
  43.     #endif
  44. }
  45.  
  46. public OnConfigsExecuted() {
  47.     g_iFartChance = g_eCvar[FART_CHANCE] * 100
  48. }
  49.  
  50. public Duck_Post(pPlayer) {
  51.     static Float:fLastDuckTime[MAX_PLAYERS + 1]
  52.     new Float:fCurrentTime = get_gametime()
  53.    
  54.     if(fCurrentTime - fLastDuckTime[pPlayer] < g_eCvar[DUCK_BREAK]) {
  55.         fLastDuckTime[pPlayer] = fCurrentTime
  56.        
  57.         return
  58.     }
  59.    
  60.     fLastDuckTime[pPlayer] = fCurrentTime
  61.    
  62.     if(random_num(1, 10000) <= g_iFartChance) {
  63.         emit_sound(pPlayer, CHAN_VOICE, g_szFartingSounds[random(sizeof(g_szFartingSounds))], 1.0, ATTN_NORM, 0, PITCH_NORM)
  64.     }
  65. }

Szerző:  theglorious [ 2020.07.24. 20:16 ]
Hozzászólás témája:  Re: ReAPI - Oops!

Én kicsit változtattam a pluginon. Az alap változatban csak a játékos hallja, hogy pukkantott, viszont átírtam, hogy mindenki hallja. Valamint nem írta a chatbe, hogy ki fingott. A saját változat is működik, ellenben több emberrel nem tudtam tesztelni!
Teszt szerver adatok: ReHLDS: 2228 - ReGameDLL: 5.17.0.466-dev - ReAPI: v5.14.0.195-dev - AMX Mod X: v1.10.0.5399

A cvarok leírásánál azért van kérdőjel, mert nem voltam benne biztos, hogy mit is csinál pontosan. Az oops_duck_break cvar a guggolás idejét nézi (hogy mennyi ideig guggolsz), nem volt tiszta a fordítás, ezért erősítse meg valaki, hogy ez így van e.

  1. #include <amxmodx>
  2. #include <reapi>
  3.  
  4. #define AUTO_CFG
  5.  
  6. enum Cvars {
  7.     FART_CHANCE,
  8.     Float:DUCK_BREAK
  9. }
  10.  
  11. new g_eCvar[Cvars]
  12.  
  13. new g_iFartChance
  14.  
  15. new const g_szFartingSounds[][] = {
  16.     "farting/farting1.wav",
  17.     "farting/farting2.wav",
  18.     "farting/farting3.wav",
  19.     "farting/farting4.wav",
  20.     "farting/farting5.wav"
  21. }
  22.  
  23. new const g_szFartingText[][] = {
  24.     "^1tĂşl sokszor guggolt, be is fingott egy bĂĽdit",
  25.     "^1befosott",
  26.     "^1összeszarta magát",
  27.     "^1hopp eleresztett egy madárkát",
  28.     "^1fingom szagátĂłl..."
  29. }
  30.  
  31. public plugin_precache() {
  32.     for(new i; i < sizeof(g_szFartingSounds); i++) {
  33.         precache_sound(g_szFartingSounds[i])
  34.     }
  35. }
  36.  
  37. public plugin_init() {
  38.     register_plugin("Oops!", "1.0", "CHEL74")
  39.    
  40.     RegisterHookChain(RG_CBasePlayer_Duck, "Duck_Post", true)
  41.    
  42.     bind_pcvar_num(create_cvar("oops_fart_chance", "10",
  43.     .description = "SzázalĂ©kos esĂ©ly, a guggolástĂłl valĂł fingáshoz"),
  44.     g_eCvar[FART_CHANCE])
  45.     bind_pcvar_float(create_cvar("oops_duck_break", "0.2",
  46.     .description = "X másodperc után van esĂ©ly fingásra"),
  47.     g_eCvar[DUCK_BREAK])
  48.    
  49.     #if defined AUTO_CFG
  50.         AutoExecConfig()
  51.     #endif
  52. }
  53.  
  54. public OnConfigsExecuted() {
  55.     g_iFartChance = g_eCvar[FART_CHANCE] * 100
  56. }
  57.  
  58. public Duck_Post(pPlayer) {
  59.     static Float:fLastDuckTime[MAX_PLAYERS + 1]
  60.     new Float:fCurrentTime = get_gametime()
  61.    
  62.     if(fCurrentTime - fLastDuckTime[pPlayer] < g_eCvar[DUCK_BREAK]) {
  63.         fLastDuckTime[pPlayer] = fCurrentTime
  64.        
  65.         return
  66.     }
  67.    
  68.     fLastDuckTime[pPlayer] = fCurrentTime
  69.    
  70.     if(random_num(1, 10000) <= g_iFartChance) {
  71.         emit_sound(0, CHAN_VOICE, g_szFartingSounds[random(sizeof(g_szFartingSounds))], 1.0, ATTN_NORM, 0, PITCH_NORM)
  72.  
  73.         new name[32]
  74.         get_user_name(pPlayer,name,charsmax(name))
  75.         client_print_color(0, print_team_default, "^4[Oops]^3 %s %s",name, g_szFartingText[random(sizeof(g_szFartingText))])
  76.     }
  77. }

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