Jump to content
  • 0

The problem with the plugin on carbon


myst1c

Question

Hello, I am learning to write plugins from the video "Mike Hawke" And I have a problem in the video "The Hooks" The console writes this error `1. Cannot implicitly convert type 'NetworkableId' to 'uint' [CS0029] 4. 'PhysicsEffects' does not contain a definition for
Raycast' [CS0117]nd 'uint' [CS0019] (MyPlugin 32 line 96) nce?) [CS0246] (MyPlugin 32 line 96)
Here is the code itself

Текстовый документ.txt

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
  • Administrator

On line 74:

configData.door = door.net.ID;

This should be:

configData.door = door.net.ID.Value;

 

Also unrelated to your error on line 58:

if (!permission.UserHasPermission(player.userID.ToString(), "MyPlugin.admin"))

You can avoid the ToString() by simply using:

if (!permission.UserHasPermission(player.UserIDString, "MyPlugin.admin"))

 

Also, line 65-66 you don't need to create references for out operators anymore:

                Door door;
                if (!DOORLOOC(player, out door))

You can just do:

                if (!DOORLOOC(player, out var door))

Or:

                if (!DOORLOOC(player, out Door door))

 

On line 82-89 you do not need the else return since it's a void and therefore does not return anything. You also have no code after the statement so your return here is redundant. You also need to fix your net.ID to access the value properly as we did above:

            if (door.net.ID.Value == configData.door)
            {
                SendReply(player, "База админа нах пошёл");
            }
            else
            {
                return;
            }

It should be:

            if (door.net.ID.Value == configData.door)
            {
                SendReply(player, "База админа нах пошёл");
            }

 

  • Love 1
Link to comment
Share on other sites

  • 0
15 hours ago, Death said:

В строке 74:

Данные конфигурации.door = door.net.ID;

Это должно быть:

configData.door = door.net.ID.Value;

 

Также не связана с вашей ошибкой в строке 58:

если (!разрешение.Разрешение пользователя(Игрок.Идентификатор пользователя.toString(), "MyPlugin.admin"))

Вы можете избежать toString(), просто используя:

если (!разрешение.Разрешение пользователя(Игрок.Строка идентификатора пользователя, "MyPlugin.admin"))

 

Кроме того, в строке 65-66 вам больше не нужно создавать ссылки для операторов out:

                Дверь door;
                если (!DOORLOOC(Игрок, выход за дверь))

Вы можете просто сделать:

 if (!DOORLOOC(игрок, выходит из var door))

Или:

                если (!DOORLOOC(Игрок, выход за пределы Дверь door ))

 

В строке 82-89 вам не нужен возврат else, поскольку это void и, следовательно, ничего не возвращает. У вас также нет кода после инструкции, поэтому ваш возврат здесь избыточен. Вам также необходимо исправить свой net.ID для правильного доступа к значению, как мы делали выше:

            if (door.net.ID.Значение == Данные конфигурации.door)
            {
                SendReply(Игрок, "База админа нах пошёл");
            }
            ещё
            {
                Возврат;
            }

Это должно быть:

            if (door.net.ID.Значение == Данные конфигурации.door)
            {
                SendReply(Игрок, "База админа нах пошёл");
            }

 

The plugin still throws an error He says that there is no Raycast
Mistake:
1. Cannot implicitly convert type 'ulong' to 'uint'. An explicit conversion exists (are you missing a cast?) [CS0266]
  4. 'PhysicsEffects' does not contain a definition for 'Raycast' [CS0117]nd 'uint' [CS0019]
     (MyPlugin 32 line 91)
nce?) [CS0246]

Link to comment
Share on other sites

  • 0
15 minutes ago, myst1c said:

The plugin still throws an error He says that there is no Raycast
Mistake:
1. Cannot implicitly convert type 'ulong' to 'uint'. An explicit conversion exists (are you missing a cast?) [CS0266]
  4. 'PhysicsEffects' does not contain a definition for 'Raycast' [CS0117]nd 'uint' [CS0019]
     (MyPlugin 32 line 91)
nce?) [CS0246]

I've fixed everything.
 

        private bool DOORLOOC(BasePlayer player, out Door door)
        {
            RaycastHit hit;
            door = null;
            if (UnityEngine.Physics.Raycast(player.eyes.HeadRay(), out hit, 3))
            {
                door = hit.GetEntity() as Door;
            }
            return door != null;
        }

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1.3m

Downloads

Total number of downloads.

6.5k

Customers

Total customers served.

95.8k

Files Sold

Total number of files sold.

1.9m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.