You can only in client side but this does not work for all weapons.
http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Events/Player::PlayerShoot
http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Events/Player::PlayerShoot
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menusudo apt update
sudo apt install libcurl4-openssl-dev
function onScriptLoad()
{
CPlayer.rawnewmember("Authority", 1);
dofile("CMD_Manager.nut", true);
}
function onPlayerCommand(player, cmd, arguments)
{
local str = cmd + (arguments == null ? "" : " " + arguments);
if(cmd != "") CMD_Manager.Run(player, player.Authority, str);
}
CMD_Manager.Create(command, args_type, args_array, min_args, max_args, auth, protected, assoc)
"if|b|u|ifb"
That way the command system knows how to parse the parameters and what values to expect.player.Authority = 5
If the player's authority is equal to more than the command authority, then it is triggered.CMD_Manager.Create().BindExec(this, function (player, args) {
});
CMD_Manager.Create("sethealth", "s|i", ["Target", "HP"], 0, 2, 1, true, false).BindExec(this, function(player, args) {
if(args.len() >= 2)
{
local plr = FindPlayer(args[2]);
if(plr)
{
if(args[1] <= 255 && args[1] >= 0)
{
Message(format("%s changed the health of %s to %d", player.Name, plr.Name, args[1]));
plr.Health = args[1];
}
else MessagePlayer("Health must be between 0 to 255.", player);
}
else MessagePlayer("Unknown player", player);
}
else MessagePlayer("Wrong syntax, use /sethealth <player> <hp>", player)
})
This command is set to work if the arguments passed by the player are in between 0 to 2, having authority 1. Since the Associate is defined as zero, the arguments are in form of an array. Now the same command but which Associate set to true:CMD_Manager.Create("sethealth", "s|i", ["Target", "HP"], 0, 2, 1, true, true).BindExec(this, function(player, args) {
if(args.rawin("Target") && args.rawin("HP"))
{
local plr = FindPlayer(args.Target);
if(plr)
{
if(args[1] <= 255 && args[1] >= 0)
{
Message(format("%s changed the health of %s to %d", player.Name, plr.Name, args.HP));
plr.Health = args.HP;
}
else MessagePlayer("Health must be between 0 to 255.", player);
}
else MessagePlayer("Unknown player", player);
}
else MessagePlayer("Wrong syntax, use /sethealth <player> <hp>", player)
})
The arguments are now in table form.enum CMDErrorTypes {
UnknownCommand,
InsufficientAuth,
UnsupportedArg,
IncompleteArgs,
SyntaxError
}
CMD_Manager.BindFail(this, function (type, player, cmd, msg) {
switch(type)
{
case CMDErrorTypes.UnknownCommand:
MessagePlayer("[#ffffff]Error - Command doesn't exist.", player);
break;
case CMDErrorTypes.InsufficientAuth:
MessagePlayer("[#FF3300]Error - Unauthorized Access.", player);
break;
case CMDErrorTypes.UnsupportedArg:
MessagePlayer(format("[#DDFF33]Error - Wrong type of parameter passed to command %s.", cmd), player);
break;
case CMDErrorTypes.IncompleteArgs:
MessagePlayer(format("[#FFDD33]Error - Incomplete arguments for command %s.", cmd), player);
break;
case CMDErrorTypes.SyntaxError:
MessagePlayer(format("[#ff0000]Error - [#ffffff]Command %s throwed an error: %s", cmd, msg), player);
break;
default:
print("Bind Fail called");
break;
}
})
CMD_Manager.Create("cmds", "", [""], 0, 0, 1, true, true).BindExec(this, function (player, args) {
local msg = "";
foreach(listener in CMD_Manager.GetArray())
{
{
if(msg != "") msg += ", ";
msg += listener.Name;
}
}
MessagePlayer(format("Available commands: %s", msg), player);
});
{
local exec = function (player, args) {
if(args.rawin("code"))
{
try
{
local cscr = compilestring(args.code);
cscr();
}
catch (e) MessagePlayer(format("Exection Error %s", e), player);
}
else MessagePlayer("/e ( Code )", player);
}
CMD_Manager.Create("e", "g", ["code"], 0, 1, 1, true, true).BindExec(this, exec);
CMD_Manager.Create("exec", "g", ["code"], 0, 1, 1, true, true).BindExec(this, exec);
}
[/spoiler]Quote from: HunTinG on Jan 18, 2021, 10:19 PMthere's word around this summer devs may come back and deal with all issues, but that depends only if they have time...this word is around for years.
Quote from: ysc3839 on Jan 17, 2021, 05:48 PMI can tell you the 3D arrow was implemented in 0.4.7.and 0.4.7 never came out