Senior Member
Join Date: Dec 2011
Location: return city[id];
|
![Old](images/statusicon/post_old.svg)
03-28-2013
, 17:54
error Unhandled dynamic native error
|
#1
|
Code:
03/28/2013 - 17:26:19: "[C] Fuck You " say "/fuck" (dead)
03/28/2013 - 17:26:21: [AMXX] Displaying debug trace (plugin "sprites_on_hud.amxx")
03/28/2013 - 17:26:21: [AMXX] Run time error 5: memory access
03/28/2013 - 17:26:21: [AMXX] [0] sprites_on_hud.sma::native_display_hud_sprite (line 143)
03/28/2013 - 17:26:21: Unhandled dynamic native error
03/28/2013 - 17:26:21: [AMXX] Displaying debug trace (plugin "acerrinconnect.amxx")
03/28/2013 - 17:26:21: [AMXX] Run time error 10: native error (native "display_hud_sprite")
03/28/2013 - 17:26:21: [AMXX] [0] acerrinconnect.sma::fuckfunc (line 54)
*DEAD* [C] Fuck You: /fuck
AYUDA!!! no se por que pasa, antes no me pasaba!
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx> #include <amxmisc> #include <spritesonhud>
#define PLUGIN "acerrin connected" #define VERSION "1.0" #define AUTHOR "Fuck"
new sprite[] = "sprites/jail/acerrin2.spr" new sprite2[] = "sprites/jail/fuck2.spr"
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /acerrin", "acerrinfunc") register_clcmd("say /fuck", "fuckfunc") }
public plugin_precache() { precache_model(sprite2); precache_model(sprite); }
/*public client_putinserver(id) { new name[33]; get_user_name(id, name, 32) if(get_user_flags(id) & ADMIN_IMMUNITY && equali(name, "a[C]err!N"))// && equali(name, "a[C]err!N")) { for(new i = 0; i <= get_maxplayers(); i++) { display_hud_sprite(i, sprite, 0.05) set_task(5.0, "deletesprite", i, _, _, _,0) } } }*/
public acerrinfunc(id) { for(new i = 0; i <= get_maxplayers(); i++) { display_hud_sprite(i, sprite, 0.1) set_task(5.0, "deletesprite", i, _, _, _,0) } }
public fuckfunc(id) { for(new i = 0; i <= get_maxplayers(); i++) { display_hud_sprite(i, sprite2, 0.1) set_task(5.0, "deletesprite", i, _, _, _,0) } }
public deletesprite(id) remove_hud_sprite(id);
sprites_on_hud.sma
PHP Code:
/***************************************************************************\
------------------- *||DESCRIPTION||* -------------------
This plugins allows you to display a sprite on a user's HUD display It also features an easy-to-use API natives include file Animated sprites are also supported
------------------ *||CHANGE LOG||* ------------------ v1.0 ====> Initial Release v1.1 ====> Added support for animated sprites \***************************************************************************/
#include <amxmodx> #include <fakemeta> #include <xs>
// Distance at which the sprite is placed from the users screen // DO NOT EDIT UNNECESSARILY! #define DISTANCE 12
new g_player_ent[33], g_bit_connected_user, g_stop_frame[33]
// Connected players macros #define player_is_connected(%1) (g_bit_connected_user |= (1 << (%1 & 31))) #define player_disconnected(%1) (g_bit_connected_user &= ~(1 << (%1 & 31))) #define is_player_connected(%1) ((1 <= %1 <= 32) && (g_bit_connected_user & (1 << (%1 & 31))))
public plugin_init() { // Register the plugin and the main forward register_plugin("Sprites On HUD", "1.0", "@bdul!"); register_forward(FM_AddToFullPack, "fm_add_to_fullpack", 1) }
public plugin_natives() { // Lets register some natives register_native("display_hud_sprite", "native_display_hud_sprite", 1) register_native("remove_hud_sprite", "native_remove_hud_sprite", 1) }
public fm_add_to_fullpack(es, e, ent, host, host_flags, player, p_set) { // Valid player ? if (!is_player_connected(host)) return FMRES_IGNORED; // Player haves a valid sprite entity if (ent == g_player_ent[host]) { static Float:origin[3], Float:forvec[3], Float:voffsets[3] // Retrieve player's origin pev(host, pev_origin, origin) pev(host, pev_view_ofs, voffsets) xs_vec_add(origin, voffsets, origin) // Get a forward vector in the direction of player's aim velocity_by_aim(host, DISTANCE, forvec) // Set the sprite on the new origin xs_vec_add(origin, forvec, origin) engfunc(EngFunc_SetOrigin, ent, origin) set_es(es, ES_Origin, origin) // Make the sprite visible set_es(es, ES_RenderMode, kRenderNormal) set_es(es, ES_RenderAmt, 200) // Sprite animation already stopped ? if (!g_stop_frame[host]) return FMRES_IGNORED // Stop the animation at the desired frame if (pev(ent, pev_frame) == g_stop_frame[host]) { set_pev(ent, pev_framerate, 0.0) g_stop_frame[host] = 0 } } // Stupid compiler !! return FMRES_IGNORED }
public client_putinserver(id) { // Player connected player_is_connected(id) // Marks bots as disconnected players (so sprites are'nt displayed to them) if (is_user_bot(id)) player_disconnected(id) // Remove sprite entity if present if (pev_valid(g_player_ent[id])) remove_sprite_entity(id) }
public client_disconnect(id) { // Player disconnected player_disconnected(id) // Remove sprite entity if present if (pev_valid(g_player_ent[id])) remove_sprite_entity(id) }
public native_display_hud_sprite(id, const sprite_name[], Float:sprite_size, sprite_stopframe, Float:sprite_framerate) { // Invalid player ? if (!is_player_connected(id)) return -1; // Already haves a sprite on his hud if (g_player_ent[id]) return -1; // Strings passed byref param_convert(2) // Invalid sprite ? if (!sprite_name[0]) return -1; // Create an entity for the player g_player_ent[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "env_sprite")) // Invalid entity ? if (!pev_valid(g_player_ent[id])) return -1; // Set some basic properties set_pev(g_player_ent[id], pev_takedamage, 0.0) set_pev(g_player_ent[id], pev_solid, SOLID_NOT) set_pev(g_player_ent[id], pev_movetype, MOVETYPE_NONE) // Set the sprite model engfunc(EngFunc_SetModel, g_player_ent[id], sprite_name) // Set the rendering on the entity set_pev(g_player_ent[id], pev_rendermode, kRenderTransAlpha) set_pev(g_player_ent[id], pev_renderamt, 0.0) // Set the sprite size set_pev(g_player_ent[id], pev_scale, sprite_size) // Update sprite's stopping frame g_stop_frame[id] = sprite_stopframe // Allow animation of sprite ? if (g_stop_frame[id] && sprite_framerate > 0.0) { // Set the sprites animation time, framerate and stop frame set_pev(g_player_ent[id], pev_animtime, get_gametime()) set_pev(g_player_ent[id], pev_framerate, sprite_framerate) // Spawn the sprite entity (necessary to play the sprite animations) set_pev(g_player_ent[id], pev_spawnflags, SF_SPRITE_STARTON) dllfunc(DLLFunc_Spawn, g_player_ent[id]) } return g_player_ent[id]; }
public native_remove_hud_sprite(id) { // Invalid player ? if (!is_player_connected(id)) return -1; // Doesnt haves any sprite on his screen ? if (!pev_valid(g_player_ent[id])) return -1; // Remove sprite entity remove_sprite_entity(id) return 1; }
// Removes a sprite entity from world remove_sprite_entity(id) { engfunc(EngFunc_RemoveEntity, g_player_ent[id]) g_player_ent[id] = 0 g_stop_frame[id] = 0 }
spritesonhud inc
PHP Code:
#if defined _zp_dsohud_included #endinput #endif #define _zp_dsohud_included
/** * Allows you to display a sprite on a user's HUD display * * Note: The sprite which is to be displayed must be precached * in your sub-plugin * * @param id Player index. * @param sprite_name The sprite's name which is to be displayed * @param sprite_scale The sprite's scale/size, must be a float * @param sprite_stopframe The frame at which to halt the sprite's animation * @param sprite_framerate The framerate of the sprite's animation * @return Index of the sprite's entity or -1 on failure * **/ native display_hud_sprite(id, const sprite_name[], Float:sprite_scale = 0.03, sprite_stopframe = 0, Float:sprite_framerate = 0.0)
/** * Allows you to remove the sprite from a player's screen * * @param id Player index. * @return 1 on success otherwise -1 on failure * **/ native remove_hud_sprite(id)
__________________
Last edited by Fuck_You; 03-28-2013 at 17:56.
|
|