Skip to content
This repository was archived by the owner on Dec 25, 2022. It is now read-only.

Commit f2bb86d

Browse files
committed
Added extra permission to attach ropes to players
1 parent ce5d58f commit f2bb86d

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Client/Ropes.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using CitizenFX.Core;
22
using CitizenFX.Core.Native;
3+
using PocceMod.Shared;
34
using System;
45
using System.Collections.Generic;
56

@@ -106,6 +107,17 @@ public static void PlayerAttach(int entity, bool tow = false)
106107

107108
public static void Attach(int entity1, int entity2, bool tow = false)
108109
{
110+
if (!Permission.CanDo(Ability.RopeOtherPlayer))
111+
{
112+
var player = API.GetPlayerPed(-1);
113+
if ((API.IsEntityAPed(entity1) && API.IsPedAPlayer(entity1) && entity1 != player) ||
114+
(API.IsEntityAPed(entity2) && API.IsPedAPlayer(entity2) && entity2 != player))
115+
{
116+
Hud.Notification("You are not allowed to attach rope to another player");
117+
return;
118+
}
119+
}
120+
109121
TriggerServerEvent("PocceMod:AddRope", API.ObjToNet(entity1), API.ObjToNet(entity2), tow);
110122
}
111123

Shared/Ability.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public enum Ability
99
SpawnPoccePassengers,
1010
SpawnTrashPed,
1111
Rope,
12+
RopeOtherPlayer,
1213
RappelFromHeli,
1314
TeleportToClosestVehicle,
1415
OceanWaves,

config/config.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ SpawnPetCompanion=0
1111
SpawnPoccePassengers=0
1212
SpawnTrashPed=0
1313
Rope=0
14+
RopeOtherPlayer=0
1415
RappelFromHeli=0
1516
TeleportToClosestVehicle=0
1617
OceanWaves=0

0 commit comments

Comments
 (0)