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.

Messages - [R3V]Kelvin
Client Scripting / [Repost] Re: Snow Effect
« on November 1st, 07:56 AM »
Quote from Sebastian on November 1st, 07:46 AM
Maan, make nice description to it !
Here some help:

PS: Glad you didn't forget :D Great effect!
haha I attached this video to the repo's file. I thought it wasn't necessary to attach it here as well. About making a 'nice description' to it - I assumed the video itself was self-explanatory. :P
Thank you for your comments!
Client Scripting / [Repost] Snow Effect
« on November 1st, 04:01 AM »
Hello again.
Well, this script was originally posted last year on December 14th. Back then I thought it was irrelevant so I decided to delete it; but a few months later I got surprised when I found out some people, being one of them @Sebastian actually liked it when we had a little chat in the official VC:MP Discord server; then we came to an agreement - I told him I'll be reposting this in November so here I am. I promise I won't delete it again this time. :P

In this one-year period I've learned the basics of GitHub, so this time the script is on GitHub and it was rewritten from scratch with a few minor improvements. Anything you need to know can be found in the link below:

Thank you.
It's because not all of road textures are used from generic.txd, only a few ones, like those in the screenshot. The rest of road textures are located in gta3.img. If this wasn't the case, generic.txd would be a lot larger than it usually is.
Using Colour() within a GUILabel element constructor will fail to set label's alpha. Its alpha will always be initialized at 255. However, if you decide to use label.Colour = Colour( r, g, b, a ); or label.Alpha = alpha; it will just work fine.


What you were doing when the bug happened
Attempting to initialize a GUILabel element with alpha set to 0 using Colour() in its constructor:

Code: [Select]
label <- null;

function Script::ScriptLoad()
 ::label = ::GUILabel( ::VectorScreen( ::GUI.GetScreenSize().X * 0.48, ::GUI.GetScreenSize().Y * 0.51 ), ::Colour( 255, 255, 255, 0 ), "Hello there." );

What you think caused the bug
No idea. This bug seems to be affecting GUILabel elements only.
This is an old video I uploaded years ago. I uploaded it to show it to stormeus when a 04rel004 update fucked up the sync and he fixed it right away. It has nothing to do with what is being discussed on this topic.
Quote from We3da on April 5th, 10:17 PM
Its give me error here:-
Code: [Select]
if (firstletter == "\")
The console tell me 'error newline in constant'
Just like @Xmair said, you need to escape the backslash. So you can replace it with either
Code: [Select]
if ( firstletter == "\\" )
Code: [Select]
if ( firstletter == @"\" )
Quote from We3da on March 25th, 09:51 PM
i want the name like John_smith, Mohamed_L'oujdi, i want if the player not typing the symbole return false.
Considering what you said here, I made the following function that will only return true if the nickname format is A_B (where A and B are letters from a/A to z/Z). It's expected to return false otherwise.
Code: [Select]
function IsNicknameValid( nickname )
 return regexp( @"^\a+_\a+$" ).match( nickname );

So, this
Code: [Select]
IsNicknameValid( "abc" );
IsNicknameValid( "_abc" );
IsNicknameValid( "abc_" );
IsNicknameValid( "abc__def" ); // Note the double underscore.
IsNicknameValid( "abc_def_ghi" );
IsNicknameValid( "_" );
IsNicknameValid( "________" );

// No numbers or special caracters allowed.
IsNicknameValid( "Hack_Man69" );
IsNicknameValid( "Mohamed_VC-MP" );
will return false, whereas
Code: [Select]
IsNicknameValid( "abc_def" );
IsNicknameValid( "Hack_Man" );
IsNicknameValid( "Mohamed_VCMP" );
will return true.

I used Squirrel's regexp() function for this example. You can learn more about this function by clicking here.
Quote from We3da on March 21st, 06:02 PM
How i can send two string like:- SendDataToServertext(one.Text,two.Text, 15).
You call the Stream.WriteString() method twice, i.e.:
Code: [Select]
function SendDataToServertext( str1, str2, int )
 local stream = Stream();

 stream.WriteInt( int );
 stream.WriteString( str1 );
 stream.WriteString( str2 );

 Server.SendData( stream );

Usage example:
Code: [Select]
function Script::ScriptLoad()
 ::SendDataToServertext( "hello", "hi", 15 );

Server side usage example:
Code: [Select]
function onClientScriptData( player )
 // We call the Stream.ReadInt() method first because it was the first one to be sent from the client,
 // therefore we must call it first. Same applies with the strings.

 local int = Stream.ReadInt(); // Integer received from the client.
 local str1 = Stream.ReadString(); // First string received from the client.
 local str2 = Stream.ReadString(); // Second string received from the client.

 Message( "int: " + int );
 Message( "str1: " + str1 );
 Message( "str2: " + str2 );


Code: [Select]
_label <- null;

function Script::ScriptLoad()
 screenSize          = ::GUI.GetScreenSize(),
 label               = ::GUILabel( ::VectorScreen( ( screenSize.X * 0.005 ), ( screenSize.Y * 0.96 ) ), ::Colour( 255, 255, 255 ), format( "Hey, %s. Welcome to the server!", ::World.FindLocalPlayer().Name ) );
 label.FontName      = "Verdana";
 label.FontSize      = ( screenSize.X * 0.2 );
 label.FontFlags     = GUI_FFLAG_BOLD;
 label.TextAlignment = GUI_ALIGN_LEFT;

 ::_label = label;

which will display:
(click to show/hide)

if you want to delete the message, use:
Code: [Select]
::_label = null;
you could do something like this:

Code: [Select]
playerProfession <- array( GetMaxPlayers(), 0 ); // 0 for no profession.

function getPlayerProfessionName( player )
 switch( playerProfession[ player.ID ] )
  case 1:
   return "Police Officer";

  case 2:
   return "Firefighter";

  case 3:
   return "Paramedic";

 return "Citizen";

function onPlayerChat( player, message )
 Message( format( "[%s] %s: %s", getPlayerProfessionName( player ), player.Name, message ) );

 return 0;

function onPlayerPart( player, reason )
 playerProfession[ player.ID ] = 0;

all you have to do is to assign players a profession anytime using:
Code: [Select]
playerProfession[ player ID ] = profession ID;

for example:
Code: [Select]
function onPlayerCommand( player, command, arguments )
 if ( command == "cop" )
  playerProfession[ player.ID ] = 1;

  PrivMessage( player, "You are now a Police Officer!" );
According to littlewhitey's database, there are two accounts matching the result 'TonyMontana' which means you'll have to either register another account or, if you are the owner of either accounts, login yourself into the server using /login <password>.

Support / Re: CAN'T JOIN servers - update FAIL- Wiki DOWN ??
« on April 4th, 2020, 12:32 PM »
Quote from Thijn on April 4th, 2020, 10:45 AM
The latest 006 version has been on my updater for about a week.
so, it’s ok then
sorry for pointing out something that belongs to the past :P
Support / Re: ERROR ?? cannot join servers - update fail ?
« on April 4th, 2020, 01:33 AM »
as far as I know, thijn’s updater url doesn’t contain the latest 04rel006 version files, so that could cause players to be unable to play in some servers, such as littlewhitey’s, as they are instantly disconnected from the server that they’re attempting to play on
Support / Re: Error logging in to the server
« on July 18th, 2019, 05:29 PM »
for those who can't see the image:
Support / Re: Immediately disconnected from server
« on July 13th, 2019, 04:15 AM »
littlewhitey's server kicks you if you have an unallowed file (.dll/.asi), verify if the only .dll file you have is Mss32.dll (in your game's root directory). I don't know if this applies to VKs server as well