lol changes

This commit is contained in:
Jackzie 2021-10-03 15:23:51 -05:00
parent f756ec3100
commit 440808c0c5
No known key found for this signature in database
GPG key ID: 1E834FE36520537A
21 changed files with 868 additions and 301 deletions

View file

@ -1,9 +1,9 @@
char SPECIAL_NAMES[][] = {
"Smoker", "Boomer", "Hunter", "Spitter", "Jockey", "Charger", "Witch"
"Smoker", "Boomer", "Hunter", "Spitter", "Jockey", "Charger", "Witch", "Tank"
};
stock int GetSpecialType(const char[] input) {
for(int i = 0; i < sizeof(SPECIAL_NAMES); i++) {
for(int i = 0; i < 8; i++) {
if(strcmp(SPECIAL_NAMES[i], input, false) == 0) return i + 1;
}
return -1;
@ -37,16 +37,18 @@ float GetIdealMinDistance(int specialType) {
}
bool SpawnSpecialInFace(int target, int specialType) {
if(specialType >= sizeof(SPECIAL_NAMES)) return false;
if(specialType > 8) return false;
static float pos[3], ang[3];
static float testPos[3];
testPos = pos;
GetClientAbsOrigin(target, pos);
GetClientEyeAngles(target, ang);
if(specialType != 5 && specialType != 2) { //If charger/hunter, find a suitable area that is at least 5 m away
if(specialType != 5 && specialType != 2) { //If not jockey/hunter find a suitable area that is at least 5 m away
float minDistance = GetIdealMinDistance(specialType);
GetHorizontalPositionFromOrigin(pos, ang, minDistance, testPos);
FindSuitablePosition(target, pos, testPos, minDistance, 100);
if(!FindSuitablePosition(target, pos, testPos, minDistance, 100)) {
L4D_GetRandomPZSpawnPosition(target, specialType, 10, testPos);
}
pos = testPos;
} else { // Else spawn a little bit off, and above (above for jockeys)
pos[2] += 10.0;
@ -54,31 +56,49 @@ bool SpawnSpecialInFace(int target, int specialType) {
}
pos[2] += 1.0;
NegateVector(ang);
int special = (specialType == 7) ? L4D2_SpawnWitch(pos, ang) : L4D2_SpawnSpecial(specialType, pos, ang);
if(special == -1) return false;
if(specialType == 7)
SetWitchTarget(special, target);
else
g_iAttackerTarget[special] = GetClientUserId(target);
if(specialType == 2) { //Kill boomer
ForcePlayerSuicide(special);
}
return true;
return SpawnSpecialInternal(specialType, target, pos, NULL_VECTOR) > 0;
}
bool SpawnSpecialNear(int target, int specialType) {
if(specialType >= sizeof(SPECIAL_NAMES)) return false;
if(specialType > 8) return false;
static float pos[3];
if(L4D_GetRandomPZSpawnPosition(target, specialType, 10, pos)) {
int special = (specialType == 7) ? L4D2_SpawnWitch(pos, NULL_VECTOR) : L4D2_SpawnSpecial(specialType, pos, NULL_VECTOR);
if(special == -1) return false;
if(specialType == 7)
SetWitchTarget(special, target);
else
g_iAttackerTarget[special] = GetClientUserId(target);
return true;
return SpawnSpecialInternal(specialType, target, pos, NULL_VECTOR) > 0;
}
return false;
}
// doesnt seem to work with l4dhooks methods
void BypassLimit() {
int bot = CreateFakeClient("InfectedBot");
if (bot != 0) {
ChangeClientTeam(bot, 3);
CreateTimer(0.1, Timer_KickBot, bot);
}
}
int SpawnSpecialInternal(int type, int target, float pos[3], float ang[3]) {
if(type <= 6) {
// BypassLimit();
int special = L4D2_SpawnSpecial(type, pos, ang);
if(special != -1)
g_iAttackerTarget[special] = GetClientUserId(target);
return special;
}
else if(type == 7) {
int witch = L4D2_SpawnWitch(pos, ang);
if(witch != -1)
SetWitchTarget(witch, target);
return witch;
}
else if(type == 8) {
// BypassLimit();
int tank = L4D2_SpawnTank(pos, ang);
if(tank <= 0 || !IsClientConnected(tank)) return -1;
if(tank != -1)
g_iAttackerTarget[tank] = GetClientUserId(target);
return tank;
}
else return -1;
}