361 lines
No EOL
18 KiB
C#
361 lines
No EOL
18 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.Constant;
|
|
using GrandTheftMultiplayer.Server.Elements;
|
|
using GrandTheftMultiplayer.Server.Managers;
|
|
using GrandTheftMultiplayer.Shared;
|
|
using GrandTheftMultiplayer.Shared.Math;
|
|
|
|
namespace Roleplay.Fraktionen.KeinName
|
|
{
|
|
class Ballas : Script
|
|
{
|
|
public Ballas()
|
|
{
|
|
LoadBallas();
|
|
loadAusleih();
|
|
}
|
|
|
|
public const int FskinCallback = 741852;
|
|
public const int WaffenCallback = 654182;
|
|
|
|
public void LoadBallas()
|
|
{
|
|
RAPI.Marker.createMarker(0,new Vector3(151.8,-1001.229,-99),1,255,0,0,"fskin:ballas", 64165, 185,"Ballas Skin's",0); // FSKIN
|
|
RAPI.Marker.createMarker(0,new Vector3(-225.0567,-1648.99,35.258),1,255,0,0,"fhaus:ballas",0,185,"Fraktionshaus",0); // HAUS
|
|
RAPI.Marker.createMarker(0, new Vector3(151.3165, -1007.962, -99), 1, 255, 0, 0, "fhaus:ballasout", 64165, 185, "Fraktionshaus", 0); // HAUS
|
|
RAPI.Marker.createMarker(0, new Vector3(151.3256, -1003.2, -99), 1, 255, 0, 0, "waffenmarker:ballas", 64165, 185, "Waffen", 0); // HAUS
|
|
API.onEntityEnterColShape += EnterColShape;
|
|
API.onClientEventTrigger += onTrigger;
|
|
|
|
}
|
|
|
|
// AUSLEIH START
|
|
public const int CALLBACKDUDE = 8523631;
|
|
public const int ausleihfraktionsid = 3;
|
|
public Vector3 ped = new Vector3(-197.5295,-1700.014,33.49);
|
|
public const int heading = 37;
|
|
public Vector3 spawnpos = new Vector3(-215.757,-1693.5,33.60);
|
|
public const float spawnposrot = -144;
|
|
public Vector3 marker = new Vector3(-198.09,-1699.269,32.46);
|
|
public const String coldata = "Ausleih:Ballas";
|
|
public void loadAusleih() // CALL ON INIT!!!!
|
|
{
|
|
API.onClientEventTrigger += onTriggera;
|
|
API.onEntityEnterColShape += onCol;
|
|
API.createPed(PedHash.Stlat01AMY, 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.Voodoo, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
|
|
API.setPlayerIntoVehicle(sender, veh, -1);
|
|
API.setVehicleCustomPrimaryColor(veh, 65, 0, 65);
|
|
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
|
|
API.setEntitySyncedData(veh, "locked", true);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
|
|
API.setVehicleNumberPlate(veh, "Ballas");
|
|
}
|
|
} else if(index == 1){
|
|
if (Fraktionsmanager.getFraktionsRang(sender) >= 0)
|
|
{
|
|
Vehicle veh = API.createVehicle(VehicleHash.Baller2, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
|
|
API.setPlayerIntoVehicle(sender, veh, -1);
|
|
API.setVehicleCustomPrimaryColor(veh, 65, 0, 65);
|
|
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
|
|
API.setEntitySyncedData(veh, "locked", true);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
|
|
API.setVehicleNumberPlate(veh, "Ballas");
|
|
}
|
|
} else if(index == 2){
|
|
if (Fraktionsmanager.getFraktionsRang(sender) >= 0)
|
|
{
|
|
Vehicle veh = API.createVehicle(VehicleHash.Tornado2, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
|
|
API.setPlayerIntoVehicle(sender, veh, -1);
|
|
API.setVehicleCustomPrimaryColor(veh, 65, 0, 65);
|
|
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
|
|
API.setEntitySyncedData(veh, "locked", true);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
|
|
API.setVehicleNumberPlate(veh, "Ballas");
|
|
}
|
|
} else if(index == 3){
|
|
if (Fraktionsmanager.getFraktionsRang(sender) >= 0)
|
|
{
|
|
Vehicle veh = API.createVehicle(VehicleHash.Warrener, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
|
|
API.setPlayerIntoVehicle(sender, veh, -1);
|
|
API.setVehicleCustomPrimaryColor(veh, 65, 0, 65);
|
|
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
|
|
API.setEntitySyncedData(veh, "locked", true);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
|
|
API.setVehicleNumberPlate(veh, "Ballas");
|
|
}
|
|
} else if(index == 4){
|
|
if (Fraktionsmanager.getFraktionsRang(sender) >= 0)
|
|
{
|
|
Vehicle veh = API.createVehicle(VehicleHash.Futo, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
|
|
API.setPlayerIntoVehicle(sender, veh, -1);
|
|
API.setVehicleCustomPrimaryColor(veh, 65, 0, 65);
|
|
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
|
|
API.setEntitySyncedData(veh, "locked", true);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
|
|
API.setVehicleNumberPlate(veh, "Ballas");
|
|
}
|
|
} else if(index == 5){
|
|
if (Fraktionsmanager.getFraktionsRang(sender) >= 0)
|
|
{
|
|
Vehicle veh = API.createVehicle(VehicleHash.Bmx, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
|
|
API.setPlayerIntoVehicle(sender, veh, -1);
|
|
API.setVehicleCustomPrimaryColor(veh, 65, 0, 65);
|
|
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
|
|
API.setEntitySyncedData(veh, "locked", true);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
|
|
API.setVehicleNumberPlate(veh, "Ballas");
|
|
}
|
|
} else if(index == 6){
|
|
if (Fraktionsmanager.getFraktionsRang(sender) >= 0)
|
|
{
|
|
Vehicle veh = API.createVehicle(VehicleHash.Buccaneer2, spawnpos, new Vector3(0, 0, spawnposrot), 0, 0, 0);
|
|
API.setPlayerIntoVehicle(sender, veh, -1);
|
|
API.setVehicleCustomPrimaryColor(veh, 65, 0, 65);
|
|
API.setEntityData(veh, "Fraktionsfahrzeug", ausleihfraktionsid);
|
|
API.setEntitySyncedData(veh, "locked", true);
|
|
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, veh, 2);
|
|
API.setVehicleNumberPlate(veh, "Ballas");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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[56];
|
|
argumentList[0] = CALLBACKDUDE;
|
|
argumentList[1] = "Fahrzeuge";
|
|
argumentList[2] = "Fahrzeuge:";
|
|
argumentList[3] = false;
|
|
int itemlength = 7;
|
|
argumentList[4] = itemlength;
|
|
argumentList[5] = "Voodoo"; // RANG 0 /ID Police
|
|
argumentList[6] = "Baller2"; // RANG 0 /ID Police
|
|
argumentList[7] = "Tornado2"; // RANG 1 - 2 / ID Police2
|
|
argumentList[8] = "Warrener"; // RANG 1 - 2 / ID Police2
|
|
argumentList[9] = "Futo"; // RANG 1 - 2 / ID Police2
|
|
argumentList[10] = "BMX"; // RANG 1 - 2 / ID Police2
|
|
argumentList[11] = "Buccaneer2"; // RANG 1 - 2 / ID Police2
|
|
for (var i = 0; i < itemlength; i++)
|
|
{
|
|
argumentList[12 + i] = "";
|
|
}
|
|
API.shared.triggerClientEvent(player, "menu_handler_create_menu", argumentList);
|
|
|
|
}
|
|
|
|
/// AUSLEIH END
|
|
|
|
private void onTrigger(Client sender, string eventName, object[] arguments)
|
|
{
|
|
if(eventName == "menu_handler_select_item")
|
|
{
|
|
int callback = (int)arguments[0];
|
|
if(callback == FskinCallback)
|
|
{
|
|
int index = (int) arguments[1];
|
|
if(index == 0)
|
|
{
|
|
API.setPlayerSkin(sender, PedHash.BallaEast01GMY);
|
|
PlayerDatabase.setDatabaseDataString(sender, "skinid", "BallaEast01GMY");
|
|
}
|
|
else if(index == 1)
|
|
{
|
|
API.setPlayerSkin(sender, PedHash.BallaOrig01GMY);
|
|
PlayerDatabase.setDatabaseDataString(sender, "skinid", "BallaOrig01GMY");
|
|
}
|
|
else if(index == 2)
|
|
{
|
|
API.setPlayerSkin(sender, PedHash.Ballas01GFY);
|
|
PlayerDatabase.setDatabaseDataString(sender, "skinid", "Ballas01GFY");
|
|
}
|
|
else if (index == 3)
|
|
{
|
|
API.setPlayerSkin(sender, PedHash.Ballasog);
|
|
PlayerDatabase.setDatabaseDataString(sender, "skinid", "Ballasog");
|
|
}
|
|
else if (index == 4)
|
|
{
|
|
API.setPlayerSkin(sender, PedHash.BallaSout01GMY);
|
|
PlayerDatabase.setDatabaseDataString(sender, "skinid", "BallaSout01GMY");
|
|
}
|
|
else if (index == 5)
|
|
{
|
|
API.setPlayerSkin(sender, PedHash.Soucent02AFY);
|
|
PlayerDatabase.setDatabaseDataString(sender, "skinid", "Soucent02AFY");
|
|
}
|
|
else if (index == 6)
|
|
{
|
|
API.setPlayerSkin(sender, PedHash.Stlat01AMY);
|
|
PlayerDatabase.setDatabaseDataString(sender, "skinid", "Stlat01AMY");
|
|
}
|
|
else if (index == 7)
|
|
{
|
|
string skin = PlayerDatabase.getSkin(sender);
|
|
PedHash pedskin = API.pedNameToModel(skin);
|
|
API.setPlayerSkin(sender, pedskin);
|
|
Database.CharacterDatabase.setPlayerDatabaseClothes(sender, API);
|
|
}
|
|
}else if(callback == WaffenCallback)
|
|
{
|
|
int index = (int)arguments[1];
|
|
int mats = Aktionen.BadFraktionmanager.getFraktionsMats(3);
|
|
if (index == 0)
|
|
{
|
|
if (mats >= 10)
|
|
{
|
|
Aktionen.BadFraktionmanager.setFraktionsKassenValue(3, "Materialien", mats - 10);
|
|
API.givePlayerWeapon(sender, WeaponHash.KnuckleDuster, 1, false, true);
|
|
}
|
|
else
|
|
{
|
|
API.sendNotificationToPlayer(sender, "Ihr habt nicht genug Materialien!");
|
|
}
|
|
}
|
|
else if(index == 1)
|
|
{
|
|
if (mats >= 20)
|
|
{
|
|
Aktionen.BadFraktionmanager.setFraktionsKassenValue(3, "Materialien", mats - 20);
|
|
API.givePlayerWeapon(sender, WeaponHash.KnuckleDuster, 1, false, true);
|
|
API.givePlayerWeapon(sender, WeaponHash.Bat, 1, false, true);
|
|
}
|
|
else
|
|
{
|
|
API.sendNotificationToPlayer(sender, "Ihr habt nicht genug Materialien!");
|
|
}
|
|
}
|
|
else if(index == 2)
|
|
{
|
|
if (mats >= 30)
|
|
{
|
|
Aktionen.BadFraktionmanager.setFraktionsKassenValue(3, "Materialien", mats - 40);
|
|
API.givePlayerWeapon(sender, WeaponHash.KnuckleDuster, 1, false, true);
|
|
API.givePlayerWeapon(sender, WeaponHash.Bat, 1, false, true);
|
|
API.givePlayerWeapon(sender, WeaponHash.Knife, 1, false, true);
|
|
API.givePlayerWeapon(sender, WeaponHash.Pistol, 100, false, true);
|
|
}
|
|
else
|
|
{
|
|
API.sendNotificationToPlayer(sender, "Ihr habt nicht genug Materialien!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void EnterColShape(ColShape colshape, NetHandle entity)
|
|
{
|
|
if(entity != null && colshape != null)
|
|
{
|
|
if(colshape.hasData("fskin:ballas") == true && colshape.getData("fskin:ballas") == true)
|
|
{
|
|
Client player = API.getPlayerFromHandle(entity);
|
|
if (Fraktionsmanager.isBallas(player) == true)
|
|
{
|
|
object[] argumentList = new object[30];
|
|
argumentList[0] = FskinCallback;
|
|
argumentList[1] = "Ballas";
|
|
argumentList[2] = "Skins:";
|
|
argumentList[3] = false;
|
|
argumentList[4] = 8;
|
|
argumentList[5] = "~r~Skin 1";
|
|
argumentList[6] = "~r~Skin 2";
|
|
argumentList[7] = "~r~Skin 3";
|
|
argumentList[8] = "~r~Skin 4";
|
|
argumentList[9] = "~r~Skin 5";
|
|
argumentList[10] = "~r~Skin 6";
|
|
argumentList[11] = "~r~Skin 7";
|
|
argumentList[12] = "~b~ Standart Skin";
|
|
API.triggerClientEvent(player, "menu_handler_create_menu", argumentList);
|
|
}
|
|
} else if(colshape.hasData("fhaus:ballas") == true && colshape.getData("fhaus:ballas") == true)
|
|
{
|
|
Client player = API.getPlayerFromHandle(entity);
|
|
if (Fraktionsmanager.getFraktion(player) == 3)
|
|
{
|
|
API.setEntityPosition(player, new Vector3(152.65, -1004, -99));
|
|
API.setEntityDimension(player, 64165);
|
|
}
|
|
} else if(colshape.hasData("fhaus:ballasout") == true && colshape.getData("fhaus:ballasout") == true)
|
|
{
|
|
Client player = API.getPlayerFromHandle(entity);
|
|
if (player != null)
|
|
{
|
|
if (Fraktionsmanager.getFraktion(player) == 3)
|
|
{
|
|
API.setEntityPosition(player, new Vector3(-222.46,-1649.834,34.46));
|
|
API.setEntityDimension(player, 0);
|
|
}
|
|
}
|
|
}
|
|
else if (colshape.hasData("waffenmarker:ballas") == true && colshape.getData("waffenmarker:ballas") == true)
|
|
{
|
|
Client player = API.getPlayerFromHandle(entity);
|
|
if (Fraktionsmanager.getFraktion(player) == 3)
|
|
{
|
|
object[] argumentList = new object[20];
|
|
argumentList[0] = WaffenCallback;
|
|
argumentList[1] = "Ballas";
|
|
argumentList[2] = "Waffenpackete:";
|
|
argumentList[3] = false;
|
|
argumentList[4] = 3;
|
|
argumentList[5] = "~b~Kleines Packet";
|
|
argumentList[6] = "~y~Mittleres Packet";
|
|
argumentList[7] = "~r~Grosses Packet";
|
|
argumentList[8] = "~c~ 10 Mats";
|
|
argumentList[9] = "~c~ 20 Mats";
|
|
argumentList[10] = "~c~ 30 Mats";
|
|
API.triggerClientEvent(player, "menu_handler_create_menu", argumentList);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Vehicle Locations:
|
|
// 101,4014 -1926.09 20.64 ROT 70
|
|
// 89.64 -1938.885 20.62 ROT 30
|
|
// 114.3122 -1932.24 20.65 ROT 33
|
|
// 115 -1947.6 20.6 ROT -39
|
|
// 105.6679 -1952.63 20.62 ROT 95
|
|
// 94.87 -1948.49 20.65 Rot 33 |