24/07/2015, 01:30 PM
(Última modificación: 05/08/2015, 12:35 AM por SoundBlaster.)
Simple SurF MOD
¿Qué tiene de especial?
- Pues nada v:
Sólo acomode algunas cosas del Ardivaba
Le coloque el guardado AdvVault (?
Le agregue un VIP para que gane experiencia por 2
Sí tiene un bug digan me así aprendo c:
Cosas necesarias:
Poco a Poco le agregare más cosas (?
¿Qué tiene de especial?
- Pues nada v:
Sólo acomode algunas cosas del Ardivaba
Le coloque el guardado AdvVault (?
Le agregue un VIP para que gane experiencia por 2
Sí tiene un bug digan me así aprendo c:
Cosas necesarias:
Código PHP:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#include <colorchat>
#include <adv_vault>
new const g_szPrefix[] = "[AMXX]";
#define NivelMaximo 800
new const Niveles[NivelMaximo] =
{
50,
100,
200,
400,
600,
800,
...
}
new experiencia[33], niveles[33], PKS[33], g_VerHud
new const Modelos[][] =
{
"models/Carpeta/v_modelo.mdl",
}
new Ganancia[33], AccountType[33][20];
enum _: GANANCIA_DATA
{
GD_ADM_TYPE[20],
GD_ADM_FLAG,
GD_ADM_GN
}
new const Ganancias[][GANANCIA_DATA] =
{
{"VIP", ADMIN_LEVEL_F, 2}
}
enum
{
CAMP_NIVELES = 0,
CAMP_EXP,
MAX_CAMPOS
};
new g_iVault;
new g_iCampos[MAX_CAMPOS];
public plugin_cfg()
{
set_cvar_num( "sv_airaccelerate", 100);
}
public plugin_init()
{
/* Información del PLUGIN */
register_plugin("Simple SurF MOD", "1.0", "Ardivaba")
/* Sistema de Niveles por Experiencia */
register_event( "DeathMsg", "EventDeathMsg", "a" )
/* Comando para dar nivel */
register_concmd("amx_darnivel", "DarNivel", ADMIN_RCON, "SurFXPMOD v1.0 by SoundBlaster")
register_concmd("amx_quitar", "QuitarTodo", ADMIN_RCON, "SurFXPMOD v1.0 by SoundBlaster")
/* Información */
register_clcmd("say /level", "info_menu");
register_clcmd("say /info", "Informacion");
/* HUD */
g_VerHud = CreateHudSyncObj()
/* Armas por Niveles */
register_event("CurWeapon","ev_CurWeapon", "be", "1=1")
RegisterHam(Ham_TakeDamage, "player", "fwHamTakeDamage")
/* Guardado */
g_iVault = adv_vault_open("SurFXPMOD", false);
g_iCampos[CAMP_NIVELES] = adv_vault_register_field(g_iVault, "NIVELES");
g_iCampos[CAMP_EXP] = adv_vault_register_field(g_iVault, "EXP");
adv_vault_init(g_iVault);
}
public plugin_precache()
{
new i
for(i = 0; i < sizeof(Modelos); i++)
precache_model(Modelos[i])
}
public client_putinserver( id )
{
CargarDatos(id);
Load_AdminTypes(id);
set_task(2.0,"hud",id+123,_,_,"b");
}
public client_disconnect( id )
{
remove_task(id+123)
GuardarDatos(id)
}
public hud(taskid)
{
new id = taskid - 123;
if(!is_user_alive(id))
{
new espect = pev(id, pev_iuser2);
if(!espect)
return PLUGIN_CONTINUE;
new nombre[33];get_user_name(espect, nombre, charsmax(nombre))
new nuevonivel = Niveles[niveles[espect]]-experiencia[espect]
set_hudmessage(0, 255, 0, 0.15, 0.15, 1, 6.0, 1.1, 0.0, 0.0, -1);
ShowSyncHudMsg(id, g_VerHud, "%s Detalles del Jugador^n1- Nombre: %s^n2- Vida: %d / Chaleco: %d^n3- Nivel: %d / %d^n4- Experiencia: %d / %d",
g_szPrefix, nombre, get_user_health(espect), get_user_armor(espect), niveles[espect], NivelMaximo, experiencia[espect], nuevonivel)
}
return PLUGIN_CONTINUE;
}
public EventDeathMsg()
{
new killer = read_data( 1 )
new victim = read_data( 2 )
new headshot = read_data( 3 )
new xp, hs
if(niveles[killer] > niveles[victim]) xp = 40 * Ganancia[victim];
if(niveles[killer] < niveles[ victim ]) xp = 60 * Ganancia[victim];
if(niveles[killer] == niveles[victim]) xp = 50 * Ganancia[victim];
PKS[ victim ] = 0
if( victim == killer ) return PLUGIN_CONTINUE;
if(headshot)
{
xp = xp + 50 * Ganancia[victim];
hs = 1
}
if(PKS[killer] < 10) PKS[killer]++
xp = xp + PKS[killer]
add_xp(killer, xp, hs)
ChatColor(victim, GREEN, "^x04%s^x3 Estas muerto y perdiste tu^x04 killstreak!", g_szPrefix)
check_level(killer)
return PLUGIN_CONTINUE;
}
/* Add xp */
public add_xp( id, xp, hs )
{
new nuevonivel = Niveles[niveles[id]]-experiencia[id]
experiencia[id] = experiencia[id] + xp
if(hs)
{
ChatColor(id, GREEN, "^x04%s Headshot!^x03 Tu tienes ^x04%d^x03 de^x04 Experiencia! ^x01-^x03 Killstreak: ^x04%d^x03 Nuevo nivel despues de ^x04%d Experiencia.", g_szPrefix, xp, PKS[ id ], nuevonivel)
}
else
{
ChatColor(id, GREEN, "^x04%s^x03 Tu tienes ^x04%d^x03 de^x04 Experiencia! ^x01-^x03 Killstreak: ^x04%d^x03 Nuevo nivel despues de ^x04%d^x03 de^x04 Experiencia.", g_szPrefix, xp, PKS[ id ], nuevonivel)
}
}
public check_level( id )
{
if(niveles[id] < NivelMaximo )
{
while(experiencia[id] >= Niveles[niveles[id]])
{
niveles[id]++
ChatColor(id, GREEN, "^x04%s^x03 Ahora eres nivel^x04 %d!", g_szPrefix, niveles[id])
GuardarDatos(id)
}
}
}
public info_menu(id)
{
new keys = MENU_KEY_0
new infomenu[999], len; len = 0
new nombre[32]
get_user_name(id, nombre, charsmax(nombre))
new nuevonivel = Niveles[niveles[id]]-experiencia[id]
len += formatex(infomenu[len], charsmax(infomenu) - len, "\r%s \wInformacion^n^n", g_szPrefix)
len += formatex(infomenu[len], charsmax(infomenu) - len, "|=======================|^n")
len += formatex(infomenu[len], charsmax(infomenu) - len, "\r- \wNombre: %s^n", nombre)
len += formatex(infomenu[len], charsmax(infomenu) - len, "\r- \wNivel: %d / %d^n", niveles[id], NivelMaximo)
len += formatex(infomenu[len], charsmax(infomenu) - len, "\r- \wExperiencia: %d / %d^n", experiencia[id], nuevonivel)
len += formatex(infomenu[len], charsmax(infomenu) - len, "|=======================|")
len += formatex(infomenu[len], charsmax(infomenu) - len, "^n^n\y0. \rSalir")
show_menu(id, keys, infomenu)
return PLUGIN_CONTINUE
}
public GuardarDatos(id)
{
adv_vault_set_start(g_iVault);
adv_vault_set_field(g_iVault, g_iCampos[CAMP_NIVELES], niveles[id]);
adv_vault_set_field(g_iVault, g_iCampos[CAMP_EXP], experiencia[id]);
new g_szPlayerName[33];get_user_name(id, g_szPlayerName, 31)
adv_vault_set_end(g_iVault, 0, g_szPlayerName[id]);
}
public CargarDatos(id)
{
new g_szPlayerName[33];get_user_name(id, g_szPlayerName, 31)
if (!adv_vault_get_prepare(g_iVault, _, g_szPlayerName[id]))
{
niveles[id] = experiencia[id] = 0;
return;
}
niveles[id] = adv_vault_get_field(g_iVault, g_iCampos[CAMP_NIVELES]);
experiencia[id] = adv_vault_get_field(g_iVault, g_iCampos[CAMP_EXP]);
}
public ev_CurWeapon(id)
{
if (!is_user_connected(id) || !is_user_alive(id))
return PLUGIN_HANDLED;
new wid = read_data(2)
switch(wid)
{
case CSW_KNIFE : if(niveles[id] >= 5) set_pev(id, pev_viewmodel2, "models/Carpeta/v_modelo.mdl")
}
return PLUGIN_CONTINUE;
}
public fwHamTakeDamage(victim, inflictor, attacker, Float:damage, damagebits)
{
if(!is_user_connected(attacker))
return HAM_IGNORED
new wid = get_user_weapon(attacker)
switch(wid)
{
case CSW_KNIFE : if(niveles[attacker] >= 5) SetHamParamFloat(4, damage * 1.4)
}
return HAM_IGNORED;
}
public QuitarTodo(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new nombre[32], Player
read_argv(1, nombre, charsmax(nombre))
Player = cmd_target(id, nombre, CMDTARGET_ALLOW_SELF)
if(!Player)
return PLUGIN_HANDLED
niveles[Player] = 1
experiencia[Player] = 0
if(id != Player)
ChatColor(id, GREEN, "^x04%s^x03 Le has Quitado^x04 Todo,^x03 Al Jugador ^x04%s", g_szPrefix, nombre)
ChatColor(Player, GREEN, "^x04%s^x03 Te han Quitado todos tus^x04 niveles", g_szPrefix)
check_level(Player)
return PLUGIN_HANDLED
}
public DarNivel(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED;
static arg[32], arg2[99], player, asd
read_argv(1, arg, sizeof arg - 1)
read_argv(2, arg2, sizeof arg2 - 1)
player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
if (!player) return PLUGIN_HANDLED;
asd = (str_to_num(arg2))
niveles[player] = asd
experiencia[player] = Niveles[niveles[player]]
check_level(player)
return PLUGIN_HANDLED;
}
Load_AdminTypes(id)
{
if(is_user_admin(id)) // Si es admin
{
new i, flags = get_user_flags(id);
for(i = 0 ; i < sizeof Ganancias ; i++ )
{
if(flags & Ganancias[i][GD_ADM_FLAG])
{
Ganancia[id] = Ganancias[i][GD_ADM_GN];
formatex(AccountType[id], charsmax(AccountType), "%s", Ganancias[i][GD_ADM_TYPE]);
break;
}
}
}
else
{
Ganancia[id] = 1;
formatex(AccountType[id], charsmax(AccountType), "Usuario");
}
}
Poco a Poco le agregare más cosas (?