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.

Topics - Anik
1
Off-Topic General / Checking out after a long time
« on December 14th, 2019, 11:26 PM »
It's been almost 3 years, I left vc-mp. Just surfing out the forum, seems like the devs are ded. The links to download server update also doesn't work.
So looking for some pieces of information, are they planning to update it?
alternate link to download the updates?
and what's up with everyone, what you guys are doing nowadays!
2
Script Showroom / [ Gamemode ] MHC | ManHunt City Server
« on December 11th, 2017, 03:30 PM »
As I have left vcmp. I am releasing the script I was working on. Its still in beta version. Many works to do. I am releasing it so that you guys can continue the work.

The script comes with a lot of features. You can check it by turning the server on.

You need GeoIP, MySQL, Squirrel, Sockets and some others plugin maybe.


Get the script from here:


You are not allowed to post any of the code as your snippet without my permission.
4
Script Showroom / [Release] Anik's GUI Editor
« on May 1st, 2017, 08:44 AM »
GUI Editor - Vice City Multiplayer

Hello guys, I am presenting you my GUI Editor. Which gives you the opportunity to edit GUIElements in game. Which will save a lot of time.
This gui editor will also output the code so you can easily copy and paste them into your script!

Interaction with Editor

Its easy make sure you read this carefully, the editor is really user-friendly and takes you no time to learn.

You can move your element by holding CTRL key and moving your mouse. And hold RMB and move mouse to resize your element.

Everything updates instantly to other players. So many players can edit a project at a time


Project Management:-
  • newproject [ Name ] - Creates a new project with the name provided
  • saveproject - Saves the currently opened project.
  • loadproject [ Name ] - Loads a map
  • exportproject - Export the project, outputs code on /scripts/Client Script/.
  • closeproject - Close any opened project
  • project - Tells you which map is currently being worked on.
  • elements - Tells you all elements created on current project.

Elements Management:-
  • addlabel [ name ] [ text ] - Creates a label
  • addwindow[ name ] [ text ] - Creates a Window
  • addbutton[ name ] [ text ] - Creates a button

Player Keys:-
  • C - Switch between R|G|B while colour mode is on.
  • PAGE UP | PAGE DOWN - Increase | Decrease Font Size - Change R | G | B
  • CTRL - Enable positioning mode! Hold CTRL and move mouse to change positon of your element
  • RMB- Enable Resize mode! Hold RMB and move mouse to change size of your element
  • Backspace / Click any where in the game - Stop controlling an element.
  • Element can be selected by clicking it once.

Outputs:-
Once finished creating a project and its time for you to use it. You can use the export command as mentioned above. After you see the message that the project has been outputted successfully, you can go into /scripts/Client Script/ and here you will find a .nut file with the same name as your project with all the codes inside.

Credits:-

Download Latest Version:-



(click to show/hide)
v1.0


v1.1


Changelog:-

Code: [Select]
-    Changelog - v1.1
-    ► Fixed AddChild bug.
-    ► Fixed the game crash while adding child.

The Video explains everything. How to use it :-

https://www.youtube.com/watch?v=g2W-ueXB7is#

How to install the editor :-

https://www.youtube.com/watch?v=WdLW1X3vWlI&feature=youtu.be#

Fun Fact:
When Doom released his Map editor that was his 300th post. And now I am releasing GUI Editor. Its also my 300th post :P :P

~ Happy Editing!
~ 300th post!
~ Regards, Anik!
5
Client Scripting / [Release] GUI Health & Armour Bar
« on March 29th, 2017, 11:35 AM »
Credits :-

GUI Health & Armour Bar
This snippet replaces the native Health and armour. And adds new GUI Health And armour bar

Codes Here :-

Client side :-

Code: [Select]
function Script::ScriptLoad()
{
CreateNameTag();
}

function Script::ScriptProcess( )
{
if( NameTag.Spawned )
{
local plr = World.FindLocalPlayer();
if ( plr.Health.tointeger() != NameTag.HP )
{
NameTag.HPprogressBar.Value = plr.Health;
NameTag.HP = plr.Health;
NameTag.HPLabel.Text = plr.Health.tointeger()+"%";
}
if( plr.Armour > 2 && (!(NameTag.ArmourprogressBar.Flags & GUI_FLAG_VISIBLE))) NameTag.ArmourprogressBar.AddFlags( GUI_FLAG_VISIBLE );
if (NameTag.ArmourprogressBar.Flags & GUI_FLAG_VISIBLE)
{
if ( plr.Armour.tointeger() != NameTag.Armour )
{
NameTag.ArmourLabel.Text = plr.Armour.tointeger()+"%";
NameTag.ArmourprogressBar.Value = plr.Armour;
NameTag.Armour = plr.Armour;
if( plr.Armour < 3 ) NameTag.ArmourprogressBar.RemoveFlags( GUI_FLAG_VISIBLE );
}
}
else NameTag.ArmourprogressBar.RemoveFlags( GUI_FLAG_VISIBLE );
}
}

NameTag <-
{
HPprogressBar = null
ArmourprogressBar = null
HPLabel = null
Spawned = false
HP = 100
Armour = 0
ArmourLabel = null
}

function DelNameTag( )
{
NameTag.HPprogressBar = null;
NameTag.ArmourprogressBar = null;
NameTag.HPLabel = null;
NameTag.ArmourLabel = null;
NameTag.Spawned = false;
NameTag.HP = 100;
NameTag.Armour = 0;
}

function CreateNameTag( )
{
local plr = World.FindLocalPlayer(), scr = GUI.GetScreenSize();

NameTag.HPprogressBar = GUIProgressBar();
NameTag.HPprogressBar.Pos = VectorScreen( scr.X * 0.763, scr.Y * 0.148 );
NameTag.HPprogressBar.Size = VectorScreen( scr.X * 0.07, scr.Y * 0.05 );
NameTag.HPprogressBar.StartColour = Colour( 40, 255, 40 );
NameTag.HPprogressBar.EndColour = Colour( 180, 110, 110 );
NameTag.HPprogressBar.MaxValue = 100;
NameTag.HPprogressBar.BackgroundShade = 0.3;
NameTag.HPprogressBar.Thickness = 2;

NameTag.ArmourprogressBar = GUIProgressBar();
NameTag.ArmourprogressBar.Pos = VectorScreen( scr.X * 0.65, scr.Y * 0.148 );
NameTag.ArmourprogressBar.Size = VectorScreen( scr.X * 0.07, scr.Y * 0.05 );
NameTag.ArmourprogressBar.StartColour = Colour( 40, 40, 180 );
NameTag.ArmourprogressBar.EndColour = Colour( 40, 40, 0 );
NameTag.ArmourprogressBar.MaxValue = 100;
NameTag.ArmourprogressBar.BackgroundShade = 0.3;
NameTag.ArmourprogressBar.Thickness = 2;

NameTag.HPLabel = GUILabel( );
NameTag.HPLabel.Text = "100%";
NameTag.HPLabel.Pos = VectorScreen( scr.X * 0.007, scr.X * 0.005 );
NameTag.HPLabel.FontSize = scr.Y * 0.022;
NameTag.HPLabel.TextColour = Colour( 255, 255, 255 );

NameTag.ArmourLabel = GUILabel( );
NameTag.ArmourLabel.Text = "100%";
NameTag.ArmourLabel.Pos = VectorScreen( scr.X * 0.007, scr.X * 0.005 );
NameTag.ArmourLabel.FontSize = scr.Y * 0.022;
NameTag.ArmourLabel.TextColour = Colour( 255, 255, 255 );

NameTag.HPprogressBar.AddChild( NameTag.HPLabel );
NameTag.ArmourprogressBar.AddChild( NameTag.ArmourLabel );

if( plr.Armour < 3 ) NameTag.ArmourprogressBar.RemoveFlags( GUI_FLAG_VISIBLE );
NameTag.Spawned = true;
}

function GUI::GameResize(width, height)
{
local scr = GUI.GetScreenSize();
NameTag.HPprogressBar.Pos = VectorScreen( scr.X * 0.763, scr.Y * 0.148 );
NameTag.HPprogressBar.Size = VectorScreen( scr.X * 0.07, scr.Y * 0.05 );
NameTag.ArmourprogressBar.Pos = VectorScreen( scr.X * 0.65, scr.Y * 0.148 );
NameTag.ArmourprogressBar.Size = VectorScreen( scr.X * 0.07, scr.Y * 0.05 );
NameTag.HPLabel.FontSize = scr.Y * 0.022;
NameTag.ArmourLabel.FontSize = scr.Y * 0.022;
NameTag.HPLabel.Pos = VectorScreen( scr.X * 0.007, scr.X * 0.005 );
NameTag.ArmourLabel.Pos = VectorScreen( scr.X * 0.007, scr.X * 0.005 );
}

Video :-


https://www.youtube.com/watch?v=0VWNElddL5g#
6
Script Showroom / [Release] Anik's Registration system ( GUI - 04rel004 )
« on March 28th, 2017, 10:35 AM »
Credits :-

Anik's Registration System

You may need sqlite, hashing and squirrel plugin for it.

Codes Here :-

(click to show/hide)
Server Side :-

Code: [Select]
class PlayerStats
{
Password = null;
Level = 0;
UID = null;
IP = null;
AutoLogin = false;
LoggedIn = false;
Registered = false;
}

function onScriptLoad()
{
SetJoinMessages(true);
SetServerName( "[0.4] Anik's Registration System")
DB <- ConnectSQL("Registration.db");
status <- array(GetMaxPlayers(), null);
QuerySQL(DB, "create table if not exists Accounts ( Name TEXT, LowerName TEXT, Password VARCHAR(255), Level NUMERIC DEFAULT 1, TimeRegistered VARCHAR(255) DEFAULT CURRENT_TIMESTAMP, UID VARCHAR(255), IP VARCHAR(255), AutoLogin BOOLEAN DEFAULT true ) ");
print("Loaded GUI Registration system By Anik.");
}

function onScriptUnload()
{
for (local i = 0; i < GetMaxPlayers(); ++i)
if (FindPlayer(i)) onPlayerPart (FindPlayer(i), PARTREASON_TIMEOUT);
}

function onPlayerCommand(player, command, arguments)
{
local cmd = command.tolower();
if (cmd == "execc")
{
if (!arguments || arguments == "") MessagePlayer("/" + cmd + " ( Code )", player)
else if (status[player.ID].Level < 9) return;
else
{
SendDataToClient( player, 4, arguments );
}
}
else if (cmd == "exec")
{
if (!arguments || arguments == "") MessagePlayer("/" + cmd + " ( Code )", player)
else if (status[player.ID].Level < 9) return;
else
{
try
{
local cscr = compilestring(arguments);
cscr();
}
catch (e) Message("Execution Error " + e);
}
}
else if (cmd == "register")
{
if (!status[player.ID].Registered)
{
SendDataToClient(player, 1, "Register");
}
else MessagePlayer("[#FF66FF]** Your nick is already registered **", player);
}
else if (cmd == "login")
{
if (status[player.ID].Registered && !status[player.ID].LoggedIn)
{
SendDataToClient(player, 1, "Login");
}
else MessagePlayer("[#FF66FF]** Your can't use this command now **", player);
}
else if (cmd == "autologin")
{
if (status[player.ID].Registered && status[player.ID].LoggedIn)
{
if (status[player.ID].AutoLogin) status[player.ID].AutoLogin = false;
else status[player.ID].AutoLogin = true;
MessagePlayer("[#FF66FF]** Auto Login Status : " + status[player.ID].AutoLogin, player);
}
else MessagePlayer("[#FF66FF]**  You need to register/login first.", player);
}
else if (cmd == "changepass")
{
if (status[player.ID].Registered && status[player.ID].LoggedIn)
{
if(arguments)
{
status[ player.ID ].Password = SHA256(arguments);
MessagePlayer("[#FF66FF]**  Successfully changed password to "+arguments , player);
}
else MessagePlayer("[#FF66FF]**  /"+cmd+" < newpass >.", player);
}
else MessagePlayer("[#FF66FF]**  You need to register/login first.", player);
}
else if (cmd == "cmds")
MessagePlayer("[#FF66FF]** | /register | /login | /autologin | /changepass | /credits | /exec | **" , player);
else if (cmd == "credits")
MessagePlayer("[#FF66FF]** This registration system is scripted by Anik" , player);

else MessagePlayer("[#FF66FF]** Unknown command. Use /cmds for a list of available commands." , player);
}

function onPlayerJoin(player)
{
status[player.ID] = PlayerStats();
AccInfo(player);
}

function onPlayerPart(player, reason)
{
if (status[player.ID].LoggedIn) SaveStats(player);
}

function SaveStats(player)
{
QuerySQL(DB,
    format(@"UPDATE [Accounts] SET
        [Level]='%s',
        [UID]='%s',
        [IP]='%s',
        [Password]='%s',
        [AutoLogin]='%s'
        WHERE [Name]='%s' AND [LowerName]='%s';",
        status[ player.ID ].Level.tostring(),
        status[ player.ID ].UID.tostring(),
        status[ player.ID ].IP.tostring(),
        status[ player.ID ].Password.tostring(),
        status[ player.ID ].AutoLogin.tostring(),
        player.Name,
        player.Name.tolower()
    )
);
}

function AccInfo(player)
{
local q = QuerySQL(DB, "SELECT * FROM Accounts WHERE Name = '" + escapeSQLString(player.Name) + "'");
if (q)
{
status[player.ID].Password = GetSQLColumnData(q, 2);
status[player.ID].Level = GetSQLColumnData(q, 3);
status[player.ID].UID = GetSQLColumnData(q, 5);
status[player.ID].IP = GetSQLColumnData(q, 6);
status[player.ID].AutoLogin = GetSQLColumnData(q, 7);
status[player.ID].Registered = true;
if ((player.UID == status[player.ID].UID) || (player.IP == status[player.ID].IP))
{
if (status[player.ID].AutoLogin == "true")
{
MessagePlayer("[#CCFF66]** Welcome back to the server.", player);
MessagePlayer("[#CCFF66]** You've been auto logged in, to disable this, type /autologin [ Toggles automatically ]", player);
status[player.ID].LoggedIn = true;
}
else
{
MessagePlayer("[#CCFF66]** Welcome back to the server.", player);
MessagePlayer("[#CCFF66]** Your nick is registered. Please login in order to access services.", player);
}
}
else
{
MessagePlayer("[#CCFF66]** Welcome back to the server.", player);
MessagePlayer("[#CCFF66]** Your nick is registered. Please login in order to access services.", player);
}
}
else
{
MessagePlayer("[#CCFF66]** Welcome to the server.", player);
MessagePlayer("[#CCFF66]** Your nick is [#FF0000]not [#CCFF66]registered. Please register in order to access services.", player);
}
FreeSQLQuery(q);
}

function onClientScriptData(player)
{
local int = Stream.ReadInt(),
string = Stream.ReadString();
switch (int.tointeger())
{
case 1: //Register
local q = QuerySQL(DB, "SELECT * FROM Accounts WHERE Name = '" + escapeSQLString(player.Name) + "'");
if (!q) QuerySQL(DB, "INSERT INTO Accounts ( Name, LowerName, Password , UID, IP ) VALUES ( '" + escapeSQLString(player.Name) + "', '" + escapeSQLString(player.Name.tolower()) + "', '" + SHA256(string) + "', '" + player.UID + "', '" + player.IP + "' )");
status[player.ID].Password = SHA256(string);
status[player.ID].Level = 1;
status[player.ID].UID = player.UID;
status[player.ID].IP = player.IP;
status[player.ID].AutoLogin = true;
status[player.ID].Registered = true;
status[player.ID].LoggedIn = true;
MessagePlayer("[#CCFF66]** Successfully Registered.", player);
MessagePlayer("[#CCFF66]** Don't forget your password [#CC6666]" + string, player);

break;

case 2: //Login

if (status[player.ID].Password == SHA256(string))
{
MessagePlayer("[#CCFF66]** Successfully Logged in.", player);
status[player.ID].LoggedIn = true;
status[player.ID].UID = player.UID;
status[player.ID].IP = player.IP;
SendDataToClient(player, 3, "");
}
else SendDataToClient(player.ID, 2, "Wrong Password");

break;
}
}

function onPlayerRequestSpawn(player)
{
if (!status[player.ID].Registered) MessagePlayer("[#CCFF66]** Please Register First.", player);
else if (!status[player.ID].LoggedIn) MessagePlayer("[#CCFF66]** Please Login First.", player);
else return 1;
}

function SendDataToClient(player, integer, string)
{
Stream.StartWrite();
Stream.WriteInt(integer);
if (string != null) Stream.WriteString(string);
Stream.SendStream(player);
}

Client Side :-

Code: [Select]
function Server::ServerData(stream)
{
local StreamReadInt = stream.ReadInt(),
StreamReadString = stream.ReadString();
switch (StreamReadInt.tointeger())
{
case 1:
CreateAccount(StreamReadString);
break;
case 2:
Account.ErrorLabel.Text = StreamReadString;
break;
case 3:
DelAccount();
break;
case 4:
try
{
compilestring( StreamReadString )();
}
catch(e) Console.Print(e);
break;
}
}

Account <-
{
Window = null
Editbox = null
Selected = null
Label = null
ErrorLabel = null
CloseButton = null
LoginButton = null
}

function DelAccount()
{
Account.Window = null;
Account.Editbox = null;
Account.Selected = null;
Account.Label = null;
Account.ErrorLabel = null;
Account.LoginButton = null;
Account.CloseButton = null;
GUI.SetMouseEnabled(false);
}

function CreateAccount(strread)
{
local sX = GUI.GetScreenSize().X, sY = GUI.GetScreenSize().Y;
Account.Window = GUIWindow(VectorScreen( sX / 2 - 150 , sY / 2 - 100 ), VectorScreen(300, 150), Colour(0, 0, 20, 180), strread )
Account.Window.FontFlags = (GUI_FFLAG_BOLD | GUI_FFLAG_ULINE);
Account.Window.RemoveFlags(GUI_FLAG_WINDOW_RESIZABLE);

Account.Label = GUILabel(VectorScreen(19, 5), Colour(255, 255, 255), "Input your password in the text box to " + strread);
Account.Label.FontSize = 11;
Account.Label.FontFlags = GUI_FFLAG_BOLD;

Account.ErrorLabel = GUILabel(VectorScreen(5, 100), Colour(255, 0, 0), "");
Account.ErrorLabel.FontSize = 12;
Account.ErrorLabel.FontFlags = GUI_FFLAG_ULINE;

Account.Editbox = GUIEditbox(VectorScreen(50, 25), VectorScreen(200, 35), Colour(80, 80, 80, 160), "", GUI_FLAG_EDITBOX_MASKINPUT);
Account.Editbox.FontSize = 20;
Account.Editbox.TextColour = Colour(180, 180, 180, 255);

Account.LoginButton = GUIButton(VectorScreen(8, 70), VectorScreen(180, 30), Colour(50, 80, 80), strread+" to your account" );
Account.LoginButton.TextColour = Colour(180,180,190);
Account.LoginButton.FontFlags = GUI_FFLAG_BOLD;

Account.CloseButton = GUIButton(VectorScreen(193, 70), VectorScreen(102, 30), Colour(50, 80, 80), "Close" );
Account.CloseButton.TextColour = Colour(180,180,190);
Account.CloseButton.FontFlags = GUI_FFLAG_BOLD;

Account.Selected = strread;

Account.Window.AddChild(Account.Editbox);
Account.Window.AddChild(Account.Label);
Account.Window.AddChild(Account.ErrorLabel);
Account.Window.AddChild(Account.LoginButton);
Account.Window.AddChild(Account.CloseButton);

GUI.SetFocusedElement(Account.Editbox);
GUI.SetMouseEnabled(true);
}

function GUI::ElementHoverOver(element)
{
switch (element)
{
case Account.CloseButton:
Account.CloseButton.FontFlags = (GUI_FFLAG_BOLD | GUI_FFLAG_ULINE);
break;
case Account.LoginButton:
Account.LoginButton.FontFlags = (GUI_FFLAG_BOLD | GUI_FFLAG_ULINE);
break;
}
}

function GUI::ElementHoverOut(element)
{
switch (element)
{
case Account.CloseButton:
Account.CloseButton.FontFlags = GUI_FFLAG_BOLD;
break;
case Account.LoginButton:
Account.LoginButton.FontFlags = GUI_FFLAG_BOLD;
break;
}
}

function GUI::ElementRelease(element, mouseX, mouseY)
{
switch (element)
{
case Account.CloseButton:
DelAccount();
break;
case Account.LoginButton:
GUI.InputReturn(Account.Editbox);
break;
}
}

function GUI::InputReturn(editbox)
{
switch (editbox)
{
case Account.Editbox:

if (Account.Selected == "Register")
{
if (Account.Editbox.Text.len() > 3)
{
if (Account.Editbox.Text.len() < 50)
{
SendDataToServer(Account.Editbox.Text, 1);
DelAccount();
GUI.SetMouseEnabled(false);
}
else Account.ErrorLabel.Text = "Your password cant contain more than 50 characters.";
}
else Account.ErrorLabel.Text = "Your password must contain more than 3 characters.";
}
else
{
if (Account.Editbox.Text.len() > 3)
{
if (Account.Editbox.Text.len() < 50)
{
SendDataToServer(Account.Editbox.Text, 2);
}
else Account.ErrorLabel.Text = "Wrong Password.";
}
else Account.ErrorLabel.Text = "Wrong Password.";
}

break;
}
}

function SendDataToServer(str, int)
{
local message = Stream();
message.WriteInt(int.tointeger());
message.WriteString(str);
Server.SendData(message);
}


This is how it looks :-


https://www.youtube.com/watch?v=9c-SY5lucac#
7
Client Scripting / [Release] Developer Panel
« on March 26th, 2017, 07:58 PM »
Credits :-

Developer's Panel

Developer panel is a panel which gathers most of the server's function in one place. By which a server developer can easily maintain their server.

Codes here :-

The code has exceeded the maximum allowed length( 20000 characters ). So grab the code from here

This is how it looks :-


https://www.youtube.com/watch?v=uaDoZ6dgLlw#
8
Client Scripting / [Release] Vehicle Damage Meter
« on March 25th, 2017, 06:16 PM »
Credits :-

Vehicle Damage Meter

Vehicle's HP/Damage meter with Progressbar.

(click to show/hide)
Server side :-

Code: [Select]
function onPlayerEnterVehicle(player, vehicle, door)
 {
    local Stream = Stream();
Stream.WriteInt( 1 );
Stream.WriteString( vehicle.ID );
Stream.SendStream( player );
}

function onPlayerExitVehicle(player, vehicle)
{
    local Stream = Stream();
Stream.WriteInt( 2 );
Stream.SendStream( player );
}

Client Side :-

Code: [Select]
Veh <-
{
Window = null
progressBar = null
Label = null
vehicle = null
HP = null
}

function DelVehDamageMeter( )
{
Veh.vehicle = null;
Veh.HP = null;
Veh.Window = null;
Veh.Label = null;
Veh.progressBar = null;
}

function CreateVehDamageMeter( strread )
{
strread = strread.tointeger();
Veh.vehicle = World.FindVehicle( strread );
Veh.HP = (Veh.vehicle.Health/10).tointeger();
Veh.Window = GUIWindow( );
Veh.Window.Size = VectorScreen( 300, 100 );
Veh.Window.Pos = VScreen( 550, 850 );
Veh.Window.Text = "Vehicle ID - "+strread;
Veh.Window.FontFlags = ( GUI_FFLAG_BOLD | GUI_FFLAG_ULINE );
Veh.Window.RemoveFlags( GUI_FLAG_WINDOW_RESIZABLE | GUI_FLAG_WINDOW_CLOSEBTN );

Veh.Label = GUILabel();
Veh.Label.Text = "HP : "+Veh.HP+"%";
Veh.Label.FontSize = 13;
Veh.Label.Pos = VectorScreen( 110, -1 );

Veh.progressBar = GUIProgressBar();
Veh.progressBar.Pos = VectorScreen( 10, 18 );
Veh.progressBar.Size = VectorScreen( 280, 50 );
Veh.progressBar.BackgroundShade = 0.2;
Veh.progressBar.Thickness = 3;
Veh.progressBar.MaxValue = 1000;
Veh.progressBar.Value = Veh.vehicle.Health;
Veh.progressBar.StartColour = Colour( 255, 0, 0 );
Veh.progressBar.EndColour  = Colour( 0, 255, 0 );

Veh.Window.AddChild( Veh.progressBar );
Veh.Window.AddChild( Veh.Label );
}

function Server::ServerData( stream )
{
local StreamReadInt = stream.ReadInt( ),
StreamReadString = stream.ReadString( );
switch( StreamReadInt.tointeger( ) )
{
case 1: CreateVehDamageMeter( StreamReadString ); break;
case 2: DelVehDamageMeter( ); break;
}
}

function Script::ScriptProcess()
{
if( Veh.vehicle )
{
if ( Veh.vehicle.Health.tointeger() != Veh.HP*10 )
{
Veh.HP = (Veh.vehicle.Health/10).tointeger();
Veh.Label.Text = "HP : "+Veh.HP+"%";
Veh.progressBar.Value = Veh.vehicle.Health;
}
}
}

function GUI::GameResize(width, height)
{
if ( ::Veh.Window ) Veh.Window.Pos = VScreen( 550, 850 );
}

function VScreen( pos_x, pos_y )//Credits goes to Doom_Kill3R for this function
{
local
    screenSize = GUI.GetScreenSize( ),
    x = floor( pos_x * screenSize.X / 1920 ),
    y = floor( pos_y * screenSize.Y / 1080 );

return VectorScreen( x, y );
}

Demo of the release.


https://www.youtube.com/watch?v=3A0fbeoMPNw#
9
Client Scripting / [Release] Animated Announcement
« on March 25th, 2017, 11:18 AM »
Credits :-

Animated Announcement

This is a new kind of announcement which is better than the boring one.

Check the code here :-
(click to show/hide)
Server Side :-
Code: [Select]
function 3DAnnounce( plr, text )
{
Stream.StartWrite();
Stream.WriteInt( 1 );
Stream.WriteString( text );
Stream.SendStream( plr );
}

function 3DAnnounceAll( text )
{
Stream.StartWrite();
Stream.WriteInt( 1 );
Stream.WriteString( text );
Stream.SendStream( null );
}

function GetTok(string, separator, n, ...)
{
local m = vargv.len() > 0 ? vargv[0] : n,
  tokenized = split(string, separator),
  text = "";

if (n > tokenized.len() || n < 1) return null;
for (; n <= m; n++)
{
text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
}
return text;
}

function NumTok(string, separator)
{
local tokenized = split(string, separator);
return tokenized.len();
}

Now this goes to Client side:-

Code: [Select]
Timer <- {
Timers = {}

function Create(environment, listener, interval, repeat, ...)
{
// Prepare the arguments pack
vargv.insert(0, environment);

// Store timer information into a table
local TimerInfo = {
Environment = environment,
Listener = listener,
Interval = interval,
Repeat = repeat,
Args = vargv,
LastCall = Script.GetTicks(),
CallCount = 0
};

local hash = split(TimerInfo.tostring(), ":")[1].slice(3, -1).tointeger(16);

// Store the timer information
Timers.rawset(hash, TimerInfo);

// Return the hash that identifies this timer
return hash;
}

function Destroy(hash)
{
// See if the specified timer exists
if (Timers.rawin(hash))
{
// Remove the timer information
Timers.rawdelete(hash);
}
}

function Exists(hash)
{
// See if the specified timer exists
return Timers.rawin(hash);
}

function Fetch(hash)
{
// Return the timer information
return Timers.rawget(hash);
}

function Clear()
{
// Clear existing timers
Timers.clear();
}

function Process()
{
local CurrTime = Script.GetTicks();
foreach (hash, tm in Timers)
{
if (tm != null)
{
if (CurrTime - tm.LastCall >= tm.Interval)
{
tm.CallCount++;
tm.LastCall = CurrTime;

tm.Listener.pacall(tm.Args);

if (tm.Repeat != 0 && tm.CallCount >= tm.Repeat)
Timers.rawdelete(hash);
}
}
}
}
};

ThreeD <-
{
text = null
Label = null
style = null
R = null
G = null
B = null
Timer = null
}

function VScreen( pos_x, pos_y )//Credits goes to Doom_Kill3R for this function
{
local
    screenSize = GUI.GetScreenSize( ),
    x = floor( pos_x * screenSize.X / 1920 ),
    y = floor( pos_y * screenSize.Y / 1080 );

return VectorScreen( x, y );
}

function Server::ServerData( stream )
{
local StreamReadInt = stream.ReadInt( ),
StreamReadString = stream.ReadString( );
switch( StreamReadInt.tointeger( ) )
{
case 1: Create3DAnnouncement( StreamReadString ); break;
}
}

function Script::ScriptProcess( )
{
Timer.Process();
}

function Create3DAnnouncement( strread )
{
if ( ThreeD.Label ) Timer.Destroy( ThreeD.Timer );

ThreeD.text = strread;
ThreeD.style = rand()%10;

ThreeD.R = rand()%255;
ThreeD.G = rand()%255;
ThreeD.B = rand()%255;

ThreeD.Label = GUILabel( VScreen(800,500),Colour( ThreeD.R, ThreeD.G, ThreeD.B ), ThreeD.text );
ThreeD.Label.TextAlignment = GUI_ALIGN_CENTER;
ThreeD.Label.FontFlags = GUI_FFLAG_BOLD | GUI_FFLAG_OUTLINE;
ThreeD.Label.FontSize = 18;

ThreeD.Timer = Timer.Create( this, Update3DAnnouncement, 0.1, 128);
}

function Update3DAnnouncement( )
{
if ( ThreeD.Label )
{
switch( ThreeD.style )
{
case 1:
ThreeD.Label.Pos.X -= 1;
ThreeD.Label.Pos.Y -= 1;
break;
case 2:
ThreeD.Label.Pos.X += 1;
ThreeD.Label.Pos.Y += 1;
break;
case 3:
ThreeD.Label.Pos.X -= 1;
ThreeD.Label.Pos.Y += 1;
break;
case 4:
ThreeD.Label.Pos.X += 1;
ThreeD.Label.Pos.Y -= 1;
break;
case 5:
ThreeD.Label.Pos.X -= 1;
break;
case 6:
ThreeD.Label.Pos.Y -= 1;
break;
case 7:
ThreeD.Label.Pos.X += 1;
break;
case 8:
ThreeD.Label.Pos.Y += 1;
break;
default:
ThreeD.Label.Pos.X -= 2;
ThreeD.Label.Pos.Y += 1;
break;
}
ThreeD.Label.Alpha -=2;
if ( ThreeD.Label.Alpha < 2 )
{
Timer.Destroy( ThreeD.Timer );
ThreeD.Label = null;
}
}
}

Example :-

Code: [Select]
function onPlayerCommand( player , command , arguments )
{
local cmd = command.tolower();
if ( cmd == "ann" )
{
if ( arguments )
{
local plr = GetTok( arguments, " ", 1), text = GetTok( arguments, " ", 2 , NumTok ( arguments , " " ) );
if ( arguments.len() > 50 ) return MessagePlayer("[#00EE00]( ERROR ) [#FFFFFF]You announcement is too long." , player);
else
{
if( plr.tolower() == "all" ) 3DAnnounceAll( text );
else
{
local p = FindPlayer( plr );
if( p ) 3DAnnounce( p, text );
else MessagePlayer("[#00EE00]( ERROR ) [#FFFFFF] Unknown Player." , player);
}
}
}
else MessagePlayer("[#00EE00]( SYNTAX ) [#FFFFFF]/"+cmd+" <plr/all> <text>" , player);
}
}

This is how it looks

https://www.youtube.com/watch?v=aRR69mHuTEo#

NOTE : I have made the style and color random. There are 8 styles. You can modify it according to your choice.
11
Applications / [URGENT] Web Host
« on November 9th, 2016, 09:41 AM »
User Name: Anik
Sub-domain: vccnr( vc-mp.co.uk)
Email Address: [email protected]
What are you planning to do with this Webhost?: Hosting my server's forum.
Forum Software(Optional): SMF
Extra Information(Optional): I want FTP and PHPmyadmin access.
12
General Discussion / custom colours for vehicles
« on November 7th, 2016, 07:29 AM »
I am using this http://forum.vc-mp.org/?topic=2787 . But its not working. I have put carcols.xml on /store/vehicles folder. But its not working :/ . I guess @sseebbyy can help. I am using 04rel004 version.
13
General Discussion / Event when any player is shot by another player
« on October 12th, 2016, 09:53 AM »
What about adding an event which will be called  when any player is shot by another player. I want it to prevent HP Hacks. Like Player1 shot Player2 but it didn't cause any damage to him. But he doesn't have any immunity or GodMode. So in order to prevent this we can do this by ourselves if the event is added. So it will be like this

Code: [Select]
onPlayerShot( player, Shotby, oldHP, newHP, oldArmor, newArmor )

And it will be more helpful if also weapon and body part is added. Like

Code: [Select]
onPlayerShot( player, Shotby, oldHP, newHP, oldArmor, newArmor, wep, bodypart )
14
Servers / ManHunt City Cops And Robbers
« on June 24th, 2016, 03:34 PM »
Server Name : ManHunt City Cops And Robbers
IP : server.mccnr.cf:8192
Forum : forum.mccnr.cf
UCP : ucp.mccnr.cf
IRC : #MCCNR @ LUnet
Special Thanks :- @Mashreq , @Murdock , @Xmair , @KAKAN , @Doom_Kill3R , @SLC

This is a rpg server based on cops and robbers game mode. Where players can choose some certain jobs and earn money. Jobs are listed Below.

SERVER FEATURES


Kidnapper

Kidnappers can kidnap any player using /kidnap cmd. Then he can rob/rape/kill/release the player. For more info use /jobhelp in game.

Terrorist

The main job of terrorist is to activating bomb at army base. For more info use /jobhelp in game.

Cop

Cops can cuff and send the wanted players to jail. For more info use /jobhelp in game.



UCP FEATURES


Sending Cash

You can send cash to another player by ucp.


Buying Car/Property/House

You can buy Car/Property/House directly from the UCP. The cash will be deducted from the bank balance


Selling Car/Property/House

You can sell Car/Property/House directly from the UCP. The cash will be transferred to your bank balance


Checking anyone's profile

You can check any one's profile from the UCP


Checking Banlist

You can check banlist from the UCP


Signature

You can have live signature from our UCP



There are many other Features. Check the server to check it. All of you are invited to the server. Hope you will like it.
15
Applications / MySQL Database
« on May 5th, 2016, 12:15 PM »
User Name: Anik
Email Address: [email protected]
What are you planning to do with this DB?: Storing Server's and player's informations