How to check if player is within silent aim radius?
-
Hello community. I have created a script which can kill all players directly as soon as i shoot. now i want to extend this to a silent aim functionality. How do I calculate correctly that players who are visible and somewhere in a certain radius around the crosshair will be hit?
It would also be interesting to know how to implement the damage correctly. I have currently set 99999 because it seems I'm missing other aspects. It would be advantageous to have the real damage of the weapon here, regardless of whether the player is behind a wall or not.
Does anyone have experience with those scenarios and is willing to solve this?
init() { level thread onPlayerConnect(); } onPlayerConnect() { for (;;) { level waittill("connected", player); player thread onPlayerSpawned(); } } onPlayerSpawned() { self endon("disconnect"); if (!self isHost()) return; self.isMagicShotActive = false; self thread monitorToggleKey(); self thread monitorWeaponFire(); } monitorToggleKey() { self endon("disconnect"); lastToggleTime = 0; for (;;) { wait 0.05; if (self actionslotthreebuttonpressed()) { currTime = getTime(); if (currTime - lastToggleTime > 0.5) { lastToggleTime = currTime; self.isMagicShotActive = !self.isMagicShotActive; if (self.isMagicShotActive) self iPrintlnBold("^2Magic Shot aktiviert!"); else self iPrintlnBold("^1Magic Shot deaktiviert!"); } } } } monitorWeaponFire() { self endon("disconnect"); for (;;) { self waittill("weapon_fired"); if (self.isMagicShotActive) { self thread damageAllEnemies(); } } } damageAllEnemies() { foreach (player in level.players) { if (!isAlive(player)) continue; if (player == self) continue; playerPos = player getOrigin(); // How to check if player is within silent aim radius? // How to get real weapon damage? radiusDamage(playerPos, 99999, 99999, 99999, self); wait 0.01; } }
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login