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

Could anyone help me out?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xfusionlockx
AlliedModders Donor
Join Date: Aug 2014
Old 03-06-2016 , 20:28   Could anyone help me out?
Reply With Quote #1

Code:
public Action:Command_Replace(int iClient, int iArgs)
{
	char sAlias[64], sPropString[256], sPropBuffer[2][128], sClassname[128], sTargetname[128], sSkin[64], sModel[128];
	int iR, iG, iB, iA;
	float fOrigin[3], fAngles[3];

	if(iArgs < 1)
	{
		Flare_ReplyCommand(iClient, "{green}[flr_tag]replace{default} <alias>");
		return Plugin_Handled;
	}

	GetCmdArg(1, sAlias, sizeof(sAlias));

	Handle hProps = CreateKeyValues("Props");

	FileToKeyValues(hProps, g_sSpawnList);

	KvJumpToKey(hProps, "Models", false);
	
	KvGetString(hProps, sAlias, sPropString, sizeof(sPropString), "null");

	KvRewind(hProps);

	CloseHandle(hProps);

	if(StrEqual(sPropString, "null", true))
	{
		Flare_ReplyCommand(iClient, "Prop not found.");

		return Plugin_Handled;
	}

	ExplodeString(sPropString, "^", sPropBuffer, 2, sizeof(sPropBuffer[]));

	Format(sModel, sizeof(sModel), sPropBuffer[1]);

	int i = GetClientAimTarget(iClient, false);

	if(i == -1)
	{
		Flare_NotLooking(iClient);
		return Plugin_Handled;
	}

	if(Flare_CheckOwner(iClient, i))
	{
		if(g_bFlareEnt[i])
		{
			GetEdictClassname(i, sClassname, sizeof(sClassname));
			GetEntPropString(i, Prop_Data, "m_iName", sTargetname, sizeof(sTargetname));

			GetEntPropVector(i, Prop_Send, "m_vecOrigin", fOrigin);
			GetEntPropVector(i, Prop_Send, "m_angRotation", fAngles);

			RoundFloat(fOrigin[0]);
			RoundFloat(fOrigin[1]);
			RoundFloat(fOrigin[2]);

			RoundFloat(fAngles[0]);
			RoundFloat(fAngles[1]);
			RoundFloat(fAngles[2]);

			int iSkin = GetEntProp(i, Prop_Data, "m_nSkin", 1);

			IntToString(iSkin, sSkin, sizeof(sSkin));

			int iCollision = GetEntProp(i, Prop_Send, "m_CollisionGroup", 4, 0);

			int iOffset = GetEntSendPropOffs(i, "m_clrRender");
		 
			if(iOffset > 0) 
			{
				iR = GetEntData(i, iOffset, 1);
				iG = GetEntData(i, iOffset + 1, 1);
				iB = GetEntData(i, iOffset + 2, 1);
				iA = GetEntData(i, iOffset + 3, 1);
			}

			g_bFlareEnt[i] = false;

			int iProp = CreateEntityByName("prop_physics_override");

			PrecacheModel(sModel);

			DispatchKeyValue(iProp, "classname", sClassname);
			DispatchKeyValue(iProp, "model", sModel);
			DispatchKeyValue(iProp, "skin", sSkin);
			DispatchKeyValue(iProp, "targetname", sTargetname);

			SetEntProp(iProp, Prop_Send, "m_CollisionGroup", iCollision, 4, 0);

			DispatchSpawn(iProp);

			g_iColor[iProp][0] = iR;
			g_iColor[iProp][1] = iG;
			g_iColor[iProp][2] = iB;
			g_iColor[iProp][3] = iA;

			SetEntityRenderColor(iProp, g_iColor[iProp][0], g_iColor[iProp][1], g_iColor[iProp][2], g_iColor[iProp][3]);
			SetEntityRenderMode(iProp, RENDER_TRANSALPHA);

			TeleportEntity(iProp, fOrigin, fAngles, NULL_VECTOR);

			AcceptEntityInput(iProp, "disablemotion");

			Format(g_sPropname[iProp], sizeof(g_sPropname[]), sPropBuffer[0]);

			Flare_SetOwner(iClient, iProp);

			g_bFlareEnt[iProp] = true;

			Flare_RemoveEntity(i);

			Flare_ClientBeam(iClient, iProp, true);
		}
	}

	return Plugin_Handled;
}
For some reason, I will do a model replace, then I try to replace the same entity again. It will just remove. Can anyone help me out?
xfusionlockx is offline
Kailo
Senior Member
Join Date: Sep 2014
Location: Moscow, Russia
Old 03-07-2016 , 03:16   Re: Could anyone help me out?
Reply With Quote #2

I think you got some errors in log, check it.
Kailo 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 05:02.


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