Run time errors..

Ако имате затруднения при изработката/преработката на даден плъгин - пишете тук, ще се опитаме да ви помогнем!
Аватар
X3.!
Извън линия
Foreigner
Foreigner
Мнения: 31
Регистриран на: 30 Ное 2018, 20:46
Се отблагодари: 1 път

Run time errors..

Мнение от X3.! » 16 Апр 2020, 15:11

Hello, im getting a lot of "run time errors" in my plugin. I cant fix all of them, If I fix one, the other one appears
Im guessing it happens because of the events, forwards registered first

Код за потвърждение: Избери целия код

L 04/16/2020 - 14:00:58: [AMXX] Displaying debug trace (plugin "zp50_g.amxx", version "1.0")
L 04/16/2020 - 14:00:58: [AMXX] Run time error 3: stack error 
L 04/16/2020 - 14:00:58: [AMXX]    [0] zp50_g.sma::update_icon (line 223)

L 04/16/2020 - 14:01:09: Invalid event (name "CurWeapon") (plugin "zp50_g.amxx")
L 04/16/2020 - 14:01:09: [AMXX] Displaying debug trace (plugin "zp50_g.amxx", version "1.0")
L 04/16/2020 - 14:01:09: [AMXX] Run time error 10: native error (native "register_event")
L 04/16/2020 - 14:01:09: [AMXX]    [0] zp50_g.sma::plugin_precache (line 58)
Thats what I did to register the things

Код за потвърждение: Избери целия код

public plugin_precache()
{
	register_plugin("[ZP] Game Mode: Zombie Event", "1.0", "ZP Dev Team"
	zp_gamemodes_register("Zombie Event Mode")


	g_HudSync = CreateHudSyncObj()
	g_MaxPlayers = get_maxplayers()
    // Create the HUD Sync Objects
	
	cvar_Event_chance = register_cvar("zp_event_chance", "20")
	cvar_Event_show_hud = register_cvar("zp_event_show_hud", "1")
	cvar_Event_sounds = register_cvar("zp_event_sounds", "1")
	cvar_Event_min_players = register_cvar("zp_event_min_players", "0")
	cvar_Event_allow_respawn = register_cvar("zp_event_allow_respawn", "0")

	register_event("CurWeapon", "update_icon", "b")
	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage", 0);
	RegisterHam(Ham_TraceAttack, "player", "fw_TraceAttack", 0);
	register_forward(FM_CmdStart, "fw_Start")

	// Initialize arrays
	g_sound_Event = ArrayCreate(SOUND_MAX_LENGTH)
	
	// Load from external file
	amx_load_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "ROUND Event", g_sound_Event)
	
	// If we couldn't load custom sounds from file, use and save default ones
	new index
	if (!ArraySize(g_sound_Event))
	{
		for (index = 0; index < sizeof sound_Event; index++)
			ArrayPushString(g_sound_Event, sound_Event[index])
		
		// Save to external file
		amx_save_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "ROUND Event", g_sound_Event)
	}
	
	// Precache sounds
	new sound[SOUND_MAX_LENGTH]
	for (index = 0; index < ArraySize(g_sound_Event); index++)
	{
		ArrayGetString(g_sound_Event, index, sound, charsmax(sound))
		if (equal(sound[strlen(sound)-4], ".mp3"))
		{
			format(sound, charsmax(sound), "sound/%s", sound)
			precache_generic(sound)
		}
		else
			precache_sound(sound)
	}
}
CurWeapon event (update_icon)

Код за потвърждение: Избери целия код

public update_icon(id)
{
	if(is_user_alive(id))
	{
		if(get_user_weapon(id) != CSW_KNIFE)
		{
			strip_user_weapons(id)
			give_item(id, "weapon_knife")
		}
	}
	return PLUGIN_CONTINUE
}
Also im getting an Invalid CVar Pointer (cvar_Event_sounds), as you see I have registered the cvar in plugin_precache and im using it only here.

Код за потвърждение: Избери целия код

	if (get_pcvar_num(cvar_Event_sounds))
	{
		new sound[SOUND_MAX_LENGTH]
		ArrayGetString(g_sound_Event, random_num(0, ArraySize(g_sound_Event) - 1), sound, charsmax(sound))
		PlaySoundToClients(sound)
	}

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

Run time errors..

Мнение от OciXCrom » 16 Апр 2020, 15:33

If you get an invalid cvar pointer, it means you're trying to return a value from a cvar before registering it. Make sure register_cvar is used before get_pcvar_*.

Invalid event (name "CurWeapon") (plugin "zp50_g.amxx") - you misspelled the event name. It's CurWeapon, not CurWepon.

Аватар
X3.!
Извън линия
Foreigner
Foreigner
Мнения: 31
Регистриран на: 30 Ное 2018, 20:46
Се отблагодари: 1 път

Run time errors..

Мнение от X3.! » 16 Апр 2020, 15:36

It is actually CurWeapon, nothing wrong with the event name :confused:
Also im registering the cvar before using it, its registered in plugin_precache which is the first function

PS: when the gamemode starts, everybody gets overflow and server then crashes "Core dumped" something. And the thing I see is the CurWeapon error

Аватар
X3.!
Извън линия
Foreigner
Foreigner
Мнения: 31
Регистриран на: 30 Ное 2018, 20:46
Се отблагодари: 1 път

Run time errors..

Мнение от X3.! » 18 Апр 2020, 11:58

Got any other ideas? If you want to see more functions or something?

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

Run time errors..

Мнение от OciXCrom » 18 Апр 2020, 14:11

I don't think the error is from this plugin. Something is messing with your in-game events. The "CurWeapon" event can't just disappear like that.

Аватар
X3.!
Извън линия
Foreigner
Foreigner
Мнения: 31
Регистриран на: 30 Ное 2018, 20:46
Се отблагодари: 1 път

Run time errors..

Мнение от X3.! » 19 Апр 2020, 04:08

Which kind of plugin could block it from execution? Also for the cvar thingy, I never changed anything in it though. It is the same as all the other and default ZP5.0.8 modes. But only the cvar name is changed. Im so confused right now

Аватар
OciXCrom
Извън линия
Администратор
Администратор
Мнения: 7206
Регистриран на: 06 Окт 2016, 19:20
Местоположение: /resetscore
Се отблагодари: 117 пъти
Получена благодарност: 1295 пъти
Обратна връзка:

Run time errors..

Мнение от OciXCrom » 19 Апр 2020, 15:03

Not sure. Probably some that is blocking in-game messages (events). Try disabling other plugins to see which one is causing it.

Публикувай отговор
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Помощ в скриптирането”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 6 госта