03/02/2019, 02:25 PM
Hola les dejo este plugin que tengo desde hace mucho y no lo utilizo.
crea un boton y te da XP ( hay que editar la native y poner la suya ) al tocar el boton.
crea un boton y te da XP ( hay que editar la native y poner la suya ) al tocar el boton.
Código PHP:
/* Script generated by Pawn Studio */
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <xs>
#include <engine>
#include <cstrike>
new const iPlugin[][] = {"ZE TOUCH XP", "0.1", "Hypnotize", "[ ZE ]" };
new const Model[] = "models/zombie_escape/modelo_boton.mdl";
new const iEnt[] = "ZonaSegura";
new Float:fOrigin[3];
new Path[256];
new iMap[90];
new iRuta[900];
new g_isTouch[ 33 ];
native get_exp(id);
native set_exp( id, value );
native get_pts( id );
native set_pts( id, value );
#define reward 20
public plugin_init()
{
register_plugin(iPlugin[0], iPlugin[1], iPlugin[2])
// Add your own code here
RegisterHam(Ham_Use, "func_button", "HamUseButton");
register_event("HLTV", "event_RoundStart", "a", "1=0", "2=0");
register_clcmd("say /zona", "f_Menu");
get_mapname(iMap, charsmax(iMap));
get_configsdir(Path, charsmax(Path));
formatex(iRuta, charsmax(iRuta), "%s/%s.ini", Path, iMap);
ReadPos();
}
public plugin_precache() precache_model(Model);
public event_RoundStart()
{
arrayset(g_isTouch, false, sizeof(g_isTouch));
}
public HamUseButton(ent, victim)
{
if(!ent || victim > 32)
return HAM_IGNORED
if(!is_user_alive(victim))
return HAM_IGNORED
static szTarget[32];
entity_get_string(ent, EV_SZ_target, szTarget, charsmax(szTarget));
if( equal( szTarget, "end_map" ) && is_user_alive(victim) && !g_isTouch[victim] )
{
if(is_user_connected(victim) && cs_get_user_team(victim) == CS_TEAM_CT)
{
g_isTouch[ victim ] = true;
set_dhudmessage( 255, 255, 0, -1.0, 0.65, 0, 1.0, 3.0 );
show_dhudmessage( victim, "TERMINASTE EL MAPA WACHIN!!!");
set_exp( victim, reward );
set_pts( victim, ( get_pts( victim ) + reward ) );
chatcolor( victim, "^4%s^1 ^1Ganaste ^4%d^1 de ^4Experiencia^1 por llegar a la meta!", iPlugin[3], reward );
}
}
return HAM_IGNORED
}
public f_Menu(id)
{
if( ~get_user_flags( id ) & ADMIN_RCON )
return PLUGIN_HANDLED;
new menu = menu_create("Registrar Touch","hn_poner");
menu_additem(menu,"Registrar Entidad");
menu_additem(menu,"Borrar Entidad");
menu_additem(menu,"Guardar Entidad");
menu_display(id, menu);
return PLUGIN_HANDLED;
}
public hn_poner(id, menu, item)
{
if ( item == MENU_EXIT || ~get_user_flags( id ) & ADMIN_RCON )
{
menu_destroy(menu)
return PLUGIN_HANDLED;
}
switch(item){
case 0:{
new iOrigin[3]; get_user_origin(id, iOrigin, 3);
IVecFVec(iOrigin, fOrigin); CreateEnt(fOrigin);
}
case 1:{
new iEntity = -1;
while((iEntity = find_ent_by_class(iEntity, iEnt)) != 0) remove_entity( iEntity );
}
case 2: SaveEnt(fOrigin);
}
f_Menu(id);
return PLUGIN_HANDLED;
}
CreateEnt(const Float:Origin[3])
{
new ent = create_entity("func_button")
if(!is_valid_ent(ent))
return PLUGIN_CONTINUE;
entity_set_string(ent, EV_SZ_classname, iEnt);
entity_set_string(ent, EV_SZ_target, "end_map");
entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
entity_set_model(ent, Model);
#define INFENT_MINS { -16.0, -16.0, 0.0 }
#define INFENT_MAXS { 16.0, 16.0, 72.0 }
entity_set_size( ent, Float:INFENT_MINS, Float:INFENT_MAXS );
engfunc(EngFunc_SetOrigin, ent, Origin);
set_rendering(ent, kRenderFxGlowShell, 125, 125, 125, kRenderNormal, 16);
drop_to_floor(ent);
return PLUGIN_HANDLED;
}
SaveEnt(const Float:Origin[3]){
new iCoordenada[90]; formatex(iCoordenada, charsmax(iCoordenada), "%.2f %.2f %.2f", Origin[0], Origin[1], Origin[2]);
new szText[300];
if(!file_exists(iRuta)) {
log_amx("[ZE] Archivo '%s' No existe, pero lo creamos.", iRuta);
write_file(iRuta, "; Archivo creado automaticamente");
formatex(szText, charsmax(szText), "; El mapa es %s:", iMap); write_file(iRuta, szText);
write_file(iRuta, "; Plugin Made By Hypnotize");
write_file(iRuta, "; Las Coordenadas son:");
}
write_file(iRuta, iCoordenada);
}
public ReadPos()
{
if(!file_exists(iRuta)) {
client_print(0, print_chat, "[ZE] Archivo '%s' NO Existe.", iRuta);
return;
}
new iDat[40], iDat2[40], iDat3[40];
new szLine[700], Float:iPoss[3];
new file; file = fopen(iRuta, "r");
while(file && !feof(file))
{
fgets(file, szLine, charsmax(szLine));
if(szLine[0] == ';' || szLine[0] == '/' && szLine[1] == '/' || !szLine[0])
continue;
parse( szLine, iDat, charsmax(iDat), iDat2, charsmax(iDat2), iDat3, charsmax(iDat3));
iPoss[ 0 ] = str_to_float( iDat );
iPoss[ 1 ] = str_to_float( iDat2 );
iPoss[ 2 ] = str_to_float( iDat3 );
CreateEnt( iPoss );
}
fclose(file);
}
stock chatcolor(id, const input[], any:...)
{
static szMsg[191], msgSayText;
if (!msgSayText)
msgSayText = get_user_msgid("SayText");
vformat(szMsg, 190, input, 3);
replace_all(szMsg, 190, "!g", "^4");
replace_all(szMsg, 190, "!y", "^1");
replace_all(szMsg, 190, "!team", "^3");
message_begin(id ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, msgSayText, .player = id);
write_byte(id ? id : 33);
write_string(szMsg);
message_end();
}