Bueno, acá les dejo el primer script que hice en Pawn, que esta basado en Minimal C. Me sirvió mucho para poder entender C y C++. COnsiste en un script que modifica todo el Counter Strike y lo convierte en un juego solo de granadas. Moris y revivis automáticamente. Hice mas versiones, con Experiencia, Niveles, cuentas... Si lo encuentro lo posteo. Dudas me dicen
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#define PLUGIN "Grenade_Game"
#define AUTHOR "Rodriii'"
#define VERSION "1.0"
new cvar_active
public plugin_init()
{
register_event("CurWeapon" , "Event_CurWeapon" , "be" , "1=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" )
}
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")
}
EDITO: Encontré la última versión, que tiene XP MOD, Arma por frags, cuentas, y muchas cosas mas. Se que tiene errores, pero creo que es uno de mis logros
#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"
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()
}
public client_connect(id)
{
g_PlayerXP[id] = 0;
g_PlayerLevel[id] = 0;
}
public Event_Niveles( id )
{
if(g_PlayerLevel[id] = 1;
{
set_user_health(id, 105);
set_user_maxspeed(id, 252);
}
if(g_PlayerLevel[id] = 2;
{
set_user_health(id, 110);
set_user_maxspeed(id, 254);
}
if(g_PlayerLevel[id] = 3;
{
set_user_health(id, 115);
set_user_maxspeed(id, 256);
}
if(g_PlayerLevel[id] = 4:
{
set_user_health(id, 120);
set_user_maxspeed(id, 260);
}
if(g_PlayerLevel[id] = 5:
{
set_user_health(id, 125);
set_user_maxspeed(id, 263);
}
if(g_PlayerLevel[id] = 6:
{
set_user_health(id, 130);
set_user_maxspeed(id, 267);
}
if(g_PlayerLevel[id] = 7;
{
set_user_health(id, 135);
set_user_maxspeed(id, 271);
}
if(g_PlayerLevel[id] = 8;
{
set_user_health(id, 140);
set_user_maxspeed(id, 275);
}
if(g_PlayerLevel[id] = 9;
{
set_user_health(id, 145);
set_user_maxspeed(id, 279);
}
if(g_PlayerLevel[id] = 10;
{
set_user_health(id, 150);
set_user_maxspeed(id, 284);
}
}
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")
}
Saludos