Raised This Month: $ Target: $400
 0% 

FakeMeta: basics


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 09-19-2004 , 04:46   FakeMeta: basics
Reply With Quote #1

Ok, I need help figuring out how to use Fakemeta.

Could someone do the following:
Show me how to make a forward <server_frame for example>

How to use the commands to get a function, for example, use fakemeta to get a vector out of an ent.

If you could show me how to do these two, I could use my limited module knowledge to figure the rest out.

Thank you ^^.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-19-2004 , 05:01  
Reply With Quote #2

to make a forward look at fakemeta_const.inc for all forward names

Code:
/* Used with register_forward()
 */
enum {
	FM_PrecacheModel = 1,	// done
	FM_PrecacheSound,	// done
	FM_SetModel,		// done
	FM_ModelIndex,		// done
	FM_ModelFrames,	// done
	FM_SetSize,		// done
	FM_ChangeLevel,			// done
	FM_VecToYaw,			// done
	FM_VecToAngles,			// done
	FM_MoveToOrigin,		// done
	FM_ChangeYaw,			// done
	FM_ChangePitch,			// done
	FM_FindEntityByString,	// done
	FM_GetEntityIllum,		// done
	FM_FindEntityInSphere,	// done
	FM_FindClientInPVS,		// done
	FM_EntitiesInPVS,		// done
	FM_MakeVectors,			// done
	FM_AngleVectors,		// done
	FM_CreateEntity,		// done
	FM_RemoveEntity,		// done
	FM_CreateNamedEntity,	// done
	FM_MakeStatic,			// done
	FM_EntIsOnFloor,		// done
	FM_DropToFloor,			// done
	FM_WalkMove,			// int  )				(edict_t *ent, float yaw, float dist, int iMode); -- does't work as of 0.20 RC2
	FM_SetOrigin,			// done
	FM_EmitSound,			// done
	FM_EmitAmbientSound,	// done
	FM_TraceLine,			// void )				(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); -- does't work as of 0.20 RC2
	FM_TraceToss,			// void )				(edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr); -- does't work as of 0.20 RC2
	FM_TraceMonsterHull,	// int  )		(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr); -- does't work as of 0.20 RC2
	FM_TraceHull,			// void )				(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);  -- does't work as of 0.20 RC2
	FM_TraceModel,			// void )			(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);  -- does't work as of 0.20 RC2
	FM_TraceTexture,		// const char *)			(edict_t *pTextureEntity, const float *v1, const float *v2 ); -- does't work as of 0.20 RC2
	FM_TraceSphere,			// void )			(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);  -- does't work as of 0.20 RC2
	FM_GetAimVector,		// done
	FM_ParticleEffect,		// done
	FM_LightStyle,			// done
	FM_DecalIndex,			// done
	FM_PointContents,		// done
	FM_MessageBegin,		// done
	FM_MessageEnd,			// done
	FM_WriteByte,			// done
	FM_WriteChar,			// done
	FM_WriteShort,			// done
	FM_WriteLong,			// done
	FM_WriteAngle,			// done
	FM_WriteCoord,			// done
	FM_WriteString,			// done
	FM_WriteEntity,			// done
	FM_CVarGetFloat,		// done
	FM_CVarGetString,		// done
	FM_CVarSetFloat,		// done
	FM_CVarSetString,		// done
	FM_FreeEntPrivateData,	// done
	FM_SzFromIndex,			// done
	FM_AllocString,			// done
	FM_RegUserMsg,			// done
	FM_AnimationAutomove,	// done
	FM_GetBonePosition,		// void )		(const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );  -- does't work as of 0.20 RC2
	FM_GetAttachment,		// void	)			(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );  -- does't work as of 0.20 RC2
	FM_SetView,				// done
	FM_Time,				// done
	FM_CrosshairAngle,		// done
	FM_FadeClientVolume,	// done
	FM_SetClientMaxspeed,	// done
	FM_CreateFakeClient,	// done
	FM_RunPlayerMove,		// void )			(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec ); -- does't work as of 0.20 RC2
	FM_NumberOfEntities,	// done
	FM_StaticDecal,			// done
	FM_PrecacheGeneric,		// done
	FM_BuildSoundMsg,		// void )			(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);  -- does't work as of 0.20 RC2
	FM_GetPhysicsKeyValue,	// done
	FM_SetPhysicsKeyValue,	// done
	FM_GetPhysicsInfoString,// done
	FM_PrecacheEvent,		// done
	FM_PlaybackEvent,		// done
	FM_CheckVisibility,			//)		(
	FM_GetCurrentPlayer,			// done
	FM_CanSkipPlayer,			// done
	FM_SetGroupMask,				//done
	FM_Voice_GetClientListening,	// done
	FM_Voice_SetClientListening,	// done
	FM_InfoKeyValue,	// done
	FM_SetKeyValue,	// done
	FM_SetClientKeyValue,	 // done
	FM_GetPlayerAuthId,	// done
	FM_GetPlayerWONId,	// done
	FM_IsMapValid,	// done


	FM_Spawn,	// done
	FM_Think,	// done
	FM_Use,	// done
	FM_Touch,	// done
	FM_Blocked,	// done
	FM_KeyValue,	// void )			( edict_t *pentKeyvalue, KeyValueData *pkvd ); -- does't work as of 0.20 RC2
	FM_SetAbsBox,			// done
	FM_ClientConnect,		// done
	
	FM_ClientDisconnect,	// done
	FM_ClientKill,		// done
	FM_ClientPutInServer,	// done
	FM_ClientCommand,		// done

	FM_ServerDeactivate,	// done

	FM_PlayerPreThink,		// done
	FM_PlayerPostThink,		// done

	FM_StartFrame,		// done
	FM_ParmsNewLevel,		// done
	FM_ParmsChangeLevel,	// done

	 // Returns string describing current .dll.  E.g., TeamFotrress 2, Half-Life
	FM_GetGameDescription,	 // done

	// Spectator funcs
	FM_SpectatorConnect,	// done
	FM_SpectatorDisconnect,	// done
	FM_SpectatorThink,		// done

	// Notify game .dll that engine is going to shut down.  Allows mod authors to set a breakpoint.
	FM_Sys_Error,		// done

	FM_PM_FindTextureType,	// done
	FM_RegisterEncoders,	// done

	// Enumerates player hulls.  Returns 0 if the hull number doesn't exist, 1 otherwise

	// Create baselines for certain "unplaced" items.
	FM_CreateInstancedBaseline,	// done 
	FM_AllowLagCompensation,	// done
};

enum TraceResult
{
	TR_AllSolid,
    TR_StartSolid,
	TR_InOpen,
	TR_InWater,
	TR_flFraction,
	TR_vecEndPos,
	TR_flPlaneDist,
	TR_vecPlaneNormal,
	TR_pHit,
	TR_iHitgroup,
};
Then just use
Code:
/* Registers a forward */ native register_forward(_forwardType,_function[],_post=0);

so youll end up with
Code:
public plugin_init() {      register_forward(FM_ClientConnect,"connectP"); } public connectP() {     }
Now i dont noe whats passed on to FM_ClientConnect so it depends. you might have connectP() or connectP(id)
Freecode is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 09-19-2004 , 06:59  
Reply With Quote #3

I noticed that you can register forwards within plugin_precache, which sometimes is necessary because a lot of stuff actually happens between precache and plugin_init, like all entities precaches, models are loaded etc. It's not necessary if you don't need to catch all that stuff, but it helped me out in a couple of plugins.
Johnny got his gun is offline
mahnsawce
Senior Member
Join Date: Apr 2004
Location: internet
Old 09-19-2004 , 09:17  
Reply With Quote #4

Yes, documentation, or at least some form of notes still need to be written for the forwards in fakemeta.

Registering server frames, like you originally asked would be this:

Code:
public plugin_init() { register_forward(FM_StartFrame,"frame") } public frame() {  /* stuff */  return FMRES_IGNORED; }

No parameters are passed to startframes (it's equivilent to the "server_frame()" forward in engine, too).

Also make sure you return a value listed in the fakemeta_const:

FMRES_IGNORED: Do nothing
FMRES_HANDLED: (also) do nothing
FMRES_OVERRIDE: Still call the function in the engine / gamedll, but use my given return value instead.
FMRES_SUPERCEDE: Don't call the function in the engine / gamedll, and use my return value.
mahnsawce is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 09-19-2004 , 15:31  
Reply With Quote #5

Thank you guys, but you didnt answer my SECOND question, which I also need.

How would I use it to do something NON-forward like?

Also, what would be a good forward for when someone starts running or presses +forward? prethink I thought but I wasnt sure.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 09-19-2004 , 15:52  
Reply With Quote #6

ok well
Code:
new health = get_user_health(id); //fakemeta way new health = pev(id,pev_health); set_user_health(id,100); //fakemeta way set_pev(id,pev_health,100);

And yes use client_prethink and just check flags
Freecode is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 09-19-2004 , 17:12  
Reply With Quote #7

Thank you ^^
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
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 17:11.


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