153 lines
No EOL
7.2 KiB
Text
153 lines
No EOL
7.2 KiB
Text
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 WeazelNews : Script
|
||
{
|
||
public WeazelNews()
|
||
{
|
||
loadWeazelBase();
|
||
API.onEntityEnterColShape += onWeazel;
|
||
API.onClientEventTrigger += onTrigger;
|
||
}
|
||
|
||
public const int WeazelCallback = 891989756;
|
||
public void loadWeazelBase(){
|
||
API.createPed(PedHash.Bevhills01AMY,new Vector3(-537.1616,-886.4875,25.20927),-173,0);
|
||
RAPI.Marker.createMarker(1, new Vector3(-537.1462,-887.467,24.16158),1,255,255,255,"weazelbase",0,150,"Fahrzeug auslagern",0);
|
||
Blip bl = API.createBlip(new Vector3(-581,-930,37));
|
||
bl.sprite = 184;
|
||
|
||
}
|
||
|
||
public void onWeazel(ColShape col, NetHandle en)
|
||
{
|
||
if(col != null && en != null){
|
||
if(col.hasData("weazelbase") == true && col.getData("weazelbase") == true){
|
||
Client player = API.getPlayerFromHandle(en);
|
||
if(player != null){
|
||
if(Fraktionsmanager.getFraktion(player) == 2)
|
||
{
|
||
object[] argumentList = new object[20];
|
||
argumentList[0] = WeazelCallback;
|
||
argumentList[1] = "~y~Weaze News";
|
||
argumentList[2] = "Fahrzeuge:";
|
||
argumentList[3] = false;
|
||
argumentList[4] = 3;
|
||
argumentList[5] = "~y~ News Van"; // Rumpo
|
||
argumentList[6] = "~y~ News Bike"; // Bagger
|
||
argumentList[7] = "~r~ News Helikopter"; // Maverick
|
||
argumentList[8] = "";
|
||
argumentList[9] = "";
|
||
argumentList[10] = "";
|
||
API.triggerClientEvent(player, "menu_handler_create_menu", argumentList);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
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 == WeazelCallback){
|
||
if(index == 0){
|
||
Vehicle van = API.createVehicle(VehicleHash.Rumpo, new Vector3(-532.6706,-889.3377,24.89119), new Vector3(-7,-0.272,-179.4867),0,0,0);
|
||
API.setVehicleCustomPrimaryColor(van,255,255,0);
|
||
API.setVehicleCustomSecondaryColor(van,255,255,0);
|
||
API.setPlayerIntoVehicle(sender, van, -1);
|
||
API.setEntityData(van, "Fraktionsfahrzeug", 2);
|
||
API.setEntitySyncedData(van, "locked", true);
|
||
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, van, 2);
|
||
API.setVehicleNumberPlate(van, "News");
|
||
} else if(index == 1){
|
||
Vehicle van = API.createVehicle(VehicleHash.Bagger, new Vector3(-532.6706,-889.3377,24.89119), new Vector3(-7,-0.272,-179.4867),0,0,0);
|
||
API.setVehicleCustomPrimaryColor(van,255,255,0);
|
||
API.setVehicleCustomSecondaryColor(van,255,255,0);
|
||
API.setPlayerIntoVehicle(sender, van, -1);
|
||
API.setEntityData(van, "Fraktionsfahrzeug", 2);
|
||
API.setEntitySyncedData(van, "locked", true);
|
||
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, van, 2);
|
||
API.setVehicleNumberPlate(van, "News");
|
||
} else if(index == 2){
|
||
Vehicle van = API.createVehicle(VehicleHash.Maverick, new Vector3(-581,-930,37), new Vector3(0,0,90),0,0,0);
|
||
API.setVehicleCustomPrimaryColor(van,255,255,0);
|
||
API.setVehicleCustomSecondaryColor(van,255,255,0);
|
||
API.setPlayerIntoVehicle(sender, van, -1);
|
||
API.setEntityData(van, "Fraktionsfahrzeug", 2);
|
||
API.setEntitySyncedData(van, "locked", true);
|
||
API.sendNativeToPlayersInDimension(0, Hash.SET_VEHICLE_DOORS_LOCKED, van, 2);
|
||
API.setVehicleNumberPlate(van, "News");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
[Command("sannounce")]
|
||
public void announcestart(Client player, int mode)
|
||
{
|
||
if(Fraktionsmanager.getFraktion(player) == 2){
|
||
API.sendChatMessageToAll("~y~ ------------------Weazel News------------------´");
|
||
API.setEntityData(player,"weazelmode",mode);
|
||
API.delay(1000*1,true,() => {
|
||
if(mode == 1){
|
||
API.sendChatMessageToAll("~y~ ------Event------");
|
||
} else if(mode == 2){
|
||
API.sendChatMessageToAll("~y~ ------Bericht------");
|
||
} else if(mode == 3){
|
||
API.sendChatMessageToAll("~y~ ------Werbung------");
|
||
} else {
|
||
API.sendNotificationToPlayer(player,"Mode nicht gefunden!");
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
[Command("eannounce")]
|
||
public void announceend(Client player)
|
||
{
|
||
if(Fraktionsmanager.getFraktion(player) == 2){
|
||
if(API.hasEntityData(player,"weazelmode") == true){
|
||
int mode = API.getEntityData(player,"weazelmode");
|
||
API.delay(1000*1,true,() => {
|
||
if(mode == 1){
|
||
API.sendChatMessageToAll("~y~ ------Event Ende------");
|
||
} else if(mode == 2){
|
||
API.sendChatMessageToAll("~y~ ------Bericht Ende------");
|
||
} else if(mode == 3){
|
||
API.sendChatMessageToAll("~y~ ------Werbung Ende------");
|
||
}
|
||
});
|
||
API.resetEntityData(player,"weazelmode");
|
||
} else {
|
||
API.sendNotificationToPlayer(player,"Du musst erst ein Announce starten! /sannounce [mode]");
|
||
}
|
||
}
|
||
}
|
||
|
||
[Command("announce", Alias = "a", GreedyArg = true)]
|
||
public void announce(Client player, string message){
|
||
if(Fraktionsmanager.getFraktion(player) == 2){
|
||
if(API.hasEntityData(player,"weazelmode") == true){
|
||
API.sendChatMessageToAll("~y~ Reporter: " + player.name + " : ~y~" + message);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
} |