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

201 lines
9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GrandTheftMultiplayer.Server;
using GrandTheftMultiplayer.Shared;
using GrandTheftMultiplayer.Server.API;
using GrandTheftMultiplayer.Shared.Math;
using GrandTheftMultiplayer.Server.Elements;
using GrandTheftMultiplayer.Server.Constant;
using GrandTheftMultiplayer.Server.Managers;
namespace Roleplay.Environment
{
class Stadthalle : Script
{
public const int STADTHALLE_CALLBACK = 5453369;
public const int STADTHALLE_CALLBACK2 = 545336922;
public Stadthalle()
{
Blip stadthalle = API.createBlip(new Vector3(-545.3369, -203.71, 38.21), 0);
API.setBlipSprite(stadthalle, 1);
API.setBlipColor(stadthalle, 46);
RAPI.Marker.createMarker(1, new Vector3(-545.3369, -203.71, 37.21), 1, 255, 0, 0, "stadthalle", 0, 185, "Stadthalle");
API.onEntityEnterColShape += onStadtHalleEnter;
API.onClientEventTrigger += onTrigger;
API.onClientEventTrigger += Interaction;
LoadHoesInstripclub();
}
private Dictionary<Client, Client> clickedplayers = new Dictionary<Client, Client>();
private void onTrigger(Client sender, string eventName, object[] arguments)
{
if(eventName == "menu_handler_select_item")
{
var callbackId = (int)arguments[0];
var index = (int)arguments[1];
if(callbackId == STADTHALLE_CALLBACK)
{
if(index == 0)
{
if (API.getEntityData(sender, "perso") == false)
{
if (Environment.MONEY.Money.hasBarMoney(sender, 50) == true)
{
API.sendNotificationToPlayer(sender, "Du hast dir den Personalausweis gekauft!", true);
API.setEntityData(sender, "perso", true);
Environment.MONEY.Money.giveBarMoney(sender, -50, API);
PlayerDatabase.setDatabaseData(sender, PlayerDatabase.PlayerDatabaseFlags.perso, 1);
}
else
{
API.sendNotificationToPlayer(sender, "Du hast nicht genug Bargeld dabei!");
}
}
} else
{
API.triggerClientEvent(sender, "menu_handler_close_menu");
}
} else if(callbackId == STADTHALLE_CALLBACK2)
{
if (index == 0)
{
Client clicked = clickedplayers[sender];
if (PlayerDatabase.getDatabaseDataInt(sender, PlayerDatabase.PlayerDatabaseFlags.perso) == 1)
{
API.sendChatMessageToPlayer(sender, "Du hast " + clicked.name + " deinen Personalausweis gezeigt!");
API.sendChatMessageToPlayer(clicked, "Personalausweis von: " + sender.name);
API.sendChatMessageToPlayer(clicked, "~b~Ingame Name: " + sender.name);
API.sendChatMessageToPlayer(clicked, "~b~ID: " + Commands.cmdLoginRegister.getPlayerID(sender));
API.sendChatMessageToPlayer(clicked, "~y~Spielstunden: " + Jobs.Jobmanager.getPlayingHOURS(sender));
}
else
{
API.sendNotificationToPlayer(sender, "Du hast keinen Personalausweis!");
}
}
else if (index == 1)
{
Client clicked = clickedplayers[sender];
string fuehrerschein = "Nein";
string motorrad = "Nein";
string lkw = "Nein";
string plane = "Nein";
string boot = "Nein";
string waffe = "Nein";
API.sendChatMessageToPlayer(sender, "Du hast " + clicked.name + " deinen Fuehrerschein gezeigt!");
API.sendChatMessageToPlayer(clicked, "Fuehrerschein von: " + sender.name);
if (Fahrschule.doesPlayerHaveFuehrerschein(sender) == true) { fuehrerschein = "Ja"; }
API.sendChatMessageToPlayer(clicked, "~b~Fuehrerschein: " + fuehrerschein);
if (Fahrschule.doesPlayerHaveMotorradSchein(sender) == true) { motorrad = "Ja"; }
API.sendChatMessageToPlayer(clicked, "~b~Motorradschein: " + motorrad);
if (Fahrschule.doesPlayerHaveLKWSchein(sender) == true) { lkw = "Ja"; }
API.sendChatMessageToPlayer(clicked, "~b~LKWschein: " + lkw);
if (Fahrschule.doesPlayerhaveFlugzeugschein(sender) == true) { plane = "Ja"; }
API.sendChatMessageToPlayer(clicked, "~b~Flugzeugschein: " + plane);
if (Fahrschule.doesPlayerHaveBootschein(sender) == true) { boot = "Ja"; }
API.sendChatMessageToPlayer(clicked, "~b~Bootschein: " + boot);
if (Fahrschule.doesPlayerHaveWaffenschein(sender) == true) { waffe = "Ja"; }
API.sendChatMessageToPlayer(clicked, "~b~Waffenschein: " + waffe);
}
else
{
API.triggerClientEvent(sender, "menu_handler_close_menu");
}
}
}
}
private void onStadtHalleEnter(ColShape colshape, NetHandle entity)
{
if(colshape.getData("stadthalle") == true)
{
if(API.getEntityType(entity) == EntityType.Player)
{
Client player = API.getPlayerFromHandle(entity);
object[] argumentList = new object[13];
argumentList[0] = STADTHALLE_CALLBACK;
argumentList[1] = "Stadthalle";
argumentList[2] = "Optionen:";
argumentList[3] = true;
int itemlength = 2;
argumentList[4] = itemlength;
argumentList[5] = "Personalausweis kaufen";
argumentList[6] = "Schliessen";
for (var i = 0; i < itemlength; i++)
{
argumentList[7 + i] = "";
}
API.triggerClientEvent(player, "menu_handler_create_menu", argumentList);
}
}
}
private void Interaction(Client sender, string eventName, object[] arguments)
{
if (eventName == "playerinteraction2")
{
NetHandle ent = (NetHandle)arguments[0];
Client clickedplayer = API.getPlayerFromHandle(ent);
if (clickedplayers.ContainsKey(sender) == false)
{
clickedplayers.Add(sender, clickedplayer);
} else
{
clickedplayers.Set(sender,clickedplayer);
}
object[] argumentList = new object[14];
argumentList[0] = STADTHALLE_CALLBACK2;
argumentList[1] = "Spieler";
argumentList[2] = "Optionen:";
argumentList[3] = false;
int itemlength = 3;
argumentList[4] = itemlength;
argumentList[5] = "Personalausweis zeigen";
argumentList[6] = "Scheine zeigen";
argumentList[7] = "Schliessen";
for (var i = 0; i < itemlength; i++)
{
argumentList[8 + i] = "";
}
API.triggerClientEvent(sender, "menu_handler_create_menu", argumentList);
}
}
[Flags]
public enum AnimationFlags
{
Loop = 1 << 0,
StopOnLastFrame = 1 << 1,
OnlyAnimateUpperBody = 1 << 4,
AllowPlayerControl = 1 << 5,
Cancellable = 1 << 7
}
//STRIP CLUB
public void LoadHoesInstripclub()
{
Ped ped = API.createPed(PedHash.Stripper02Cutscene, new Vector3(109.8732,-1288.612,28.858), -56, 0);
API.playPedAnimation(ped, true, "mini@strip_club@private_dance@part3", "priv_dance_p3");
Ped ped2 = API.createPed(PedHash.Topless01AFY, new Vector3(113.4914,-1288.052,28.458), -84, 0);
API.playPedAnimation(ped2, true, "mini@strip_club@private_dance@part3", "priv_dance_p3");
}
[Command("ps")]
public void ps(Client player, string one, string two)
{
API.playPlayerAnimation(player, (int)AnimationFlags.Loop, one, two);
}
}
}