More updates

This commit is contained in:
Jackz 2023-05-02 09:05:27 -05:00
parent 98ec7a34fa
commit a52f053082
No known key found for this signature in database
GPG key ID: E0BBD94CF657F603
8 changed files with 305 additions and 156 deletions

View file

@ -738,4 +738,34 @@ stock void HSVToRGBInt(const float vec[3], int out[3]) {
out[0] = RoundToFloor(view_as<float>(out[0]));
out[1] = RoundToFloor(view_as<float>(out[1]));
out[2] = RoundToFloor(view_as<float>(out[2]));
}
}
// Gets a position from where the cursor is upto distance away (basically <= distance, going against walls)
stock bool GetCursorLimited(int client, float distance, float endPos[3], TraceEntityFilter filter)
{
if (client > 0 && client <= MaxClients && IsClientInGame(client)) {
float clientEye[3], clientAngle[3], direction[3];
GetClientEyePosition(client, clientEye);
GetClientEyeAngles(client, clientAngle);
GetAngleVectors(clientAngle, direction, NULL_VECTOR, NULL_VECTOR);
ScaleVector(direction, distance);
AddVectors(clientEye, direction, endPos);
TR_TraceRayFilter(clientEye, endPos, MASK_OPAQUE, RayType_EndPoint, filter, client);
if (TR_DidHit(INVALID_HANDLE)) {
TR_GetEndPosition(endPos);
}
return true;
}
return false;
}
stock void SetWeaponDelay(int client, float delay) {
int pWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
if (pWeapon > -1) {
SetEntPropFloat(pWeapon, Prop_Send, "m_flNextPrimaryAttack", GetGameTime() + delay);
SetEntPropFloat(pWeapon, Prop_Send, "m_flNextSecondaryAttack", GetGameTime() + delay);
}
}

View file

@ -0,0 +1,13 @@
#if defined _player_notes_included_
#endinput
#endif
#define _player_notes_included_
void AddNote(int noteCreator, int noteTarget, const char[] message) {
char steamidCreator[32], steamidTarget[32];
GetClientAuthId(noteCreator, AuthId_Steam2, steamidCreator, sizeof(steamidCreator));
GetClientAuthId(noteTarget, AuthId_Steam2, steamidTarget, sizeof(steamidTarget));
AddNoteIdentity(steamidCreator, steamidTarget, message);
}
native void AddNoteIdentity(const char noteCreator[32], const char noteTarget[32], const char[] message);