|
Member
Join Date: Apr 2012
Location: Argentina
|

08-29-2012
, 11:01
Re: Grenade_Gamev1.2 [AMXX] [BETA]
|
#22
|
Quote:
Originally Posted by gladius
Para bloquear que compren puedes usar este código.
PHP Code:
public plugin_precache() { new ent = create_entity("info_map_parameters") DispatchKeyValue(ent, "buying", "3") DispatchSpawn(ent) }
Para los niveles simplemente has esto.
PHP Code:
#define PLAYER_LEVELS(%0) 100 * power(2, %0)
new g_pcvar_perkill;
public plugin_init() { g_pcvar_perkill = register_cvar("XP_per_kill", "x") // x es la cantidad }
public Event_Death() // DeathMsg { g_PlayerXP[attacker] += get_pcvar_num(g_pcvar_perkill); if(g_PlayerXP[attacker] >= LEVELS[g_PlayerLevel[attacker]]) { g_PlayerLevel[attacker]++; client_print(attacker, print_chat, "[Grenade_Game] Felicidades!, haz avanzado al nivel %i!", g_PlayerLevel[attacker]) } }
Para la vida y Velocidad
PHP Code:
#define PLAYER_HEALTH(%0) (100 + 5 * %0) #define PLAYER_VELOCITY(%0) (250.0 + 2 * %0)
new Float:g_PlayerVelocity[33];
public Set_Health(user) { set_user_health(user, LEVELS(g_PlayerLevel[id])); }
public Set_Velocity(user) { g_PlayerVelocity[user] = PLAYER_VELOCITY(g_PlayerLevel[id])); }
La velocidad luego la usas en el code del cual Neeeeeeel te habla en su post #5
Hay más cosas que se pueden mejorar.
|
Lo puse tal cual me lo pusistes vos, no entendi lo que quisistes decir. Así me quedo:
PHP Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fakemeta> #include <fun> #include <hamsandwich> #include <fvault>
new SZ_Password[ 192 ] new SZ_Password_T[ 33 ][ 192 ]
new Registrado[ 33 ] new BadPassword[ 33 ]
new const Vault[] = "_Datos"
new gCvarPluginToggle new cvar_active
new g_PlayerXP[33]; new g_PlayerLevel[33];
new gBuyCommands[][] = { "usp", "glock", "deagle", "p228", "elites", "fn57", "m3", "xm1014", "mp5", "tmp", "p90", "mac10", "ump45", "ak47", "galil", "famas", "sg552", "m4a1", "aug", "scout", "awp", "g3sg1", "sg550", "m249", "vest", "vesthelm", "flash", "hegren", "sgren", "defuser", "nvgs", "shield", "primammo", "secammo", "km45", "9x19mm", "nighthawk", "228compact", "12gauge", "autoshotgun", "smg", "mp", "c90", "cv47", "defender", "clarion", "krieg552", "bullpup", "magnum", "d3au1", "krieg550", "buyammo1", "buyammo2" }
#define NUM_OF_LEVELS 10
new const LEVELS[NUM_OF_LEVELS] = { 100, 200, 400, 800, 1600, 3200, 6400, 12800, 25600, 51200,
new gmsgStatusText;
#define PLUGIN "Grenade_Gamev1.2" #define AUTHOR "VodKa" #define VERSION "1.2" #define PLAYER_HEALTH(%0) (100 + 5 * %0) #define PLAYER_VELOCITY(%0) (250.0 + 2 * %0) public plugin_init() { register_forward( FM_ClientUserInfoChanged, "FWClientUserInfoChanged" ) register_event("CurWeapon" , "Event_CurWeapon" , "be" , "1=1" ); gCvarPluginToggle = register_cvar("amx_block_buy", "1") cvar_active = register_cvar("amx_grenade", "1") register_plugin(PLUGIN, VERSION, AUTHOR) RegisterHam(Ham_Killed, "player", "Revivir", 1) RegisterHam( Ham_Spawn, "player", "Ham_PlayerSpawn" ) register_clcmd( "say /registrarse", "CMDRegistrarse" ) register_clcmd( "IntroducirContrasenia", "CMDIntroducirContrasenia" ) register_cvar("sv_xpmode", "1") register_event("DeathMsg", "DeathMsg", "a") register_cvar("XP_per_kill", "20") register_event("ResetHUD", "ResetHud", "b") gmsgStatusText = get_user_msgid("StatusText") register_event("Niveles", "Event_Niveles", "be", "1=1"); for (new i = 0; i < sizeof (gBuyCommands); i++) register_clcmd(gBuyCommands[i], "BlockBuyCommands") }
public DeathMsg() { if (!get_cvar_num("sv_animalmod")) return; new attacker = read_data(1) if(g_PlayerLevel[attacker] == NUM_OF_LEVELS) return; g_PlayerXP[attacker] += get_cvar_num("XP_per_kill") if(g_PlayerXP[attacker] >= LEVELS[g_PlayerLevel[attacker]]) { ++g_PlayerLevel[attacker]; client_print(attacker, _:print_chat, "[Grenade_Game] Felicidades!, haz avanzado al nivel %i!", g_PlayerLevel[attacker]) } ShowHUD(attacker); }
ShowHUD(id) { new HUD[51] format(HUD, 50, "[Grenade_Game] Nivel: %i XP: %i", g_PlayerLevel[id], g_PlayerXP[id])
message_begin(MSG_ONE, gmsgStatusText, {0,0,0}, id) write_byte(0) write_string(HUD) message_end() }
new Float:g_PlayerVelocity[33];
public Set_Health(user) { set_user_health(user, LEVELS(g_PlayerLevel[id])); }
public Set_Velocity(user) { g_PlayerVelocity[user] = PLAYER_VELOCITY(g_PlayerLevel[id])); }
public client_connect(id) { g_PlayerXP[id] = 0; g_PlayerLevel[id] = 0; }
public client_disconnect( Index ) Save( Index )
public client_putinserver( Index ) { Registrado[ Index ] = 0 BadPassword[ Index ] = 0 Load( Index ) }
public CMDRegistrarse( Index ) { if( Registrado[ Index ] || BadPassword[ Index ] ) return PLUGIN_HANDLED; client_cmd( Index, "messagemode IntroducirContrasenia" ) return PLUGIN_CONTINUE; }
public CMDIntroducirContrasenia( Index ) { read_args( SZ_Password, 191 ) remove_quotes( SZ_Password ) trim( SZ_Password )
if( equal( SZ_Password, "" ) || contain( SZ_Password, " ") != -1) return PLUGIN_HANDLED; else { client_cmd( Index, "setinfo _pass ^"%s^"", SZ_Password ) Registrado[ Index ] = 1 static SZ_Name[ 32 ], SZ_Data[ 512 ] get_user_name( Index, SZ_Name, 31 ) formatex( SZ_Data, charsmax( SZ_Data ), "%s %d", SZ_Password, cs_get_user_money( Index ) ) fvault_set_data( Vault, SZ_Name, SZ_Data ) SZ_Password_T[ Index ] = SZ_Password return PLUGIN_HANDLED; } return PLUGIN_CONTINUE; }
public Save( Index ) { if( !Registrado[ Index ] || BadPassword[ Index ] ) return PLUGIN_HANDLED; static SZ_Data[ 512 ], SZ_Name[ 32 ] formatex( SZ_Data, charsmax( SZ_Data ), "%s %d", SZ_Password_T[ Index ], cs_get_user_money( Index ) ) get_user_name( Index, SZ_Name, 31 ) fvault_set_data( Vault, SZ_Name, SZ_Data ) return PLUGIN_CONTINUE; }
public Load( Index ) { static SZ_Data[ 512 ], SZ_Name[ 32 ], SETINFO_Password[ 191 ], VAULT_Password[ 191 ], Dinero[ 11 ] get_user_name( Index, SZ_Name, 31 ) get_user_info( Index, "_pass", SETINFO_Password, 190 ) if( !fvault_get_data( Vault, SZ_Name, SZ_Data, charsmax( SZ_Data ) ) ) return 0; Registrado[ Index ] = 1 parse( SZ_Data, VAULT_Password, 190, Dinero, 10 ) if( equal( SETINFO_Password, VAULT_Password ) ) { SZ_Password_T[ Index ] = SETINFO_Password cs_set_user_money( Index, str_to_num( Dinero ) ) return 2; } else { BadPassword[ Index ] = 1 set_hudmessage(255, 0, 0, -1.0, 0.15, 1, 6.0, 14.0) show_hudmessage(id, "Password incorrecta, vuelve a intentarlo", szName); } return 1; }
public FWClientUserInfoChanged( Index, Buffer ) { if( !is_user_connected( Index ) ) return FMRES_IGNORED; static NickName[32], NickOld[32]; get_user_name( Index, NickOld, 31 ) engfunc( EngFunc_InfoKeyValue, Buffer, "name", NickName, 31 ) if( equal( NickName, NickOld ) ) return FMRES_IGNORED; engfunc( EngFunc_SetClientKeyValue, Index, Buffer, "name", NickOld ) client_cmd( Index, "name ^"%s^"; setinfo name ^"%s^"", NickOld, NickOld ) return FMRES_SUPERCEDE; }
public BlockBuyCommands(id) { if (!get_pcvar_num(gCvarPluginToggle)) return PLUGIN_CONTINUE; return PLUGIN_HANDLED; }
public Ham_PlayerSpawn(id) { strip_user_weapons(id) }
public Revivir(id) { ExecuteHamB(Ham_CS_RoundRespawn, id) give_item(id, "weapon_hegrenade") give_item(id, "weapon_flashbang") }
public Event_CurWeapon( id ) { if(get_pcvar_num(cvar_active)) { new he = read_data(2) if(he == CSW_HEGRENADE && is_user_alive(id)) return PLUGIN_CONTINUE else { set_task(0.1, "he", id) } } else { return PLUGIN_CONTINUE; } return PLUGIN_HANDLED; }
public he(id) { give_item(id,"weapon_hegrenade") }
Last edited by lRodri.; 08-29-2012 at 19:38.
|
|