我无法在 C# 上编译 GTA V 脚本找不到命名空间播放器的类型

问题描述

我正在使用在 C# 脚本上运行的 rage 多人游戏服务器。它使 gta v 可以在具有自定义游戏模式的服务器上玩。

问题是这样的: 找不到类型或命名空间名称“Player”(您是否缺少 using 指令或程序集引用?)

我遵循了本教程 https://www.youtube.com/watch?v=HLRFF6A36mM

代码在这里

using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
 
namespace gtavrp.Commands
{
    class PlayerCommands : Script
    {
        //~o~ stands for orange ~w~ stands for white
        //Below that is the description
        [Command("me","~o~Usage: ~w~ /me [action]",GreedyArg = true)]
        public void CMD_Me(Player player,string action)
        {
            //This removes the extra spaces inside the chat
            action = action.Trim();
 
            List<Player> nearbyPlayers = NAPI.Player.GetPlayersInRadiusOfPlayer(20,player);
 

            foreach (Player item in nearbyPlayers)
            {
                item.SendChatMessage($"~p~{player.Name} {action}");
            }
 
        }
    }
}

我已经尝试添加这行代码

使用 GTANetworkMethods;

但它仍然没有修复问题,因为我最终遇到了 item.SendChatMessage 的问题,即使它确实停止将播放器标记错误

我确实用客户端替换了播放器,但仍然没有成功,如果用客户端而不是播放器替换脚本,则在服务器运行时不会加载脚本。

请帮忙,我不知道如何解决这个问题

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)