hlmod.hu
https://hlmod.hu/

No Scope probléma
https://hlmod.hu/viewtopic.php?f=9&t=28113
Oldal: 1 / 1

Szerző:  pajti [2017.08.14. 07:13 ]
Hozzászólás témája:  No Scope probléma

sziasztok!

a következő módon próbáltam lekérni azt, hogy egy játékos zoom nélkül öl meg egy játékost:

Kód:
public plugin_init() {
   register_plugin(PLUGIN, VERSION, AUTHOR)
   register_event("DeathMsg", "noZoom", "a", "1>0")
}
public noZoom() {
   
   new killer = read_data( 1 )
   if(get_user_weapon(killer) == CSW_AWP && cs_get_user_zoom(killer) == CS_SET_NO_ZOOM) {
      client_print(killer, print_chat, "no zoom");
   }
}


de ha zoomolok, akkor is lefut az if ág.
gondolom azért, mert a lövés pillanatában "kilép" a zoomból, de akkor hogyan lehetne megoldani?

Szerző:  Stew [2017.08.14. 10:33 ]
Hozzászólás témája:  Re: No Scope probléma

Próbáld így.
  1. public zoom(id) {
  2.  
  3.      if (get_cvar_num("sv_antizoom") == 1) {
  4.  
  5.    if ( is_user_alive(id) ) {
  6.  
  7. new unzoom = get_cvar_num("sv_unzoom")
  8.     switch(unzoom) {
  9. case 1: client_cmd(id,"drop")
  10. case 2: client_cmd(id,"invprev")
  11. case 3: user_slap(id,5,1)
  12. }
  13.  
  14. }  
  15.     return PLUGIN_HANDLED
  16. }
  17.  
  18. }
  19.  
  20.  
  21. public plugin_init() {
  22.   register_plugin("NozomTeszt", "1.0", "Stew")
  23.   register_event("SetFOV","zoom","b","1<90")
  24.   register_cvar("sv_antizoom", "0", FCVAR_SERVER)
  25.   register_cvar("sv_unzoom", "1", FCVAR_SERVER)
  26.   return   PLUGIN_CONTINUE
  27. }

Szerző:  qkly [2017.08.14. 12:08 ]
Hozzászólás témája:  Re: No Scope probléma

Stew írta:
Próbáld így.
  1. public zoom(id) {
  2.  
  3.      if (get_cvar_num("sv_antizoom") == 1) {
  4.  
  5.    if ( is_user_alive(id) ) {
  6.  
  7. new unzoom = get_cvar_num("sv_unzoom")
  8.     switch(unzoom) {
  9. case 1: client_cmd(id,"drop")
  10. case 2: client_cmd(id,"invprev")
  11. case 3: user_slap(id,5,1)
  12. }
  13.  
  14. }  
  15.     return PLUGIN_HANDLED
  16. }
  17.  
  18. }
  19.  
  20.  
  21. public plugin_init() {
  22.   register_plugin("NozomTeszt", "1.0", "Stew")
  23.   register_event("SetFOV","zoom","b","1<90")
  24.   register_cvar("sv_antizoom", "0", FCVAR_SERVER)
  25.   register_cvar("sv_unzoom", "1", FCVAR_SERVER)
  26.   return   PLUGIN_CONTINUE
  27. }


? Viccelsz? Ez mi? Mik ezek a cvarok, és mit keres alul az init? :c :lol:

Szerző:  pajti [2017.08.14. 16:53 ]
Hozzászólás témája:  Re: No Scope probléma

Stew írta:
Próbáld így.
  1. public zoom(id) {
  2.  
  3.      if (get_cvar_num("sv_antizoom") == 1) {
  4.  
  5.    if ( is_user_alive(id) ) {
  6.  
  7. new unzoom = get_cvar_num("sv_unzoom")
  8.     switch(unzoom) {
  9. case 1: client_cmd(id,"drop")
  10. case 2: client_cmd(id,"invprev")
  11. case 3: user_slap(id,5,1)
  12. }
  13.  
  14. }  
  15.     return PLUGIN_HANDLED
  16. }
  17.  
  18. }
  19.  
  20.  
  21. public plugin_init() {
  22.   register_plugin("NozomTeszt", "1.0", "Stew")
  23.   register_event("SetFOV","zoom","b","1<90")
  24.   register_cvar("sv_antizoom", "0", FCVAR_SERVER)
  25.   register_cvar("sv_unzoom", "1", FCVAR_SERVER)
  26.   return   PLUGIN_CONTINUE
  27. }


,,nem vagyok egy nagy agy izéé", de ez nem akkor fut le, amikor zoomolok?
Kód:
register_event("SetFOV","zoom","b","1<90")

pont az ellenkezője kellene

vagy esetleg egy egyszerű tagadással (!1<90) meglehet ezt oldani? tesztelés helyett azért kérdezem, mert jelenleg nem tudom tesztelni és addig hátha jön rá válasz..

Szerző:  FloxaY [2017.08.14. 16:59 ]
Hozzászólás témája:  Re: No Scope probléma

a lényeg benne van

  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <fun>
  4.  
  5. new const Version[] = "0.1";
  6.  
  7. const MaxPlayers = 32;
  8.  
  9. new g_pCvarKillPoints;
  10. new g_iCurrentZoom[ MaxPlayers + 1 ];
  11.  
  12. public plugin_init()
  13. {
  14.     register_plugin( "No Scope Announce" , Version , "bugsy" );
  15.    
  16.     register_event( "DeathMsg"  , "fw_EvDeathMsg"  , "a" , "1>0" , "4=scout" , "4=awp" );
  17.     register_event( "CurWeapon" , "fw_EvCurWeapon" , "b" , "1=1" , "2=3" , "2=18" );
  18.    
  19.     g_pCvarKillPoints = register_cvar( "ns_killpoints" , "2" );
  20. }
  21.  
  22. public fw_EvDeathMsg()
  23. {
  24.     static iKiller , szName[ 33 ];
  25.    
  26.     iKiller = read_data( 1 );
  27.  
  28.     if ( is_user_connected( iKiller ) && ( g_iCurrentZoom[ iKiller ] == CS_SET_NO_ZOOM ) )
  29.     {
  30.         get_user_name( iKiller , szName , charsmax( szName ) );
  31.         set_hudmessage( 85 , 212 , 255 , -1.0 , 0.38 , 1 , 2.0 , 5.0 , 0.0 , 0.0 , -1 );
  32.         show_hudmessage( 0 , "%s just did a scopeless kill shot!" , szName );
  33.        
  34.         set_user_frags( iKiller , get_user_frags( iKiller ) + ( get_pcvar_num( g_pCvarKillPoints ) - 1 ) );
  35.     }
  36. }
  37.  
  38. public fw_EvCurWeapon( id )
  39. {
  40.     g_iCurrentZoom[ id ] = cs_get_user_zoom( id );
  41. }

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