230 lines
No EOL
10 KiB
C#
230 lines
No EOL
10 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.Fraktionen
|
|
{
|
|
class Abschleppdienst : Script
|
|
{
|
|
public Abschleppdienst()
|
|
{
|
|
loadAusleih();
|
|
loadeinlagern();
|
|
loadAbschleppdienstBase();
|
|
API.onEntityEnterColShape += onAbschleppdienst;
|
|
}
|
|
|
|
public const int AbschleppdienstCallback = 654132;
|
|
public void loadAbschleppdienstBase(){
|
|
RAPI.Marker.createMarker(0,new Vector3(258.0971,2584.527,44.95414),1,255,255,255,"fskin:Abschleppdienst",0,185,"Abschleppdienst Skin's",0); // FSKIN
|
|
Blip bl = API.createBlip(new Vector3(263,2597,44));
|
|
bl.sprite = 68;
|
|
|
|
}
|
|
|
|
public Vector3 einlagern = new Vector3();
|
|
public const String einlagerncol = "col:einlagern";
|
|
|
|
public void loadeinlagern() // CALL ON MAIN
|
|
{
|
|
RAPI.Marker.createMarker(0,new Vector3(221.844,2580.228,45.82),1,255,255,255,einlagerncol,0,150,"Einlagern",0);
|
|
RAPI.Marker.createMarker(0,new Vector3(1236.104,-1629.54,51.84175),1,255,255,255,einlagerncol,0,150,"Einlagern",0);
|
|
RAPI.Marker.createMarker(0,new Vector3(-202.4617,-1710,32.5),1,255,255,255,einlagerncol,0,150,"Einlagern",0);
|
|
API.onEntityExitColShape += onCol231;
|
|
}
|
|
|
|
public void onCol231(ColShape col, NetHandle net){
|
|
if(col != null && net != null){
|
|
if(col.hasData(einlagerncol) == true && col.getData(einlagerncol) == true){
|
|
if(API.getEntityType(net) == EntityType.Vehicle){
|
|
Vehicle veh = API.getEntityFromHandle<Vehicle>(net);
|
|
if(veh.hasData("Fraktionsfahrzeug") == true){
|
|
veh.delete();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// AUSLEIH START
|
|
public const int CALLBACKDUDE = 798521456;
|
|
public const int ausleihfraktionsid = 6;
|
|
public Vector3 ped = new Vector3(256.3601,2585.865,44.90773);
|
|
public const int heading = 93;
|
|
public Vector3 spawnpos = new Vector3(236.3498,2588.333,44.80683);
|
|
|
|
public const float spawnposrot = 27;
|
|
public Vector3 marker = new Vector3(255.66,2585.791,43.945);
|
|
|
|
public const String coldata = "Ausleih:Mech";
|
|
public void loadAusleih() // CALL ON INIT!!!!
|
|
{
|
|
API.onClientEventTrigger += onTriggera;
|
|
API.onEntityEnterColShape += onCol;
|
|
|
|
API.createPed(PedHash.Xmech01SMY, 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.TowTruck2, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
|
|
API.setPlayerIntoVehicle(sender, veh, -1);
|
|
API.setVehicleCustomPrimaryColor(veh, 100, 15, 15);
|
|
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
|
|
API.setEntitySyncedData(veh, "locked", true);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
|
|
API.setVehicleNumberPlate(veh, "Abschlepp");
|
|
}
|
|
} else if(index == 1){
|
|
if (Fraktionsmanager.getFraktionsRang(sender) >= 0)
|
|
{
|
|
Vehicle veh = API.createVehicle(VehicleHash.TowTruck, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
|
|
API.setPlayerIntoVehicle(sender, veh, -1);
|
|
API.setVehicleCustomPrimaryColor(veh, 100, 15, 15);
|
|
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
|
|
API.setEntitySyncedData(veh, "locked", true);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
|
|
API.setVehicleNumberPlate(veh, "Abschlepp");
|
|
}
|
|
} else if(index == 2){
|
|
if (Fraktionsmanager.getFraktionsRang(sender) >= 0)
|
|
{
|
|
Vehicle veh = API.createVehicle(VehicleHash.Regina, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
|
|
API.setPlayerIntoVehicle(sender, veh, -1);
|
|
API.setVehicleCustomPrimaryColor(veh, 100, 15, 15);
|
|
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
|
|
API.setEntitySyncedData(veh, "locked", true);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
|
|
API.setVehicleNumberPlate(veh, "Abschlepp");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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[40];
|
|
argumentList[0] = CALLBACKDUDE;
|
|
argumentList[1] = "Fahrzeuge";
|
|
argumentList[2] = "Fahrzeuge:";
|
|
argumentList[3] = false;
|
|
int itemlength = 3;
|
|
argumentList[4] = itemlength;
|
|
argumentList[5] = "Towtruck2 ~m~(Rang 0)"; // RANG 0 /ID Police
|
|
argumentList[6] = "Towtruck ~m~(Rang 0)"; // RANG 0 /ID Police
|
|
argumentList[7] = "Regina ~m~(Rang 0)"; // RANG 1 - 2 / ID Police2
|
|
for (var i = 0; i < itemlength; i++)
|
|
{
|
|
argumentList[8 + i] = "";
|
|
}
|
|
API.shared.triggerClientEvent(player, "menu_handler_create_menu", argumentList);
|
|
}
|
|
/// AUSLEIH END
|
|
public void onAbschleppdienst(ColShape col, NetHandle en)
|
|
{
|
|
if(col != null && en != null)
|
|
{
|
|
if(col.hasData("fskin:Abschleppdienst") == true && col.getData("fskin:Abschleppdienst") == true){
|
|
Client player = API.getPlayerFromHandle(en);
|
|
if(player != null){
|
|
if(Fraktionsmanager.getFraktion(player) == 6){
|
|
if(player.hasData("Abschleppdienstskin") == false){
|
|
player.setData("Abschleppdienstskin",true);
|
|
int rang = Fraktionen.Fraktionsmanager.getFraktionsRang(player);
|
|
if(rang == 0 || rang == 1 || rang == 3 || rang == 4){
|
|
// Male
|
|
if(player.getData("geschlecht") == 1){
|
|
API.setPlayerClothes(player,11,86,4);
|
|
API.setPlayerClothes(player,4,46,0);
|
|
API.setPlayerClothes(player,6,12,6);
|
|
} else if(player.getData("geschlecht") == 0){
|
|
API.setPlayerClothes(player,11,78,4);
|
|
API.setPlayerClothes(player,4,48,0);
|
|
API.setPlayerClothes(player,6,36,6);
|
|
}
|
|
}
|
|
API.givePlayerWeapon(player, WeaponHash.Flashlight, 1, true, true);
|
|
API.setPlayerHealth(player, 100);
|
|
} else {
|
|
player.resetData("Abschleppdienstskin");
|
|
API.removeAllPlayerWeapons(player);
|
|
if(player.getData("geschlecht") == 0){
|
|
API.setPlayerSkin(player,PedHash.FreemodeFemale01);
|
|
Database.CharacterDatabase.setPlayerDatabaseClothes(player,API);
|
|
} else {
|
|
API.setPlayerSkin(player,PedHash.FreemodeMale01);
|
|
Database.CharacterDatabase.setPlayerDatabaseClothes(player,API);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
[Command("rep")]
|
|
public void repair(Client player)
|
|
{
|
|
if (Fraktionsmanager.getFraktion(player) == 6)
|
|
{
|
|
if(player.hasData("Abschleppdienstskin") == true)
|
|
{
|
|
if (player.isInVehicle == true)
|
|
{
|
|
API.repairVehicle(player.vehicle);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
[Command("tanken")]
|
|
public void tanken(Client player)
|
|
{
|
|
if (Fraktionsmanager.getFraktion(player) == 6)
|
|
{
|
|
if(player.hasData("Abschleppdienstskin") == true){
|
|
if (player.isInVehicle == true)
|
|
{
|
|
API.setEntitySyncedData(player.vehicle, "tank", 100);
|
|
API.sendNotificationToPlayer(player,"Fahrzeug getankt!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
} |