Half-Life и Adrenaline Gamer форум
http://aghl.ru/forum/

spectator & Score !
http://aghl.ru/forum/viewtopic.php?f=12&t=2087
Страница 1 из 2

Автор:  abdobiskra [ 26 фев 2015, 11:56 ]
Заголовок сообщения:  spectator & Score !

Hello ....! Who can find me plugin when players enter in a spectator becomes Score 0 , such as Arcade mod in AG !

Автор:  Kuma77 [ 26 фев 2015, 19:51 ]
Заголовок сообщения:  Re: spectator & Score !

First you need to catch players when they are on spectate then register new msg send to scoreinfo
and send 0 score or what you want to send .

this example work very well

here we go

Код:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hl>


#define VERSION "1.0"


new gMsg_ScoreInfo

public plugin_init() {
   register_plugin("set score on spectate", VERSION, "Kuma")
   gMsg_ScoreInfo = get_user_msgid("ScoreInfo")
   register_clcmd("spectate", "Catch_Spectate")
}

public Catch_Spectate(id)
{
   
   player_setScore(id, 0)
   
}


player_setScore(id, iFrags)
{
new tid = hl_get_user_team(id) // you can remove this line
message_begin(MSG_BROADCAST, gMsg_ScoreInfo)
write_byte(id)
write_short(iFrags)
write_short(0)
write_short(0)
write_short(tid) // you can remove this line
message_end()
}

Автор:  unnamed [ 27 фев 2015, 00:05 ]
Заголовок сообщения:  Re: spectator & Score !

This method resets frags and deaths at the scoreboard only.
To reset score completely you can use hl.inc

Код:
set_user_frags(id, 0)
hl_set_user_deaths(id, 0)

No need to hook ScoreInfo.
Also you can check if player in spectator mode with:

Код:
hl_get_user_spectator(id)

Автор:  Kuma77 [ 27 фев 2015, 00:32 ]
Заголовок сообщения:  Re: spectator & Score !

I try to get user on spectate but not work :

Код:
public function(id)
{
  if(hl_get_user_spectator(id))
     client_print(id, 3, " you switch to spectate mod")
}


Автор:  Lev [ 27 фев 2015, 01:28 ]
Заголовок сообщения:  Re: spectator & Score !

Depends on where you call this function. For "spectate" commands handler you should use post version.

Автор:  Kuma77 [ 27 фев 2015, 01:34 ]
Заголовок сообщения:  Re: spectator & Score !

Lev писал(а):
you should use post version.


I dont understand this part .

Posted after 59 minutes 17 seconds:
I found this method and i think its worst one :


Код:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hl>

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


public plugin_init() {
   register_plugin(PLUGIN, VERSION, AUTHOR)
}


public client_putinserver(id)
{
   set_task(4.0, "check", id)
}

public check(id)
{
   new szName[32]
   get_user_name(id, szName, 31)
   if(hl_get_user_spectator(id)){
      client_print(0, 3, " %s switch to spectate mod", szName)
      set_user_frags(id, 0)
      hl_set_user_deaths(id, 0)
      return
   }
   set_task(0.1, "check", id)
}


Автор:  unnamed [ 27 фев 2015, 03:02 ]
Заголовок сообщения:  Re: spectator & Score !

Код:
register_event("TextMsg", "toSpectators", "b", "2&#Spec_Mode")


Код:
public toSpectators(id)
{
...
}

Автор:  Kuma77 [ 27 фев 2015, 03:38 ]
Заголовок сообщения:  Re: spectator & Score !

unnamed , its great idea i was thinking this will work for cs only :D

here is your code abdobiskra

 

Автор:  Lev [ 27 фев 2015, 04:32 ]
Заголовок сообщения:  Re: spectator & Score !

Код:
   register_forward(FM_ClientCommand, "Fw_FmClientCommandPost", 1);

public Fw_FmClientCommandPost(id)
{
   if (IsHltv(id) || IsBot(id))
      return FMRES_IGNORED;

   new cmd[32];
   read_argv(0, cmd, charsmax(cmd));

   if (equal(cmd, "spectate"))
   {
      // your code here, check for spectate mode
   }

   return FMRES_IGNORED;
}

Автор:  Kuma77 [ 27 фев 2015, 07:09 ]
Заголовок сообщения:  Re: spectator & Score !

Lev what is different between them ? i mean fakemeta clcmd and TextMsg event .
i think FM will be slow

Страница 1 из 2 Часовой пояс: UTC + 5 часов [ Летнее время ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/