KP Lol plugin
-
Recently I stumbled upon a plugin named “KP Lol” by themilkman which was posted on lr.org.
I’m reposting it here with permission:KP Lol is a Freelancer plugin I have been working on for the past year or so. It adds a console to the game, where you can issue commands. It has a very big list of commands, and I designed it with the intention that it could help other people design DLL plugins or even help modders debug their mods.
Also, KP Lol will only work in singleplayer. It will refuse to work if you are on a multiplayer server.
So no worrying about cheating =DSome of its features other than console commands:
- Has a Lua interpreter (you can write Lua scripts)
Through Lua, you can have custom functions called
when a key is pressed in-game.
There is also a lot of functions you can call from Lua
that do the same thing as some console commands.
You can also modify FL’s constants through Lua. - View and edit Freelancer’s memory
- Hook custom code
- Cloaking when a key is pressed.
And there are many many more commands, not just these.
Ok, here is a list of console commands:
mark
unmark
malloc <bytes>free <pointer>view <pointer><bytes>edit <pointer><bytes>hex <string><- converts a string to hex bytes
script <string><- this executes a lua script
matrix <x><y><z><- converts Euler angles to a rotation matrix
quaternion <x><y><z><- converts Euler angles to a quaternion, for use in storyline missions.
setrotation <shipid><x><y><z>drainshield <shipid>hash <string><- Calculates a hashcode for a string
getposition <shipid>sethealth <shipid><value>activate <shipid><equipid><value>enumcargo
randompos <- this one moves the player to a random position in the system
setposition <shipid><x><y><z>setorientation <shipid><column><row><value>killship <shipid>offset <module><pointer><- this one will take an offset from a file, and get
the position of it in memory.
For example, say you found a value in http://www.memes.no/88flak/downloads/beta/1.1_Offsets.txt
you wanted to change while the game was running. Just type in “offset common.dll 13E6D0”
and you can then use the “view” and “edit” commands to view and change that value.
invulnerable <shipid>give_stackable <itemname><amount>give_nonstackable <itemname><amount>setcash <amount>forceland <basename>setrank <rank>setrep <faction><value>setmusic <musicid>callsign <faction><form> <num1><num2>getsystem
getplayer
gettarget
settarget
maxammo
ship_info <pointer>exit
about
commandsList of Lua functions you can use in your scripts:
conprint(“string”)
Prints string to the KP lol console.
Conprint shouldn’t be called during a function registered with regkey().player_getpos()
Returns the player’s x, y, and z coords.player_setpos(x, y, z)
Sets the player’s coords.player_gettarget()
Returns the player’s target ID.player_getspaceid()
Returns the player’s ship ID.player_setrot(x, y, z)
Sets the player’s x, y, and z rotation values.player_getrot()
Returns the player’s x, y, and z rotation values.player_setrep(“faction”, value)
Sets the player’s current reputation with a factionplayer_getrep(“faction”)
Returns the player’s current reputation with a faction.ship_getpos(id)
Returns a ship’s x, y and z coords.ship_setpos(id, x, y, z)
Sets a ship’s x, y, and z coords.ship_gettarget(id)
Returns another ship’s target ID.ship_setrot(id, x, y, z)
Sets the player’s x, y, and z rotation values.ship_getrot(id)
Returns the player’s x, y, and z rotation values.hash(“string”)
Creates a hashcode for string.playsound(hash)
Plays the sound identified by hash.playmusic(hash)
Plays the music identified by hash.player_land(“base”)
Lands the player on the specified base.player_setcash(amount)
Sets the player’s current funds.player_getcash()
Returns the player’s current funds.player_setrank(amount)
Sets the player’s level.player_getrank()
Returns the player’s level.player_additem(hash, amount)
Gives amount of hash to the player.player_getship()
Returns the player’s shiparch ID.mark(id)
Marks a ship on the player’s HUD.unmark(id)
Unmarks a ship on the player’s HUD.regkey(key, “function”)
Calls “function” when key is pressed.The following constants are accessible from Lua as globals:
CHATTER_MAX_DIST
CHATTER_MAX_DIST_ATTEN
CHATTER_START_ATTEN
COLLISION_DAMAGE_FACTOR
COMM_PLAYER_FAR_DIST
COMM_PLAYER_FAR_DIST_ATTEN
FIRE_FAILED_DELAY
JETTISONED_CARGO_VELOCITY
LOOT_OWNER_SAFE_TIME
LOOT_UNSEEN_LIFE_TIME
LOOT_UNSEEN_RADIUS
MUSIC_CROSS_FADE_DELAY
MUZZLE_CONE_ANGLE
PLAYER_ATTACHED_EQUIP_HIT_PTS_SCALE
PLAYER_COLLISION_GROUP_HIT_PTS_SCALE
WALLA_MAX_DIST
WALLA_MAX_DIST_ATTEN
WALLA_START_ATTEN
CRUISE_ACCEL_TIME
CRUISE_ATTEN_MOD_RANGE
CRUISE_ACCEL_TIME
CRUISE_DRAG
CRUISE_STEADY_TIME
CRUISING_SPEED
THROTTLE_ATTEN_MOD_RANGE
THROTTLE_STEADY_TIMEI plan on expanding on commands and lua constants.
Also, if anyone would like to give suggestions for commands or Lua functions
go ahead and I will try to add them in.</pointer></num2></num1></form></faction></musicid></value></faction></rank></basename></amount></amount></itemname></amount></itemname></shipid></pointer></module></shipid></value></row></column></shipid></z></y></x></shipid></value></equipid></shipid></value></shipid></shipid></string></shipid></z></y></x></shipid></z></y></x></z></y></x></string></string></bytes></pointer></bytes></pointer></pointer></bytes>Here it is for you all to test out.
Extract the whole contents to Freelancer/EXE and then add kplol.dll to [Libraries] in dacom.ini
If you have any questions or find any bugs, PM me or send me an email at [email protected],
and let me know what you guys think.The really interesting part is the Lua interface which allows for easy scripting. I’d like to write a similar (FLHook) plugin one day that would allow for Lua scripts. I think this could easily be the future for FL speciality modding.
- Has a Lua interpreter (you can write Lua scripts)
-
Awesome.
-
I’d quite like to do something along those lines with FLHook + Python. Possibly client-side as well, but I expect that wouldn’t go down as well if it could be used to cheat. (Obviously, I would refuse to not distribute the source with it if I ever got around to coding such a thing.)
Edit: Fenris_Wolf did an embedded Perl plugin for FLHook a while back: http://the-starport.net/freelancer/forum/viewtopic.php?topic_id=2483
-
i would like to use this kplol to give items to player at the end of events directly InGame without using IonCross.
I try clientside -> “no cheating permitted in MP” message
Must i use it in serverside ? How configure it ?
and the randompos can be good to make some mini events like HideSeekDestroy