186 lines
No EOL
10 KiB
C#
186 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 Regierung : Script
|
|
{
|
|
public Regierung()
|
|
{
|
|
loadRegierungsBase();
|
|
API.onEntityEnterColShape += onRegierung;
|
|
API.onClientEventTrigger += onTrigger;
|
|
}
|
|
|
|
public const int RegierungCallback = 908456;
|
|
public void loadRegierungsBase(){
|
|
API.createPed(PedHash.Devinsec01SMY,new Vector3(-145.3589,930.9544,235.6721),132,0);
|
|
RAPI.Marker.createMarker(1,new Vector3(-146.2026,929.923,234.6558),1,255,255,255,"Regierungbase",0,150,"Fahrzeug auslagern",0);
|
|
RAPI.Marker.createMarker(0,new Vector3(-168.0824,916.4675,235.6557),1,255,255,255,"fhaus:regierung",0,185,"Fraktionshaus",0); // HAUS
|
|
RAPI.Marker.createMarker(0,new Vector3(-173.986,497.1363,137.667),1,255,255,255,"fhaus:regierungout",98746,185,"Fraktionshaus",0); // HAUS
|
|
RAPI.Marker.createMarker(0,new Vector3(-167.3105,487.8482,133.8438),1,255,255,255,"fskin:regierung", 98746, 185,"Regierung Skin's",0); // FSKIN
|
|
RAPI.Marker.createMarker(0, new Vector3(-150.6196,939.8922,235.68),1,255,255,255, "regierungabgeben",0,185,"Fahrzeuge abgeben",0);
|
|
Blip bl = API.createBlip(new Vector3(-168,916,235));
|
|
bl.sprite = 419;
|
|
|
|
}
|
|
|
|
public void onRegierung(ColShape col, NetHandle en)
|
|
{
|
|
if(col != null && en != null)
|
|
{
|
|
if(col.hasData("Regierungbase") == true && col.getData("Regierungbase") == true)
|
|
{
|
|
Client player = API.getPlayerFromHandle(en);
|
|
if(player != null){
|
|
if(Fraktionsmanager.getFraktion(player) == 5)
|
|
{
|
|
object[] argumentList = new object[28];
|
|
argumentList[0] = RegierungCallback;
|
|
argumentList[1] = "~w~Regierung";
|
|
argumentList[2] = "Fahrzeuge:";
|
|
argumentList[3] = false;
|
|
argumentList[4] = 4;
|
|
argumentList[5] = "~w~ Stretchlimo"; // Stretch
|
|
argumentList[6] = "~w~ SUV"; // Baller6
|
|
argumentList[7] = "~w~ Bentley"; // Windsor2
|
|
argumentList[8] = "~w~ Hubschrauber"; // Volatus heli
|
|
argumentList[9] = "";
|
|
argumentList[10] = "";
|
|
argumentList[11] = "";
|
|
argumentList[12] = "";
|
|
API.triggerClientEvent(player, "menu_handler_create_menu", argumentList);
|
|
}
|
|
}
|
|
}
|
|
else if(col.hasData("fhaus:regierung") == true && col.getData("fhaus:regierung") == true)
|
|
{
|
|
Client player = API.getPlayerFromHandle(en);
|
|
if (Fraktionsmanager.getFraktion(player) == 5)
|
|
{
|
|
API.setEntityPosition(player, new Vector3(-174.7247, 493.333, 133.8438));
|
|
API.setEntityDimension(player, 98746);
|
|
}
|
|
} else if(col.hasData("fhaus:regierungout") == true && col.getData("fhaus:regierungout") == true)
|
|
{
|
|
Client player = API.getPlayerFromHandle(en);
|
|
if (player != null)
|
|
{
|
|
if (Fraktionsmanager.getFraktion(player) == 5)
|
|
{
|
|
API.setEntityPosition(player, new Vector3(-168, 920, 235));
|
|
API.setEntityDimension(player, 0);
|
|
}
|
|
}
|
|
} else if(col.hasData("fskin:regierung") == true && col.getData("fskin:regierung") == true){
|
|
Client player = API.getPlayerFromHandle(en);
|
|
if(player != null){
|
|
if(Fraktionsmanager.getFraktion(player) == 5){
|
|
if(player.hasData("regierungsskin") == false){
|
|
player.setData("regierungsskin",true);
|
|
API.setPlayerSkin(player,PedHash.Devinsec01SMY);
|
|
API.givePlayerWeapon(player,WeaponHash.Pistol,250,true, true);
|
|
API.givePlayerWeapon(player,WeaponHash.SMG,500,true, true);
|
|
API.givePlayerWeapon(player,WeaponHash.CarbineRifle, 500,true, true);
|
|
API.givePlayerWeapon(player, WeaponHash.Flashlight, 1, true, true);
|
|
API.setPlayerHealth(player, 100);
|
|
API.setPlayerArmor(player, 100);
|
|
} else {
|
|
player.resetData("regierungsskin");
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if(col.getData("regierungabgeben") == true)
|
|
{
|
|
Client player = API.getPlayerFromHandle(en);
|
|
if (player != null && player.isInVehicle == true)
|
|
{
|
|
Vehicle veh = player.vehicle;
|
|
if (veh != null)
|
|
{
|
|
if (API.hasEntityData(veh, "Fraktionsfahrzeug") == true && API.getEntityData(veh, "Fraktionsfahrzeug") == 5)
|
|
{
|
|
if (Fraktionsmanager.getFraktion(player) == 5)
|
|
{
|
|
veh.delete();
|
|
API.sendNotificationToPlayer(player, "Fahrzeug eingelagert!");
|
|
}
|
|
else
|
|
{
|
|
API.sendNotificationToPlayer(player, "Du bist nicht in der richtigen Fraktion!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void onTrigger(Client sender, string eventName, object[] args){
|
|
if(eventName == "menu_handler_select_item"){
|
|
int callback = (int) args[0];
|
|
int index = (int) args[1];
|
|
if(callback == RegierungCallback){
|
|
if(index == 0){
|
|
Vehicle van = API.createVehicle(VehicleHash.Stretch, new Vector3(-156.3472,935.9196,235.7073), new Vector3(0,0,-135.3404),0,0,0);
|
|
API.setVehicleCustomPrimaryColor(van,0,0,0);
|
|
API.setVehicleCustomSecondaryColor(van,0,0,0);
|
|
API.setPlayerIntoVehicle(sender, van, -1);
|
|
API.setEntityData(van, "Fraktionsfahrzeug", 5);
|
|
API.setEntitySyncedData(van, "locked", false);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, van, 2);
|
|
API.setVehicleNumberPlate(van, "Regierung");
|
|
} else if(index == 1){
|
|
Vehicle van = API.createVehicle(VehicleHash.Baller6, new Vector3(-156.3472,935.9196,235.7073), new Vector3(0,0,-135.3404),0,0,0);
|
|
API.setVehicleCustomPrimaryColor(van,0,0,0);
|
|
API.setVehicleCustomSecondaryColor(van,0,0,0);
|
|
API.setPlayerIntoVehicle(sender, van, -1);
|
|
API.setEntityData(van, "Fraktionsfahrzeug", 5);
|
|
API.setEntitySyncedData(van, "locked", false);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, van, 2);
|
|
API.setVehicleNumberPlate(van, "Regierung");
|
|
} else if(index == 2){
|
|
Vehicle van = API.createVehicle(VehicleHash.Windsor2, new Vector3(-156.3472,935.9196,235.7073), new Vector3(0,0,-135.3404),0,0,0);
|
|
API.setVehicleCustomPrimaryColor(van,0,0,0);
|
|
API.setVehicleCustomSecondaryColor(van,0,0,0);
|
|
API.setPlayerIntoVehicle(sender, van, -1);
|
|
API.setEntityData(van, "Fraktionsfahrzeug", 5);
|
|
API.setEntitySyncedData(van, "locked", false);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, van, 2);
|
|
API.setVehicleNumberPlate(van, "Regierung");
|
|
} else if(index == 3){
|
|
Vehicle van = API.createVehicle(VehicleHash.Volatus, new Vector3(-156.3472,935.9196,235.7073), new Vector3(0,0,-135.3404),0,0,0);
|
|
API.setVehicleCustomPrimaryColor(van,0,0,0);
|
|
API.setVehicleCustomSecondaryColor(van,0,0,0);
|
|
API.setPlayerIntoVehicle(sender, van, -1);
|
|
API.setEntityData(van, "Fraktionsfahrzeug", 5);
|
|
API.setEntitySyncedData(van, "locked", false);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, van, 2);
|
|
API.setVehicleNumberPlate(van, "Regierung");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |