114 lines
5 KiB
C#
114 lines
5 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.Jobs.Taxifahrer
|
|
{
|
|
class Taxifahrer : Script
|
|
{
|
|
public Taxifahrer()
|
|
{
|
|
Jobmanager.createJobPed(PedHash.Dockwork01SMM, new Vector3(438.3491, -622.89, 28), 90, "", "");
|
|
RAPI.Marker.createMarker(1, new Vector3(437, -622.668, 27), 1, 0, 255, 0, "taxifahrer", 0, 185, "Taxifahrer", 0);
|
|
API.onEntityEnterColShape += onJobGUI;
|
|
API.onClientEventTrigger += onTrigger;
|
|
API.onPlayerEnterVehicle += onEnter;
|
|
API.onPlayerExitVehicle += onLeft;
|
|
}
|
|
|
|
private void onEnter(Client player, NetHandle vehicle, int x)
|
|
{
|
|
if(player != null && vehicle != null)
|
|
{
|
|
Vehicle veh = API.getEntityFromHandle<Vehicle>(vehicle);
|
|
if(API.hasEntityData(veh,"Taxi") == true && API.getEntityData(veh,"Taxi") == true)
|
|
{
|
|
if(player.vehicleSeat != -1)
|
|
{
|
|
Client Taxifahrer = veh.occupants[0];
|
|
API.setEntityData(player, "Mitfahrer", true);
|
|
API.setEntityData(player, "Mitfahrer:Start", player.position);
|
|
API.sendChatMessageToPlayer(player, "~r~Du kannst dem Taxifahrer nun dein Ziel mitteilen. Er wird dir einen Preis vorschlagen.");
|
|
API.sendChatMessageToPlayer(Taxifahrer, "~r~Du kannst dem Spieler nachdem er sein Ziel gennant hat einen gewuenschten Betrag für die gefahrene Strecke anfragen (Realistisch).");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void onLeft(Client player, NetHandle vehicle, int x)
|
|
{
|
|
if(player != null && vehicle != null)
|
|
{
|
|
Vehicle veh = API.getEntityFromHandle<Vehicle>(vehicle);
|
|
if(veh.hasData("Taxi") == true && veh.getData("Taxi") == true)
|
|
{
|
|
if (API.hasEntityData(player, "Taxifahrer") == true && API.getEntityData(player, "Taxifahrer") == true)
|
|
{
|
|
veh.delete();
|
|
API.sendNotificationToPlayer(player, "~r~ Job beendet!");
|
|
}
|
|
else if (API.hasEntityData(player, "Mitfahrer") == true && API.hasEntityData(player, "Mitfahrer:Start") == true && API.getEntityData(player, "Mitfahrer") == true)
|
|
{
|
|
Client Taxifahrer = veh.occupants[0];
|
|
API.sendNotificationToPlayer(Taxifahrer,"Du musst dem Taxifahrer nun das Geld geben. Falls nicht darf er das LSPD kontaktieren!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void onTrigger(Client sender, string eventName, object[] arguments)
|
|
{
|
|
if (eventName == "triggerBackFromClient")
|
|
{
|
|
string job = (string)arguments[0];
|
|
if (job == "job:start:" + Jobmanager.Jobnames.taxifahrer[0])
|
|
{
|
|
if (Environment.Fahrschule.doesPlayerHaveFuehrerschein(sender))
|
|
{
|
|
if (Jobmanager.getJob(sender) == Jobmanager.Jobnames.taxifahrer[0])
|
|
{
|
|
Vehicle veh = API.createVehicle(VehicleHash.Taxi, new Vector3(421.4, -658.88, 25.204), new Vector3(0, 0, 180), 0, 0, 0);
|
|
API.setVehicleCustomPrimaryColor(veh, 255, 255, 0);
|
|
API.setPlayerIntoVehicle(sender, veh, -1);
|
|
API.sendNotificationToPlayer(sender, "Du musst nun mit deinem Handy(Taste: N) Werbung schalten! ");
|
|
API.setVehicleLocked(sender, true);
|
|
API.setEntityData(veh, "Taxi", true);
|
|
API.setEntityData(sender, "Taxifahrer", true);
|
|
}
|
|
else
|
|
{
|
|
API.sendNotificationToPlayer(sender, "~r~Du musst den Job erstmal annehmen!");
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
API.sendNotificationToPlayer(sender, "~r~Du hast kein PKW Schein!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void onJobGUI(ColShape colshape, NetHandle entity)
|
|
{
|
|
if (colshape != null && entity != null)
|
|
{
|
|
if (colshape.getData("taxifahrer") == true)
|
|
{
|
|
Client player = API.getPlayerFromHandle(entity);
|
|
Jobmanager.acceptFenster(player, Jobmanager.Jobnames.taxifahrer, 100);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|