143 lines
7.7 KiB
C#
143 lines
7.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;
|
|
using GrandTheftMultiplayer.Shared;
|
|
using GrandTheftMultiplayer.Shared.Math;
|
|
|
|
namespace Roleplay.Fraktionen.Aktionen
|
|
{
|
|
class Matstransport : Script
|
|
{
|
|
public Matstransport()
|
|
{
|
|
RAPI.Marker.createMarker(0, new Vector3(826, 2191, 52), 1, 255, 0, 0, "MatsTransport", 0, 185, "Mats Transport", 0);
|
|
API.onEntityEnterColShape += onCol;
|
|
API.onPlayerExitVehicle += onExit;
|
|
}
|
|
|
|
public int mindpolice = 2;
|
|
public int mats = 500;
|
|
public Marker marker = null;
|
|
public Blip pu = null;
|
|
|
|
private void onCol(ColShape colshape, NetHandle entity)
|
|
{
|
|
if(colshape != null && entity != null)
|
|
{
|
|
if (colshape.hasData("MatsTransport") == true && colshape.getData("MatsTransport") == true)
|
|
{
|
|
if (API.getEntityType(entity) == EntityType.Player)
|
|
{
|
|
if (marker == null)
|
|
{
|
|
Client player = API.getPlayerFromHandle(entity);
|
|
if (Fraktionsmanager.isEvil(player) == true)
|
|
{
|
|
if (player.isInVehicle != true)
|
|
{
|
|
if (Fraktionsmanager.getAllOnlineFraktionsMemberInt(1) >= mindpolice)
|
|
{
|
|
if (Aktionsmanager.isAktion() == false)
|
|
{
|
|
Aktionsmanager.triggerAktion();
|
|
Vehicle veh = API.createVehicle(VehicleHash.Mule, new Vector3(842, 2201, 52), new Vector3(0, 0, 60), 0, 0, 0);
|
|
Fraktionsmanager.sendFraktionsChatMessage(1, "~r~Die Fraktion: ~y~" + Fraktionsmanager.getFraktionsName(Fraktionsmanager.getFraktion(player)) + " ~r~transportiert einen Waffenbeladenen Truck!");
|
|
pu = API.createBlip(veh);
|
|
API.setEntityData(veh, "matstruck", true);
|
|
pu.sprite = 514;
|
|
pu.color = 49;
|
|
API.setPlayerIntoVehicle(player, veh, -1);
|
|
API.setEntityData(player, "matstruckdriver", true);
|
|
API.sendChatMessageToPlayer(player, "~r~Alle sehen nun den Waffentruck, bringe den so schnellst wie moeglich in deine Basis!");
|
|
API.sendChatMessageToAll("~r~Ein Waffentruck wurde gestartet!");
|
|
if (Fraktionsmanager.getFraktion(player) == 3)
|
|
{
|
|
marker = RAPI.Marker.createMarkerWithReturnType(1, new Vector3(-182.9398,-1628.776,32.41265), 3, 255, 0, 0, "Abgabe Marker", 0, 185, "", 0);
|
|
ColShape col = API.createCylinderColShape(new Vector3(-182.9398,-1628.776,32.41265), 5, 5);
|
|
col.setData("Waffentruck", true);
|
|
} else if(Fraktionsmanager.getFraktion(player) == 4)
|
|
{
|
|
marker = RAPI.Marker.createMarkerWithReturnType(1, new Vector3(1242.395, -1608.875, 53), 3, 255, 0, 0, "Abgabe Marker", 0, 185, "", 0);
|
|
ColShape col = API.createCylinderColShape(new Vector3(1242.395, -1608.875, 53), 5, 5);
|
|
col.setData("Waffentruck", true);
|
|
}
|
|
} else
|
|
{
|
|
API.sendNotificationToPlayer(player, "Die nächste Aktion kann erst 60 Minuten nach der anderen gestartet werden!");
|
|
}
|
|
} else
|
|
{
|
|
API.sendNotificationToPlayer(player, "Es müssen mind. " + mindpolice + " Online sein !");
|
|
}
|
|
} else
|
|
{
|
|
API.sendNotificationToPlayer(player, "Steige aus dem Fahrzeug aus !");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
API.sendNotificationToPlayer(player, "Du bist nicht in einer Gang oder Mafia!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (colshape.hasData("Waffentruck") == true && colshape.getData("Waffentruck") == true)
|
|
{
|
|
if(API.getEntityType(entity) == EntityType.Vehicle) {
|
|
Vehicle veh = API.getEntityFromHandle<Vehicle>(entity);
|
|
if (veh != null)
|
|
{
|
|
Client player = veh.occupants[0];
|
|
if (Fraktionsmanager.isEvil(player) == true)
|
|
{
|
|
if (player.isInVehicle == true)
|
|
{
|
|
if (API.hasEntityData(veh, "matstruck") == true && API.getEntityData(veh, "matstruck") == true)
|
|
{
|
|
veh.delete();
|
|
marker.delete();
|
|
marker = null;
|
|
API.sendChatMessageToAll("~r~Waffentruck wurde abgegeben!");
|
|
Levelsystem.addPlayerLevelFortschritt(player,5,API);
|
|
pu.delete();
|
|
pu = null;
|
|
Aktionen.BadFraktionmanager.setFraktionsKassenValue(Fraktionsmanager.getFraktion(player), "Materialien", Aktionen.BadFraktionmanager.getFraktionsMats(Fraktionsmanager.getFraktion(player)) + mats);
|
|
Fraktionsmanager.sendFraktionsNotification(Fraktionsmanager.getFraktion(player), "Fraktionsmaterialien wurden mit " + mats + " Mats Aufgefuellt!", true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void onExit(Client player, NetHandle vehicle, int x)
|
|
{
|
|
if(Fraktionsmanager.isEvil(player) == true)
|
|
{
|
|
Vehicle veh = API.getEntityFromHandle<Vehicle>(vehicle);
|
|
if (API.hasEntityData(player, "matstruckdriver") == true && API.getEntityData(player, "matstruckdriver") == true)
|
|
{
|
|
if (API.hasEntityData(veh, "matstruck") == true && API.getEntityData(veh, "matstruck") == true)
|
|
{
|
|
veh.delete();
|
|
marker.delete();
|
|
marker = null;
|
|
API.sendChatMessageToPlayer(player, "Waffentruck wurde abgebrochen!");
|
|
pu.delete();
|
|
pu = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|