/* Sublime AMXX Editor v3.0.0-beta */
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
//EDIT DEL MODO ORIGINAL FreezeTag DEL AUTOR Javivi
#define TASK_END 3210
#define TASKID_ROUNDEND 1338
#define TASK_HUD 2100
new g_Team[33], g_AliveT, g_AliveCT, g_FrozenT;
new g_Points[33];
new g_maxplayers;
new PrecacheSpawn;
new ScoreHud;
new g_msgScreenFade;
new g_HudSync;
new bool:isRoundEnd;
new const RemoveEntities[ ][ ] =
{
"func_hostage_rescue", "info_hostage_rescue", "func_bomb_target", "info_bomb_target",
"hostage_entity", "info_vip_start", "func_vip_safetyzone", "func_escapezone"
}
enum _:i_Items
{
Item[33],
Precio[10],
Descripcion[40]
}
new const i_ItemsCT[][i_Items] =
{
{"+30 HP", 5, "Aumenta tu vida +30 puntos"},
{"Velocidad", 8, "Aumenta tu velocidad 10s"},
{"Gravedad", 12, "Disminuye tu gravedad"},
{"Invisibilidad", 16, "Se invisible por 10s"}
};
new const i_ItemsT[][i_Items] =
{
{"+30 HP", 5, "Aumenta tu vida +30 puntos"},
{"Velocidad", 8, "Aumenta tu velocidad 10s"},
{"Gravedad", 12, "Disminuye tu gravedad"},
{"Invisibilidad", 16, "Se invisible por 10s"},
{"Inmunidad", 18, "Se inmune durante 10s"},
{"Descongelarme", 22, "El nombre lo dice todo 8v"}
}
enum _:i_Clases
{
Nombre[33],
Dir[60],
Float:Velocidad,
Float:Gravedad,
Hp,
Chaleco}
new const i_ClasesCT[][i_Clases] =
{
{"Barney", "models/player/Barney/Barney.mdl", 250.0, 1.1, 140, 80},
{"Homero", "models/player/Homero/Homero.mdl", 260.0, 1.0, 130, 70},
{"Smithers", "models/player/Smithers/Smithers.mdl", 280.0, 0.9, 110, 40},
{"Apu", "models/player/Apu/Apu.mdl", 300.0, 0.7, 100, 15}
}
new const i_ClasesTT[][i_Clases] =
{
{"Burns", "models/player/Burns/Burns.mdl", 270.0, 0.7, 90, 60},
{"Bart", "models/player/Bart/Bart.mdl", 310.0, 0.6, 100, 40},
{"Otto", "models/player/Otto/Otto.mdl", 280.0, 0.9, 120, 40},
{"Krusty", "models/player/Krusty/Krusty.mdl", 260.0, 0.8, 110, 80}
}
//CVARS
new cvar_pp_freeze, cvar_pp_unfreeze;
//CVARS TIENDA
new cvar_shop_maxhp;
//VARIABLES TIENDA
new bool:g_isUserSpeed[33], bool:g_isUserGravity[33], bool:g_isUserInv[33], bool:g_isUserInm[33];
public plugin_init()
{
register_plugin("Sol & Hielo", "1.4", "GabsHp");
unregister_forward(FM_Spawn, PrecacheSpawn);
//HAM's
RegisterHam(Ham_Touch, "player", "fw_PlayerTouch");
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn", 1)
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled", 1);
RegisterHam(Ham_TakeDamage, "player", "Player_TakeDamage");
//HAM BLOCK KNIFE
RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_knife", "OnPrimaryAttack" );
RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_knife", "OnSecondaryAttack" );
register_event( "HLTV", "new_round", "a", "1=0", "2=0" );
set_cvar_num( "mp_freezetime", 0 )
//PUNTOS POR CONGELAR/DESCONGELAR
cvar_pp_freeze = register_cvar("sh_pp_freeze", "3");
cvar_pp_unfreeze = register_cvar("sh_pp_unfreeze", "2");
//TIENDA
cvar_shop_maxhp = register_cvar("sh_shop_maxhp", "150");
//HUD
ScoreHud = CreateHudSyncObj();
g_HudSync = CreateHudSyncObj();
g_maxplayers = get_maxplayers();
g_msgScreenFade = get_user_msgid("ScreenFade");
//BLOQUEAR BUY
register_message(get_user_msgid("StatusIcon"), "msg_statusicon");
// BLOQUEAR MSG Y SONIDO WIN
register_message( get_user_msgid("SendAudio"), "msg_sendaudio");
register_message( get_user_msgid("TextMsg"), "msg_textmsg");
//COMANDOS
register_clcmd("say /d", "id_descongelar");
register_clcmd("say /shop", "openShop");
register_clcmd("nightvision", "openShop");
//TIENDA
}
public plugin_precache()
{
PrecacheSpawn = register_forward( FM_Spawn, "precache_spawn", 1 )
for(new i=1; i < sizeof i_ClasesCT; i++)
{
precache_model(i_ClasesCT[i][Dir])
}
for(new i=1; i < sizeof i_ClasesTT; i++)
{
precache_model(i_ClasesTT[i][Dir])
}
}
public precache_spawn(ent)
{
if( is_valid_ent(ent))
{
static szClass[33]
entity_get_string(ent, EV_SZ_classname, szClass, sizeof(szClass))
for(new i = 0; i < sizeof(RemoveEntities); i++)
if(equal(szClass, RemoveEntities[i]))
remove_entity(ent)
}
}
public client_disconnected(id)
{
if(is_user_alive(id))
{
if(g_Team[id] & 1)
{
g_AliveCT--
}
if(g_Team[id] & 2)
{
g_AliveT--
CheckTerrorist()
}
}
g_Points[id] = 0;
}
public client_putinserver(id)
{
set_task(1.0, "ShowHUD", id+TASK_HUD, _, _, "b")
g_Points[id]=15
}
public new_round()
{
g_FrozenT = 0
g_AliveT = 0
g_AliveCT= 0
isRoundEnd = false
remove_task( TASKID_ROUNDEND )
set_task(180.0, "Roundend", TASKID_ROUNDEND)
}
public Roundend(task)
{
if(isRoundEnd) return PLUGIN_HANDLED
set_hudmessage( 255, 0, 0, -1.0, 0.40, 1, 6.0, 5.0 )
ShowSyncHudMsg( 0, g_HudSync, "[TEAM SOL WINS]" )
client_cmd( 0, "spk radio/terwin.wav" )
for (new id = 1; id <= g_maxplayers; id++)
{
if(!is_user_connected(id))
continue
Unfreeze(id)
switch( g_Team[id])
{
case 2:
{
cs_set_user_team(id, CS_TEAM_CT)
}
case 1:
{
user_silentkill(id)
cs_set_user_team(id, CS_TEAM_T)
}
}
}
return PLUGIN_HANDLED
}
CheckTerrorist()
{
if(isRoundEnd) return PLUGIN_HANDLED
if(g_AliveT == 0)
{
isRoundEnd = true
set_hudmessage(0, 0, 255, -1.0, 0.30, 1, 6.0, 5.0)
ShowSyncHudMsg(0, g_HudSync, "[TEAM HIELO WINS]!")
client_cmd(0, "spk radio/ctwin.wav")
// Swap teams
for (new id = 1; id <= g_maxplayers; id++)
{
if(!is_user_connected(id))
continue
Unfreeze(id)
switch(g_Team[id])
{
case 2:
{
user_silentkill(id)
cs_set_user_team(id , CS_TEAM_CT)
set_user_frags(id, get_user_frags(id) + 1)
}
case 1:
{
user_silentkill(id)
set_user_frags(id, get_user_frags(id) + 2)
cs_set_user_team(id, CS_TEAM_T)
g_Points[id]+=5
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Has obtenido^4 5 puntos^1 por ganar la ronda!")
}
}
}
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
CheckCT()
{
if(isRoundEnd) return PLUGIN_HANDLED
if(g_AliveCT == 0)
{
isRoundEnd = true
set_hudmessage(255, 0, 0, -1.0, 0.30, 1, 6.0, 5.0)
ShowSyncHudMsg(0, g_HudSync, "[TEAM SOL WINS]")
client_cmd(0, "spk radio/terwin.wav")
for(new id = 1; id <= g_maxplayers; id++)
{
if(!is_user_connected(id)) continue
Unfreeze(id)
switch(g_Team[id])
{
case 2:
{
user_silentkill(id)
cs_set_user_team(id, CS_TEAM_CT)
set_user_frags(id, get_user_frags(id) + 2)
g_Points[id]+=5
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Has ganado^4 5 puntos^1 por ganar la ronda!")
}
case 1:
{
set_user_frags(id, get_user_frags(id) + 1)
user_silentkill(id)
cs_set_user_team(id, CS_TEAM_T)
}
}
}
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public ShowHUD(taskid)
{
new id = taskid-TASK_HUD
if(!is_user_alive(id))
{
set_hudmessage(0, 255, 0, -1.0, 0.8, 0, 6.0, 1.0)
ShowSyncHudMsg(id, ScoreHud, "[SOL & HIELO]^nDESCONGELADOS [%d] - [%d] CONGELADOS^nCT's [%d]", g_AliveT, g_FrozenT, g_AliveCT)
return;
}
set_hudmessage(0, 255, 0, -1.0, 0.8, 0, 6.0, 1.0)
ShowSyncHudMsg(id, ScoreHud, "[SOL & HIELO]^nDESCONGELADOS [%d] - [%d] CONGELADOS^nCT's [%d] - TUS PUNTOS [%d]", g_AliveT, g_FrozenT, g_AliveCT, g_Points[id])
}
public fw_PlayerKilled(id)
{
if(g_Team[id] == 2)
{
static Flags; Flags = entity_get_int(id, EV_INT_flags)
if(Flags & FL_FROZEN)
{
g_FrozenT--
Unfreeze(id)
CheckTerrorist()
return PLUGIN_HANDLED
}
CheckTerrorist()
g_AliveT--
return PLUGIN_HANDLED
}
if(g_Team[id] == 1)
{
g_AliveCT--
CheckCT()
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public fw_PlayerSpawn(id)
{
if(is_user_alive(id))
{
set_user_rendering(id)
GiveWeapons(id)
static clase; clase = random_num(0, 3)
switch(cs_get_user_team(id))
{
case CS_TEAM_CT:
{
g_Team[id] = 1
g_AliveCT++
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_knife")
client_print_color(id, print_team_default, "^4[Sol&Hielo] ^3Tu personaje es ^4[%s]", i_ClasesCT[clase][Nombre])
client_print_color(id, print_team_default, "^4[Sol&Hielo] ^3Velocidad^4 [%f] ^1-^3 Gravedad^4 [%f] ^1-^3 HP^4 [%d] ^1-^3 Chaleco^4 [%d]", i_ClasesCT[clase][Velocidad], i_ClasesCT[clase][Gravedad], i_ClasesCT[clase][Hp], i_ClasesCT[clase][Chaleco])
set_user_gravity(id, i_ClasesCT[clase][Gravedad])
set_user_health(id, i_ClasesCT[clase][Hp])
set_user_armor(id, i_ClasesCT[clase][Chaleco])
cs_set_user_model(id, i_ClasesCT[clase][Nombre])
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 30)
set_user_maxspeed(id, i_ClasesCT[clase][Velocidad])
}
case CS_TEAM_T:
{
g_Team[id] = 2
g_AliveT++
give_item(id, "weapon_flashbang")
give_item(id, "weapon_knife")
client_print_color(id, print_team_default, "^4[Sol&Hielo] ^3Tu personaje es ^4[%s]", i_ClasesTT[clase][Nombre])
client_print_color(id, print_team_default, "^4[Sol&Hielo] ^3Velocidad^4 [%f] ^1-^3 Gravedad^4 [%f] ^1-^3 HP^4 [%d] ^1-^3 Chaleco^4 [%d]", i_ClasesTT[clase][Velocidad], i_ClasesTT[clase][Gravedad], i_ClasesTT[clase][Hp], i_ClasesTT[clase][Chaleco])
set_user_gravity(id, i_ClasesTT[clase][Gravedad])
set_user_health(id, i_ClasesTT[clase][Hp])
set_user_armor(id, i_ClasesTT[clase][Chaleco])
cs_set_user_model(id, i_ClasesTT[clase][Nombre])
set_user_maxspeed(id, i_ClasesTT[clase][Velocidad])
}
}
//TIENDA
g_isUserGravity[id] = false
g_isUserSpeed[id] = false
g_isUserInv[id] = false
//TIENDA TT
g_isUserInm[id] = false
}
}
public fw_PlayerTouch(Toucher, Touched)
{
if(!is_user_alive(Toucher) || !is_user_alive(Touched)) return PLUGIN_HANDLED
static Flags; Flags = entity_get_int(Touched, EV_INT_flags)
static rName[33]; get_user_name(Toucher, rName, charsmax(rName))
static dName[33]; get_user_name(Touched, dName, charsmax(dName))
//SI UN CT TOCA A UN TERRORISTA
if(g_Team[Toucher] == 1 && g_Team[Touched] == 2)
{
if(Flags & FL_FROZEN || g_isUserInm[Touched]) return PLUGIN_HANDLED
if(entity_get_float(Touched, EV_FL_fuser1) < get_gametime())
{
client_print_color(Toucher, print_team_default, "^4[Sol&Hielo] ^1Has ^4congelado ^1a %s! ^4+%d Puntos" , dName, get_pcvar_num(cvar_pp_freeze))
client_print_color(Touched, print_team_default, "^4[Sol&Hielo] ^1Has sido ^4congelado^1 por ^4%s^1!", rName)
g_Points[Toucher]+=get_pcvar_num(cvar_pp_freeze)
entity_set_int(Touched, EV_INT_flags, Flags | FL_FROZEN)
g_FrozenT++
g_AliveT--
set_user_rendering(Touched, kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 40)
ScreenFade(Toucher, 0, 255, 0, 60)
ScreenFade(Touched, 0, 255, 255, 60)
entity_set_float(Touched, EV_FL_fuser1, get_gametime() + 2.0)
CheckTerrorist()
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
//SI UN TERRORISTA TOCA A OTRO TERRORISTA
if(g_Team[Toucher] == 2 && g_Team[Touched] == 2)
{
if(Flags & FL_FROZEN)
{
if(entity_get_float(Touched, EV_FL_fuser1) < get_gametime())
{
client_print_color(Toucher, print_team_default, "^4[Sol&Hielo] ^1Has descongelado a ^4%s^1! ^4+%d Puntos", dName, get_pcvar_num(cvar_pp_unfreeze))
client_print_color(Touched, print_team_default, "^4[Sol&Hielo] ^1Has sido ^4descongelado ^1por ^4%s^1!", rName)
g_Points[Toucher]+=get_pcvar_num(cvar_pp_unfreeze)
entity_set_int(Touched, EV_INT_flags, Flags &~ FL_FROZEN)
g_FrozenT--
g_AliveT++
set_user_rendering(Touched)
ScreenFade(Toucher, 0, 255, 0, 60)
ScreenFade(Touched, 255, 0, 0, 60)
entity_set_float(Touched, EV_FL_fuser1, get_gametime() + 2.0);
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public Player_TakeDamage( victim, inflictor, attacker, Float:damage, damagebits )
{
if(damagebits==DMG_FALL && g_Team[victim] == 2)
{
SetHamParamFloat(4, Float:0.0);
return HAM_HANDLED;
}
if(damage>get_user_health(victim) && g_Team[victim] == 2)
{
Unfreeze(victim)
if(g_Team[attacker] == 1)
{
g_Points[attacker]+=3
client_print_color(attacker, print_team_default, "^4[Sol&Hielo]^1 Has obtenido ^4+3 puntos por matar a tu enemigo!")
}
return HAM_HANDLED;
}
return HAM_IGNORED;
}
public msg_statusicon( msgid, dest, id )
{
static icon[ 5 ]
get_msg_arg_string( 2, icon, charsmax( icon ) )
if( icon[ 0 ] == 'b' && icon[ 2 ] == 'y' && icon[ 3 ] == 'z' )
{
// Block buy
set_pdata_int( id, 235, get_pdata_int( id, 235 ) &~ ( 1<<0 ) )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
// Block win msg
public msg_textmsg( msg_id, msg_dest, msg_entity )
{
static message[ 3 ]
get_msg_arg_string( 2, message, charsmax( message ) )
switch( message[1] )
{
case 'C', 'T':
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
// Block win sound
public msg_sendaudio( msg_id, msg_dest, msg_entity )
{
static message[10]
get_msg_arg_string( 2, message, charsmax( message ) )
switch( message[7] )
{
case 'c', 't' :
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public Unfreeze(id)
{
// Unfreeze player if it's frozen
static Flags; Flags = entity_get_int( id, EV_INT_flags )
if( Flags & FL_FROZEN )
entity_set_int( id, EV_INT_flags, Flags &~ FL_FROZEN )
}
public OnPrimaryAttack( const entity )
{
return HAM_SUPERCEDE;
}
public OnSecondaryAttack( const entity )
{
return HAM_SUPERCEDE;
}
public id_descongelar(id)
{
if(!(get_user_flags(id) & ADMIN_KICK))
{
client_print_color(id, print_team_default, "^4[Sol&Hielo] ^1Solo ^4ADMINS^1 pueden usar este comando!")
return PLUGIN_HANDLED
}
if(!is_user_alive(id)) return PLUGIN_HANDLED
static Flags; Flags = entity_get_int(id, EV_INT_flags)
if(Flags & FL_FROZEN && g_Team[id] == 2)
{
static szName[33]; get_user_name(id, szName, charsmax(szName))
entity_set_int(id, EV_INT_flags, Flags &~ FL_FROZEN)
ScreenFade(id, 255, 0, 0, 60)
client_print_color(id, print_team_default, "Equipo [%d]", g_Team[id])
client_print_color(0, print_team_default, "^4[Sol&Hielo] ^1El admin ^4%s ^1 se ha descongelado con comando!", szName)
g_FrozenT--
g_AliveT++
entity_set_float(id, EV_FL_fuser1, get_gametime() + 2.0);
return PLUGIN_HANDLED
}
client_print_color(id, print_center, "No estas congelado - Equipo [%d]", g_Team[id])
return PLUGIN_HANDLED
}
//TIENDA Y HABILIDADES
public openShop(id)
{
if(!is_user_alive(id))
{
client_print_color(id, print_team_default, "^4[Sol&Hielo] ^1No puedes usar la tienda mientras estás muerto!")
return PLUGIN_HANDLED
}
if(g_Team[id] == 1)
{
//ABRIR TIENDA CT
ctShop(id)
client_print_color(id, print_team_default, "^4[TiendaCT]^1 Tus puntos: ^4%d", g_Points[id])
}
if(g_Team[id] == 2)
{
//ABRIR TIENDA TT
ttShop(id)
client_print_color(id, print_team_default, "^4[TiendaTT]^1 Tus puntos: ^4%d", g_Points[id])
}
return PLUGIN_HANDLED
}
public ctShop(id)
{
new szItem[240], Posicion[2];
new titulo[100];
formatex(titulo, charsmax(titulo), "\r[\ySol&Hielo\r] \wTienda CT^n\w[\yTus Puntos: \r%d\w]", g_Points[id])
new ctMenu = menu_create(titulo, "handlerCT")
for(new i; i < sizeof i_ItemsCT; i++)
{
if(g_Points[id]<i_ItemsCT[i][Precio])
{
formatex(szItem, charsmax(szItem), "\y[\d%s\y] [\d%s\y] [\d%d puntos\y]", i_ItemsCT[i][Item], i_ItemsCT[i][Descripcion], i_ItemsCT[i][Precio])
}
else
{
formatex(szItem, charsmax(szItem), "\y[\w%s\y] [\w%s\y] [\r%d\w puntos\y]", i_ItemsCT[i][Item], i_ItemsCT[i][Descripcion], i_ItemsCT[i][Precio])
}
num_to_str(i, Posicion, charsmax(Posicion))
menu_additem(ctMenu, szItem, Posicion)
}
menu_setprop(ctMenu, MPROP_PERPAGE, 5)
menu_setprop(ctMenu, MPROP_NEXTNAME, "Siguiente")
menu_setprop(ctMenu, MPROP_BACKNAME, "Atras")
menu_setprop(ctMenu, MPROP_EXITNAME, "Salir")
menu_display(id, ctMenu, 0)
return PLUGIN_HANDLED
}
public handlerCT(id, menu, item)
{
if(!is_user_alive(id))
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No puedes usar esto ahora!")
}
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
switch(item)
{
//30HP
case 0:
{
if(g_Points[id]<i_ItemsCT[item][Precio])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No tienes suficientes puntos!")
return PLUGIN_HANDLED
}
if(get_user_health(id)+30 > get_pcvar_num(cvar_shop_maxhp))
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No puedes comprar este item, pues sobrepasa el limite de HP permitida!")
return PLUGIN_HANDLED
}
set_user_health(id, get_user_health(id)+30)
g_Points[id]-= i_ItemsCT[item][Precio]
ScreenFade(id, 255, 255, 0, 60)
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Has comprado^4 %s^1!", i_ItemsCT[item])
}
case 1:
{
if(g_Points[id]<i_ItemsCT[item][Precio])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No tienes suficientes puntos!")
return PLUGIN_HANDLED
}
if(g_isUserSpeed[id])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Ya has comprado este item!")
return PLUGIN_HANDLED
}
set_user_maxspeed(id, get_user_maxspeed(id) + 70.0)
g_isUserSpeed[id] = true
set_task(10.0, "r_Speed", id)
g_Points[id]-= i_ItemsCT[item][Precio]
ScreenFade(id, 255, 255, 0, 60)
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Has comprado^4 %s ^1!", i_ItemsCT[item])
}
case 2:
{
if(g_Points[id]<i_ItemsCT[item][Precio])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No tienes suficientes puntos!")
return PLUGIN_HANDLED
}
if(g_isUserGravity[id])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Ya has comprado este item!")
return PLUGIN_HANDLED
}
set_user_gravity(id, get_user_gravity(id) - 0.4)
g_Points[id] -= i_ItemsCT[item][Precio]
ScreenFade(id, 255, 255, 0, 60)
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Has comprado^4 %s ^1!", i_ItemsCT[item])
}
case 3:
{
if(g_Points[id]<i_ItemsCT[item][Precio])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No tienes suficientes puntos!")
return PLUGIN_HANDLED
}
if(g_isUserInv[id])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Ya has comprado este item!")
return PLUGIN_HANDLED
}
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 20)
g_Points[id] -= i_ItemsCT[item][Precio]
ScreenFade(id, 255, 255, 0, 60)
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Has comprado^4 %s ^1!", i_ItemsCT[item])
set_task(10.0, "r_Inv", id)
}
}
return PLUGIN_HANDLED
}
public ttShop(id)
{
new szItem[240], Posicion[2];
new titulo[100];
formatex(titulo, charsmax(titulo), "\r[\ySol&Hielo\r] \wTienda TT^n\w[\yTus Puntos: \r%d\w]", g_Points[id])
new ttMenu = menu_create(titulo, "handlerTT")
for(new i; i < sizeof i_ItemsT; i++)
{
if(g_Points[id]<i_ItemsT[i][Precio])
{
formatex(szItem, charsmax(szItem), "\d[%s] [%s] [%d puntos]", i_ItemsT[i][Item], i_ItemsT[i][Descripcion], i_ItemsT[i][Precio])
}
else
{
formatex(szItem, charsmax(szItem), "\r[\w%s\r] [\w%s\r] [\w%d\y puntos\r]", i_ItemsT[i][Item], i_ItemsT[i][Descripcion], i_ItemsT[i][Precio])
}
num_to_str(i, Posicion, charsmax(Posicion))
menu_additem(ttMenu, szItem, Posicion)
}
menu_setprop(ttMenu, MPROP_PERPAGE, 5)
menu_setprop(ttMenu, MPROP_NEXTNAME, "Siguiente")
menu_setprop(ttMenu, MPROP_BACKNAME, "Atras")
menu_setprop(ttMenu, MPROP_EXITNAME, "Salir")
menu_display(id, ttMenu, 0)
return PLUGIN_HANDLED
}
public handlerTT(id, menu, item)
{
if(!is_user_alive(id))
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No puedes usar esto ahora!")
}
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
switch(item)
{
//30HP
case 0:
{
if(g_Points[id]<i_ItemsT[item][Precio])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No tienes suficientes puntos!")
return PLUGIN_HANDLED
}
if(get_user_health(id)+30 > get_pcvar_num(cvar_shop_maxhp))
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No puedes comprar este item, pues sobrepasa el limite de HP permitida!")
return PLUGIN_HANDLED
}
set_user_health(id, get_user_health(id)+30)
g_Points[id]-= i_ItemsT[item][Precio]
ScreenFade(id, 255, 255, 0, 60)
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Has comprado^4 %s^1!", i_ItemsT[item])
}
case 1:
{
if(g_Points[id]<i_ItemsT[item][Precio])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No tienes suficientes puntos!")
return PLUGIN_HANDLED
}
if(g_isUserSpeed[id])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Ya has comprado este item!")
return PLUGIN_HANDLED
}
set_user_maxspeed(id, get_user_maxspeed(id) + 70.0)
g_isUserSpeed[id] = true
set_task(10.0, "r_Speed", id)
g_Points[id]-= i_ItemsT[item][Precio]
ScreenFade(id, 255, 255, 0, 60)
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Has comprado^4 %s ^1!", i_ItemsT[item])
}
case 2:
{
if(g_Points[id]<i_ItemsT[item][Precio])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No tienes suficientes puntos!")
return PLUGIN_HANDLED
}
if(g_isUserGravity[id])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Ya has comprado este item!")
return PLUGIN_HANDLED
}
set_user_gravity(id, get_user_gravity(id) - 0.4)
g_Points[id] -= i_ItemsT[item][Precio]
ScreenFade(id, 255, 255, 0, 60)
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Has comprado^4 %s ^1!", i_ItemsT[item])
}
case 3:
{
if(g_Points[id]<i_ItemsT[item][Precio])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No tienes suficientes puntos!")
return PLUGIN_HANDLED
}
if(g_isUserInv[id])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Ya has comprado este item!")
return PLUGIN_HANDLED
}
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 20)
g_Points[id] -= i_ItemsT[item][Precio]
ScreenFade(id, 255, 255, 0, 60)
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Has comprado^4 %s ^1!", i_ItemsT[item])
set_task(10.0, "r_Inv", id)
}
case 4:
{
static Flags; Flags = entity_get_int(id, EV_INT_flags)
if(g_Points[id]<i_ItemsT[item][Precio])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No tienes suficientes puntos!")
return PLUGIN_HANDLED
}
if(g_isUserInm[id])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Ya has comprado este item!")
return PLUGIN_HANDLED
}
if(Flags & FL_FROZEN)
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No puedes comprar este item mientras estás congelado!")
return PLUGIN_HANDLED
}
g_Points[id] -= i_ItemsT[item][Precio]
ScreenFade(id, 255, 255, 0, 60)
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Has comprado^4 %s ^1!", i_ItemsT[item])
g_isUserInm[id] = true
set_task(10.0, "r_Inm", id)
}
case 5:
{
static Flags; Flags = entity_get_int(id, EV_INT_flags)
if(g_Points[id]<i_ItemsT[item][Precio])
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No tienes suficientes puntos!")
return PLUGIN_HANDLED
}
if(!(Flags & FL_FROZEN))
{
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 No puedes usar esto si no estás congelado!")
return PLUGIN_HANDLED
}
g_Points[id] -= i_ItemsT[item][Precio]
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Has comprado^4 %s ^1!", i_ItemsT[item])
ScreenFade(id, 255, 0, 0, 60)
entity_set_int(id, EV_INT_flags, Flags &~ FL_FROZEN)
entity_set_float(id, EV_FL_fuser1, get_gametime() + 2.0);
g_AliveT++
g_FrozenT--
}
}
return PLUGIN_HANDLED
}
public r_Speed(id)
{
if(!g_isUserSpeed[id]) return PLUGIN_HANDLED
set_user_maxspeed(id, get_user_maxspeed(id) - 70)
ScreenFade(id, 255, 128, 0, 60)
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Tu ^4velocidad^1 se ha restaurado!")
g_isUserSpeed[id] = false
return PLUGIN_HANDLED
}
public r_Inv(id)
{
if(!g_isUserInv[id]) return PLUGIN_HANDLED
set_user_rendering(id)
ScreenFade(id, 255, 128, 0, 60)
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Ya no eres ^4Invisible^1!")
return PLUGIN_HANDLED
}
public r_Inm(id)
{
if(!g_isUserInm[id]) return PLUGIN_HANDLED
ScreenFade(id, 255, 128, 0, 60)
client_print_color(id, print_team_default, "^4[Sol&Hielo]^1 Ya no eres ^4Inmune^1!")
g_isUserInm[id] = false
return PLUGIN_HANDLED
}
GiveWeapons(const id)
{
strip_user_weapons(id)
}
stock ScreenFade(const iId, Red, Green, Blue, Alpha)
{
message_begin( iId ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, g_msgScreenFade, _, iId );
write_short(1 * 4096);
write_short(1 * 4096);
write_short(0x0000);
write_byte(Red);
write_byte(Green);
write_byte(Blue);
write_byte(Alpha);
message_end();
}