Raised This Month: $51 Target: $400
 12% 

request:L4D1 ammo creation crash fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ZBzibing
Senior Member
Join Date: Dec 2012
Old 05-08-2022 , 06:04   request:L4D1 ammo creation crash fix
Reply With Quote #1

Many developers have the ammo creation function, but there will be problems that cause the map to crash, and some developers may have fixed their own plug-ins. But there are still many plug-in authors who have not updated. So is there a general repair function? .So all plugins will not have this trouble again.

Classic crash test map:
Code:
l4d_hospital04_interior
__________________
Please forgive, If I'm not describing it accurately. I use google translate
Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:

Last edited by ZBzibing; 03-13-2024 at 04:21. Reason: The problem has been solved
ZBzibing is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 05-08-2022 , 07:53   Re: request:L4D1 ammo creation crash fix
Reply With Quote #2

How it was fixed by other plugins? Need some code example.
__________________
Marttt is offline
ZBzibing
Senior Member
Join Date: Dec 2012
Old 05-08-2022 , 11:05   Re: request:L4D1 ammo creation crash fix
Reply With Quote #3

Quote:
Originally Posted by Marttt View Post
How it was fixed by other plugins? Need some code example.
collapse example:
Code:
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"
#include <sourcemod>
#include <sdktools>
#pragma newdecls required
#define MODEL_AMMO_L4D			"models/props_unique/spawn_apartment/coffeeammo.mdl"
#define MODEL_AMMO_L4D1			"models/props/terror/Ammo_Can.mdl"
#define MODEL_AMMO_L4D2			"models/props/terror/ammo_stack.mdl"
#define MODEL_AMMO_L4D3			"models/props/de_prodigy/ammo_can_02.mdl"

public Plugin myinfo = 
{
	name = "",
	author = PLUGIN_AUTHOR,
	description = "",
	version = PLUGIN_VERSION,
	url = ""
};

public void OnPluginStart()
{
	RegConsoleCmd("sm_ammo",addammo);
}

public Action addammo(int client,int args)
{
	float location[3];
	if (!Misc_TraceClientViewToLocation(client, location)) 
	{
		GetClientAbsOrigin(client, location);
	}
	Do_CreateEntity("weapon_ammo_spawn", MODEL_AMMO_L4D2, location, false);

}


void Do_CreateEntity(const char[] name, const char[] model, float location[3], const bool zombie) {
	int entity = CreateEntityByName(name);
	if (strcmp(model, "PROVIDED") != 0)
		SetEntityModel(entity, model);
	DispatchSpawn(entity);
	if (zombie) {
		int ticktime = RoundToNearest( GetGameTime() / GetTickInterval() ) + 5;
		SetEntProp(zombie, Prop_Data, "m_nNextThinkTick", ticktime);
		location[2] -= 25.0; 
	}
	ActivateEntity(entity);
	TeleportEntity(entity, location, NULL_VECTOR, NULL_VECTOR);
}

bool Misc_TraceClientViewToLocation(int client, float location[3]) {
	float vAngles[3], vOrigin[3];
	GetClientEyePosition(client,vOrigin);
	GetClientEyeAngles(client, vAngles);
	Handle trace = TR_TraceRayFilterEx(vOrigin, vAngles, MASK_PLAYERSOLID, RayType_Infinite, TraceRayDontHitSelf, client);
	if(TR_DidHit(trace)) {
		TR_GetEndPosition(location, trace);
		CloseHandle(trace);
		return true;
	}
	CloseHandle(trace);
	return false;
}

public bool TraceRayDontHitSelf(int entity, int mask, any data) {
	if(entity == data) { 
		return false; 
	}
	return true;
}
normal work:
https://forums.alliedmods.net/showthread.php?t=221111

There are also many authors who have not updated, and will crash when spawning ammunition. Is there a unified repair plug-in to make many of those plug-ins work again?
__________________
Please forgive, If I'm not describing it accurately. I use google translate
Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:

Last edited by ZBzibing; 05-08-2022 at 11:07.
ZBzibing is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-08-2022 , 11:50   Re: request:L4D1 ammo creation crash fix
Reply With Quote #4

Whats the crash error message?
__________________
Silvers is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 05-09-2022 , 05:40   Re: request:L4D1 ammo creation crash fix
Reply With Quote #5

Are you referring to this crash?
Quote:
Originally Posted by ZBzibing View Post
About Repair
422/ - weapon_ammo_spawn: UTIL_SetModel: not precached: models/props_unique/spawn_apartment/coffeeammo.mdl

Can the author provide a fix, because many plugins also have the same problem, and many authors don't update, I want to know how to fix it and try to fix it myself
Someone else and I already replied to your post on the thread where you posted that crash message, but it seems you didn't check back for replies before making this thread.

Quote:
Originally Posted by ZBzibing View Post
So is there a general repair function? .So all plugins will not have this trouble again.
Quote:
Originally Posted by iaNanaNana View Post
Add PrecacheModel() before SetEntityModel() or DispatchKeyValue(a, "model")
Quote:
Originally Posted by Psyk0tik View Post
Try my new plugin: [L4D & L4D2] Late Model Precacher

It catches unprecached models and precaches them to prevent the "UTIL_SetModel" crash.
__________________
Psyk0tik is offline
ZBzibing
Senior Member
Join Date: Dec 2012
Old 05-10-2022 , 08:27   Re: request:L4D1 ammo creation crash fix
Reply With Quote #6

Quote:
Originally Posted by Silvers View Post
Whats the crash error message?
I tested this problem alone, cleared the log and waited for the log to be regenerated. But repeated tests found that he could not generate the record, and the server crashed directly
Crash Test Action:
map l4d_hospital04_interior
Type !ammo and wait for dozens of seconds
Server crashes on its own
__________________
Please forgive, If I'm not describing it accurately. I use google translate
Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:
ZBzibing is offline
ZBzibing
Senior Member
Join Date: Dec 2012
Old 05-10-2022 , 08:29   Re: request:L4D1 ammo creation crash fix
Reply With Quote #7

Quote:
Originally Posted by Psyk0tik View Post
Are you referring to this crash?


Someone else and I already replied to your post on the thread where you posted that crash message, but it seems you didn't check back for replies before making this thread.
I was wondering if his method would fix all the issues with generating ammo plugins. But I can't find the link, I look for translations, so it's sometimes hard for me to see the information instantly.

Do you provide a feature that fixes most plugins crashing when creating models?
__________________
Please forgive, If I'm not describing it accurately. I use google translate
Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:
ZBzibing is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-10-2022 , 08:37   Re: request:L4D1 ammo creation crash fix
Reply With Quote #8

Do you have Accelerator extension installed?

Kinda sounds like the issue where creating ammo/items/weapons/props clip through the world, caused by using DispatchSpawn before TeleportEntity. Swap them around.

Something like (from Footlocker thread, which I just noticed does DispatchSpawn before TeleportEntity, one day I'll fix that): Engine Error: The server will crash if an item (eg vomitjar) is spawned within another item. This seems to be a problem on Windows only. The error message:
"models/w_models/weapons/w_eq_bile_flask.mdl (2) at -1.$ -1.$ -1.$ in contact with world (2) at -35.8 14.4 65.0, crash. dist = -1, minq = 100000002004087730000.000000"
__________________

Last edited by Silvers; 05-10-2022 at 08:38.
Silvers is offline
ZBzibing
Senior Member
Join Date: Dec 2012
Old 05-10-2022 , 14:33   Re: request:L4D1 ammo creation crash fix
Reply With Quote #9

Quote:
Originally Posted by Silvers View Post
Do you have Accelerator extension installed?

Kinda sounds like the issue where creating ammo/items/weapons/props clip through the world, caused by using DispatchSpawn before TeleportEntity. Swap them around.

Something like (from Footlocker thread, which I just noticed does DispatchSpawn before TeleportEntity, one day I'll fix that): Engine Error: The server will crash if an item (eg vomitjar) is spawned within another item. This seems to be a problem on Windows only. The error message:
"models/w_models/weapons/w_eq_bile_flask.mdl (2) at -1.$ -1.$ -1.$ in contact with world (2) at -35.8 14.4 65.0, crash. dist = -1, minq = 100000002004087730000.000000"
I'm using your spawn ammo right now, if you implement the repair function in the future, the effects of other plugins can also be used.
__________________
Please forgive, If I'm not describing it accurately. I use google translate
Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:
ZBzibing is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-10-2022 , 15:15   Re: request:L4D1 ammo creation crash fix
Reply With Quote #10

Quote:
Originally Posted by ZBzibing View Post
I'm using your spawn ammo right now, if you implement the repair function in the future, the effects of other plugins can also be used.
They need to fix it themselves.
__________________
Silvers is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode