|
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
|

07-30-2008
, 03:32
Re: [HelpREQ] How to set chat text colors, roundtime and forwarding
|
#5
|
Quote:
Originally Posted by dor123
About forward, I didn't ment how to register, that thing I already knew.
What I ment is why should I forward? What does it do? What does PreThink and PostTHink and stuff like that mean?
If you could find any guides/tutorials or simply explain to me those things I will be gratefull (also I added karma to you  )
|
So, every forward has its own purpose.
The forwards are functions which are called when a particular event happens.
There are 3 types of forwards
event forwards -> example "Damage", "CurWeapon" etc...
To register these events use ->
PHP Code:
register_event()
The list of most events that you can hook is -> Half Life Game Events
As example: I will give the CurWeapon event.
Curweapon is an event which is called when a player swiches weapons, shoots weapons, and even reloads.
When one of these actions happen, the event is called with certain parameters.
That is why when example a player has changed a weapon you need to hook the Curweapon event this way ->
PHP Code:
register_event("CurWeapon","my_func","b","1=1")
1 = 1 that means that weapon is active
Fakemeta forwards ->
Allows a lot of forwards which can be very very helpfull.
Example: FM_PlayerPreThink, FM_Think, FM_EmitSound
Code:
enum {
FM_PrecacheModel = 1, // int ) (const szModel[])
FM_PrecacheSound, // int ) (const szSound[])
FM_SetModel, // void ) (ent, const szModel[])
FM_ModelIndex, // int ) (const szModel[])
FM_ModelFrames, // int ) (iModelIndex)
FM_SetSize, // void ) (ent, const Float:fMins[3], const Float:fMaxs[3])
FM_ChangeLevel, // void ) (szMap[], szSomething[])
FM_VecToYaw, // float ) (const Float:fVector[3])
FM_VecToAngles, // void ) (const Float:fVectorIn[3], Float:fVectorOut[3])
FM_MoveToOrigin, // void ) (ent, const Float:fGoal[3], Float:fDistance, iMoveType)
FM_ChangeYaw, // void ) (ent)
FM_ChangePitch, // void ) (ent)
FM_FindEntityByString, // edict ) (entStartSearchAfter, const szField[], const szValue[])
FM_GetEntityIllum, // int ) (ent)
FM_FindEntityInSphere, // edict ) (ent, const Float:fVector[3], Float:fRadius)
FM_FindClientInPVS, // edict ) (id)
FM_EntitiesInPVS, // edict ) (ent)
FM_MakeVectors, // void ) (const Float:fVector[3])
FM_AngleVectors, // void ) (const Float:fVec[3], Float:fForward[3], Float:fRight[3], Float:fUp[3])
FM_CreateEntity, // edict ) ()
FM_RemoveEntity, // void ) (ent)
FM_CreateNamedEntity, // edict ) (iClassname)
FM_MakeStatic, // void ) (ent)
FM_EntIsOnFloor, // int ) (ent)
FM_DropToFloor, // int ) (ent)
FM_WalkMove, // int ) (ent, Float:fYaw, Float:fDist, iMode)
FM_SetOrigin, // void ) (ent, const Float:fOrigin[3])
FM_EmitSound, // void ) (ent, iChannel, const szSample[], Float:fVolume, Float:fAttenuation, iFlags, iPitch)
FM_EmitAmbientSound, // void ) (ent, Float:fOrigin[3], const szSample[], Float:fVolume, Float:fAttenuation, iFlags, iPitch)
FM_TraceLine, // void ) (const Float:fV1[3], const Float:fV2[3], iNoMonsters, entToSkip, tr)
FM_TraceToss, // void ) (ent, entToIgnore, tr)
FM_TraceMonsterHull, // int ) (ent, const Float:fV1, const Float:fV2, iNoMonsters, entToSkip, tr)
FM_TraceHull, // void ) (const Float:fV1[3], const Float:fV2[3], iNoMonsters, iHullNumber, entToSkip, tr)
FM_TraceModel, // void ) (const Float:fV1[3], const Float:fV2[3], iHullNumber, ent, tr)
FM_TraceTexture, // char ) (entTexture, const Float:fV1[3], const Float:fV2[3])
FM_TraceSphere, // void ) (const Float:fV1[3], const Float:fV2[3], iNoMonsters, Float:fRadius, entToSkip, tr)
FM_GetAimVector, // void ) (ent, Float:fSpeed, Float:fReturn[3])
FM_ParticleEffect, // void ) (const Float:fOrigin[3], const Float:fDir[3], Float:fColor, Float:fCount)
FM_LightStyle, // void ) (iStyle, szVal[])
FM_DecalIndex, // int ) (const szName[])
FM_PointContents, // int ) (const Float:fOrigin[3])
FM_MessageBegin, // void ) (iMsg_Dest, iMsg_Type, const Float:fOrigin[3], ent)
FM_MessageEnd, // void ) ()
FM_WriteByte, // void ) (iValue)
FM_WriteChar, // void ) (iValue)
FM_WriteShort, // void ) (iValue)
FM_WriteLong, // void ) (iValue)
FM_WriteAngle, // void ) (Float:fValue)
FM_WriteCoord, // void ) (Float:fValue)
FM_WriteString, // void ) (const szValue[])
FM_WriteEntity, // void ) (iValue)
FM_CVarGetFloat, // float ) (const szCvar[])
FM_CVarGetString, // char ) (const szCvar[])
FM_CVarSetFloat, // void ) (const szCvar[], Float:fValue)
FM_CVarSetString, // void ) (const szCvar[], szValue[])
FM_FreeEntPrivateData, // void ) (ent)
FM_SzFromIndex, // char ) (iString)
FM_AllocString, // int ) (const szValue[])
FM_RegUserMsg, // int ) (szName[], iSize)
FM_AnimationAutomove, // void ) (const ent, Float:fTime)
FM_GetBonePosition, // void ) (const ent, iBone, Float:fOrigin[3], Float:fAngle[3])
FM_GetAttachment, // void ) (const ent, iAttachment, Float:fOrigin[3], Float:fAngle[3])
FM_SetView, // void ) (const ent, const entView)
FM_Time, // float ) ()
FM_CrosshairAngle, // void ) (const ent, Float:fPitch, Float:fYaw)
FM_FadeClientVolume, // void ) (const ent, iFadePercent, iFadeOutSeconds, iHoldTime, iFadeInSeconds)
FM_SetClientMaxspeed, // void ) (const ent, Float:fMaxSpeed)
FM_CreateFakeClient, // edict ) (const szNetName[])
FM_RunPlayerMove, // void ) (const entFakeClient, Float:fViewAngles[3], Float:fForwardmove, Float:fSidemove, Float:fUpmove, iButtons, iImpulse, i_mSec)
FM_NumberOfEntities, // int ) ()
FM_StaticDecal, // void ) (const Float:fOrigin[3], iDecalIndex, iEntityIndex, iModelIndex)
FM_PrecacheGeneric, // int ) (szString[])
FM_BuildSoundMsg, // void ) (ent, iChannel, const szSample[], Float:fVolume, Float:fAttenuation, iFlags, iPitch, iMsg_Dest, iMsg_Type, const Float:fOrigin[3], ent)
FM_GetPhysicsKeyValue, // char ) (const ent, const szKey[])
FM_SetPhysicsKeyValue, // void ) (const ent, const szKey[], const szValue[])
FM_GetPhysicsInfoString, // char ) (const ent)
FM_PrecacheEvent, // int ) (iType, const szEvent[])
FM_PlaybackEvent, // void ) (iFlags, const entInvoker, iEventIndex, Float:fDelay, Float:fOrigin[3], Float:fAngles[3], Float:fParam1, Float:fParam2, iParam1, iParam2, bool:bParam1, bool:bParam2)
FM_CheckVisibility, // int ) (const ent, iSet)
FM_GetCurrentPlayer, // int ) ()
FM_CanSkipPlayer, // int ) (const ent)
FM_SetGroupMask, // void ) (iMask, iOp)
FM_Voice_GetClientListening, // bool ) (iReceiver, iSender)
FM_Voice_SetClientListening, // bool ) (iReceiver, iSender, bool:bListen)
FM_InfoKeyValue, // char ) (szInfoBuffer[], szKey[])
FM_SetKeyValue, // void ) (szInfoBuffer[], szKey[], szValue[])
FM_SetClientKeyValue, // void ) (iClientIndex, szInfoBuffer[], szKey[], szValue[])
FM_GetPlayerAuthId, // char ) (ent)
FM_GetPlayerWONId, // char ) (ent)
FM_IsMapValid, // int ) (szFileName[])
FM_Spawn, // int ) (ent)
FM_Think, // void ) (ent)
FM_Use, // void ) (entUsed, entOther)
FM_Touch, // void ) (entTouched, entOther)
FM_Blocked, // void ) (entBlocked, entOther)
FM_KeyValue, // void ) (keyvalue, kvd_id)
FM_SetAbsBox, // void ) (ent)
FM_ClientConnect, // bool ) (ent, const szName[], const szAddress[], const szRejectReason[128])
FM_ClientDisconnect, // void ) (ent)
FM_ClientKill, // void ) (ent)
FM_ClientPutInServer, // void ) (ent)
FM_ClientCommand, // void ) (ent)
FM_ServerDeactivate, // void ) ()
FM_PlayerPreThink, // void ) (ent)
FM_PlayerPostThink, // void ) (ent)
FM_StartFrame, // void ) ()
FM_ParmsNewLevel, // void ) ()
FM_ParmsChangeLevel, // void ) ()
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
FM_GetGameDescription, // char ) ()
// Spectator funcs
FM_SpectatorConnect, // void ) (ent)
FM_SpectatorDisconnect, // void ) (ent)
FM_SpectatorThink, // void ) (ent)
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
FM_Sys_Error, // void ) (const szError[])
FM_PM_FindTextureType, // char ) (szType[])
FM_RegisterEncoders, // void ) ()
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise
// Create baselines for certain "unplaced" items.
FM_CreateInstancedBaseline, // void ) ()
FM_AllowLagCompensation, // int ) ()
FM_AlertMessage, // void ) (AlertType:aType, szBuffer[])
// NEW_DLL_FUNCTIONS:
FM_OnFreeEntPrivateData, // void ) (ent)
FM_GameShutdown, // unknown ) ()
FM_ShouldCollide, // unknown ) (entTouched, entOther)
// LATE ADDITIONS (v1.71)
FM_ClientUserInfoChanged, // void ) (ent, szInfo[])
// LATE ADDITIONS (v1.75)
FM_UpdateClientData, // void ) (const ent, iSendWeapons, cd_handle)
FM_AddToFullPack, // int ) (entState, e, ent, host, iHostFlags, iPlayer, pSet)
FM_CmdStart, // void ) (const ent, uc_handle, seed)
FM_CmdEnd, // void ) (const ent)
FM_CreateInstBaseline, // int ) (classname, baseline)
FM_CreateBaseline, // void ) (iPlayer, i_eIndex, baseline, ent, iPlayerModelIndex, Float:fMins[3], Float:fMaxs[3])
FM_GetInfoKeyBuffer, // char ) (ent)
FM_ClientPrintf // void ) (ent, type, const szMsg[])
};
This is from amxx wiki.
The forward FM_EmitSound takes place when at an origin a sound is emited.
For example I will give the moment when a he grenade explodes.
It will produce a sound that will make a player know that it has kaboomed.
When the sound is produced or better said before that.
The forward FM_EmitSound is called with these paramaters (ent, iChannel, const szSample[], Float:fVolume, Float:fAttenuation, iFlags, iPitch)
To get an accurate forward you must check almost all the paramaters.
ent = hegrenade
iChannel = the channel which was chosen (not important)
szSample[] = the sound that will be emited
The rest are some other stuff that I didn't use...
FM_PlayerPreThink is a function which takes place repetetively on an ammount of x miliseconds.
The same for postThink. But the diference is that these ones take place one after another.
Then the func will execute this way: -> PRETHINK -> POSTHINK -> PRETHINK ...
And the last Hamsandwich forwards -> RegisterHam(Ham_XXX,entclassname[],"function",post=0)
The same as fakemeta ;).
__________________
Last edited by ot_207; 07-30-2008 at 03:46.
|
|