-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lower tickrate for performance & disable weapon spawning for now & mi…
…nor stuffs
- Loading branch information
Showing
16 changed files
with
243 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using CitizenFX.Core; | ||
using System; | ||
|
||
namespace CorruptSnail.CPlayer | ||
{ | ||
class PlayerSpawner : BaseScript | ||
{ | ||
public PlayerSpawner() | ||
{ | ||
EventHandlers["playerSpawned"] += new Action(SpawnPlayer); | ||
} | ||
|
||
private void SpawnPlayer() | ||
{ | ||
Game.PlayerPed.Position = Safezones.SAFEZONES[0].Pos; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using CitizenFX.Core; | ||
using CitizenFX.Core.Native; | ||
using System.Threading.Tasks; | ||
|
||
namespace CorruptSnail.CPlayer | ||
{ | ||
class Safezones : BaseScript | ||
{ | ||
private bool inSafezone = false; | ||
|
||
public class Safezone | ||
{ | ||
public Vector3 Pos { get; private set; } | ||
public float Range { get; private set; } | ||
|
||
public Safezone(Vector3 pos, float range) | ||
{ | ||
Pos = pos; | ||
Range = range; | ||
} | ||
} | ||
|
||
public static Safezone[] SAFEZONES { get; } = | ||
{ | ||
new Safezone(new Vector3(3474, 3681, 34), 250f) | ||
}; | ||
|
||
public Safezones() | ||
{ | ||
Tick += OnTick; | ||
} | ||
|
||
private async Task OnTick() | ||
{ | ||
await Delay(100); | ||
|
||
if (API.NetworkIsSessionStarted() && !API.GetIsLoadingScreenActive()) | ||
{ | ||
Ped playerPed = Game.PlayerPed; | ||
|
||
foreach (Safezone safezone in SAFEZONES) | ||
if (World.GetDistance(playerPed.Position, safezone.Pos) < safezone.Range | ||
&& !inSafezone) | ||
{ | ||
inSafezone = true; | ||
TriggerEvent("corruptsnail:inZone", true); | ||
TriggerEvent("chatMessage", "", new int[] { 0, 255, 0 }, "\nYou are in a safezone now!\n" | ||
+ "Zombies will not spawn and you can spawn stuff in the F6 menu.\n"); | ||
} | ||
else if (World.GetDistance(playerPed.Position, safezone.Pos) > safezone.Range | ||
&& inSafezone) | ||
{ | ||
inSafezone = false; | ||
TriggerEvent("corruptsnail:inZone", false); | ||
TriggerEvent("chatMessage", "", new int[] { 255, 0, 0 }, "\nYou left the safezone!\n" | ||
+ "Zombies will spawn now and you are unable to spawn stuff.\n"); | ||
} | ||
} | ||
|
||
await Task.FromResult(0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.