login
April 16, 2024, 10:53:08 pm

Author Topic: [Squirrel] Undocumented Functions  (Read 2808 times)

0 Members and 1 Guest are viewing this topic.

stormeus

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 1755
  • Country: us
  • VC:MP Developer
    • View Profile
    • GTA VICE CITY Respective owner
[Squirrel] Undocumented Functions
« on: April 06, 2012, 11:21:22 pm »
Seeing that most of us here are pretty decent scripters, I'm going to leave a list of undocumented functions in the Squirrel server that were found. I really don't like the idea of having "zomg excloosive" scripts when these functions are present in every copy of the Squirrel server. I also don't like having one server be able to use scripts that were accidentally skipped over when documenting the wiki, as it lowers the quality of other servers and makes the community overall shittier.

tl;dr morphine and gudio be mad

I did not do this alone. Gudio had found some other functions, and Morphine encouraged me to find the functions and, if my memory serves me right, found a couple as well. If you must ask what these do or how you use these, close this tab or window right now.

I decided not to post this on the official VC:MP Squirrel forum because god knows how many nabs await there.



Level 1
Stuff with no wiki pages

Player.SetIgnoredBy( Player playerToBlock, Boolean toBlock )
This will make the player ignore the given playerToBlock parameter, if toBlock is true. In other words, they'll be muted only to that player. When set to false, they are unmuted to the blocking player.

Player.IsIgnoredBy( Player playerPossiblyBlocked )
Returns boolean (true/false) value of whether the Player object is ignoring the playerPossiblyBlocked parameter.

SetWeaponDamage( Integer weapon, Float damage )
Does what it says on the label; default values for weapons are unknown. It's likely they correspond to the game's weapon configuration.

RemoveAllPickups( void )
Does what it says on the label; should remove all pickups.



Level 2
Shit that doesn't even appear on the wiki

onPlayerCrashDump( Player player, CrashAddress crash )
Called when a player performs a crash dump. However, their disconnection is not automatic. You will need to kick the player to make good use of this event.

onBannedConnectionAttempt( String IP )
Called when an RCON-banned player queries or attempts to join the server. Only their IP is passed, as a proper Player object is impossible to create given the nature of the event.

String Player.Velocity
Simply prints the string "Velocity" and is of no use.

Vector2D Vehicle.Velocity
Working vehicle velocity counter which can be useful for making speedometers. Returns a two-dimensional vector (x, y) which can then be used to calculate speed using this code:

Code: (Squirrel) [Select]
local v = player.Vehicle.Velocity;
local s = ( ( sqrt( (v.x * v.x) + (v.y * v.y) ) * 230 ) + 0.5).tointeger(); // kilometers per hour

GetPickupCount( void )
Simply returns the pickup count. Good if you dynamically create pickups but don't want to reach the limit.

GetVehicleCount( void )
Like GetPickupCount, returns the number of vehicles on the server.

CreateStaticVehicle( Integer model, Vector pos, Float angle, Integer col1, Integer col2 )
Working alias to CreateVehicle and can be used at any point in the script like CreateVehicle.

SetPlayerDesyncedPos( Player player, Vector pos )
Unknown if working. If it does work, this function presumably sets a desynced player's position, which will appear unchanged to synced players.

SetVehicleDesyncedPos( Vehicle vehicle, Vector pos )
See SetPlayerDesyncedPos



Level 3
Console commands

unload_script filename
Unloads a script according to filename

load_script filename
Loads a script according to filename (see: load_script)



Orange -- Unknown if working



This information is likely going to be copied to the official Squirrel wiki... eventually. ::)
« Last Edit: April 08, 2012, 10:49:08 pm by stormeus »
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

<krystianoo> stormeus do good job
<krystianoo> with recent update
<krystianoo> if not agree; jeb yourself in head
<Avenger> yesterday you said death to stormeus
<karan> double standard krystianoo
<karan> he called him fake prophet too
<krystianoo> sure fake prophet
<krystianoo> but with recent updates real

Zeke

  • Crazy Man
  • *****
  • Posts: 935
  • Country: bg
  • VC:MP and LU beta tester
    • View Profile
Re: [Squirrel] Undocumented Functions
« Reply #1 on: April 06, 2012, 11:28:02 pm »
Cool stuff, good work.
If you can add all the MySQL missing thingys from the wiki, id be pro.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

Quote
InstallHook(0x405AC0,(DWORD)CantFindFuckingAnim,0x405A95,
CantFindFuckingAnim_HookJmpCode,sizeof(CantFindFuckingAnim_HookJmpCode));
-------------------------------------------------
Quote
[00:41:12] <~Murdock> actually just transfering files
[00:41:16] <~Murdock> sounds, clientscripts etc
[00:42:05] <heekzs> what transfer method you uses
[00:43:03] <~Murdock> speed of light

GranDoIz

  • Crazy Man
  • *****
  • Posts: 690
  • Country: mz
  • Palestine Will Be Free (°_°) Freedom
    • View Profile
Re: [Squirrel] Undocumented Functions
« Reply #2 on: April 06, 2012, 11:58:38 pm »
GoooD  ;D
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


morphine

  • Crazy Man
  • *****
  • Posts: 1909
  • Country: lt
    • View Profile
Re: [Squirrel] Undocumented Functions
« Reply #3 on: April 07, 2012, 12:36:20 am »
Edited onPlayerCrashDump.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


tato

  • Vice Underdog Rookie (Inactive)
  • Fanatic
  • *
  • Posts: 134
    • View Profile
    • Extreme Addicts
Re: [Squirrel] Undocumented Functions
« Reply #4 on: April 07, 2012, 06:12:41 am »
omfg!! awesome great..i bet there are more out there :thumbsup: :thumbsup: :thumbsup:
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


Midiox

  • Crazy Man
  • *****
  • Posts: 459
    • View Profile
Re: [Squirrel] Undocumented Functions
« Reply #5 on: April 07, 2012, 08:24:07 am »
Good job  :thumbsup:
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


Charley

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 4751
  • Country: 00
    • View Profile
Re: [Squirrel] Undocumented Functions
« Reply #6 on: April 07, 2012, 10:16:26 am »
Nice one Stormeus. I played around with the IgnoredBy functions about a year ago and encountered some problems, I can't remember their exact nature though.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

Writer of excessively long posts


morphine

  • Crazy Man
  • *****
  • Posts: 1909
  • Country: lt
    • View Profile
Re: [Squirrel] Undocumented Functions
« Reply #7 on: April 07, 2012, 12:49:08 pm »
player.SetIgnoredBy( plr, true );

Blocks messages sent by "player" to "plr". This includes private messages and public chat messages. i.e. chat messages sent by "player" will not be seen by "plr".
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


stormeus

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 1755
  • Country: us
  • VC:MP Developer
    • View Profile
    • GTA VICE CITY Respective owner
Re: [Squirrel] Undocumented Functions
« Reply #8 on: April 07, 2012, 01:56:17 pm »
Modified Player.SetIgnoredBy, GetIgnoredBy

Added GetVehicleCount

Added Player.Velocity which requires testing
doesn't work lol

Added Vehicle.Velocity as a presumption, since Player.Velocity exists in the code. Requires testing.
Works!

Modified CreateStaticVehicle
« Last Edit: April 07, 2012, 02:23:39 pm by stormeus »
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

<krystianoo> stormeus do good job
<krystianoo> with recent update
<krystianoo> if not agree; jeb yourself in head
<Avenger> yesterday you said death to stormeus
<karan> double standard krystianoo
<karan> he called him fake prophet too
<krystianoo> sure fake prophet
<krystianoo> but with recent updates real

Charley

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 4751
  • Country: 00
    • View Profile
Re: [Squirrel] Undocumented Functions
« Reply #9 on: April 07, 2012, 05:27:17 pm »
Yeah it wasn't a problem in the syntax Morphine, it was to do with sync. The actual function didn't function how it should, that's all I remember.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

Writer of excessively long posts


morphine

  • Crazy Man
  • *****
  • Posts: 1909
  • Country: lt
    • View Profile
Re: [Squirrel] Undocumented Functions
« Reply #10 on: April 08, 2012, 07:53:15 am »
It's extremely confusing at first. I had to ask AdTec how to get it to work and.. I got it to work. :D

This is a little cut from the command which uses this function in Vice Legends (and works, surprisingly):

Code: [Select]
player.SetIgnoredBy( playerToIgnore, true );
                                        VCLPrivMessage( "You have muted everything related to " +  playerToIgnore.Name + " from your game.", player );

I've made a mistake in the last post I think.. it's a bit vice-versa with the player pointers here. Mixing them up is deadly.   :thumbsdown:
« Last Edit: April 08, 2012, 07:57:09 am by Morphine »
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


stormeus

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 1755
  • Country: us
  • VC:MP Developer
    • View Profile
    • GTA VICE CITY Respective owner
Re: [Squirrel] Undocumented Functions
« Reply #11 on: April 08, 2012, 10:49:20 pm »
Modified SetIgnoredBy, IsIgnoredBy
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

<krystianoo> stormeus do good job
<krystianoo> with recent update
<krystianoo> if not agree; jeb yourself in head
<Avenger> yesterday you said death to stormeus
<karan> double standard krystianoo
<karan> he called him fake prophet too
<krystianoo> sure fake prophet
<krystianoo> but with recent updates real