181 lines
7.4 KiB
C#
181 lines
7.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using GrandTheftMultiplayer.Server.API;
|
|
using GrandTheftMultiplayer.Server.Constant;
|
|
using GrandTheftMultiplayer.Server.Elements;
|
|
using GrandTheftMultiplayer.Server.Managers;
|
|
using GrandTheftMultiplayer.Shared;
|
|
using GrandTheftMultiplayer.Shared.Math;
|
|
|
|
namespace Roleplay.Fraktionen
|
|
{
|
|
class Einknasten : Script
|
|
{
|
|
|
|
[Flags]
|
|
public enum AnimationFlags
|
|
{
|
|
Loop = 1 << 0,
|
|
StopOnLastFrame = 1 << 1,
|
|
OnlyAnimateUpperBody = 1 << 4,
|
|
AllowPlayerControl = 1 << 5,
|
|
Cancellable = 1 << 7
|
|
}
|
|
|
|
public Einknasten()
|
|
{
|
|
Blip blip = API.createBlip(new Vector3(1850.173, 2582.71, 45.67));
|
|
API.setBlipSprite(blip, 285);
|
|
API.setBlipName(blip, "Gefängnis");
|
|
|
|
RAPI.Marker.createMarker(1, new Vector3(1848.337, 2608.531, 44.59), 2, 0, 255, 0, "prisonmarker", 0, 185, "Gefaengnis", 0);
|
|
API.onEntityEnterColShape += onJail;
|
|
|
|
}
|
|
|
|
private void onJail(ColShape colshape, NetHandle entity)
|
|
{
|
|
if (colshape.getData("prisonmarker") == true)
|
|
{
|
|
if (API.getEntityType(entity) == EntityType.Player)
|
|
{
|
|
Client reinkommer = API.getPlayerFromHandle(entity);
|
|
|
|
if (Fraktionsmanager.isStateFraktion(reinkommer) == true)
|
|
{
|
|
Vehicle fahrzeug = reinkommer.vehicle;
|
|
Client[] mitfahrerlist = fahrzeug.occupants;
|
|
foreach (Client mitfahrer in mitfahrerlist)
|
|
{
|
|
if (Fraktionsmanager.isDuty(mitfahrer) == false)
|
|
{
|
|
if (API.getEntityData(mitfahrer, "jail") == 0)
|
|
{
|
|
if (Fraktionsmanager.getWanteds(mitfahrer) <= 60)
|
|
{
|
|
if (Fraktionsmanager.getWanteds(mitfahrer) > 9)
|
|
{
|
|
putPlayerInJail(mitfahrer, Fraktionsmanager.getWanteds(mitfahrer), API);
|
|
//API.sendNotificationToPlayer(reinkommer, "Du hast den Spieler: " + mitfahrer + " eingesperrt!");
|
|
Fraktionsmanager.sendFraktionsNotification(1, "~r~Officer " + reinkommer.name + " hat " + mitfahrer.name + " eingesperrt!", true);
|
|
Levelsystem.addPlayerLevelFortschritt(reinkommer,10,API);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public static List<Client> injail = new List<Client>();
|
|
public static int lastid = 0;
|
|
|
|
[Command("unarrest")]
|
|
public void unArrest(Client player, Client target)
|
|
{
|
|
if (API.getEntityData(player, "adminlevel") > 3)
|
|
{
|
|
PlayerDatabase.setDatabaseData(target, "jailtime", 0);
|
|
API.setEntityData(target, "jail", 0);
|
|
API.kickPlayer(target, "Unarrested! Reconnect!");
|
|
}
|
|
else
|
|
{
|
|
API.sendNotificationToPlayer(player, "Du bist kein Administrator!");
|
|
}
|
|
}
|
|
|
|
|
|
public static void putPlayerInJail(Client player, int minutes, API api)
|
|
{
|
|
PlayerDatabase.setDatabaseData(player, "jailtime", minutes);
|
|
API.shared.setEntityData(player, "jail", minutes);
|
|
injail.Add(player);
|
|
API.shared.triggerClientEvent(player, "unfesseln");
|
|
API.shared.removeAllPlayerWeapons(player);
|
|
Fraktionsmanager.setWanteds(player, 0);
|
|
API.shared.setEntityData(player, "knastid", injail.IndexOf(player));
|
|
API.shared.sendNativeToPlayer(player, Hash.DO_SCREEN_FADE_OUT, 1);
|
|
API.shared.setEntityPosition(player, new Vector3(1720.454, 2556.604, 45.56));
|
|
API.shared.setEntityRotation(player, new Vector3(0, 0, 134.0309));
|
|
API.shared.sendNativeToPlayer(player, Hash.DO_SCREEN_FADE_IN, 1000);
|
|
API.shared.setEntityInvincible(player, true);
|
|
API.shared.setPlayerHealth(player, 100);
|
|
|
|
API.shared.sendNotificationToPlayer(player, "Du bist fuer ~y~ " + minutes + " Minuten im Gefägnis!");
|
|
api.delay(minutes * 60000, true, () => { outOfPrison(player,api); });
|
|
api.delay(60000, false, () => { oneMinute(player); });
|
|
|
|
if (API.shared.getEntityModel(player) == -1667301416)
|
|
{
|
|
GivePrisonerOutfit_Female(player);
|
|
}
|
|
else if (API.shared.getEntityModel(player) == 1885233650)
|
|
{
|
|
GivePrisonerOutfit_Male(player);
|
|
}
|
|
|
|
api.playPlayerAnimation(player, (int)(AnimationFlags.Loop | AnimationFlags.OnlyAnimateUpperBody | AnimationFlags.AllowPlayerControl), "mp_arresting", "idle");
|
|
}
|
|
|
|
public static void oneMinute(Client player)
|
|
{
|
|
if (API.shared.getEntityData(player, "jail") > 0)
|
|
{
|
|
API.shared.setEntityData(player, "jail", API.shared.getEntityData(player, "jail") - 1);
|
|
API.shared.sendNotificationToPlayer(player, "Du musst noch ~y~" + API.shared.getEntityData(player, "jail") + " Minuten~w~ im Gefägnis sitzen.");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public static void outOfPrison(Client player, API api)
|
|
{
|
|
API.shared.setEntityData(player, "jail", 0);
|
|
API.shared.sendNativeToPlayer(player, Hash.DO_SCREEN_FADE_OUT, 1);
|
|
API.shared.sendNativeToPlayer(player, Hash.DO_SCREEN_FADE_IN, 1000);
|
|
API.shared.setEntityPosition(player, new Vector3(1850.173, 2582.71, 45.67));
|
|
API.shared.setEntityRotation(player, new Vector3(0, 0, -80));
|
|
API.shared.setEntityData(player, "knastid", 0);
|
|
API.shared.setEntityInvincible(player, false);
|
|
API.shared.setPlayerHealth(player, 100);
|
|
API.shared.stopPlayerAnimation(player);
|
|
API.shared.setPlayerClothes(player, 7, 0, 0);
|
|
Database.CharacterDatabase.setPlayerDatabaseClothes(player, api);
|
|
PlayerDatabase.setDatabaseData(player, "jailtime", api.getEntityData(player, "jail"));
|
|
}
|
|
|
|
public static void GivePrisonerOutfit_Male(Client player)
|
|
{
|
|
player.setClothes(3, 5, 0);
|
|
player.setClothes(4, 7, 15);
|
|
player.setClothes(5, 0, 0);
|
|
player.setClothes(6, 7, 0);
|
|
player.setClothes(7, 41, 0);
|
|
player.setClothes(8, 15, 0);
|
|
player.setClothes(9, 0, 0);
|
|
player.setClothes(10, 0, 0);
|
|
player.setClothes(11, 5, 0);
|
|
}
|
|
|
|
public static void GivePrisonerOutfit_Female(Client player)
|
|
{
|
|
player.setClothes(3, 14, 0);
|
|
player.setClothes(4, 3, 15);
|
|
player.setClothes(5, 0, 0);
|
|
player.setClothes(6, 10, 1);
|
|
player.setClothes(7, 25, 0);
|
|
player.setClothes(8, 2, 0);
|
|
player.setClothes(9, 0, 0);
|
|
player.setClothes(10, 0, 0);
|
|
player.setClothes(11, 49, 0);
|
|
}
|
|
}
|
|
}
|