尝试调用 nil 值(字段"getn")

  • 本文关键字:字段 getn 调用 nil lua
  • 更新时间 :
  • 英文 :


你们能帮我修复这个lua代码吗?

我在第89行if IsMouseButtonPressed(1) and indexP < table.getn(weapon[indexW]) then上遇到问题,得到错误试图调用nil值(字段'get ')

"你;让我添加更多的细节,所以我将在这里添加一些字母。

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

AK47 = {{0,0}, {-0.56, 0.92}, {-0.55, 0.79}, {-0.45, 0.82}, {-0.27, 1.01}, {0.06, 2.49}, {0.65, 2.16}, {0.78, 2.17}, {0.46, 2.5}, {-0.04, 3.86}, {-0.41, 3.39}, {-0.54, 3.39}, {-0.41, 3.86}, {-0.36, 4.06}, {-0.36, 3.58}, {-0.1, 3.57}, {0.41, 4.02}, {1.14, 4.42}, {1.56, 3.73}, {1.74, 3.69}, {1.7, 4.28}, {1.05, 3.73}, {0.74, 3.34}, {0.84, 3.3}, {1.37, 3.6}, {1.9, 2.64}, {2.28, 2.1}, {1.8, 2.17}, {0.47, 2.85}, {-0.97, 2.71}, {-1.86, 1.95}, {-2.51, 1.4}, {-2.92, 1.06}, {-5.4, 0.71}, {-4.89, -0.84}, {-4.96, -1.29}, {-5.62, -0.64}, {-3.39, -0.37}, {-3.3, -0.53}, {-2.72, 0.24}, {-1.64, 1.95}, {0.7, 1.73}, {2.42, 0.96}, {2.49, 0.98}, {0.92, 1.79}, {-0.99, 1.83}, {-1.91, 0.87}, {-2.42, 0.28}, {-2.54, 0.05}, {-3.53, -0.87}, {-3.0, -1.9}, {-2.94, -1.57}, {-3.34, 0.1}, {-0.75, 0.42}, {-0.58, 0.61}, {-0.28, 0.72}, {0.15, 0.75}, {3.19, 2.01}, {4.93, -0.32}, {5.85, -0.97}, {5.95, 0.06}, {2.62, 0.6}, {2.26, 0.72}, {2.18, 0.93}, {2.39, 1.23}, {1.91, 1.37}, {1.51, 1.5}, {1.56, 1.38}, {2.07, 1.0}, {3.51, 0.62}, {3.18, -0.16}, {3.2, -0.6}, {3.59, -0.7}, {5.44, -0.2}, {5.49, 0.1}, {4.17, -0.95}, {1.46, -3.35}, {-1.57, -2.44}, {-3.26, -1.15}, {-3.41, 0.33}, {-2.02, 2.01}, {0.28, 0.57}, {0.98, 0.12}, {1.12, 0.12}, {0.68, 0.57}, {0.02, 1.49}, {-0.72, 1.24}, {-1.17, 1.1}, {-1.35, 1.06}, {-1.35, 0.49}, {-1.54, 0.11}, {-1.19, 0.22}, {-0.28, 0.84}, {1.38, 1.16}, {2.36, -0.91}, {2.85, -1.41}, {2.87, -0.36}, {1.28, 0.36}, {1.21, 0.51}, {0.8, 0.73}, {0.06, 1.01}, {-1.64, 1.63}, {-2.58, -0.2}, {-3.09, -0.97}, {-3.17, -0.69}, {-4.36, -0.19}, {-3.85, -0.15}, {-3.81, -0.39}, {-4.24, -0.91}, {-6.19, -2.43}, {-5.14, -2.99}, {-5.16, -2.9}, {-6.26, -2.15}, {-1.9, -0.25}, {-1.69, 0.03}, {-1.71, 0.15}, {-1.93, 0.09}}
M4A4 = {{0,0}, {0.27, 1.1}, {0.24, 0.98}, {0.18, 1.12}, {0.16, 1.58}, {0.03, 1.42}, {-0.16, 1.58}, {-0.9, 2.81}, {-1.15, 2.42}, {-0.62, 2.84}, {0.71, 3.66}, {1.42, 3.17}, {0.72, 3.66}, {-0.77, 4.13}, {-1.54, 3.53}, {-1.48, 4.03}, {-1.55, 4.55}, {-1.24, 4.1}, {0.38, 4.49}, {2.06, 3.13}, {2.97, 2.07}, {3.13, 2.51}, {1.65, 2.3}, {1.35, 2.16}, {2.01, 1.87}, {4.02, 0.81}, {3.98, -0.19}, {2.91, 1.84}, {0.28, 1.96}, {-0.91, 1.83}, {-1.54, 1.67}, {-2.61, 1.79}, {-2.81, 0.8}, {-3.25, 0.37}, {-5.18, -0.21}, {-4.58, -1.06}, {-5.18, -0.88}, {-4.11, -0.07}, {-3.67, 0.14}, {-4.1, -0.18}, {-5.07, -1.48}, {-4.51, -1.72}, {-3.45, 0.38}, {-0.32, 0.53}, {0.04, 0.64}, {0.27, 0.64}, {1.69, 1.04}, {2.01, 0.46}, {0.71, 1.17}, {-1.18, 1.04}, {-2.05, -0.28}, {-2.26, -0.46}, {-2.93, -1.1}, {-2.62, -1.3}, {-1.82, 0.82}, {0.08, 0.52}, {0.59, 0.34}, {0.72, 0.25}, {4.48, 0.1}, {6.12, -0.65}, {6.58, 0.62}, {1.82, 0.98}, {1.43, 1.27}, {1.79, 1.05}, {4.5, 0.9}, {4.17, 0.02}, {4.65, 0.31}, {1.55, 0.35}, {1.37, 0.39}, {1.56, 0.31}, {2.47, 0.68}, {2.26, 0.52}, {1.03, -1.02}, {-1.23, -1.46}, {-2.51, -0.05}, {-1.82, 1.33}, {0.24, 1.0}, {1.2, 0.66}, {1.26, 0.8}, {0.67, 0.88}, {0.56, 0.82}, {0.81, 0.71}, {0.52, 0.23}, {0.51, 0.09}, {0.58, 0.01}, {0.76, -0.1}, {0.66, -0.21}, {0.74, -0.23}}
AUG = {{0,0}, {0.63, 0.67}, {0.57, 0.59}, {0.33, 0.79}, {-0.06, 0.62}, {-0.27, 0.53}, {-0.29, 0.6}, {-0.34, 0.96}, {-0.29, 0.86}, {-0.3, 0.97}, {-0.64, 2.07}, {-0.52, 1.86}, {-0.26, 2.13}, {0.18, 3.0}, {0.57, 2.65}, {0.67, 2.97}, {0.53, 3.41}, {0.51, 3.03}, {0.98, 3.28}, {1.18, 2.33}, {1.32, 1.95}, {1.29, 2.29}, {0.59, 1.79}, {0.4, 1.65}, {0.73, 1.72}, {1.58, 1.47}, {1.69, 1.12}, {0.66, 1.68}, {-1.09, 1.68}, {-2.08, 0.85}, {-2.04, 1.26}, {-0.68, 0.65}, {-0.53, 0.65}, {0.04, 0.72}, {1.27, 0.34}, {1.66, -0.7}, {1.52, 0.14}, {0.47, 0.78}, {0.0, 0.89}, {-0.43, 0.83}, {-2.08, 1.29}, {-2.46, 0.06}, {-2.74, -0.35}, {-3.85, -0.78}, {-3.29, -1.31}, {-3.65, -1.59}, {-3.06, -2.07}, {-2.68, -2.03}, {-2.87, 0.14}, {-0.3, 0.61}, {0.19, 0.8}, {0.02, 0.86}, {-0.3, 0.84}, {-0.41, 0.68}, {-0.67, 0.51}, {-0.99, 0.33}, {-0.96, 0.02}, {-0.4, -0.55}, {1.44, -1.32}, {3.05, 0.79}, {3.34, 0.85}, {3.32, 0.11}, {2.95, 0.13}, {3.24, 0.58}, {1.66, 0.26}, {1.46, 0.36}, {0.51, 1.02}, {-0.62, 0.68}, {-1.04, 0.16}, {-0.63, -0.51}, {0.76, -1.0}, {2.11, 0.14}, {2.28, -0.03}, {3.06, -1.23}, {2.64, -1.34}, {3.12, -0.96}, {2.22, -0.53}, {2.03, -0.24}, {1.01, 1.06}, {-0.89, 1.38}, {-2.38, 0.16}, {-2.63, 0.13}, {-1.88, 0.27}, {-1.7, 0.16}, {-1.45, 0.39}, {-0.21, 0.14}, {-0.16, 0.16}, {-0.18, 0.18}}
SG553 = {{0,0}, {-0.56, 1.34}, {-0.5, 1.2}, {-0.69, 1.27}, {-2.27, 2.8}, {-2.31, 2.28}, {-2.14, 2.87}, {-1.87, 4.11}, {-1.12, 3.9}, {-1.13, 4.42}, {-1.29, 4.98}, {-1.0, 4.47}, {-1.14, 5.02}, {-1.36, 5.54}, {-1.22, 4.93}, {-1.28, 5.55}, {-0.73, 6.22}, {-0.51, 5.58}, {-2.23, 5.6}, {-3.55, 2.59}, {-4.02, 1.51}, {-2.25, 3.06}, {1.53, 3.17}, {3.45, 2.22}, {2.02, 3.19}, {-0.54, 2.48}, {-1.56, 1.91}, {-2.1, 1.81}, {-2.59, 1.58}, {-2.61, 0.94}, {-2.73, 1.4}, {-1.08, 0.64}, {-0.9, 0.66}, {-0.35, 1.0}, {0.78, 0.98}, {1.4, 0.53}, {0.75, 0.98}, {-0.84, 1.3}, {-1.69, 0.71}, {-1.28, 1.22}, {0.28, 1.91}, {0.94, 1.77}, {-0.31, 1.5}, {-2.24, 0.51}, {-2.31, -1.29}, {-2.42, -1.74}, {-3.59, -2.94}, {-2.8, -3.15}, {-3.53, -3.04}, {-2.87, -1.56}, {-2.73, -1.06}, {-3.09, -1.14}, {-1.84, -0.31}, {-1.69, -0.23}, {-0.54, -0.99}, {4.26, -3.02}, {7.61, 2.5}, {8.4, 2.11}, {9.79, -0.58}, {8.69, -1.11}, {9.78, -0.94}, {7.46, -0.76}, {6.65, -0.54}, {7.3, 0.9}, {3.21, 1.27}, {2.62, 1.72}, {2.94, 1.94}, {2.62, 1.39}, {2.33, 1.25}, {2.4, 1.7}, {0.97, 1.19}, {0.73, 1.2}, {1.16, 0.88}, {3.64, 0.45}, {3.39, -0.87}, {3.8, -0.93}, {5.47, -1.88}, {4.93, -1.82}, {3.57, 1.82}, {-0.08, 1.49}, {-1.41, 1.18}, {-1.75, 1.09}, {-2.14, 1.27}, {-2.1, 0.77}, {-2.46, 0.43}, {-6.76, -0.03}, {-6.01, -1.16}, {-6.76, -1.25}}
M4A1S = {{0,0}, {0.18, 0.78}, {0.17, 0.68}, {0.15, 0.68}, {0.1, 0.79}, {0.03, 0.66}, {-0.01, 0.58}, {-0.05, 0.58}, {-0.1, 0.65}, {-0.46, 1.77}, {-0.6, 1.51}, {-0.53, 1.52}, {-0.25, 1.78}, {0.31, 2.44}, {0.76, 2.1}, {0.75, 2.1}, {0.3, 2.44}, {-0.4, 2.86}, {-0.83, 2.43}, {-0.99, 2.41}, {-0.86, 2.8}, {-0.92, 3.14}, {-0.92, 2.8}, {-0.47, 2.79}, {0.43, 3.09}, {1.19, 2.24}, {1.7, 1.58}, {1.94, 1.45}, {1.91, 1.86}, {1.03, 1.57}, {0.77, 1.5}, {0.86, 1.41}, {1.31, 1.28}, {2.45, 0.88}, {2.6, 0.06}, {2.34, 0.28}, {1.67, 1.53}, {0.28, 1.37}, {-0.38, 1.28}, {-0.83, 1.2}, {-1.08, 1.12}, {-1.62, 1.23}, {-1.68, 0.71}, {-1.83, 0.38}, {-2.08, 0.24}, {-3.29, -0.0}, {-2.88, -0.52}, {-2.89, -0.67}, {-3.3, -0.43}, {-2.59, -0.0}, {-2.28, 0.17}, {-2.28, 0.15}, {-2.59, -0.05}, {-3.17, -0.72}, {-3.01, -1.12}, {-2.59, -0.67}, {-1.93, 0.63}, {-0.17, 0.34}, {0.04, 0.37}, {0.18, 0.38}, {0.25, 0.37}, {1.07, 0.64}, {1.34, 0.23}, {1.09, 0.29}, {0.32, 0.81}, {-0.62, 0.84}, {-1.16, 0.08}, {-1.44, -0.27}, {-1.45, -0.21}, {-1.86, -0.52}, {-1.8, -0.88}, {-1.5, -0.44}, {-0.98, 0.81}, {0.04, 0.32}, {0.35, 0.18}, {0.48, 0.13}, {0.46, 0.18}}
FAMAS = {{0,0}, {-0.75, 0.66}, {-0.68, 0.59}, {-0.45, 0.83}, {0.06, 0.69}, {0.29, 0.62}, {0.1, 0.7}, {-0.86, 1.85}, {-1.31, 1.43}, {-1.07, 1.8}, {-0.53, 2.82}, {0.04, 2.6}, {0.1, 2.92}, {-0.27, 3.68}, {-0.18, 3.28}, {0.68, 3.53}, {1.75, 3.49}, {2.31, 2.7}, {2.89, 2.75}, {3.07, 1.81}, {3.0, 1.31}, {1.82, 2.52}, {-0.12, 2.33}, {-1.24, 1.93}, {-1.86, 1.77}, {-2.99, 1.84}, {-3.12, 0.89}, {-3.5, 1.0}, {-2.89, 1.16}, {-2.57, 1.01}, {-2.97, 0.87}, {-2.58, -0.09}, {-2.36, -0.31}, {-1.55, 1.11}, {0.11, 1.2}, {1.03, 0.93}, {1.34, 0.77}, {3.76, 1.22}, {3.67, 0.16}, {4.02, 0.6}, {2.01, 0.91}, {1.72, 1.0}, {2.06, 0.65}, {3.38, -0.16}, {3.0, -0.83}, {3.4, -0.48}, {1.01, 0.11}, {0.89, 0.21}, {1.01, 0.16}, {2.61, -0.21}, {2.34, -0.37}, {2.39, 0.54}, {0.93, 0.63}, {0.61, 0.82}, {0.09, 1.02}, {-0.45, 0.77}, {-0.8, 0.41}, {-0.97, 0.27}, {-4.59, -0.01}, {-4.21, -1.03}, {-3.75, 0.17}, {-0.71, 0.37}, {-0.52, 0.51}, {-0.01, 0.62}, {1.34, 0.82}, {1.89, -0.49}, {2.05, -0.73}, {2.67, -0.81}, {2.28, -1.02}, {2.47, -1.33}, {2.8, -1.73}, {2.37, -1.74}, {2.67, -1.94}}
UMP45 = {{0,0}, {-0.12, 1.13}, {-0.1, 1.01}, {-0.23, 1.11}, {-0.58, 1.4}, {-0.66, 1.19}, {-0.55, 1.41}, {-0.46, 2.96}, {-0.06, 2.7}, {-0.23, 3.01}, {-0.62, 3.81}, {-0.71, 3.36}, {-1.06, 3.71}, {-1.63, 3.93}, {-1.72, 3.4}, {-1.42, 3.99}, {-1.07, 4.44}, {-0.5, 4.04}, {0.53, 4.44}, {1.74, 3.1}, {2.32, 2.43}, {1.39, 3.16}, {-0.51, 2.07}, {-1.16, 1.75}, {-0.48, 2.06}, {0.81, 2.65}, {1.56, 2.05}, {2.15, 1.92}, {2.97, 1.91}, {3.0, 1.13}, {3.42, 1.15}, {2.61, 0.48}, {2.38, 0.3}, {1.86, 1.39}, {0.07, 0.57}, {-0.23, 0.57}, {-0.06, 0.63}, {0.69, 1.15}, {0.96, 0.86}, {0.73, 1.14}, {-0.09, 1.02}, {-0.34, 0.95}, {0.27, 0.77}, {1.47, 0.23}, {1.47, -0.89}, {1.64, -0.98}, {1.13, -0.72}, {1.02, -0.69}, {0.68, 0.29}, {-0.64, 1.63}, {-2.73, 0.53}, {-3.04, 0.41}, {-3.7, 1.09}, {-3.4, 0.73}, {-2.32, -0.69}, {-0.12, -0.38}, {0.15, -0.4}, {0.28, -0.38}, {1.79, -1.35}, {2.25, -0.81}, {2.59, -0.68}, {3.29, -1.36}, {3.04, -1.03}, {1.92, 1.27}, {-0.18, 0.62}, {-0.8, 0.32}, {-0.94, 0.21}, {-3.72, 0.48}, {-3.39, -0.32}, {-3.6, -0.71}, {-0.68, -0.19}, {-0.58, -0.23}, {-0.66, -0.26}}
MP7 = {{0,0}, {0.04, 0.6}, {0.06, 0.52}, {0.02, 0.52}, {-0.05, 0.59}, {-0.09, 0.45}, {-0.12, 0.39}, {-0.17, 0.37}, {-0.23, 0.4}, {-0.34, 0.46}, {-0.36, 0.36}, {-0.37, 0.35}, {-0.37, 0.44}, {-0.81, 1.23}, {-0.63, 1.13}, {-0.61, 1.15}, {-0.74, 1.28}, {-1.32, 1.82}, {-1.3, 1.53}, {-1.14, 1.6}, {-0.84, 2.03}, {-0.16, 2.21}, {0.42, 2.01}, {0.4, 2.0}, {-0.22, 2.19}, {-0.97, 1.85}, {-1.32, 1.38}, {-1.39, 1.35}, {-1.19, 1.76}, {-0.45, 1.75}, {-0.04, 1.68}, {-0.16, 1.6}, {-0.82, 1.5}, {-1.13, 0.79}, {-1.25, 0.28}, {-1.34, 0.15}, {-1.42, 0.39}, {-0.97, 0.31}, {-0.94, 0.25}, {-0.74, 0.4}, {-0.38, 0.76}, {0.22, 1.47}, {0.96, 1.09}, {1.4, 0.87}, {1.54, 0.81}, {2.39, 1.01}, {2.26, 0.47}, {2.34, 0.23}, {2.63, 0.29}, {2.39, 0.31}, {2.11, 0.2}, {2.11, 0.14}, {2.4, 0.14}, {2.04, -0.15}, {1.88, -0.36}, {1.75, -0.04}, {1.64, 0.82}, {0.42, 0.54}, {0.18, 0.62}, {-0.02, 0.67}, {-0.18, 0.7}, {-0.51, 0.93}, {-0.7, 0.66}, {-0.86, 0.53}, {-0.98, 0.54}, {-0.49, 0.23}, {-0.46, 0.14}, {-0.47, 0.12}, {-0.52, 0.17}, {-0.58, 0.14}, {-0.57, 0.09}, {-0.45, 0.18}, {-0.22, 0.42}, {0.21, 0.47}, {0.57, 0.24}, {0.63, 0.24}, {0.37, 0.46}, {0.03, 0.62}, {-0.17, 0.56}, {-0.36, 0.47}, {-0.52, 0.35}, {-1.94, 0.45}, {-1.81, -0.37}, {-1.84, -0.8}, {-2.02, -0.83}, {-2.72, -1.17}, {-2.32, -1.32}, {-2.27, -1.25}, {-2.57, -0.95}, {-0.52, -0.08}, {-0.47, 0.0}, {-0.47, 0.01}, {-0.53, -0.04}, {-1.43, -0.06}, {-1.38, 0.01}, {-1.13, -0.27}, {-0.66, -0.91}, {0.09, -0.32}, {0.36, -0.2}, {0.4, -0.2}, {0.23, -0.33}, {0.0, -0.3}, {-0.08, -0.29}, {-0.16, -0.21}, {-0.24, -0.05}, {-0.14, 0.14}, {0.03, 0.27}, {0.05, 0.3}, {-0.09, 0.25}, {-0.57, 0.22}, {-0.63, -0.1}, {-0.63, -0.11}, {-0.58, 0.21}, {-0.21, 0.31}, {-0.05, 0.35}, {0.01, 0.38}, {-0.03, 0.41}}
MP9 = {{0,0}, {-0.06, 1.42}, {-0.25, 1.37}, {-0.78, 1.07}, {-0.63, 1.11}, {0.59, 2.78}, {1.0, 2.79}, {-0.48, 4.4}, {-0.29, 4.37}, {2.43, 5.36}, {2.47, 5.35}, {0.26, 5.22}, {-0.92, 5.21}, {-2.59, 5.49}, {-1.39, 5.53}, {1.82, 3.97}, {3.44, 3.05}, {4.88, 3.09}, {5.55, 1.7}, {5.5, 0.56}, {5.56, -0.51}, {6.82, -3.0}, {5.91, -0.05}, {0.32, 2.2}, {-0.78, 2.69}, {0.66, 2.9}, {-0.23, 2.62}, {-5.22, 2.59}, {-6.44, 1.18}, {-3.31, 2.16}, {-3.27, 2.24}, {-4.45, 1.93}, {-4.56, 1.71}, {-3.43, 1.78}, {-3.57, 1.31}, {-5.25, 0.28}, {-5.24, -0.86}, {-8.97, -4.96}, {-5.99, -0.22}, {0.73, 0.86}, {1.83, 0.35}, {4.05, 0.95}, {4.15, 0.48}, {5.39, -0.03}, {4.94, 0.56}, {1.1, 0.4}, {0.39, 0.72}, {-3.55, 0.93}, {-5.12, -1.93}, {-6.55, -2.47}, {-6.59, -1.18}, {-1.54, 0.71}, {-1.43, 1.04}, {-3.35, 0.7}, {-1.94, 1.62}, {1.7, 1.68}, {3.05, 1.07}, {1.29, 1.25}, {1.19, 1.36}}
MAC = {{0,0}, {-0.82, 0.45}, {-0.73, 0.39}, {-0.66, 0.62}, {-0.38, 0.59}, {-0.2, 0.6}, {-0.03, 0.7}, {0.3, 1.08}, {0.57, 0.88}, {0.56, 1.03}, {0.7, 2.3}, {0.48, 2.09}, {0.78, 2.26}, {1.61, 2.97}, {1.72, 2.49}, {1.8, 2.88}, {2.11, 4.05}, {1.73, 3.67}, {1.86, 4.17}, {1.85, 3.48}, {1.61, 3.12}, {0.78, 3.72}, {-0.83, 3.03}, {-1.54, 2.59}, {-0.42, 2.98}, {1.07, 1.84}, {1.68, 1.26}, {1.58, 1.64}, {0.85, 1.84}, {0.49, 1.75}, {0.6, 1.95}, {0.93, 1.9}, {0.88, 1.68}, {0.43, 2.0}, {-0.16, 1.32}, {-0.46, 1.13}, {-0.59, 1.24}, {-0.29, 0.8}, {-0.3, 0.69}, {-0.53, 0.63}, {-1.46, 0.89}, {-1.52, 0.39}, {-1.75, 0.26}, {-3.53, 0.42}, {-3.18, 0.02}, {-3.56, -0.29}, {-5.85, -0.96}, {-5.23, -1.28}, {-3.24, -0.91}, {-0.31, -0.1}, {-0.28, -0.1}, {-0.31, -0.11}, {-2.34, -0.22}, {-2.42, -0.23}, {-0.93, -1.37}, {0.89, -0.29}, {1.49, 0.54}, {0.91, -0.29}, {-0.41, -0.78}, {-1.22, -0.21}, {-1.37, -0.14}, {-2.03, -0.36}, {-1.84, -0.12}, {-2.07, 0.06}, {-2.36, -0.15}, {-2.13, -0.01}, {-0.86, 1.18}, {1.45, 1.47}, {3.11, -0.47}, {3.4, -0.39}, {2.26, 0.29}, {2.0, 0.3}, {2.26, 0.27}, {2.72, 0.26}, {2.42, 0.17}, {2.73, 0.05}, {3.76, -0.62}, {3.35, -0.77}, {3.48, 0.62}, {0.8, 0.51}, {0.54, 0.67}, {-0.08, 0.74}, {-3.75, 1.42}, {-4.46, -1.43}, {-2.25, -2.49}, {0.19, -0.29}, {0.47, -0.07}, {0.51, -0.09}}
weapon = {AK47, M4A4, AUG, SG553, M4A1S, FAMAS, UMP45, MP7, MP9, MAC}
------------------------ Rate of Fire ----------------------
ak47_ROF = {delay = 100, interpolation = 4}
m4a4_ROF = {delay = 90, interpolation = 3}
aug_ROF = {delay = 90, interpolation = 3}
sg553_ROF = {delay = 90, interpolation = 3}
m4a1s_ROF = {delay = 100, interpolation = 4}
famas_ROF = {delay = 90, interpolation = 3}
ump_ROF = {delay = 90, interpolation = 3}
mp7_ROF = {delay = 80, interpolation = 4}
mp9_ROF = {delay = 70, interpolation = 2}
mac_ROF = {delay = 75, interpolation = 3}
weaponRof = {ak47_ROF, m4a4_ROF, aug_ROF, sg553_ROF, m4a1s_ROF, famas_ROF, ump_ROF, mp7_ROF, mp9_ROF, mac_ROF}
------------------- Weapon Sensitivity ---------------------
AKsen = 2.85
M4sen = 2.8
AUGsen = 4.7
SG553sen = 2.8
M4A1sen = 2.3
FAMsen = 3
UMPsen = 2.8
MP7sen = 3
MP9sen = 2.9
MACsen = 2.8
weaponSen = {AKsen, M4sen, AUGsen, SG553sen, M4A1sen, FAMsen, UMPsen, MP7sen, MP9sen, MACsen}
------------------------------------------------------------
indexW = 1 --index of weapon
indexP = 1 --index of Pattern
indexT = 1 -- 1 rifle / 2 smg
function OnEvent(event, arg)
    EnablePrimaryMouseButtonEvents(true)
    if IsMouseButtonPressed(2) then
        indexW = indexW + 1
        if indexT == 1 then     
            if indexW > 6 then
                indexW = 1
            end     
        end
        if indexT == 2 then
            if indexW > 10 then
                indexW = 7
            end     
        end
        if indexW == 1 then
            PressAndReleaseKey("insert")
        end
        if indexW == 2 then
            PressAndReleaseKey("home")
        end
        if indexW == 3 then
            PressAndReleaseKey("pageup")
        end
        if indexW == 4 then
            PressAndReleaseKey("delete")
        end
        if indexW == 5 then
            PressAndReleaseKey("end")
        end
        if indexW == 6 then
            PressAndReleaseKey("pagedown")
        end
        if indexW == 7 then
            PressAndReleaseKey("up")
        end
        if indexW == 8 then
            PressAndReleaseKey("down")
        end
        if indexW == 9 then
            PressAndReleaseKey("left")
        end
        if indexW == 10 then
            PressAndReleaseKey("right")
        end
    end
    while IsMouseButtonPressed(4) do
        if IsMouseButtonPressed(1) and indexP < table.getn(weapon[indexW]) then
            MoveMouseRelative(weapon[indexW][indexP][1]*weaponSen[indexW], weapon[indexW][indexP][2]*weaponSen[indexW])
            Sleep(weaponRof[indexW].delay/weaponRof[indexW].interpolation)
            indexP = indexP + 1
        else
                Sleep(10)
                indexP = 1
        end
        if IsMouseButtonPressed(2) then
            indexT = indexT + 1
            if indexT > 2 then
                indexT = 1
            end
            if indexT == 1 then
                indexW = 1
                PressAndReleaseKey("insert")
            else
                indexW = 7
                PressAndReleaseKey("up")
            end
            Sleep(300)
            OutputLogMessage(indexW)
        end
    end
    indexP = 1
end

table.getn在最近的Lua版本中不存在。请使用长度操作符:#weapon[indexW] .