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

Topics - AroliS^

#1
Snippet Showroom / [Release] ADiscord Library
Aug 24, 2022, 08:56 PM
ADiscord

A Nodejs Library for connecting a VC MP server over sockets to Discord
Since Discord plugins weren't fully functional at all.  and I got few DM's that they were in the need of a library I decide to create a fully function library where everybody somehow can collaborate :) Enjoy it


Everybody is more than welcome to collaborate. Didn't have the time to do a deep test.
If you encounter any bugs/errors just let me know and I will fix it as soon as possible

Github Wiki
Github Repository

.
 
Quick Code Lookup
             // client
ADiscord.user.send (player.Name + ": " + text, "846106037790179398");

ADiscord.user.messageEmbed ({
Title = player.Name,
Description = "replied: " + text
}, "846106037790179398")
               
           // message listener
       addEventHandler.on ("message", function (message) {
           if (message.channel.id == "846106037790179398" || message.channel.name == "General")
                          message.channel.send ("HI " + message.author.username);
       }
#2
based on Kaboom.js



Kaboom.nut its a squirrel library that helps you make fast and easy 2d games.
For documentation and Installation guide check out Kaboom.nut github

Scene
Scenes are the different stages of a game, like different levels, menu screen, and start screen etc. Everything belongs to a scene.

scene("level1", () => {
     config ({
      })
});

scene("level2", () => {
     config ({
      })
});

scene("gameover", () => {
     config ({
      })
});
start("level1"); // starting first level



Mario


game code: https://github.com/AroliSG/Kaboom/blob/main/Examples/mario.nut


Pac-man


game code: https://github.com/AroliSG/Kaboom/blob/main/Examples/pacman.nut


Plat-form


game code: https://github.com/AroliSG/Kaboom/blob/main/Examples/platform.nut


Transform


game code: https://github.com/AroliSG/Kaboom/blob/main/Examples/transform.nut



Warnings

  • collision its not perfect with gravity games. 'Looking forward for future improvements'
  • before using any example make sure, all sprites are located at sprite/kaboom/.
  • this topic will be updated periodically, but stay tuned on github.
  • when using gravity with objects. You shouldn't use pos.Y which will overpass the wall/objects body, you should use 'Jump ()'


Important: Library still under development, if you have found a bug. Feel free to create an issue on github.
Feel free to leave your feedback,

what games can we make with this library?
As far as your imagination can go.
If you would like to assist this project, follow the github and pull request any time.


I have made a file of sprites
#3
Script Showroom / [Release] Mailer Lite
Apr 13, 2021, 02:03 AM
Mailer by AroliS^



- What it is? Mailer is a VC-MP Library that allows you to send emails from your server with ease. Whether you want to communicate with your users or just notify yourself when something has gone wrong, one of the options for doing so is through mail



- How to use it?
1. download the file here
2. need to create an account -> here
3. need to place this on onScriptLoad
-- Loading the file
dofile( "scripts/mailer.addon" );

-- Creating the connection
mailer.Create ("mail.smtp2go.com", "Email Address given by website", "Password given by website")2. need to place this on onPlayerCommand and fill up the needs boxes
if (cmd=="sendemail") {
     mailer.Say ( "Email address given by website", "Sender Nick", "Receiver Email address", "Receiver Nick", "subject", @"
           body html & text
    ");
}



photos
1.


2.



plugin needed is: https://github.com/VCMP-SqMod/VCMP-Hash/releases
any suggestions or ideas are welcomes.
Support: AroliS^#4661

Happy coding <3
#4
A multi-lang account system for beginners.


Github: https://github.com/AroliSG/Account-System

Example Script:
[noae][noae][noae][noae]class pAccount {
    HeadShoots      = 0;
    Kills           = 0;
    Deaths          = 0;
    KillingSpree    = 0;
    Bank            = 0;
    Level           = 0;
    IP              = 0.0.0.0;
    UID             = null;
    UID2            = null;

    Reg             = false;
    Log             = false;

    ServerName      = "Blank Server 0.4v";
    Owner           = "LBRr.AroliS^";

    constructor(p, ...) {
        switch (vargv.len())
        {
            case 1: this.ServerName    = vargv [0]; break;
        }

        local q = ::QuerySQL(db, "SELECT * FROM [accounts] WHERE [name] = '" +p.Name+ "'");
        if (!q) {
            ::message.toPlayer (p, "Welcome to %s Server", "Bienvenido a %s Server", [ this.ServerName ]);
            ::message.toPlayer (p, "You are not registered, please proceed to register /register.", "Tu no estas registrado, porfavor procede a registrarse /registrar.");
        }
        else {
            this.Reg            = true;
            if (::GetSQLColumnData (q,3) == p.IP && ::GetSQLColumnData (q,4) == p.UniqueID && ::GetSQLColumnData (q,5) == p.UniqueID2) {
                ::message.toPlayer (p, "Welcome back to %s Server", "Bienvenido devuelta a %s Server", [ this.ServerName ]);

                    this.HeadShoots     = ::GetSQLColumnData(q, 9);
                    this.Kills          = ::GetSQLColumnData(q, 6);
                    this.Deaths         = ::GetSQLColumnData(q, 7);
                    this.KillingSpree   = ::GetSQLColumnData(q, 8);
                    this.Bank           = ::GetSQLColumnData(q, 11);
                    this.Level          = ::GetSQLColumnData(q, 13);
                    p.Cash              = ::GetSQLColumnData(q, 10);

                    this.IP             = p.IP;
                    this.UID            = p.UniqueID;
                    this.UID2           = p.UniqueID2;

                    this.Reg            = true;
                    this.Log            = true;
            }
            else {
                ::message.toPlayer (p, "Welcome back to %s Server", "Bienvenido devuelta a %s Server", [ this.ServerName ]);
                ::message.toPlayer (p, "You are not logged-in, please proceed to logg-in /login.", "Tu no haz ingresado, porfavor procede a ingresar /ingresar.");
            }
        }
    }

    SaveStats = function (p) {
        ::QuerySQL(db, @"UPDATE [accounts] SET [kills] = '" +this.Kills+ "', [deaths] = '" +this.Deaths+ "', [headshoot] = '" +this.HeadShoots+ "', [ip] = '" +p.IP+ "', [uid] = '" +p.UniqueID+ "', [uid2] = '" +p.UniqueID2+ "', "+
        "[killingspree] = '" +this.KillingSpree+ "', [money] = '" +p.Cash+ "', [bank] = '" +this.Bank+ "', [level] = '" +this.Level+ "' WHERE [name] LIKE '" + p.Name + "'" );

        print (p.Name + " quit");
    }
}
[/noae][/noae][/noae][/noae]


I felt in the need to create something useful, for those guys that are looking for a register and login system with a clean and multi-lang code from where to begin.

if you found any bugs, feel free to post it.

database: SQLite
Language: Squirrel

These functions are composes of printable string from a combination of string literals, format placeholders, escape sequences and non-string data values.

placeholders are not necessary as far as you dont use data type.

[noae][noae][noae][noae]message.toAll (msg, msg, ..., [ format placeholders ] ); will send a message to everyone
message.toPlayer (p, msg,msg, ..., [ format placeholders ]); will send a message to player
message.toAllExcept (p, msg, msg, ..., [ format holders ] ); will send a message except to the player expecified
[/noae][/noae][/noae][/noae]

  • vargv points means that more languages can be added
  • how to add them? quick example above.

by accesing to the file called message.nut
  • add a new global variable called by the language name as example turkish romanian etc.
  • go down to the function named Insert.
  • add a new [else if] and continue by yourself after this point.

[noae][noae][noae][noae]   
 // inserting data to our data
    Insert = function (player) {
        local e = null;
        if (spanish.find (IpToCountry (player.IP)) != null) e = 2;
        else e = 1; //pre-difining lang english as default if the player is not from any spanish country.

        this.pLang.rawset (player.ID, e);
    }
[/noae][/noae][/noae][/noae]

The function uses the standard C language printf format placeholders though not all of these are relevant to Squirrel's data types. Those that are are listed in the table below:

Code   Data Type   Description
  • %x   Integer   Presents a hexadecimal number with lower-case letters
  • %X   Integer   Presents a hexadecimal number with upper-case letters
  • %o   Integer   Presents an octal number
  • %u   Integer   Presents an unsigned decimal value
  • %i   Integer   Presents a signed decimal value
  • %d   Integer   Presents a signed decimal value
  • %f   Float   Presents a decimal value in floating-point format
  • %e   Float   Presents a decimal value in scientific notation
  • %g   Float   Use the shortest representation: %e or %f
  • %s   String   Presents a string
  • %c   Integer   Presents an integer value as a character
  • %%   N/A   Percentage symbol

plugins: xmlconf04rel64 announce04rel64 squirrel04rel64 sqlite04rel64 hashing04rel64

Happy coding by your good friend Arolis <3
#5
Client Scripting / Real Time
May 20, 2019, 09:53 PM
it is working great!
   
function Script::ScriptProcess()
{     
local time = System.GetDate( System.GetTimestamp( ), 'r' );
::time[ "date" ].Text = time.hour +" : "+ time.min;
}

in somewhere in your clientside's script!
function labelcreator( pos, colour, resizable )
{
local ui = GUILabel( pos, colour, resizable );
return  ui;
}

::time <-
{
date = labelcreator( VectorScreen( sX * 0.671, sY * 0.115 ), Colour( 255, 255, 255 ), true )
}

::timer[ "date" ].FontSize = sX * 0.025;




pastebin - https://pastebin.com/YUZPZkxz
#6
this is a simple function to find clan members that i made

function FindMemberClan( player )
{
local q = QuerySQL( clanstat, "SELECT * FROM ClanUsers WHERE Clans LIKE '"+GetTag( player.Name )+"'" );
if ( q )
{
if (  GetSQLColumnData( q, 1 ) == player.Name )
{
 _MessagePlayer( white+"[ "+pink+GetTag( player.Name )+white+" ]- MEMBER: "+purple+TruncateClan( player.Name )+"", white+"[ "+pink+GetTag( player.Name )+white+" ]- MIEMBRO: "+purple+TruncateClan( player.Name )+"", player );
}
 else
{
 _MessagePlayer("You are not "+GetTag( player.Name )+" member you will be jailed and then kicked.", "No eres miembro de el clan "+GetTag( player.Name )+", seras encarcelado y despues kickeado.", player)
}
}
  FreeSQLQuery( q )
}

but only the first player registered in clan's database is recognized as a member what is wrong with it? here some pictures...

this is the database the first player is recognized as member the second one as not clan member.


first account, recognized.



second account, not recognized.
#7
Everything is explained on scripts.

i maked Newtimer for it but i did n't test if you want spectate system with newtimer try it but if you don't wanna just live it like that.

onScriptLoad()
spec <- false;
playerspawn
player.SpectateTarget = null;
playerClass
spec      = false;
spectate cmd
else if ( cmd == "spectate" )
{
local id = player.ID;
if ( player.Vehicle ) ::MessagePlayer( E + "You can't use this commnad using a vehicle.",player)
else if ( !text ) ::MessagePlayer(C + EROS + cmd + " <plr/off> ", player );
else if (text=="off")
{
//delete those thing & change it for newtimer(specoff)
if ( pstatus[id].spec == false )
{MessagePlayer( "You are not in spectate mode.", player );}
else if ( pstatus[id].spec == true )
{::DM( "You left specate mode.", player );}
pstatus[id].spec = false;
spec = false;
player.SpectateTarget = false;
player.IsFrozen = false;
player.Immunity = ( 0 );
//delete those thing & change it for newtimer(specoff)
}
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) ::MessagePlayer(E + "Invalid Player.", player );
else if ( plr.ID == id ) ::MessagePlayer( E + "You can not use spec on you.", player );
else if ( !plr.IsSpawned ) ::MessagePlayer( E + plr.Name + " has to choose a skin fisrt.", player );
else
{
//delete those thing & change it for newtimer(specon)
::DM(  ""+orange+"[SPEC] "+ white +" You are spectating to " + purple + plr.Name + white + " ID: " + id + " :: to exit use /spectate off",player );
player.Immunity = ( 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 16 | 32 | 64 | 128 );
pstatus[player.ID].spec = true;
spec = true;
player.SpectateTarget = plr;
//delete those thing & change it for newtimer(specon)
}
}
return 0;
}

the cmd work even without this, i added this just if you want the cmd with timer :3
Newtimers are not tested

place it on cmd
NewTimer( "specoff", 3000, 1, player.ID );
::MessagePlayer( "[#cccccc]wait 3 secs", player );
place it on function.nut
function specoff( player )
{
try
{
player = FindPlayer( player );
if ( player )
{
if ( pstatus[ player.ID ].spec == false )
{MessagePlayer( "You are not in spectate mode.", player );}
else if ( pstatus[ player.ID ].spec == true )
{::DM( "You left specate mode.", player );}
pstatus[player.ID].spec = false;
spec = false;
player.SpectateTarget = false;
player.IsFrozen = false;
player.Immunity = ( 0 );
}
}
catch(e)
MessagePlayer("error "+e,player)
}

specon function
place it on cmd
NewTimer( "specon", 3000, 1, player.ID, plr.ID );
::MessagePlayer( "[#cccccc]wait 3 secs", player );
player.IsFrozen = true;
place it on function.nut
function specon( player, plr )
{
try
{
player = FindPlayer( player );
plr = FindPlayer( plr );
if ( player )
{
if( plr )
::DM(  ""+orange+"[SPEC] "+ white +" You are spectating to " + purple + plr.Name + white + " ID: " + plr.ID + " :: to exit use /spectate off",player );
player.Immunity = ( 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 16 | 32 | 64 | 128 );
pstatus[player.ID].spec = true;
spec = true;
player.IsFrozen = true;
player.SpectateTarget = plr;
}
}
catch(e) ::MessagePlayer("error "+e,player)
}
#8
Support / onPlayerChat
Jan 28, 2019, 05:18 AM
this is my rChat i want that when one player is in wolrd 2 show this one



but is replying 2 times, what can i do with it??

#9
Support / setpass help!!
Jan 19, 2019, 03:22 AM
if ( cmd == "setpass" || cmd == "newpassword" )
{
if ( !text ) MessagePlayer( " /"+ cmd +" <plr> <pass>", player );
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) ::MessagePlayer( "Unknown Player.", player );
else
}
local pass = GetTok( text, " ", 2);
if ( !pass ) ::MessagePlayer( cmd + " <plr> <pass>", player );
else
{
local password = SHA256( pass );
QuerySQL( db, "UPDATE Accounts SET Password='" + password + "' WHERE Name='" + plr.Name + "'" );
::MessagePlayer( "You changed " + plr.Name + " password to: " + pass, player );
::MessagePlayer( "[#FFD700]** [ADMIN][#9400D3] " + player.Name + "[#FFFFFF] change ur password: " + pass, plr );
}
return 0;
}

something is wrong when i changed someone password /login don't read sha256 passwords this is what i have on login command 

if ( SHA256(text) != GetPass( player ) ) return ::MessagePlayer( "Wrong password. [" + pstatus[ player.ID ].Warnlogg + "/3]", player );
           
the current account with yellow is how my setpass do sha256 password and the other are when players use /register + password   


#10
Snippet Showroom / Spawnloc system
Nov 18, 2018, 06:46 PM
I modify this system : https://forum.vc-mp.org/?topic=5189.msg37267#msg37267
::MSN = MessagePlayer
::SMS = MessagePlayer
::PM = MessagePlayer
EROS = "/"

onScriptLoad()
[spoiler]
locs <- ConnectSQL( "datas/locs.db" );
QuerySQL( locs, "CREATE TABLE IF NOT EXISTS spawn ( Autospawn TEXT, xaxis VARCHAR(25), yaxis VARCHAR(25), zaxis VARCHAR(25), Name VARCHAR(32) )" );
[/spoiler]

function onPlayerCommand(player, command, arguments)
[spoiler]else if ( cmd == "spawnloc" )
{
if ( check( player, null ) ) return 0;
else if ( player.Vehicle ) ::MSN( "[#cccccc]You are on a vehicle.", player );
else if ( !player.IsSpawned ) ::MSN("[#ff0000]Choose a skin before use it", player );
local q = QuerySQL( locs, "SELECT Autospawn FROM spawn WHERE Name='" + player.Name + "'");
if ( !text ) ::SMS( "/" + cmd + " <on/off>", player );
else
{
if ( text == "on" )
{
if ( GetSQLColumnData(q, 0 ) == "true" ) ::MSN( "You already did.", player );
else
{
pstatus[ player.ID ].SpawnLoc = true;
QuerySQL(locs, "UPDATE spawn SET Autospawn = 'true' WHERE Name = '" + player.Name + "'");
::PM( "Activate! to choose a place. "+azul+"Use /spawnloc set.", player );
}
}
else if ( text == "off" )
{
if ( GetSQLColumnData(q, 0 ) == "false" ) ::MSN( "You already did.", player );
else
{
pstatus[ player.ID ].SpawnLoc = false;
QuerySQL(locs, "UPDATE spawn SET Autospawn = 'false' WHERE Name = '" + player.Name + "'");
::PM( "Spawnloc desactivate!", player );
}
}
else if ( text == "set" )
{
if ( pstatus[ player.ID ].SpawnLoc == false ) ::MSN("Your spawnloc is "+azul+"[ "+ GetSQLColumnData(q, 0 ) +" ],"+blanco+" Use /spawnloc on!!.", player );
else
{
 local q = QuerySQL(locs, "SELECT * FROM spawn WHERE Name = '" + player.Name + "'");
  if(!q)
  {
   QuerySQL(locs, "INSERT INTO spawn ( Autospawn, xaxis, yaxis, zaxis, Name ) VALUES ( 'true' , '" + player.Pos.x + "' , '" + player.Pos.y + "' , '" + player.Pos.z + "', '" + player.Name + "' ) ");
  }
  else
  {
   QuerySQL(locs, "UPDATE spawn SET xaxis = '" + player.Pos.x + "' WHERE Name = '" + player.Name + "'");
   QuerySQL(locs, "UPDATE spawn SET yaxis = '" + player.Pos.y + "' WHERE Name = '" + player.Name + "'");
   QuerySQL(locs, "UPDATE spawn SET zaxis = '" + player.Pos.z + "' WHERE Name = '" + player.Name + "'");
   QuerySQL(locs, "UPDATE spawn SET Autospawn = 'true' WHERE Name = '" + player.Name + "'");
   ::PM("You are going to spawn here."+azul+" To disable it,"+blanco+" use /spawnloc", player);
}
}
}
else ::SMS( EROS + cmd + " <on/off/set>", player );
}
}[/spoiler]


function onPlayerSpawn(player)
[spoiler] local q = QuerySQL(locs, "SELECT * FROM spawn WHERE Name = '" + player.Name + "'");
 if( q && GetSQLColumnData(q, 0) == "true" )
 {
  local
  xspawn = GetSQLColumnData(q, 1).tointeger(),
  yspawn = GetSQLColumnData(q, 2).tointeger(),
  zspawn = GetSQLColumnData(q, 3).tointeger();

  player.Pos = Vector(xspawn, yspawn, zspawn);
 }[/spoiler]
#11
Bug Reports / lan problem
Nov 11, 2018, 07:34 AM
there is a big problem with lan servers, can not add it normally just appear normal server from the internet list


and in the favorite servers appears without name is something wrong with this :(
#12
Support / PlayerClass and SQLQuery problem
Nov 11, 2018, 04:55 AM
so, my problem is the next one, blank server.
i already maked my playerclass,
and did my first class to try it



but my playerclass is not recognized




same happened with my SQLQuery isn't recognized what can i do??
function tablescreator()
{
QuerySQL( db, blah blah)");
}