Raised This Month: $32 Target: $400
 8% 

Solved Jimmy Gibbs crashes server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
eyal282
Veteran Member
Join Date: Aug 2011
Old 01-21-2018 , 15:06   Jimmy Gibbs crashes server
Reply With Quote #1

Why does the existence of Jimmy Gibbs in the end of a round crash the server and how to fix it?
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 01-27-2018 at 15:32.
eyal282 is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 01-21-2018 , 19:19   Re: Jimmy Gibbs crashes server
Reply With Quote #2

I've never encountered that problem before. I use Atomic Stryker's Spawn Uncommon Infected plugin to spawn Jimmy Gibbs in every map.
__________________
Psyk0tik is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 01-22-2018 , 00:51   Re: Jimmy Gibbs crashes server
Reply With Quote #3

Quote:
Originally Posted by Crasher_3637 View Post
I've never encountered that problem before. I use Atomic Stryker's Spawn Uncommon Infected plugin to spawn Jimmy Gibbs in every map.
Apparently I solved it but I gotta test it before marking solved.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Skyy
AlliedModders Donor
Join Date: Jan 2010
Location: Toronto, Canada
Old 01-22-2018 , 13:44   Re: Jimmy Gibbs crashes server
Reply With Quote #4

the existence of jimmy gibbs does not crash servers, poorly coded plugins do.
Skyy is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 01-23-2018 , 03:07   Re: Jimmy Gibbs crashes server
Reply With Quote #5

Quote:
Originally Posted by Skyy View Post
the existence of jimmy gibbs does not crash servers, poorly coded plugins do.
Be my guest, solve my issue:

Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public Plugin:myinfo = 
{
	name = "Car Alarm Inform",
	author = "Eyal282 ( FuckTheSchool )",
	description = "Tells the players whomst'dve the fucc started the mofo car alarm",
	version = "69.420",
	url = "<- URL ->"
}

new CircleStage = -1;
new Fuccer, String:FuccerName[32];
new SpecialLeft = -1;
new bool:AlarmWentOff;

public OnPluginStart()
{
	HookEvent("create_panic_event", Event_CreatePanicEvent, EventHookMode_Post);
	HookEvent("triggered_car_alarm", Event_TriggeredCarAlarm, EventHookMode_Pre);
	HookEvent("infected_death", Event_InfectedDeath, EventHookMode_Post);
	HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
	HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);
}

public Action:Event_RoundStart(Handle:hEvent, String:Name[], bool:dontBroadcast)
{
	SpecialLeft = -1;
}

public Action:Event_RoundEnd(Handle:hEvent, String:Name[], bool:dontBroadcast)
{
	SpecialLeft = -1;
	//WipeAllInfected();
	
}
public OnMapStart()
{
	PrecacheModel("models/infected/common_male_jimmy.mdl", true);
	PrecacheModel("models/infected/common_female_tshirt_skirt.mdl", true);
}
/*
public OnMapEnd()
{
	WipeAllInfected();
}	

WipeAllInfected()
{
	new MaxEntities = GetEntityCount();

	
	new String:Classname[11];
	for(new i=0;i < MaxEntities;i++)
	{
		if(!IsValidEdict(i))
			continue;
		
		GetEdictClassname(i, Classname, sizeof(Classname));
		
		if(StrEqual(Classname, "infected", true))
			RemoveEdict(i);
	}
}
*/
public Action:Event_InfectedDeath(Handle:hEvent, String:Name[], bool:dontBroastcast)
{
	new infected_id = GetEventInt(hEvent, "infected_id");
	new R = 0;
	new G = 0;
	new B = 0;
	
	if(infected_id > 0)
	{
		SetEntProp(infected_id, Prop_Send, "m_glowColorOverride", R + (G * 256) + (B * 65536));
		SetEntProp(infected_id, Prop_Send, "m_iGlowType", 0);
	}
}

public OnEntityCreated(entity, const String:Classname[])
{
	if(!StrEqual(Classname, "infected", true))
		return;
	
	if(SpecialLeft > 0)
	{	
		SetEntityModel(entity, "models/infected/common_male_jimmy.mdl");
		RequestFrame(TurnSpecial, entity);
		SpecialLeft--;
	}
	
	if(CircleStage == -1 || Fuccer == 0)
		return;
		
	new Float:Origin[3];
	GetEntPropVector(Fuccer, Prop_Data, "m_vecOrigin", Origin);
	Origin[0] = GetXOriginByCircleStage(CircleStage, Origin);
	Origin[1] = GetYOriginByCircleStage(CircleStage, Origin);
	
	CircleStage++;
	
	if(CircleStage == 8)
		CircleStage = -1;
	
	new Handle:datapack = CreateDataPack();
	
	RequestFrame(TeleportCommon, datapack);
	
	WritePackCell(datapack, entity);
	WritePackFloat(datapack, Origin[0]);
	WritePackFloat(datapack, Origin[1]);
	WritePackFloat(datapack, Origin[2]);
	
}

public TeleportCommon(Handle:datapack)
{
	ResetPack(datapack);
	new entity = ReadPackCell(datapack);
	new Float:Origin[3];
	Origin[0] = ReadPackFloat(datapack);
	Origin[1] = ReadPackFloat(datapack);
	Origin[2] = ReadPackFloat(datapack);
	TeleportEntity(entity, Origin, NULL_VECTOR, NULL_VECTOR);
	CloseHandle(datapack);
}

public TurnSpecial(entity)
{
	new R = 255;
	new G = 0;
	new B = 0;
	
	SetEntProp(entity, Prop_Send, "m_glowColorOverride", R + (G * 256) + (B * 65536));
	SetEntProp(entity, Prop_Send, "m_iGlowType", 3);

	SetEntPropFloat(entity, Prop_Data, "m_flModelScale", GetRandomFloat(0.5, 1.0));
}

public Action:Event_TriggeredCarAlarm(Handle:hEvent, String:Name[], bool:dontBroastcast)
{
	AlarmWentOff = true;
}
public Action:Event_CreatePanicEvent(Handle:hEvent, String:Name[], bool:dontBroastcast)
{
	Fuccer = GetClientOfUserId(GetEventInt(hEvent, "userid"));
	
	if(Fuccer == 0) // Console panic events.
		return;
		
	else if(GetClientTeam(Fuccer) != 2) // Better safe than sorry.
		return;
	
	GetClientName(Fuccer, FuccerName, sizeof(FuccerName));
	RequestFrame(CheckAlarm, 0);
}

public CheckAlarm(zero)
{
	if(!IsClientInGame(Fuccer))
	{
		AlarmWentOff = false;
		return;
	}
	else if(!AlarmWentOff)
		return;

	AlarmWentOff = false;
	CircleStage = 0;
	SpecialLeft += 108;
	
	SpawnEightInfected(8);
	PrintToChatAll("\x03%s \x01has triggered the\x04 car alarm!\x01 He's now circled with special commons and 100 more are on the way!", FuccerName);
}

public SpawnEightInfected(TimesLeft)
{
	if(TimesLeft <= 0)
		return;

	else if(!IsClientInGame(Fuccer))
		return;
		
	new flags = GetCommandFlags("z_spawn");
	SetCommandFlags("z_spawn", flags & ~FCVAR_CHEAT);
	FakeClientCommand(Fuccer, "z_spawn");
	SetCommandFlags("z_spawn", flags);
	
	TimesLeft--;
	RequestFrame(SpawnEightInfected, TimesLeft);
}

stock Float:GetXOriginByCircleStage(Stage, Float:Origin[3])
{
	if(Stage == 0)
		return Origin[0] + 50.0;
		
	else if(Stage == 1)
		return Origin[0] - 50.0;
		
	else if(Stage == 4)
		return Origin[0] + 40.0;
	
	else if(Stage == 5)
		return Origin[0] - 40.0;
	
	else if(Stage == 6)
		return Origin[0] + 25.0;
	
	else if(Stage == 7)
		return Origin[0] + 25.0;
	
	return Origin[0];
}

stock Float:GetYOriginByCircleStage(Stage, Float:Origin[3])
{
	if(Stage == 2)
		return Origin[1] + 50.0;
	
	else if(Stage == 3)
		return Origin[1] - 50.0;
		
	else if(Stage == 4)
		return Origin[1] + 40.0;
		
	else if(Stage == 5)
		return Origin[1] - 40.0;
	
	else if(Stage == 6)
		return Origin[1] + 30.0;
	
	else if(Stage == 7)
		return Origin[1] + 30.0;
		
	return Origin[1];
}
If by any chance the crash is caused by the model size, then you're already wrong. Feel free to fix this for everybody else as by now it's quite working for me when removing all /* -> */
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 01-23-2018 at 12:38.
eyal282 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 01-27-2018 , 15:32   Re: Jimmy Gibbs crashes server
Reply With Quote #6

SOVLED!

The reason of crashing splits into 2 reasons:

1. I used RemoveEdict instead of AcceptEntityInput(entity, "Kill")
2. I didn't block the ability of more jimmy gibbs to spawn when the map ends. This means that when the round ends & in "OnMapEnd", the amount of jimmies left should be set to 0, so that the forward "OnEntityCreated" will not touch any spawned commons.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 01-27-2018 at 16:50.
eyal282 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 06:37.


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