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

Making players glow crashes server.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
andrept4
Senior Member
Join Date: Dec 2012
Location: Portugal
Old 05-01-2020 , 16:22   Making players glow crashes server.
Reply With Quote #1

So I'm making a plugin that makes certain players glow. For some reason this function crashes the server:

Code:
public void GiveGlow(int client, int nEquipa) {
	char model[PLATFORM_MAX_PATH];
	int skin = -1;
	GetClientModel(client, model, sizeof(model));
	skin = CreatePlayerModelProp(client, model);
	if(skin > MaxClients) {
		if(SDKHookEx(skin, SDKHook_SetTransmit, OnSetTransmit_All)){
			static int offset = -1;
			
			if(!offset && (offset = GetEntSendPropOffs(client, "m_clrGlow")) == -1) {
				LogError("Unable to find property offset: \"m_clrGlow\"!");
				return;
			}
			
			SetEntProp(client, Prop_Send, "m_bShouldGlow", true, true);
			SetEntProp(client, Prop_Send, "m_nGlowStyle", 1);
			SetEntPropFloat(client, Prop_Send, "m_flGlowMaxDist", 10000.0);
			
			SetEntData(client, offset, CorR[nEquipa], _, true);
			SetEntData(client, offset + 1, CorG[nEquipa], _, true);
			SetEntData(client, offset + 2, CorB[nEquipa], _, true);
			SetEntData(client, offset + 3, CorA[nEquipa], _, true);
		}
	}
}

public Action OnSetTransmit_All(int entity, int client) {
	if(playerModelsIndex[client] != entity) {
		return Plugin_Continue;
	}
	return Plugin_Handled;
}
__________________
andrept4 is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-02-2020 , 09:33   Re: Making players glow crashes server.
Reply With Quote #2

PHP Code:
static int offset = -1;
            
            if(!
offset 
Should be checking for offset == -1 not 0 (which is what !offset does)
__________________
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 12:30.


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