Raised This Month: $138 Target: $400
 34% 

[Edit] Plugin /help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ykaru
Junior Member
Join Date: Aug 2019
Old 09-07-2019 , 06:47   [Edit] Plugin /help
Reply With Quote #1

Hi, I have this / help plugin for the base builder mode which should be in preparation when someone writes / help to make a sound, and the admin to appear as a specific player needs help. But after the admin accepts the request for help, the chat messages start to appear 2-3 times, ie if I write something it appears 2-3 times. Even the automatic messages on the server do the same. Can anyone modify it so that it doesn't stop this bug with the messages? Thank you in advance.
Sorry for my english.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <cstrike>
#include <basebuilder>

#define SPRITE "sprites/white.spr"
#define HELPSOUND "misc/bb_help.wav"
#define ADMIN_FLAG   ADMIN_KICK

new bool:valuri
new sprite_white;
new array:
g_Array

public plugin_init() {
   
register_plugin("Help System","1.0","MAGNET")
   
register_event("HLTV""rundanoua""a""1=0""2=0");
   
register_clcmd("say /ajutor""ajutor")
   
register_clcmd("say /help""ajutor")
   
register_clcmd("say /adminhelp""ajutor_menu"ADMIN_FLAG"Select player to help")
   
register_clcmd("say /ahelp""ajutor_menu"ADMIN_FLAG"Select player to help")
   
register_clcmd("say /ah""ajutor_menu"ADMIN_FLAG"Select player to help")
   
g_Array ArrayCreate(16);
}


public 
plugin_precache()
{
   
sprite_white precache_model(SPRITE);
   
precache_sound(HELPSOUND)

}
public 
bb_prepphase_started()
{
   
valuri true
}

public 
bb_round_started()
{
   
valuri false;
}

public 
rundanoua()
{
   
valuri false;
}


public 
ajutor(id)
{

   new 
nick[33];
   
get_user_name(idnickcharsmax(nick))

   if(!
is_user_alive(id))
      return 
PLUGIN_HANDLED;

   if(
cs_get_user_team(id) != CS_TEAM_CT)
   {
      
client_print(idprint_chat"[Help System] Zombie nu au acces la aceasta comanda.")
      return 
PLUGIN_HANDLED;
   }
   
   if(!
valuri)
   {
      
client_print(idprint_chat"[Help System] Nu poti folosi inca aceasta comanda.")
      return 
PLUGIN_HANDLED;
   }
   
   for(new 
0;i<32;i++)
   {
      if(!
is_user_connected(i) || !(get_user_flags(i) & ADMIN_FLAG))   continue;
      
ArrayPushString(g_Arraynick)
      
client_print(0print_chat"[Help System] Jucatorul %s are nevoie de ajutor."nick)
      
client_cmd(i"spk misc/bb_help.wav")
   }
   
set_task(1.0"Info"id+32__"b");
   
   return 
PLUGIN_CONTINUE;
}

public 
ajutor_menu(id) {
   new 
szTemp[15]
   new 
menu menu_create("Help Players Menu""menu_handler")

   if(!
ArraySize(g_Array))
   {
      
client_print(idprint_chat"[Help System] Nimeni nu are nevoie de ajutor.")
      return;
   }
   else
   {
      for (new 
iArraySize(g_Array); i++)
      {
         
ArrayGetString(g_ArrayiszTempcharsmax(szTemp))
         
menu_additem(menuszTemp_i0)
      }
   }

   
menu_setprop(menuMPROP_EXITMEXIT_ALL)
   
menu_display(idmenu0)
}

public 
menu_handler(idmenuitem)
{
   if (
item == MENU_EXIT)
   {
      
menu_destroy(menu);
      return;
   }

   new 
data[6], name[64], admin_name[32]
   new 
accesscallback
   get_user_name
(idadmin_name31)
   
menu_item_getinfo(menuitemaccessdata5name63callback)

   
client_print(0print_chat"[Help System] %s a acceptat cererea de ajutor a lui %s."admin_namename)

   
client_cmd(id"amx_godmode %s"name)
   
client_cmd(id"amx_godmode %s"admin_name)
   
client_cmd(id"amx_noclip %s"admin_name)
   
   
ArrayDeleteItem(g_Arraycallback)
   
menu_destroy(menu)
   return;
}

public 
Info(id)
{
   
id-=32;
   
   if(!
is_user_alive(id) || !valuri || cs_get_user_team(id) != CS_TEAM_CT)
   {
      
remove_task(id+32);
      return;
   }

   
emit_sound(idCHAN_AUTOHELPSOUNDVOL_NORMATTN_NORM0PITCH_NORM);
   new 
Float:forigin[3];
   
entity_get_vector(idEV_VEC_originforigin);

   new 
iOrigin[3];
   for(new 
i=0;i<3;i++)
   
iOrigin[i] = floatround(forigin[i]);

   
message_beginMSG_BROADCASTSVC_TEMPENTITYiOrigin );
   
write_byteTE_BEAMCYLINDER );
   
write_coordiOrigin[0] );
   
write_coordiOrigin[1] );
   
write_coordiOrigin[2] );
   
write_coordiOrigin[0] );
   
write_coordiOrigin[1] + 300 );
   
write_coordiOrigin[2] + 300 );
   
write_shortsprite_white );
   
write_byte); // startframe
   
write_byte); // framerate
   
write_byte10 ); // life
   
write_byte10 ); // width
   
write_byte255 ); // noise
   
write_byte255 ); // r, g, b
   
write_byte100 );// r, g, b
   
write_byte100 ); // r, g, b
   
write_byte128 ); // brightness
   
write_byte); // speed
   
message_end();
   

Ykaru is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:04.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode