hlmod.hu
https://hlmod.hu/

Perc játékosok
https://hlmod.hu/viewtopic.php?f=29&t=29995
Oldal: 1 / 2

Szerző:  Alekvar [ 2019.08.15. 14:13 ]
Hozzászólás témája:  Perc játékosok

Sziasztok valaki tudna nekem olyan plugint adni, ami számoljá hány perce vagyunk a szerveren?

Nem kell nekem nap stb csak hogy Perc: 1 pl
És ha valaki spectorban van akkor ne számolja a percet! Köszönöm előre is.

Szerző:  Vieni [ 2019.08.15. 14:44 ]
Hozzászólás témája:  Re: Perc játékosok

Alekvar írta:
Sziasztok valaki tudna nekem olyan plugint adni, ami számoljá hány perce vagyunk a szerveren?

Nem kell nekem nap stb csak hogy Perc: 1 pl
És ha valaki spectorban van akkor ne számolja a percet! Köszönöm előre is.


Kód:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

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

new p_minutes[33]

new g_maxplayers

public plugin_init()
{
   register_plugin(PLUGIN, VERSION, AUTHOR)
   
   g_maxplayers = get_maxplayers()
   
   set_task(60.0,"TaskMinute",.flags="b")
}

public TaskMinute()
{
   for(new id=1; id<=g_maxplayers; id++)
   {
      if(!is_user_connected(id) || get_user_team(id) != CS_TEAM_CT && get_user_team(id) != CS_TEAM_T)
         continue
         
      p_minutes[id]++
   }
}

Szerző:  Alekvar [ 2019.08.15. 16:58 ]
Hozzászólás témája:  Re: Perc játékosok

Vieni írta:
Alekvar írta:
Sziasztok valaki tudna nekem olyan plugint adni, ami számoljá hány perce vagyunk a szerveren?

Nem kell nekem nap stb csak hogy Perc: 1 pl
És ha valaki spectorban van akkor ne számolja a percet! Köszönöm előre is.


Kód:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

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

new p_minutes[33]

new g_maxplayers

public plugin_init()
{
   register_plugin(PLUGIN, VERSION, AUTHOR)
   
   g_maxplayers = get_maxplayers()
   
   set_task(60.0,"TaskMinute",.flags="b")
}

public TaskMinute()
{
   for(new id=1; id<=g_maxplayers; id++)
   {
      if(!is_user_connected(id) || get_user_team(id) != CS_TEAM_CT && get_user_team(id) != CS_TEAM_T)
         continue
         
      p_minutes[id]++
   }
}


És akkor ha most lekerem a p_mínutes-t akkor kifogja nekem írni azt, hogy hány perce vagyok fent?

Szerző:  The Peace [ 2019.08.18. 12:16 ]
Hozzászólás témája:  Re: Perc játékosok

Alekvar írta:
Vieni írta:
Alekvar írta:
Sziasztok valaki tudna nekem olyan plugint adni, ami számoljá hány perce vagyunk a szerveren?

Nem kell nekem nap stb csak hogy Perc: 1 pl
És ha valaki spectorban van akkor ne számolja a percet! Köszönöm előre is.


Kód:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

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

new p_minutes[33]

new g_maxplayers

public plugin_init()
{
   register_plugin(PLUGIN, VERSION, AUTHOR)
   
   g_maxplayers = get_maxplayers()
   
   set_task(60.0,"TaskMinute",.flags="b")
}

public TaskMinute()
{
   for(new id=1; id<=g_maxplayers; id++)
   {
      if(!is_user_connected(id) || get_user_team(id) != CS_TEAM_CT && get_user_team(id) != CS_TEAM_T)
         continue
         
      p_minutes[id]++
   }
}


És akkor ha most lekerem a p_mínutes-t akkor kifogja nekem írni azt, hogy hány perce vagyok fent?


Szerintem igen. :d

Próbáld meg.

Szerző:  Alekvar [ 2019.08.18. 12:22 ]
Hozzászólás témája:  Re: Perc játékosok

És ha ehez akarnak olyant, hogyha fent van mondjuk 15 perce és akkor kapjon 5 pontot?

És ha 60 perce akkor mondjuk 10 pontot?

Mentest megoldom, csak ezt hogy írjam bele?

Szerző:  The Peace [ 2019.08.19. 04:18 ]
Hozzászólás témája:  Re: Perc játékosok

Alekvar írta:
És ha ehez akarnak olyant, hogyha fent van mondjuk 15 perce és akkor kapjon 5 pontot?

És ha 60 perce akkor mondjuk 10 pontot?

Mentest megoldom, csak ezt hogy írjam bele?


Szerintem így. bár régen foglalkoztam ilyennel. :D

  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <cstrike>
  4.  
  5. #define PLUGIN "New Plug-In"
  6. #define VERSION "1.0"
  7. #define AUTHOR "author"
  8.  
  9. new p_minutes[33],point[33]
  10.  
  11. new g_maxplayers
  12.  
  13. public plugin_init()
  14. {
  15.    register_plugin(PLUGIN, VERSION, AUTHOR)
  16.    
  17.    g_maxplayers = get_maxplayers()
  18.    
  19.    set_task(60.0,"TaskMinute",.flags="b")
  20. }
  21.  
  22. public TaskMinute()
  23. {
  24.    for(new id=1; id<=g_maxplayers; id++)
  25.    {
  26.       if(!is_user_connected(id) || get_user_team(id) != CS_TEAM_CT && get_user_team(id) != CS_TEAM_T)
  27.          continue
  28.          
  29.       p_minutes[id]++
  30.      
  31.       if(p_minutes[id] = 5){ //lehet == kell és nem = .
  32.          //kaptál 5 pontot mert 5 perce vagy a szerveren.
  33.          point[id] += 5
  34.       }
  35.    }
  36. }

Szerző:  regener [ 2019.08.19. 09:57 ]
Hozzászólás témája:  Re: Perc játékosok

The Peace írta:
Szerintem így. bár régen foglalkoztam ilyennel. :D [/codebox]


Lustaságom határtalan, így csak Peace részletét írom át :P

  1. public TaskMinute()
  2. {
  3.    new id
  4.    for(id=1; id<=g_maxplayers; id++)
  5.    {
  6.         if(!is_user_connected(id) || get_user_team(id) == CS_TEAM_SPECTATOR)
  7.         continue
  8.  
  9.         p_minutes[id]++
  10.  
  11.         switch(p_minutes[id])
  12.         {
  13.             case 15:
  14.             {
  15.                 point[id] += 5;
  16.                 client_print(id,print_chat,"Kaptál 5 pontot mert %d perce vagy a szerveren", p_minutes[id])
  17.             }
  18.             case 60:
  19.             {
  20.                 point[id] += 10;
  21.                 client_print(id,print_chat,"Kaptál 10 pontot mert %d perce vagy a szerveren", p_minutes[id])
  22.             }
  23.         }
  24.     }
  25. }


Viszont van hogy 60 percet megy egy map hogy eljusson odáig egyáltalán?

Szerző:  Alekvar [ 2019.08.19. 12:11 ]
Hozzászólás témája:  Re: Perc játékosok

regener írta:
The Peace írta:
Szerintem így. bár régen foglalkoztam ilyennel. :D [/codebox]


Lustaságom határtalan, így csak Peace részletét írom át :P

  1. public TaskMinute()
  2. {
  3.    new id
  4.    for(id=1; id<=g_maxplayers; id++)
  5.    {
  6.         if(!is_user_connected(id) || get_user_team(id) == CS_TEAM_SPECTATOR)
  7.         continue
  8.  
  9.         p_minutes[id]++
  10.  
  11.         switch(p_minutes[id])
  12.         {
  13.             case 15:
  14.             {
  15.                 point[id] += 5;
  16.                 client_print(id,print_chat,"Kaptál 5 pontot mert %d perce vagy a szerveren", p_minutes[id])
  17.             }
  18.             case 60:
  19.             {
  20.                 point[id] += 10;
  21.                 client_print(id,print_chat,"Kaptál 10 pontot mert %d perce vagy a szerveren", p_minutes[id])
  22.             }
  23.         }
  24.     }
  25. }


Viszont van hogy 60 percet megy egy map hogy eljusson odáig egyáltalán?


A percet mentenem így az mindig maradna és egy kis mini event lenne ez így, ha fent van a játékos ennyi időt.

Szerző:  Alekvar [ 2019.08.23. 16:34 ]
Hozzászólás témája:  Re: Perc játékosok

Le teszteltem, de számolja úgyis ha spectorban vagyok. Valaki valami megoldást?

Szerző:  regener [ 2019.08.23. 16:38 ]
Hozzászólás témája:  Re: Perc játékosok

Próbáld ki így, a sima get_user_team helyett most a cstrike-os van benne.
  1. public TaskMinute()
  2. {
  3.    new id
  4.    for(id=1; id<=g_maxplayers; id++)
  5.    {
  6.         if(!is_user_connected(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR)
  7.             continue
  8.  
  9.         p_minutes[id]++
  10.  
  11.         switch(p_minutes[id])
  12.         {
  13.             case 15:
  14.             {
  15.                 point[id] += 5;
  16.                 client_print(id,print_chat,"Kaptál 5 pontot mert %d perce vagy a szerveren", p_minutes[id])
  17.             }
  18.             case 60:
  19.             {
  20.                 point[id] += 10;
  21.                 client_print(id,print_chat,"Kaptál 10 pontot mert %d perce vagy a szerveren", p_minutes[id])
  22.             }
  23.         }
  24.     }
  25. }

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