-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2ed4576
Showing
230 changed files
with
18,213 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,163 @@ | ||
using GrandTheftMultiplayer.Server.API; | ||
using GrandTheftMultiplayer.Server.Elements; | ||
using GrandTheftMultiplayer.Server.Managers; | ||
|
||
|
||
public class AdminScript : Script | ||
{ | ||
public AdminScript() | ||
{ | ||
API.onPlayerRespawn += onDeath; | ||
API.onPlayerConnected += OnPlayerConnected; | ||
API.onUpdate += onUpdate; | ||
API.onResourceStart += onResStart; | ||
API.onPlayerDisconnected += onPlayerDisconnected; | ||
} | ||
|
||
#region Commands | ||
|
||
[Command(SensitiveInfo = true, ACLRequired = true)] | ||
public void Login(Client sender, string password) | ||
{ | ||
var logResult = API.loginPlayer(sender, password); | ||
switch (logResult) | ||
{ | ||
case 0: | ||
API.sendChatMessageToPlayer(sender, "~r~ERROR:~w~ No account found with your name."); | ||
break; | ||
case 3: | ||
case 1: | ||
API.sendChatMessageToPlayer(sender, "~g~Login successful!~w~ Logged in as ~b~" + API.getPlayerAclGroup(sender) + "~w~."); | ||
break; | ||
case 2: | ||
API.sendChatMessageToPlayer(sender, "~r~ERROR:~w~ Wrong password!"); | ||
break; | ||
case 4: | ||
API.sendChatMessageToPlayer(sender, "~r~ERROR:~w~ You're already logged in!"); | ||
break; | ||
case 5: | ||
API.sendChatMessageToPlayer(sender, "~r~ERROR:~w~ ACL has been disabled on this server."); | ||
break; | ||
} | ||
} | ||
|
||
[Command(ACLRequired = true)] | ||
public void SetTime(Client sender, int hours, int minutes) | ||
{ | ||
API.setTime(hours, minutes); | ||
} | ||
|
||
[Command(ACLRequired = true)] | ||
public void SetWeather(Client sender, int newWeather) | ||
{ | ||
API.setWeather(newWeather); | ||
} | ||
|
||
[Command(ACLRequired = true)] | ||
public void Logout(Client sender) | ||
{ | ||
API.logoutPlayer(sender); | ||
} | ||
|
||
[Command(ACLRequired = true)] | ||
public void Start(Client sender, string resource) | ||
{ | ||
if (!API.doesResourceExist(resource)) | ||
{ | ||
API.sendChatMessageToPlayer(sender, "~r~No such resource found: \"" + resource + "\""); | ||
} | ||
else if (API.isResourceRunning(resource)) | ||
{ | ||
API.sendChatMessageToPlayer(sender, "~r~Resource \"" + resource + "\" is already running!"); | ||
} | ||
else | ||
{ | ||
API.startResource(resource); | ||
API.sendChatMessageToPlayer(sender, "~g~Started resource \"" + resource + "\""); | ||
} | ||
} | ||
|
||
[Command(ACLRequired = true)] | ||
public void Stop(Client sender, string resource) | ||
{ | ||
if (!API.doesResourceExist(resource)) | ||
{ | ||
API.sendChatMessageToPlayer(sender, "~r~No such resource found: \"" + resource + "\""); | ||
} | ||
else if (!API.isResourceRunning(resource)) | ||
{ | ||
API.sendChatMessageToPlayer(sender, "~r~Resource \"" + resource + "\" is not running!"); | ||
} | ||
else | ||
{ | ||
API.stopResource(resource); | ||
API.sendChatMessageToPlayer(sender, "~g~Stopped resource \"" + resource + "\""); | ||
} | ||
} | ||
|
||
|
||
[Command(ACLRequired = true)] | ||
public void Restart(Client sender, string resource) | ||
{ | ||
if (API.doesResourceExist(resource)) | ||
{ | ||
API.stopResource(resource); | ||
API.startResource(resource); | ||
|
||
API.sendChatMessageToPlayer(sender, "~g~Restarted resource \"" + resource + "\""); | ||
} | ||
else | ||
{ | ||
API.sendChatMessageToPlayer(sender, "~r~No such resource found: \"" + resource + "\""); | ||
} | ||
} | ||
|
||
[Command(GreedyArg = true, ACLRequired = true)] | ||
public void Kick(Client sender, Client target, string reason) | ||
{ | ||
API.kickPlayer(target, reason); | ||
} | ||
|
||
[Command(ACLRequired = true)] | ||
public void Kill(Client sender, Client target) | ||
{ | ||
API.setPlayerHealth(target, -1); | ||
} | ||
|
||
#endregion | ||
|
||
|
||
private void onResStart() | ||
{ | ||
|
||
} | ||
|
||
public void onPlayerDisconnected(Client player, string reason) | ||
{ | ||
API.logoutPlayer(player); | ||
} | ||
|
||
public void onUpdate() | ||
{ | ||
|
||
} | ||
|
||
public void onDeath(Client player) | ||
{ | ||
|
||
} | ||
|
||
public void OnPlayerConnected(Client player) | ||
{ | ||
var log = API.loginPlayer(player, ""); | ||
if (log == 1) | ||
{ | ||
API.sendChatMessageToPlayer(player, "Logged in as ~b~" + API.getPlayerAclGroup(player) + "~w~."); | ||
} | ||
else if (log == 2) | ||
{ | ||
API.sendChatMessageToPlayer(player, "Please log in with ~b~/login [password]") ; | ||
} | ||
} | ||
|
||
} |
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,6 @@ | ||
<meta> | ||
<info name="Administration Utilities" author="Guadmaz" type="script" /> | ||
<script src="admin.cs" type="server" lang="csharp" /> | ||
|
||
<!-- <acl src="acl.xml" /> --> | ||
</meta> |
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,33 @@ | ||
var airbreakStrikes = 0; | ||
|
||
|
||
API.onUpdate.connect(function() { | ||
var player = API.getLocalPlayer(); | ||
|
||
if (!API.getEntityInvincible(player) && | ||
API.getLocalPlayerInvincible()) | ||
{ | ||
API.triggerServerEvent("CHEAT_GODMODE"); | ||
} | ||
|
||
if (API.isPlayerInAnyVehicle(player)) | ||
{ | ||
var car = API.getPlayerVehicle(player); | ||
var height = API.returnNative("GET_ENTITY_HEIGHT_ABOVE_GROUND", 7, car); | ||
var speed = API.getEntityVelocity(car).Length(); | ||
var model = API.getEntityModel(car); | ||
|
||
var airVeh = API.returnNative("IS_THIS_MODEL_A_PLANE", 8, model) || API.returnNative("IS_THIS_MODEL_A_HELI", 8, model); | ||
|
||
if (height > 10 && !airVeh && speed < 5) { | ||
airbreakStrikes++; | ||
|
||
if (airbreakStrikes > 5) { | ||
API.triggerServerEvent("CHEAT_AIRBREAK"); | ||
} | ||
} | ||
else { | ||
airbreakStrikes = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<meta> | ||
<info type="script" name="Anti-Cheat" version="1.0" async="true" /> | ||
|
||
<script src="serverside_ac.cs" type="server" lang="csharp" /> | ||
<script src="clientside_ac.js" type="client" lang="javascript" /> | ||
|
||
<settings> | ||
<setting name="CHEAT_TELEPORT" value="2" default="2 " description="What to do when we detect a player using a cheat. 0=Do nothing, 1=Console warn, 2=Kick, 3=Ban" /> | ||
|
||
<setting name="CHEAT_GODMODE" value="2" default="2" description="What to do when we detect a player using a cheat. 0=Do nothing, 1=Console warn, 2=Kick, 3=Ban" /> | ||
|
||
<setting name="CHEAT_AIRBREAK" value="2" default="2" description="What to do when we detect a player using a cheat. 0=Do nothing, 1=Console warn, 2=Kick, 3=Ban" /> | ||
</settings> | ||
</meta> |
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,89 @@ | ||
using System; | ||
using GrandTheftMultiplayer.Server.API; | ||
using GrandTheftMultiplayer.Server.Elements; | ||
using GrandTheftMultiplayer.Shared.Math; | ||
|
||
public class AntiCheat : Script | ||
{ | ||
public AntiCheat() | ||
{ | ||
API.onUpdate += MainUpdate; | ||
API.onClientEventTrigger += ClientEventTrigger; | ||
} | ||
|
||
public void ClientEventTrigger(Client sender, string eventName, object[] args) | ||
{ | ||
onCheatDetected(sender, eventName); | ||
} | ||
|
||
const int PED_INTERPOLATION_WARP_THRESHOLD = 15; | ||
const int PED_INTERPOLATION_WARP_THRESHOLD_FOR_SPEED = 5; | ||
|
||
const int VEHICLE_INTERPOLATION_WARP_THRESHOLD = 15; | ||
const int VEHICLE_INTERPOLATION_WARP_THRESHOLD_FOR_SPEED = 10; | ||
|
||
private DateTime _lastUpdate = DateTime.Now; | ||
public void MainUpdate() | ||
{ | ||
if (DateTime.Now.Subtract(_lastUpdate).TotalMilliseconds < 100) return; | ||
_lastUpdate = DateTime.Now; | ||
|
||
var players = API.getAllPlayers(); | ||
|
||
foreach (var p in players) | ||
{ | ||
if (API.getEntityData(p, "ANTICHEAT_LAST_POS") == null || API.getEntityData(p, "ANTICHEAT_LAST_POS") == new Vector3()) | ||
{ | ||
API.setEntityData(p, "ANTICHEAT_LAST_POS", API.getEntityPosition(p)); | ||
continue; | ||
} | ||
|
||
var lastLegitTp = API.getEntityData(p, "__LAST_POSITION_SET"); | ||
var lastLegitDeath = API.getEntityData(p, "__LAST_PLAYER_DEATH") ?? 0; | ||
var lastLegitRespawn = API.getEntityData(p, "__LAST_PLAYER_RESPAWN") ?? 0; | ||
var stillDead = lastLegitRespawn < lastLegitDeath; | ||
|
||
if ((lastLegitTp == null || API.TickCount - lastLegitTp > 500) && !stillDead) | ||
{ | ||
var lastPos = API.getEntityData(p, "ANTICHEAT_LAST_POS"); | ||
var velocity = API.getPlayerVelocity(p).Length(); | ||
var newPos = API.getEntityPosition(p); | ||
|
||
float threshold; | ||
|
||
if (!API.isPlayerInAnyVehicle(p) && !API.isPlayerParachuting(p)) | ||
threshold = (PED_INTERPOLATION_WARP_THRESHOLD + | ||
PED_INTERPOLATION_WARP_THRESHOLD_FOR_SPEED * velocity); | ||
else | ||
threshold = (VEHICLE_INTERPOLATION_WARP_THRESHOLD + | ||
VEHICLE_INTERPOLATION_WARP_THRESHOLD_FOR_SPEED * velocity); | ||
|
||
|
||
if (lastPos.DistanceToSquared(newPos) > threshold*threshold) | ||
{ | ||
onCheatDetected(p, "CHEAT_TELEPORT"); | ||
} | ||
} | ||
|
||
API.setEntityData(p, "ANTICHEAT_LAST_POS", API.getEntityPosition(p)); | ||
} | ||
} | ||
|
||
private void onCheatDetected(Client player, string cheat) | ||
{ | ||
if (!API.hasSetting(cheat)) return; | ||
|
||
switch(API.getSetting<int>(cheat)) | ||
{ | ||
case 1: | ||
API.consoleOutput("[ANTICHEAT] Player " + player.name + " is cheating with " + cheat + "!"); | ||
break; | ||
case 2: | ||
API.kickPlayer(player, "Cheating: " + cheat); | ||
break; | ||
case 3: | ||
API.banPlayer(player, "Cheating: " + cheat); | ||
break; | ||
} | ||
} | ||
} |
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,5 @@ | ||
<meta> | ||
<info name="Attack Madrazo's ranch!" type="map" gamemodes="assault" /> | ||
|
||
<map src="test.map" /> | ||
</meta> |
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,27 @@ | ||
<map> | ||
<!-- | ||
<spawnpoint team="1" posX="" posY="" posZ="" heading="" objective="*" weapons="AssaultRifle,Pistol" ammo="500,50" skins="Gangster" /> | ||
|
||
<objective id="1" posX="" posY="" posZ="" range="" name="" required="1,2" color="#FFFFFFFF" timer="5000" /> | ||
--> | ||
|
||
<spawnpoint team="1" posX="1048.766" posY="705.3881" posZ="158.5015" heading="-7.153304" weapons="Pistol,AssaultRifle" ammo="50,500" skins="ExArmy01"/> | ||
|
||
<spawnpoint team="1" objectives="1" posX="1309.75" posY="1089.66" posZ="105.55" heading="336.35" weapons="Pistol,AssaultRifle" ammo="50,500" skins="ExArmy01"/> | ||
|
||
<vehicle model="-2064372143" posX="1040.264" posY="691.5898" posZ="158.955" rotZ="52.53782" rotX="0" rotY="0" color1="0" color2="0" /> | ||
<vehicle model="-2064372143" posX="1034.528" posY="684.6589" posZ="159.5418" rotZ="21.70925" rotX="0" rotY="0" color1="0" color2="0"/> | ||
|
||
<vehicle model="-2064372143" posX="1023.03" posY="678.6723" posZ="160.057" rotZ="18.14038" rotX="0" rotY="0" color1="0" color2="0" /> | ||
<vehicle model="-2064372143" posX="1018.95" posY="666.034" posZ="160.5328" rotZ="52.7244" rotX="0" rotY="0" color1="0" color2="0" /> | ||
<vehicle model="-2064372143" posX="1015.864" posY="663.5819" posZ="160.7896" rotZ="42.7093" rotX="0" rotY="0" color1="0" color2="0"/> | ||
<vehicle model="-2064372143" posX="1012.614" posY="661.0857" posZ="160.9932" rotZ="42.60994" rotX="0" rotY="0" color1="0" color2="0"/> | ||
<vehicle model="-2064372143" posX="1009.42" posY="656.0676" posZ="161.3189" rotZ="28.41134" rotX="0" rotY="0" color1="0" color2="0"/> | ||
|
||
<spawnpoint team="2" posX="1481.231" posY="1115.881" posZ="114.3344" heading="85.83113" weapons="Pistol,AssaultRifle" ammo="50,500" skins="Hillbilly01AMM" /> | ||
|
||
<objective id="1" posX="1360.229" posY="1148.156" posZ="114.3129" name="Entrance" timer="15000" /> | ||
<objective id="2" required="1" posX="1421.076" posY="1139.248" posZ="114.334" name="House" /> | ||
<objective id="3" required="2" posX="1489.435" posY="1146.231" posZ="114.4651" name="Water Tower" timer="30000" /> | ||
<objective id="4" required="2" posX="1459.871" posY="1111.76" posZ="114.334" name="Ranch" /> | ||
</map> |
Oops, something went wrong.