Page 1 of 2

Help System BaseBuilder

Posted: 07 Sep 2019, 05:33
by Xeno985
Salut, am si eu o problema la Help System (Versiunea lui MAGNET, putin editată de mine), când trimit comanda [/ahelp], nu mai functioneaza chat-ul...

Code: Select all

#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(id, nick, charsmax(nick))

   if(!is_user_alive(id))
      return PLUGIN_HANDLED;

   if(cs_get_user_team(id) != CS_TEAM_CT)
   {
      client_print(id, print_chat, "[Help System] Zombie nu au acces la aceasta comanda.")
      return PLUGIN_HANDLED;
   }
   
   if(!valuri)
   {
      client_print(id, print_chat, "[Help System] Nu poti folosi inca aceasta comanda.")
      return PLUGIN_HANDLED;
   }
   
   for(new i = 0;i<32;i++)
   {
      if(!is_user_connected(i) || !(get_user_flags(i) & ADMIN_FLAG))   continue;
      ArrayPushString(g_Array, nick)
      client_print(0, print_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(id, print_chat, "[Help System] Nimeni nu are nevoie de ajutor.")
      return;
   }
   else
   {
      for (new i; i < ArraySize(g_Array); i++)
      {
         ArrayGetString(g_Array, i, szTemp, charsmax(szTemp))
         menu_additem(menu, szTemp, _, i, 0)
      }
   }

   menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
   menu_display(id, menu, 0)
}

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

   new data[6], name[64], admin_name[32]
   new access, callback
   get_user_name(id, admin_name, 31)
   menu_item_getinfo(menu, item, access, data, 5, name, 63, callback)

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

   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_Array, callback)
   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(id, CHAN_AUTO, HELPSOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
   new Float:forigin[3];
   entity_get_vector(id, EV_VEC_origin, forigin);

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

   message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin );
   write_byte( TE_BEAMCYLINDER );
   write_coord( iOrigin[0] );
   write_coord( iOrigin[1] );
   write_coord( iOrigin[2] );
   write_coord( iOrigin[0] );
   write_coord( iOrigin[1] + 300 );
   write_coord( iOrigin[2] + 300 );
   write_short( sprite_white );
   write_byte( 0 ); // startframe
   write_byte( 0 ); // framerate
   write_byte( 10 ); // life
   write_byte( 10 ); // width
   write_byte( 255 ); // noise
   write_byte( 255 ); // r, g, b
   write_byte( 100 );// r, g, b
   write_byte( 100 ); // r, g, b
   write_byte( 128 ); // brightness
   write_byte( 0 ); // speed
   message_end();
   
}
Dacă ma puteti ajuta, ar fi super, iar daca se poate adauga pentru admin, când selectează un jucător din lista, sa il teleporteze la respectivul.
Mersi

Re: Help System BaseBuilder

Posted: 07 Sep 2019, 12:36
by Filiq_
Ceva erori? In consola sau logs in amxx, dai comanda /ahelp dupa scrie ceva in chat si uita-te dupa erori.

Re: Help System BaseBuilder

Posted: 07 Sep 2019, 12:58
by L E V I N

Code: Select all

#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")
   register_clcmd("say /ahelp", "ajutor_menu")
   register_clcmd("say /ah", "ajutor_menu")
   g_Array = ArrayCreate(32);
}


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)
{
   if(!is_user_alive(id))
      return;

   if(cs_get_user_team(id) != CS_TEAM_CT)
   {
      client_print(id, print_chat, "[Help System] Zombie nu au acces la aceasta comanda.")
      return
   }
   
   if(!valuri)
   {
      client_print(id, print_chat, "[Help System] Nu poti folosi inca aceasta comanda.")
      return
   }

   new nick[32];
   get_user_name(id, nick, charsmax(nick))

   ArrayPushString(g_Array, nick)
   client_print(0, print_chat, "[Help System] Jucatorul %s are nevoie de ajutor.", nick)
   client_cmd(0, "spk %s",HELPSOUND)

   set_task(1.0, "Info", id+32, .flags="b");
}

public ajutor_menu(id) {
   if(!(get_user_flags(id)&ADMIN_FLAG))	return

   new szTemp[15]
   new menu = menu_create("Help Players Menu", "menu_handler")

   if(!ArraySize(g_Array))
   {
      client_print(id, print_chat, "[Help System] Nimeni nu are nevoie de ajutor.")
      return;
   }
   else
   {
      for (new i; i < ArraySize(g_Array); i++)
      {
         ArrayGetString(g_Array, i, szTemp, charsmax(szTemp))
         menu_additem(menu, szTemp, _, i, 0)
      }
   }

   menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
   menu_display(id, menu, 0)
}

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

   new data[6], name[64], admin_name[32]
   new access, callback
   get_user_name(id, admin_name, 31)
   menu_item_getinfo(menu, item, access, data, 5, name, 63, callback)
   new userid = str_to_num( data );
   new player = find_player( "k", userid );
   if(!is_user_alive(player))	return
   new pname[32]
   get_user_name(player,pname,charsmax(pname))

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

   client_cmd(id, "amx_godmode %s", pname)
   client_cmd(id, "amx_godmode %s", admin_name)
   client_cmd(id, "amx_noclip %s", admin_name)
   
   ArrayDeleteItem(g_Array, callback)
   menu_destroy(menu)
}

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(id, CHAN_AUTO, HELPSOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
   new Float:forigin[3];
   entity_get_vector(id, EV_VEC_origin, forigin);

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

   message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin );
   write_byte( TE_BEAMCYLINDER );
   write_coord( iOrigin[0] );
   write_coord( iOrigin[1] );
   write_coord( iOrigin[2] );
   write_coord( iOrigin[0] );
   write_coord( iOrigin[1] + 300 );
   write_coord( iOrigin[2] + 300 );
   write_short( sprite_white );
   write_byte( 0 ); // startframe
   write_byte( 0 ); // framerate
   write_byte( 10 ); // life
   write_byte( 10 ); // width
   write_byte( 255 ); // noise
   write_byte( 255 ); // r, g, b
   write_byte( 100 );// r, g, b
   write_byte( 100 ); // r, g, b
   write_byte( 128 ); // brightness
   write_byte( 0 ); // speed
   message_end();
}

public plugin_end()	ArrayDestroy(g_Array)

#pragma tabsize 0

Re: Help System BaseBuilder

Posted: 07 Sep 2019, 13:50
by Xeno985
Filiq_ wrote:
07 Sep 2019, 12:36
Ceva erori? In consola sau logs in amxx, dai comanda /ahelp dupa scrie ceva in chat si uita-te dupa erori.
La compilare a dat unele mismatch, dar a mers.
M-am uitat in consola in gamecp, dădea o eroare cu debug, am adăugat debug si spunea ceva de p:::menu_handler si de linia 137 parcă.

LEVIN, voi testa diseara pluginul, acum sunt la muncă.

Re: Help System BaseBuilder

Posted: 07 Sep 2019, 18:43
by Xeno985
L E V I N wrote:
07 Sep 2019, 12:58

Code: Select all

#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")
   register_clcmd("say /ahelp", "ajutor_menu")
   register_clcmd("say /ah", "ajutor_menu")
   g_Array = ArrayCreate(32);
}


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)
{
   if(!is_user_alive(id))
      return;

   if(cs_get_user_team(id) != CS_TEAM_CT)
   {
      client_print(id, print_chat, "[Help System] Zombie nu au acces la aceasta comanda.")
      return
   }
   
   if(!valuri)
   {
      client_print(id, print_chat, "[Help System] Nu poti folosi inca aceasta comanda.")
      return
   }

   new nick[32];
   get_user_name(id, nick, charsmax(nick))

   ArrayPushString(g_Array, nick)
   client_print(0, print_chat, "[Help System] Jucatorul %s are nevoie de ajutor.", nick)
   client_cmd(0, "spk %s",HELPSOUND)

   set_task(1.0, "Info", id+32, .flags="b");
}

public ajutor_menu(id) {
   if(!(get_user_flags(id)&ADMIN_FLAG))	return

   new szTemp[15]
   new menu = menu_create("Help Players Menu", "menu_handler")

   if(!ArraySize(g_Array))
   {
      client_print(id, print_chat, "[Help System] Nimeni nu are nevoie de ajutor.")
      return;
   }
   else
   {
      for (new i; i < ArraySize(g_Array); i++)
      {
         ArrayGetString(g_Array, i, szTemp, charsmax(szTemp))
         menu_additem(menu, szTemp, _, i, 0)
      }
   }

   menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
   menu_display(id, menu, 0)
}

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

   new data[6], name[64], admin_name[32]
   new access, callback
   get_user_name(id, admin_name, 31)
   menu_item_getinfo(menu, item, access, data, 5, name, 63, callback)
   new userid = str_to_num( data );
   new player = find_player( "k", userid );
   if(!is_user_alive(player))	return
   new pname[32]
   get_user_name(player,pname,charsmax(pname))

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

   client_cmd(id, "amx_godmode %s", pname)
   client_cmd(id, "amx_godmode %s", admin_name)
   client_cmd(id, "amx_noclip %s", admin_name)
   
   ArrayDeleteItem(g_Array, callback)
   menu_destroy(menu)
}

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(id, CHAN_AUTO, HELPSOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
   new Float:forigin[3];
   entity_get_vector(id, EV_VEC_origin, forigin);

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

   message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin );
   write_byte( TE_BEAMCYLINDER );
   write_coord( iOrigin[0] );
   write_coord( iOrigin[1] );
   write_coord( iOrigin[2] );
   write_coord( iOrigin[0] );
   write_coord( iOrigin[1] + 300 );
   write_coord( iOrigin[2] + 300 );
   write_short( sprite_white );
   write_byte( 0 ); // startframe
   write_byte( 0 ); // framerate
   write_byte( 10 ); // life
   write_byte( 10 ); // width
   write_byte( 255 ); // noise
   write_byte( 255 ); // r, g, b
   write_byte( 100 );// r, g, b
   write_byte( 100 ); // r, g, b
   write_byte( 128 ); // brightness
   write_byte( 0 ); // speed
   message_end();
}

public plugin_end()	ArrayDestroy(g_Array)

#pragma tabsize 0
Nu merge LEVIN, tot la fel, gen dezactiveaza chat-ul, plus nu imi mai arata mesajul ca x accepta cererea lui y si seteaza godmode si noclip

Re: Help System BaseBuilder

Posted: 07 Sep 2019, 20:53
by L E V I N
e prost făcut de la început
erori?

Re: Help System BaseBuilder

Posted: 08 Sep 2019, 12:01
by Xeno985
L E V I N wrote:
07 Sep 2019, 20:53
e prost făcut de la început
erori?
Csf, este facut de mine partea de adminhelp :))
Nu apar erori

Re: Help System BaseBuilder

Posted: 08 Sep 2019, 21:49
by L E V I N

Re: Help System BaseBuilder

Posted: 08 Sep 2019, 22:01
by Xeno985
Nu este un plugin de report...
Este pluginul lui MAGNET https://www.freakz.ro/forum/Cerere-plug ... 50607.html
A fost adăugată de mine toata partea de admin.
Gen vreau ca atunci cand un player scrie [/help], sa ii apara acele "valuri" in jurul lui (cum este duelul pe dr) si sa fie adăugat într-un meniu special pentru admini [/adminhelp], când un admin se uita acolo si alege un jucător ce a folosit comanda, sa reteze jucătorului godmode, iar adminului noclip, godmode si sa il teleporteze la jucătorul respectiv, înțeleseși tu?
Am făcut eu acel meniu de admin, dar nu am observat acest bug la chat.

Re: Help System BaseBuilder

Posted: 08 Sep 2019, 23:49
by L E V I N
ce bug în chat?

Re: Help System BaseBuilder

Posted: 09 Sep 2019, 05:59
by Xeno985
L E V I N wrote:
08 Sep 2019, 23:49
ce bug în chat?
Am spus de la început, când dau [/ahelp], se "strică" chat-ul, adică nu mai imi apare ce scriu eu, nici ce scriu ceilalți.

Re: Help System BaseBuilder

Posted: 09 Sep 2019, 23:42
by L E V I N

Code: Select all

#include <amxmodx>
#include <engine>
#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")
   register_clcmd("say /ahelp", "ajutor_menu")
   register_clcmd("say /ah", "ajutor_menu")
   g_Array = ArrayCreate(32,32);
}


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)
{
   if(!is_user_alive(id))
      return;

   if(cs_get_user_team(id) != CS_TEAM_CT)
   {
      client_print(id, print_chat, "[Help System] Zombie nu au acces la aceasta comanda.")
      return
   }
   
   if(!valuri)
   {
      client_print(id, print_chat, "[Help System] Nu poti folosi inca aceasta comanda.")
      return
   }

   new nick[32];
   get_user_name(id, nick, charsmax(nick))

   ArrayPushString(g_Array, nick)
   client_print(0, print_chat, "[Help System] Jucatorul %s are nevoie de ajutor.", nick)
   client_cmd(0, "spk %s",HELPSOUND)

   set_task(1.0, "Info", id+32, .flags="b");
}

public ajutor_menu(id) {
   if(!(get_user_flags(id)&ADMIN_FLAG))	return

   new szTemp[32]
   new menu = menu_create("Help Players Menu", "menu_handler")

   if(!ArraySize(g_Array))	client_print(id, print_chat, "[Help System] Nimeni nu are nevoie de ajutor.")
   else
   {
      for (new i; i < ArraySize(g_Array); i++)
      {
         ArrayGetString(g_Array, i, szTemp, charsmax(szTemp))
         menu_additem(menu, szTemp)
      }
   }

   menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
   menu_display(id, menu, 0)
}

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

   new data[6], name[64], admin_name[32]
   new access, callback
   get_user_name(id, admin_name, 31)
   menu_item_getinfo(menu, item, access, data, 5, name, 63, callback)
   new userid = str_to_num( data );
   new player = find_player( "k", userid );
   if(!is_user_alive(player))	return
   new pname[32]
   get_user_name(player,pname,charsmax(pname))

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

   server_cmd("amx_godmode %s", pname)
   //client_cmd(id, "amx_godmode %s", admin_name)
   server_cmd("amx_noclip %s", admin_name)
   
   ArrayDeleteItem(g_Array, callback)
   menu_destroy(menu)
}

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(id, CHAN_AUTO, HELPSOUND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
   new Float:forigin[3];
   entity_get_vector(id, EV_VEC_origin, forigin);

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

   message_begin( MSG_BROADCAST, SVC_TEMPENTITY, iOrigin );
   write_byte( TE_BEAMCYLINDER );
   write_coord( iOrigin[0] );
   write_coord( iOrigin[1] );
   write_coord( iOrigin[2] );
   write_coord( iOrigin[0] );
   write_coord( iOrigin[1] + 300 );
   write_coord( iOrigin[2] + 300 );
   write_short( sprite_white );
   write_byte( 0 ); // startframe
   write_byte( 0 ); // framerate
   write_byte( 10 ); // life
   write_byte( 10 ); // width
   write_byte( 255 ); // noise
   write_byte( 255 ); // r, g, b
   write_byte( 100 );// r, g, b
   write_byte( 100 ); // r, g, b
   write_byte( 128 ); // brightness
   write_byte( 0 ); // speed
   message_end();
}

public plugin_end()	ArrayDestroy(g_Array)

#pragma tabsize 0