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

128 lines
4.7 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.Elements;
using GrandTheftMultiplayer.Server.Managers;
namespace Roleplay.Environment
{
class Hilfsanzeigen : Script
{
public const int CALLBACK_STATS = 684684;
public Hilfsanzeigen()
{
API.onClientEventTrigger += onMenuHandler;
}
private void onMenuHandler(Client sender, string eventName, object[] arguments)
{
if(eventName == "menu_handler_select_item")
{
int callback = (int)arguments[0];
if(callback == CALLBACK_STATS)
{
int index = (int)arguments[1];
if(index == 12)
{
if (Haussystem.Haussystem.hasHouse(sender) == true)
{
if (PlayerDatabase.getDatabaseDataInt(sender, "spawnathouse") == 0)
{
PlayerDatabase.setDatabaseData(sender, "spawnathouse", 1);
API.sendNotificationToPlayer(sender, "~g~Du wirst das naechste mal an deinem Haus spawnen!");
}
else
{
PlayerDatabase.setDatabaseData(sender, "spawnathouse", 0);
API.sendNotificationToPlayer(sender, "~b~Du wirst das naechste mal an deiner letzten Position spawnen!");
}
}
else
{
API.sendNotificationToPlayer(sender, "Du hast kein Haus!", true);
}
}
}
} else if(eventName == "showF1Menu"){
showStats(sender);
}
}
[Command("stats", Alias = "stat")]
public void showStats(Client player)
{
int playingtime = Jobs.Jobmanager.getPlayingTime(player);
string auto = "Nein";
string lkw = "Nein";
string motorrad = "Nein";
string plane = "Nein";
string boot = "Nein";
if (API.getEntityData(player, "autoschein") == 1)
{
auto = "Ja";
}
if (API.getEntityData(player, "lkwschein") == 1)
{
lkw = "Ja";
}
if (Fahrschule.doesPlayerhaveFlugzeugschein(player) == true)
{
plane = "Ja";
}
if (Fahrschule.doesPlayerHaveMotorradSchein(player) == true)
{
motorrad = "Ja";
}
if(Fahrschule.doesPlayerHaveBootschein(player) == true)
{
boot = "Ja";
}
object[] argumentList = new object[32];
argumentList[0] = CALLBACK_STATS;
argumentList[1] = "Stats";
argumentList[2] = "" + player.name;
argumentList[3] = false;
int itemlength = 12;
argumentList[4] = itemlength;
argumentList[5] = "Bargeld: ~b~" + MONEY.Money.getBarMoney(player);
argumentList[6] = "Bankkonto: ~b~" + MONEY.Money.getBankMoney(player);
argumentList[7] = "Beruf: ~y~" + Jobs.Jobmanager.getJob(player);
argumentList[8] = "Fraktion: " + Fraktionen.Fraktionsmanager.getWithColorCodesFraktionsName(Fraktionen.Fraktionsmanager.getFraktion(player));
argumentList[9] = "Spielstunden: ~y~" + Convert.ToString(playingtime/60) + ":" + Convert.ToString(playingtime -(playingtime/60)*60);
argumentList[10] = "Level: ~y~" + Levelsystem.getPlayerLevel(player);
argumentList[11] = "Fuehrerschein: ~b~" + auto;
argumentList[12] = "LKW Schein: ~b~" + lkw;
argumentList[13] = "Motorrad Schein: ~b~" + motorrad;
argumentList[14] = "Flugzeug Schein: ~b~" + plane;
argumentList[15] = "Bootschein: ~b~" + boot;
argumentList[16] = "ID: ~w~" + Commands.cmdLoginRegister.getPlayerID(player);
for (var i = 0; i < itemlength; i++)
{
argumentList[17 + i] = "";
}
API.triggerClientEvent(player, "menu_handler_create_menu", argumentList);
}
[Command("help", Alias = "?")]
public void showHelp(Client player)
{
}
public void showJobs(Client player)
{
}
public void showFirstJoin(Client player)
{
}
}
}