31/05/2019, 08:41 PM
Quise adaptar esto a mi zp pero me tira error de Error: Undefined symbol "_hv" on line 18410, no se que es _hv me ayudarian?
Código PHP:
new const Model[] = "models/w_kevlar.mdl";
new const iEnt[] = "Zona_Segura";
new Float:fOrigin[3];
new Path[256];
new iMap[90];
new iRuta[900];
public plugin_init()
{
// Add your own code here
register_concmd("menu_zona", "f_Menu");
register_concmd("leer_zona", "ReadPos");
get_mapname(iMap, charsmax(iMap));
get_configsdir(Path, charsmax(Path));
formatex(iRuta, charsmax(iRuta), "%s/%s.ini", Path, iMap);
// Si un player tocó la entidad llamamos a touch_register:
register_touch("ZonaSegura", "player", "Touch_Register")
// Add your own code here
ReadPos();
}
public plugin_precache() precache_model(Model);
public f_Menu(id){
new menu = menu_create("Registrar Zona Segura en el Mapa","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 )
{
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 = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if(!ent) return;
engfunc(EngFunc_SetModel, ent, Model);
set_pev(ent, pev_solid, SOLID_TRIGGER);
set_pev(ent, pev_classname, iEnt);
engfunc(EngFunc_SetSize, ent, Float:{-150.0, -1.0, -150.0}, Float:{150.0, 1.0, 150.0});
set_pev(ent, pev_mins, Float:{-150.0, -1.0, -150.0});
set_pev(ent, pev_maxs, Float:{150.0, 1.0, 150.0});
engfunc(EngFunc_SetOrigin, ent, Origin);
}
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, "; 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);
client_print(0, print_chat, "[ZE] Zona segura identificada.", iRuta);
}
fclose(file);
}
public Touch_Register(iEnt_Zona, index)
{
new name[33]
get_user_name(index, name, 32)
new classname[8]
entity_get_string(iEnt_Zona, EV_SZ_classname, classname, 7)
if(g_PartyData[index][In_Party])
{
// Removido el CODE de Party
}
else
{
g_exp[index] += 10 * (_hv ? 2 : 1) // <-- añades EXP al user (puedes poner otro CODE como añadir niveles, etc )
g_Pupgrade[index] += 1 * (_hv ? 2 : 1) // <-- añades PUs al user (puedes poner otro CODE como añadir niveles, etc )
update_xp(index) // <-- actualizas los niveles con los valores añadidos
zp_colored_print(index, "^x04 [ZE]^x01 Ganaste^x04 %d^x01 de Exp por Llegar a la zona de^x04 Escape^x01!!",10 * (_hv ? 2 : 1))
zp_colored_print(index, "^x04 [ZE]^x01 Ganaste^x04 %d^x01 de PU por Llegar a la zona de^x04 Escape^x01!!",1 * (_hv ? 2 : 1))
}
}