update jutils

This commit is contained in:
Jackzie 2021-01-21 16:53:59 -06:00
parent dc9fb63838
commit c6a1628569
No known key found for this signature in database
GPG key ID: 1E834FE36520537A

View file

@ -1,5 +1,5 @@
#if defined _jutils_included
#endinput
#endinput
#endif
#define _jutils_included
@ -347,6 +347,7 @@ stock int GetClientWeaponEntIndex(int client, int slot) {
return -1;
}
}else{
ThrowError("Slot must be a number between 0 and 4");
return -1;
}
}
@ -355,7 +356,7 @@ stock int GetClientSecondaryWeapon(int client) {
}
stock bool GetClientWeaponName(int client, int slot, char[] name, int nameSize) {
int wpn = GetClientWeaponEntIndex(client, slot);
if(wpn > -1) {
if(wpn > 0) {
GetEntityClassname(wpn, name, nameSize);
return true;
}else{
@ -467,4 +468,20 @@ stock bool IsEntityInSightRange(int client, int target, float angle = 90.0, floa
else return true;
}
else return false;
}
}
stock void PrintToAdmins(const char[] message, const char[] flags) {
for (int x = 1; x <= MaxClients; x++){
if (IsValidClient(x) && IsValidAdmin(x, flags)) {
PrintToChat(x, message);
}
}
}
stock bool IsValidAdmin(int client, const char[] flags) {
int ibFlags = ReadFlagString(flags);
if ((GetUserFlagBits(client) & ibFlags) == ibFlags) {
return true;
}else if (GetUserFlagBits(client) & ADMFLAG_ROOT) {
return true;
}
return false;
}