72 lines
2.6 KiB
C#
72 lines
2.6 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 chat : Script
|
|
{
|
|
public chat()
|
|
{
|
|
API.onChatMessage += OnPlayerChat;
|
|
|
|
}
|
|
|
|
public void sendCloseMessage(Client player, float radius, string sender, string msg)
|
|
{
|
|
List<Client> nearPlayers = API.getPlayersInRadiusOfPlayer(radius, player);
|
|
//nearPlayers.Remove(player);
|
|
foreach (Client target in nearPlayers)
|
|
{
|
|
API.sendChatMessageToPlayer(target, sender, msg);
|
|
}
|
|
}
|
|
|
|
public void OnPlayerChat(Client player, string message, CancelEventArgs e)
|
|
{
|
|
if (API.getEntityData(player, "imanruf") != true)
|
|
{
|
|
sendCloseMessage(player, 15.0f, "~#ffffff~", API.getPlayerName(player) + " sagt: " + message);
|
|
e.Cancel = true;
|
|
return;
|
|
}
|
|
}
|
|
|
|
[Command("me", GreedyArg = true)] // help command
|
|
public void Command_me(Client sender, string message)
|
|
{
|
|
sendCloseMessage(sender, 15.0f, "~#C2A2DA~", API.getPlayerName(sender) + " " + message + ".");
|
|
}
|
|
[Command("do", GreedyArg = true)] // do command
|
|
public void Command_do(Client sender, string message)
|
|
{
|
|
sendCloseMessage(sender, 15.0f, "~#C2A2DA~", "(( " + message + ". )) " + API.getPlayerName(sender));
|
|
}
|
|
[Command("b", GreedyArg = true)] // ooc chat command
|
|
public void Command_b(Client sender, string message)
|
|
{
|
|
sendCloseMessage(sender, 15.0f, "~#ffffff~", API.getPlayerName(sender) + ": " + "(( " + message + " ))");
|
|
}
|
|
[Command("s", Alias = "shout", GreedyArg = true)] // shout command
|
|
public void Command_s(Client sender, string message)
|
|
{
|
|
sendCloseMessage(sender, 25.0f, "~#ffffff~", API.getPlayerName(sender) + " schreit: " + message + "!");
|
|
}
|
|
[Command("w", Alias = "whisper", GreedyArg = true)] // whisper command
|
|
public void Command_w(Client sender, string message)
|
|
{
|
|
sendCloseMessage(sender, 7.5f, "~#ffffff~", API.getPlayerName(sender) + " fluestert: " + message + ".");
|
|
}
|
|
|
|
|
|
}
|
|
}
|