Menu

Show posts

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 Menu

Messages - umar4911

#1
You cannot remove that afaik. You would need to make a custom class selector.
#2
You need to attach some references like what did you do. We cannot help you show like directories and files correctly placed, etc
#3
The Resurgence Free Server hosting

I am glad to announce that The Resurgence has launched its free vcmp server hosting service. Now people can apply and run a vcmp server for free! Visit the link for more details:

https://rtclan.vcmp.net/index.php?topic=290
#4
DistanceFromPoint(killer.Pos.x, killer.Pos.y, player.Pos.x, player.Pos.y)
#5
Script Showroom / Re: Anti-Speed hack
Aug 06, 2024, 09:23 AM
A lot things to care of for example.

What if I enter a vehicle very quickly after spawning and drive it?
What if someone hits me a car and I am sent flying?
#6
Command Manager


I had this command manager scripted long ago which I used in my old squirrel-based projects. Complete credits go to SLC as this command manager is a replica of the SqMod command manager and has a function of getting argument type made by him.




Installation

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);
}



The code for CMD_Manager.nut can be found on the Github Repository.




Usage


Creating command

The syntax to create a command is:
CMD_Manager.Create(command, args_type, args_array, min_args, max_args, auth, protected, assoc)
Understanding the parameters

First argument is the command name.

Second are the command masks for each argument. At the moment it supports the following specifiers:

i The argument accepts integer.
f The argument accepts floating point number.
b The argument accepts boolean.
s The argument accepts string.
g This argument is a greedy argument. Anything after this argument is captured as a string and no further parsing is done.

And you can combine them if one argument accepts multiple types of values.

Let's say that your command expects integer or float for the first argument, boolean for the second, uppercase string for the third and integer, float or boolean for the fourth. Then your mask should be like:

"if|b|u|ifb"
That way the command system knows how to parse the parameters and what values to expect.

Third argument is an array of argument names.  For example, let's say I'm creating a register command with 3 arguments. I'll probably specify ["name", "password", "email"].

The fourth and fifth argument is the minimum and maximum arguments that the command needs. When calling the command you only need the minimum and the rest is optional. You can have up to 16 arguments. I believe that's a fair number.

The sixth argument defines the authority/level of the command. It is validated with the newly added player.Authority. So yea, you got yourself an easy admin system in it, just change the player's authority.
player.Authority = 5If the player's authority is equal to more than the command authority, then it is triggered.

The seventh argument defines whether you want to protect the command or validate it to the player's authority. When set to true, it checks whether the player's authority is equal to or more than the command's authority. When set to false, it skips this validation step.

The last argument is Assosicate. It defines whether to get command's  'args' in form of table or array. When set to true, values are received in table form or else in array form.


Once done, you need to bind an environment and a function with 2 parameters (player and arguments) to the command by for example,
CMD_Manager.Create().BindExec(this, function (player, args) {

});



Lets create a command sethealth
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.



Error Handling:

In order to trigger errors for the commands, you need to define a BindFail function.

There are total 5 types of Errors defined in an Enum:
enum CMDErrorTypes {
    UnknownCommand,
    InsufficientAuth,
    UnsupportedArg,
    IncompleteArgs,
    SyntaxError
}

An example of BindFail function:
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;
}
})





All credits go to SLC for this post too as I stole some content of his :P





Some cool things that you can do for example:
[spoiler]
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);
});

An example of having commands with the same function but different name (like wep, we)


{
    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]
#7
VKs Winter Wars is originally the VKs Christmas Jolly Event but this time, the event has been shifted to another server.

New features:
- Event server is scripted in SqMod so you can get a smoother version of the event
- Reduced custom content thus less lag
- Better GUI for the event
- No 50-cap limit

For more info, refer to the forum thread or join our Discord server!


Trailer:

https://www.youtube.com/watch?v=mwR8Mjz2JCc
#8
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.
#9
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
#10


EAD staff are back again presenting to you Season Three of EAD League 2021!
The event that everyone was waiting for to go out there and rock the battlefields with their clan mates!


If you haven't heard about it before, Let's see how it works:
  • Gather your squad and make a team application here.
  • There's a certain amount of rounds to be decided as soon as the teams are decided, in which each team plays one match/round and they don't have to play their matches in order.
  • Each team picks 2 bases from the base list. These bases will stay with them till the league ends.
  • No teams can pick similar bases.
  • The matches are usually 5 v 5, except if both teams agree to play with less than 5, that's okay too.
  • Four bases for each match, with a total of 8 rounds.
  • Team applications has specific requirements this year, Please check it out here before applying.
  • We're very strict about rules, so make sure you check them in the Rules & Regulations.

If you'd like to be part of the staff, Apply as a referee here.!
It's as simple as that. Further information can be found here.
Click here to join EAD League discord
If you have any questions, feel free to ask here and the staff will answer you shortly.

Have a nice one folks, We will be waiting for you.
#11
if you change your skin using player.Skin = skin; your weapon resets. In order to avoid that, add this in your script:

function CPlayer::SetSkin(skin) {
    local slot = this.Slot;
    this.Skin = skin;
    this.Slot = slot;
}

Now use:
player.SetSkin(skinid)


onPlayerSkinChange
If you want this event, use:

function CPlayer::SetSkin(skin) {
    local slot = this.Slot, oldskin = this.Skin;
    this.Skin = skin;
    this.Slot = slot;
  onPlayerSkinChange(this, oldskin, skin)
}

Event:
function onPlayerSkinChange(player, OldSkin, NewSkin) {
}
#12
Quote from: Inferno on Dec 16, 2020, 06:35 PM
Quote from: Mr.Dip 2020 on Dec 16, 2020, 04:41 PMdoes this mean we can host our server in the master list?

You just bumped a 5 years old post to ask that?
._.

Host Time is the uptime to check the time since when the server is up / hosted.

To show your server in masterlist, you need announce plugin and port forwarded internet ( if local hosted ) or VPS
O B V I O U S L Y
#13
Support / Re: can't connect to any server
Nov 19, 2020, 09:35 AM
Updater URL: http://u04.thijn.ovh

Masterlist URL: http://master.vc-mp.org
#15
Servers / Re: [0.4] Arbiter's Official Server
Aug 27, 2020, 05:18 AM
Quote from: Darkninja on Aug 27, 2020, 04:48 AM
Quote from: DarkRaZoR^ on Aug 25, 2020, 09:21 PMI heard rumors that this server leaks account passwords from their echo.
Do you have any proof? You can't blame anyone without any proof.We even don't have echo and tell me how we can check password from Echo?
Get some proof and then talk here.
he said he heard "rumors".