Ragemp-roleplay-skript/Fraktionen/Bloods/Bloods.cs
2019-04-16 13:59:07 +02:00

335 lines
16 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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.KeinName
{
class Bloods : Script
{
public Bloods()
{
LoadBloods();
loadAusleih();
}
public const int FskinCallback = 648516851;
public const int WaffenCallback = 415978498;
public void LoadBloods()
{
RAPI.Marker.createMarker(0, new Vector3(363.8204, -2044.908, 22.3543), 1, 255, 0, 0, "fskin:bloods", 0, 185, "Blood Skin's", 0); // FSKIN
RAPI.Marker.createMarker(0, new Vector3(335.7323, -2021.591, 22.35429), 1, 255, 0, 0, "fhaus:bloods", 0, 185, "Fraktionshaus", 0); // HAUS
RAPI.Marker.createMarker(0, new Vector3(151.3165, -1007.962, -99), 1, 255, 0, 0, "fhaus:bloodsout", 1255334, 185, "Fraktionshaus", 0); // HAUS
RAPI.Marker.createMarker(0, new Vector3(349.2637, -2072.29, 20.9275), 1, 255, 0, 0, "waffenmarker:bloods", 0, 185, "Waffen", 0); // HAUS
API.onEntityEnterColShape += EnterColShape;
API.onClientEventTrigger += onTrigger;
}
// AUSLEIH START
public const int CALLBACKDUDE = 862633631;
public const int ausleihfraktionsid = 9;
public Vector3 ped = new Vector3(337.2368, -2041.33, 21.12248);
public const int heading = 0;
public Vector3 spawnpos = new Vector3(324.3036, -2030.672, 20.86474);
public const float spawnposrot = 0;
public Vector3 marker = new Vector3(335.6888, -2040.039, 19.93319);
public const String coldata = "Ausleih:Bloods";
public void loadAusleih() // CALL ON INIT!!!!
{
API.onClientEventTrigger += onTriggera;
API.onEntityEnterColShape += onCol;
API.createPed(PedHash.BurgerDrug, ped, heading, 0);
RAPI.Marker.createMarker(1, marker, 1, 255, 255, 255, coldata, 0, 185, "Fahrzeuge", 0);
}
public void onTriggera(Client sender, String eventname, object[] args)
{
if (eventname == "menu_handler_select_item")
{
int callback = (int)args[0];
int index = (int)args[1];
if (callback == CALLBACKDUDE)
{
if (index == 0)
{
if (Fraktionsmanager.getFraktionsRang(sender) >= 0)
{
Vehicle veh = API.createVehicle(VehicleHash.Comet2, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
API.setPlayerIntoVehicle(sender, veh, -1);
API.setVehicleCustomPrimaryColor(veh, 255, 0, 0);
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
API.setEntitySyncedData(veh, "locked", true);
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
API.setVehicleNumberPlate(veh, "Bloods");
}
}
else if (index == 1)
{
if (Fraktionsmanager.getFraktionsRang(sender) >= 0)
{
Vehicle veh = API.createVehicle(VehicleHash.Moonbeam2, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
API.setPlayerIntoVehicle(sender, veh, -1);
API.setVehicleCustomPrimaryColor(veh, 255, 0, 0);
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
API.setEntitySyncedData(veh, "locked", true);
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
API.setVehicleNumberPlate(veh, "Bloods");
}
}
else if (index == 2)
{
if (Fraktionsmanager.getFraktionsRang(sender) >= 0)
{
Vehicle veh = API.createVehicle(VehicleHash.Tempesta, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
API.setPlayerIntoVehicle(sender, veh, -1);
API.setVehicleCustomPrimaryColor(veh, 255, 0, 0);
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
API.setEntitySyncedData(veh, "locked", true);
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
API.setVehicleNumberPlate(veh, "Bloods");
}
}
else if (index == 3)
{
if (Fraktionsmanager.getFraktionsRang(sender) >= 0)
{
Vehicle veh = API.createVehicle(VehicleHash.Feltzer2, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
API.setPlayerIntoVehicle(sender, veh, -1);
API.setVehicleCustomPrimaryColor(veh, 255, 0, 0);
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
API.setEntitySyncedData(veh, "locked", true);
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
API.setVehicleNumberPlate(veh, "Bloods");
}
}
}
}
}
public void onCol(ColShape col, NetHandle nt)
{
if (col != null && nt != null)
{
if (col.hasData(coldata) == true && col.getData(coldata) == true)
{
Client player = API.getPlayerFromHandle(nt);
if (player != null)
{
if (Fraktionsmanager.getFraktion(player) == ausleihfraktionsid)
{
showAusleihMenu(player);
}
else
{
API.sendNotificationToPlayer(player, "Du bist nicht in der Richtigen Fraktion!");
}
}
}
}
}
public void showAusleihMenu(Client player)
{
object[] argumentList = new object[56];
argumentList[0] = CALLBACKDUDE;
argumentList[1] = "Fahrzeuge";
argumentList[2] = "Fahrzeuge:";
argumentList[3] = false;
int itemlength = 4;
argumentList[4] = itemlength;
argumentList[5] = "Comet"; // RANG 0 /ID Police
argumentList[6] = "Moonbeam"; // RANG 0 /ID Police
argumentList[7] = "Tempesta"; // RANG 1 - 2 / ID Police2
argumentList[8] = "Feltzer2"; // RANG 1 - 2 / ID Police2
for (var i = 0; i < itemlength; i++)
{
argumentList[13 + i] = "";
}
API.shared.triggerClientEvent(player, "menu_handler_create_menu", argumentList);
}
/// AUSLEIH END
private void onTrigger(Client sender, string eventName, object[] arguments)
{
if (eventName == "menu_handler_select_item")
{
int callback = (int)arguments[0];
if (callback == FskinCallback)
{
int index = (int)arguments[1];
if (index == 0)
{
API.setPlayerSkin(sender, PedHash.Claypain);
PlayerDatabase.setDatabaseDataString(sender, "skinid", "Claypain");
}
else if (index == 1)
{
API.setPlayerSkin(sender, PedHash.Hipster01AMY);
PlayerDatabase.setDatabaseDataString(sender, "skinid", "Hipster01AMY");
}
else if (index == 2)
{
API.setPlayerSkin(sender, PedHash.Malibu01AMM);
PlayerDatabase.setDatabaseDataString(sender, "skinid", "Malibu01AMM");
}
else if (index == 3)
{
API.setPlayerSkin(sender, PedHash.PartyTarget);
PlayerDatabase.setDatabaseDataString(sender, "skinid", "PartyTarget");
}
else if (index == 4)
{
API.setPlayerSkin(sender, PedHash.PestCont01SMY);
PlayerDatabase.setDatabaseDataString(sender, "skinid", "PestCont01SMY");
}
else if (index == 5)
{
API.setPlayerSkin(sender, PedHash.PestContGunman);
PlayerDatabase.setDatabaseDataString(sender, "skinid", "PestContGunman");
}
else if (index == 6)
{
string skin = PlayerDatabase.getSkin(sender);
PedHash pedskin = API.pedNameToModel(skin);
API.setPlayerSkin(sender, pedskin);
Database.CharacterDatabase.setPlayerDatabaseClothes(sender, API);
}
}
else if (callback == WaffenCallback)
{
int index = (int)arguments[1];
int mats = Aktionen.BadFraktionmanager.getFraktionsMats(9);
if (index == 0)
{
if (mats >= 10)
{
Aktionen.BadFraktionmanager.setFraktionsKassenValue(9, "Materialien", mats - 10);
API.givePlayerWeapon(sender, WeaponHash.KnuckleDuster, 1, false, true);
}
else
{
API.sendNotificationToPlayer(sender, "Ihr habt nicht genug Materialien!");
}
}
else if (index == 1)
{
if (mats >= 20)
{
Aktionen.BadFraktionmanager.setFraktionsKassenValue(9, "Materialien", mats - 20);
API.givePlayerWeapon(sender, WeaponHash.KnuckleDuster, 1, false, true);
API.givePlayerWeapon(sender, WeaponHash.Bat, 1, false, true);
}
else
{
API.sendNotificationToPlayer(sender, "Ihr habt nicht genug Materialien!");
}
}
else if (index == 2)
{
if (mats >= 30)
{
Aktionen.BadFraktionmanager.setFraktionsKassenValue(9, "Materialien", mats - 40);
API.givePlayerWeapon(sender, WeaponHash.KnuckleDuster, 1, false, true);
API.givePlayerWeapon(sender, WeaponHash.Bat, 1, false, true);
API.givePlayerWeapon(sender, WeaponHash.Knife, 1, false, true);
API.givePlayerWeapon(sender, WeaponHash.Pistol, 100, false, true);
API.givePlayerWeapon(sender, WeaponHash.MicroSMG, 200, true, true);
API.givePlayerWeaponComponent(sender, WeaponHash.MicroSMG, WeaponComponent.MicroSMGClip01);
}
else
{
API.sendNotificationToPlayer(sender, "Ihr habt nicht genug Materialien!");
}
}
}
}
}
private void EnterColShape(ColShape colshape, NetHandle entity)
{
if (entity != null && colshape != null)
{
if (colshape.hasData("fskin:bloods") == true && colshape.getData("fskin:bloods") == true)
{
Client player = API.getPlayerFromHandle(entity);
if (Fraktionsmanager.isBloods(player) == true)
{
object[] argumentList = new object[72];
argumentList[0] = FskinCallback;
argumentList[1] = "Blood";
argumentList[2] = "Skins:";
argumentList[3] = false;
argumentList[4] = 7;
argumentList[5] = "~r~Skin 1";
argumentList[6] = "~r~Skin 2";
argumentList[7] = "~r~Skin 3";
argumentList[8] = "~r~Skin 4";
argumentList[9] = "~r~Skin 5";
argumentList[10] = "~r~Skin 6";
argumentList[11] = "~r~Stanart Skin";
API.triggerClientEvent(player, "menu_handler_create_menu", argumentList);
}
}
else if (colshape.hasData("fhaus:bloods") == true && colshape.getData("fhaus:bloods") == true)
{
Client player = API.getPlayerFromHandle(entity);
if (Fraktionsmanager.getFraktion(player) == 9)
{
API.setEntityPosition(player, new Vector3(152.65, -1004, -99));
API.setEntityDimension(player, 1255334);
}
}
else if (colshape.hasData("fhaus:bloodsout") == true && colshape.getData("fhaus:bloodsout") == true)
{
Client player = API.getPlayerFromHandle(entity);
if (player != null && Fraktionsmanager.getFraktion(player) == 9)
{
API.setEntityPosition(player, new Vector3(335.7323, -2024.591, 22.35429));
API.setEntityDimension(player, 0);
}
}
else if (colshape.hasData("waffenmarker:bloods") == true && colshape.getData("waffenmarker:bloods") == true)
{
Client player = API.getPlayerFromHandle(entity);
if (Fraktionsmanager.getFraktion(player) == 9)
{
object[] argumentList = new object[20];
argumentList[0] = WaffenCallback;
argumentList[1] = "Bloods";
argumentList[2] = "Waffenpackete:";
argumentList[3] = false;
argumentList[4] = 3;
argumentList[5] = "~b~Kleines Packet";
argumentList[6] = "~y~Mittleres Packet";
argumentList[7] = "~r~Grosses Packet";
argumentList[8] = "~c~ 10 Mats";
argumentList[9] = "~c~ 20 Mats";
argumentList[10] = "~c~ 30 Mats";
API.triggerClientEvent(player, "menu_handler_create_menu", argumentList);
}
}
}
}
}
}