05/01/2021, 11:15 PM
(Última modificación: 05/01/2021, 11:19 PM por warps. Edited 2 times in total.)
Hola, terminé haciendo este copypast para mi y lo comparto por si a alguien mas le sirve o interesa.
La idea es usarlo con podbot y tienen que tener activo statsx.amxx, adjunto un mapa que hice rápido junto con sus waypoints y sonidos, salu3
La idea es usarlo con podbot y tienen que tener activo statsx.amxx, adjunto un mapa que hice rápido junto con sus waypoints y sonidos, salu3
Código PHP:
#include <amxmod>
#include <amxmisc>
#include <csstats>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <fakemeta_util>
#include <fun>
#include <hamsandwich>
#define PLUGIN "AimTrain!"
#define VERSION "1.0"
#define AUTHOR "amxmodx"
// Ammo fill by Exolent in https://forums.alliedmods.net/showthread.php?t=102416?t=102416
// Auto Respawn by Napoleon_be in https://forums.alliedmods.net/showthread.php?t=320116
// RoundTimer by AntiBots in https://forums.alliedmods.net/showthread.php?t=80044
// Screen Fade by Exolent in https://forums.alliedmods.net/showthread.php?t=72932
enum AmmoTypes
{
AMMO_CLIP,
AMMO_BACKPACK
};
new const g_iWeaponAmmo[ ][ AmmoTypes ] =
{
{ 0, 0 }, // NULL
{ 13, 52 },
{ 0, 0 }, // SHIELD
{ 10, 90 },
{ 0, 1} ,
{ 7, 32 },
{ 0, 0 }, // C4
{ 30, 100 },
{ 30, 90 },
{ 0, 1 },
{ 30, 120 },
{ 20, 100 },
{ 25, 100 },
{ 30, 90 },
{ 35, 90 },
{ 25, 90 },
{ 12, 100 },
{ 20, 120 },
{ 10, 30 },
{ 30, 120 },
{ 100, 200 },
{ 8, 32 },
{ 30, 90 },
{ 30, 120 },
{ 20, 90 },
{ 0, 2 },
{ 7, 35 },
{ 30, 90 },
{ 30, 90 },
{ 0, 0 }, // KNIFE
{ 50, 100 }
};
new g_iMaxPlayers;
new g_msgScreenFade;
new trainTime
new bool:atrSounds
new bool:atiAmmo
new szPWeapons
new szSWeapons
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Killed, "player", "PostPlayerKilled", 1)
register_event( "DeathMsg", "EventDeathMsg", "a");
trainTime = register_cvar("trainTime","60")
g_iMaxPlayers = get_maxplayers( );
g_msgScreenFade = get_user_msgid("ScreenFade");
register_clcmd("say /s", "stats")
register_clcmd("say /w", "watch")
register_clcmd("say /t", "restartTrain")
register_clcmd("say /m", "aimtrainMenu")
register_clcmd("say /j", "weaponmenu")
register_clcmd("say /i", "loadweapons")
register_clcmd("say /o", "playsounds")
register_clcmd("say /k", "noweaponsbots")
}
public plugin_precache(){
precache_sound("misc/sheep.wav")
precache_sound("misc/impressive.wav")
precache_sound("misc/perfect.wav")
precache_sound("misc/holyshit.wav")
precache_sound("misc/wickedsick.wav")
precache_sound("misc/godlike.wav")
}
public client_connect(id){
if(!is_user_bot(id))
{
server_cmd("amx_cvar pb_jasonmode 1")
}
}
//Refill by Exolent
public EventDeathMsg(){
if(atiAmmo){
new iKiller = read_data( 1 );
if( !( 1 <= iKiller <= g_iMaxPlayers )|| !is_user_alive( iKiller ) )
{
return;
}
new iVictim = read_data( 2 );
if( iVictim == iKiller|| cs_get_user_team( iVictim ) == cs_get_user_team( iKiller ) )
{
return;
}
static szWeaponName[ 32 ];
read_data( 4, szWeaponName, 31 );
if( equal( szWeaponName, "grenade" ) )
{
return;
}
new iWeaponId = get_user_weapon( iKiller );
if( !( 1 <= iWeaponId < sizeof( g_iWeaponAmmo ) )|| ( 1 << iWeaponId ) & ( ( 1 << 2 ) | ( 1 << CSW_C4 ) | ( 1 << CSW_KNIFE ) ) )
{
return;
}
get_weaponname( iWeaponId, szWeaponName, 31 );
new iWeaponEntity = find_ent_by_owner( -1, szWeaponName, iKiller );
if( is_valid_ent( iWeaponEntity ) )
{
cs_set_weapon_ammo( iWeaponEntity, g_iWeaponAmmo[ iWeaponId ][ AMMO_CLIP ] );
}
cs_set_user_bpammo( iKiller, iWeaponId, g_iWeaponAmmo[ iWeaponId ][ AMMO_BACKPACK ] );
}
}
//Auto Respawn by Napoleon_be
public PostPlayerKilled(iVictim, iAttacker, shouldgib) {
set_task(2.0, "RespawnVictim", iVictim)
}
public RespawnVictim(id) {
if(!is_user_alive(id)) {
ExecuteHamB(Ham_CS_RoundRespawn, id)
}
}
//Screen Fade by Exolent
make_ScreenFade(plr, Float:fDuration, red, green, blue, alpha){
new i = plr ? plr : get_player();
if( !i )
{
return 0;
}
message_begin(plr ? MSG_ONE : MSG_ALL, g_msgScreenFade, {0, 0, 0}, plr);
write_short(floatround(4096.0 * fDuration, floatround_round));
write_short(floatround(4096.0 * fDuration, floatround_round));
write_short(4096);
write_byte(red);
write_byte(green);
write_byte(blue);
write_byte(alpha);
message_end();
return 1;
}
get_player(){
for( new plr = 1; plr <= g_iMaxPlayers; plr++ )
{
if( is_user_connected(plr) )
{
return plr;
}
}
return 0;
}
//Timer
public showtimer(id){
new RoundTime
RoundTime = get_user_msgid("RoundTime");
message_begin(MSG_ONE, RoundTime, {0, 0, 0}, id);
write_short(get_pcvar_num(trainTime))
message_end();
}
//Stats
public stats(id){
if (callfunc_begin("cmdStatsMe", "statsx.amxx") == 1) {
callfunc_push_int(id)
callfunc_end()
}
}
//Trainer
public watch(id){
make_ScreenFade(id, 3.0, 0, 0, 0, 255)
loadweapons(id)
client_print(id,print_center,"AimTrain is On!")
set_task(3.0, "showtimer", id)
set_task(get_pcvar_float(trainTime), "stats",id)
set_task(get_pcvar_float(trainTime), "restartTrain",id)
set_task(get_pcvar_float(trainTime), "playsounds",id)
}
//Weapon Loader
public loadweapons(id){
strip_user_weapons(id)
if(szPWeapons == 0)
{
give_item(id, "weapon_ak47")
cs_set_user_bpammo(id, CSW_AK47, 90)
}
if(szPWeapons == 1)
{
give_item(id, "weapon_m4a1")
cs_set_user_bpammo(id, CSW_M4A1, 90)
}
if(szPWeapons == 2)
{
give_item(id, "weapon_galil")
cs_set_user_bpammo(id, CSW_GALIL, 90)
}
if(szPWeapons == 3)
{
give_item(id, "weapon_famas")
cs_set_user_bpammo(id, CSW_FAMAS, 90)
}
if(szPWeapons == 4)
{
give_item(id, "weapon_awp")
cs_set_user_bpammo(id, CSW_AWP, 3)
}
if(szPWeapons == 5)
{
give_item(id, "weapon_aug")
cs_set_user_bpammo(id, CSW_AUG, 90)
}
if(szPWeapons == 6)
{
give_item(id, "weapon_sg552")
cs_set_user_bpammo(id, CSW_SG552, 90)
}
if(szSWeapons == 0)
{
give_item(id, "weapon_glock18")
cs_set_user_bpammo(id, CSW_GLOCK18, 120)
}
if(szSWeapons == 1)
{
give_item(id, "weapon_usp")
cs_set_user_bpammo(id, CSW_USP, 100)
}
if(szSWeapons == 2)
{
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 35)
}
if(szSWeapons == 3)
{
give_item(id, "weapon_p228")
cs_set_user_bpammo(id, CSW_P228, 120)
}
if(szSWeapons == 4)
{
give_item(id, "weapon_elite")
cs_set_user_bpammo(id, CSW_ELITE, 120)
}
if(szSWeapons == 5)
{
give_item(id, "weapon_fiveseven")
cs_set_user_bpammo(id, CSW_FIVESEVEN, 120)
}
}
//Sounds
public playsounds(id){
new frags = get_user_frags(id)
if(atrSounds)
{
if(frags <= 0)
{
client_cmd(id, "spk misc/sheep.wav")
}
if(frags >= 25 && frags < 35)
{
client_cmd(id, "spk misc/impressive.wav")
}
if(frags >= 35 && frags < 40)
{
client_cmd(id, "spk misc/perfect.wav")
}
if(frags >= 40 && frags < 45)
{
client_cmd(id, "spk misc/holyshit.wav")
}
if(frags >= 45 && frags < 50)
{
client_cmd(id, "spk misc/wickedsick.wav")
}
if(frags >= 50)
{
client_cmd(id, "spk misc/godlike.wav")
}
}
}
//Menues
public aimtrainMenu(id){
new atSounds[198]
new atiClip [198]
new atMenu = menu_create("\yAimTrain!", "aimcfgMenu")
formatex(atSounds, charsmax(atSounds), "AimTrain! Sounds: \r[%s]", atrSounds ? "On" : "Off")
formatex(atiClip, charsmax(atiClip), "AimTrain! Refill on kill: \r[%s]", atiAmmo ? "On" : "Off")
menu_additem(atMenu, "\wStart AimTrain!", "1")
menu_additem(atMenu, "\wWeapons", "2")
menu_additem(atMenu, atiClip, "3")
menu_additem(atMenu, atSounds, "4")
menu_display(id, atMenu, 0)
}
public aimcfgMenu(id, menu, item){
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED;
}
switch(item)
{
case 0:
{
reset_user_wstats(id)
set_task (2.0, "watch", id)
server_cmd("amx_cvar mp_freezetime 3")
server_cmd("amx_cvar sv_restart 1")
}
}
switch(item)
{
case 1:
{
weaponmenu(id)
}
}
switch(item)
{
case 2:
{
atiAmmo = !atiAmmo
if(atiAmmo)
{
client_print(id,print_chat,"Refill on Kill is On")
aimtrainMenu(id)
}
else
{
client_print(id,print_chat,"Refill on Kill is Off")
aimtrainMenu(id)
}
}
}
switch(item)
{
case 3:
{
atrSounds = !atrSounds
if(atrSounds)
{
client_print(id,print_chat,"Sounds On")
aimtrainMenu(id)
}
else
{
client_print(id,print_chat,"Sounds Off")
aimtrainMenu(id)
}
}
}
return PLUGIN_HANDLED;
}
public weaponmenu(id){
new wMenu = menu_create("\yWeapons Menu", "aimtrainPWeapons")
menu_additem(wMenu, "\wAK-47", "0")
menu_additem(wMenu, "\wM4A1", "1")
menu_additem(wMenu, "\wGalil", "2")
menu_additem(wMenu, "\wFamas", "3")
menu_additem(wMenu, "\wAWP", "4")
menu_additem(wMenu, "\wAUG", "5")
menu_additem(wMenu, "\wSG552 Krieg", "6")
menu_display(id, wMenu, 0)
}
public aimtrainPWeapons(id, menu, item){
if (item == MENU_EXIT)
{
sweaponmenu(id)
}
switch(item)
{
case 0:
{
strip_user_weapons(id)
szPWeapons = 0
give_item(id, "weapon_ak47")
cs_set_user_bpammo(id, CSW_AK47, 90)
sweaponmenu(id)
}
}
switch(item)
{
case 1:
{
strip_user_weapons(id)
szPWeapons = 1
give_item(id, "weapon_m4a1")
cs_set_user_bpammo(id,CSW_M4A1,90)
sweaponmenu(id)
}
}
switch(item)
{
case 2:
{
strip_user_weapons(id)
szPWeapons = 2
give_item(id, "weapon_galil")
cs_set_user_bpammo(id, CSW_GALIL, 90)
sweaponmenu(id)
}
}
switch(item)
{
case 3:
{
strip_user_weapons(id)
szPWeapons = 3
give_item(id, "weapon_famas")
cs_set_user_bpammo(id, CSW_FAMAS, 90)
sweaponmenu(id)
}
}
switch(item)
{
case 4:
{
strip_user_weapons(id)
szPWeapons = 4
give_item(id, "weapon_awp")
cs_set_user_bpammo(id, CSW_AWP, 30)
sweaponmenu(id)
}
}
switch(item)
{
case 5:
{
strip_user_weapons(id)
szPWeapons = 5
give_item(id, "weapon_aug")
cs_set_user_bpammo(id, CSW_AUG, 90)
sweaponmenu(id)
}
}
switch(item)
{
case 6:
{
strip_user_weapons(id)
szPWeapons = 6
give_item(id, "weapon_sg552")
cs_set_user_bpammo(id, CSW_SG552, 90)
sweaponmenu(id)
}
}
}
public sweaponmenu(id){
new swMenu = menu_create("\yWeapons Menu", "aimtrainSWeapons")
menu_additem(swMenu, "\wGlock", "0")
menu_additem(swMenu, "\wUSP", "1")
menu_additem(swMenu, "\wDeagle", "2")
menu_additem(swMenu, "\wP228", "3")
menu_additem(swMenu, "\wDual", "4")
menu_additem(swMenu, "\wFive-Sevem", "5")
menu_display(id, swMenu, 0)
}
public aimtrainSWeapons(id, menu, item){
if (item == MENU_EXIT)
{
aimtrainMenu(id)
}
switch(item)
{
case 0:
{
szSWeapons = 0
give_item(id, "weapon_glock18")
cs_set_user_bpammo(id, CSW_GLOCK18, 120)
aimtrainMenu(id)
}
}
switch(item)
{
case 1:
{
szSWeapons = 1
give_item(id, "weapon_usp")
cs_set_user_bpammo(id, CSW_USP, 120)
aimtrainMenu(id)
}
}
switch(item)
{
case 2:
{
szSWeapons = 2
give_item(id, "weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 35)
aimtrainMenu(id)
}
}
switch(item)
{
case 3:
{
szSWeapons = 3
give_item(id, "weapon_p228")
cs_set_user_bpammo(id, CSW_P228, 120)
aimtrainMenu(id)
}
}
switch(item)
{
case 4:
{
szSWeapons = 4
give_item(id, "weapon_elite")
cs_set_user_bpammo(id, CSW_ELITE, 120)
aimtrainMenu(id)
}
}
switch(item)
{
case 5:
{
szSWeapons = 5
give_item(id, "weapon_fiveseven")
cs_set_user_bpammo(id, CSW_FIVESEVEN, 120)
aimtrainMenu(id)
}
}
}
public restartTrain(id){
new gMenu = menu_create("\yReset AimTrain?", "aimtrainReset")
menu_additem(gMenu, "\wYes", "1")
menu_additem(gMenu, "\wNo", "2")
menu_display(id, gMenu, 0)
}
public aimtrainReset(id, menu, item)
{
if ( item == MENU_EXIT )
{
menu_destroy(menu)
return PLUGIN_HANDLED;
}
switch(item)
{
case 0:
{
reset_user_wstats(id)
set_task(2.0, "watch", id)
client_print(id, print_center, "AimTrain reseted.")
server_cmd("amx_cvar mp_freezetime 3")
server_cmd("amx_cvar sv_restart 1")
}
case 1:
{
client_print(id, print_center, "Enjoy freeplay :)")
}
}
return PLUGIN_HANDLED;
}