LUA API - xAranaktu/FC-24-Live-Editor GitHub Wiki
PLEASE SWTICH TO LUA API v2
Functions listed on this page may soon stop working.
FC Live Editor is using Lua 5.4.6 as main scripting language. You can execute lua code by opening Features -> Lua Engine -> execute.
Just for your info, Lua scripts created for cheat engine will not work.
- Log
- MessageBox
- IsInCM
- GetSaveUID
- GetCompetitionNameByID
- GetCompetitionNameByObjID
- GetCurrentDate
- GetUserTeamID
- GetTeamIdFromPlayerId
- GetTeamName
- GetPlayerName
- SetPlayerSharpness
- SetPlayerMorale
- SetPlayerForm
- SetPlayerFitness
- PlayerHasDevelopementPlan
- PlayerSetValueInDevelopementPlan
- GetPlayersStats
- GetPlayerStats
- DeletePlayer
- CreatePlayer
- PlayerExists
- TransferPlayer
- LoanPlayer
- ReleasePlayerFromTeam
- TerminateLoan
- DeletePresignedContract
- IsPlayerLoanedOut
- IsPlayerPresigned
- IsPlayerTransferListed
- IsPlayerLoanListed
- AddPlayerToTransferList
- AddPlayerToLoanList
- RemovePlayerFromLoanList
- RemovePlayerFromTransferList
- RemovePlayerFromLists
- CreateOfferForPlayer
- GetDBTablesNames
- GetDBTableFields
- GetDBTableRows
- InsertDBTableRow
- DeleteDBTableRow
- EditDBTableField
- PlayerCaptureSetOutputDirectory
- PlayerCaptureSetSize
- PlayerCaptureSetType
- PlayerCaptureSetCamera
- PlayerCaptureAddPlayer
- PlayerCaptureStart
- GetTransferBudget
- SetTransferBudget
Write to log file and console window.
void Log(string text)
Show MessageBox with given title and text
void MessageBox(string title, string text)
Check if we are in career mode.
bool IsInCM()
Type: Bool
- True if executed in career mode
- False if executed outside of career mode
local is_in_career_mode = IsInCM()
Log(type(is_in_career_mode))
if (is_in_career_mode) then
Log("In career mode")
else
Log("Not in career mode")
end
> boolean
> In career mode
Get career save unique identifier.
Identifier is stored in "sponsors" database table in "name" field as a 31 char long string where "adsponserid" == 8181 (I hope the 8181 ID isn't used by any mod).
Generates new UID on first call if doesn't exists.
In case of any problems the function will return empty string.
Constraints:
- Can be executed only in Career Mode.
string GetSaveUID()
Type: String
- 31 char long string
- OnError: Return empty string and write error in log file.
local bIsInCM = IsInCM();
if (bIsInCM) then
local UID = GetSaveUID()
Log(type(UID))
Log(string.len(UID))
Log(UID)
end
> string
> 31
> 104cde1628794d4aad00d081fe19343
Get Competition name by ID. The name is loaded from "id_map.json" file, from "compids" key. You can add there your custom competitions.
string GetCompetitionNameByID(int competition_id)
Type: String
- Name of the Competition
- OnError: Returns competition_id id with "C" prefix.
Log(GetCompetitionNameByID(10))
Log(GetCompetitionNameByID(19))
-- This doesn't exists
Log(GetCompetitionNameByID(22222))
> Eredivisie
> Bundesliga
> C22222
Get Competition name by Object ID. The name is loaded from "id_map.json" file, from "compobjids" key. You can add there your custom competitions.
string GetCompetitionNameByObjID(int competition_obj_id)
Type: String
- Name of the Competition
- OnError: Returns competition_id id with "COBJ" prefix.
Log(GetCompetitionNameByObjID(1098))
Log(GetCompetitionNameByObjID(985))
-- This doesn't exists
Log(GetCompetitionNameByObjID(22222))
> Eredivisie
> Bundesliga
> COBJ22222
Get current in-game date. In career it will return date from career_calendar. Outside of career it will be always 1st July 2021.
table GetCurrentDate()
Type: Table
Key(string)-Value(int) pair.
Valid keys:
- day
- month
- year
local currentdate = GetCurrentDate()
Log(type(currentdate))
Log(type(currentdate.day))
Log(type(currentdate.month))
Log(type(currentdate.year))
Log("Current Date (day/month/year): " .. currentdate.day .. "/" .. currentdate.month .. "/" .. currentdate.year )
> table
> number
> number
> number
> Current Date (day/month/year): 1/7/2021
Get value from field "clubteamid" from first record in career_users table. Should be our teamid in manager career mode.
Constraints:
- Can be executed only in Career Mode.
int GetUserTeamID()
Type: Int
- Teamid of the team managed by user.
- OnError: Return 0 and write error in log file.
-- In Career mode
-- Manager of Everton
local user_teamid = GetUserTeamID()
Log(type(user_teamid))
Log(user_teamid)
> number
> 7
Get teamid from playerid. Should be id of the player club. Ignore teams in following leagues:
- 78, International
- 2136, International Women
- 76, Rest of World
- 383, Create Player League
int GetTeamIdFromPlayerId(int playerid)
Type: Int
- Club TeamId for playerid
- Returns -1 if team not found
-- Messi PlayerID: 158023
-- FC Barcelona TeamID: 241
local teamid1 = GetTeamIdFromPlayerId(158023)
Log("teamid1 (158023): " .. teamid1)
assert(type(teamid1) == "number", "GetTeamIdFromPlayerId(158023) not a number")
-- Cristiano Ronaldo PlayerID: 20801
-- Piemonte Calcio TeamID: 114153
local teamid2 = GetTeamIdFromPlayerId(20801)
Log("teamid2 (20801): " .. teamid2)
assert(type(teamid2) == "number", "GetTeamIdFromPlayerId(20801) not a number")
> teamid1 (158023): 241
> teamid2 (20801): 114153
Get name of the team for passed teamid.
Name is stored in localized database file. For example, for English game version it will be eng_us_db.db.
string GetTeamName(unsigned int teamid)
Type: String
- Name of the team
- OnError: Return empty string and write error in log file.
local teamname = GetTeamName(7)
Log(type(teamname))
Log(teamname)
teamname = GetTeamName(241)
Log(teamname)
> string
> Everton
> FC Barcelona
Get name of the player for passed playerid.
string GetPlayerName(unsigned int playerid)
Type: String
- Name of the player
- OnError: Return empty string and write error in log file.
local playername = GetPlayerName(20801)
Log(playername)
playername = GetPlayerName(158023)
Log(playername)
> Cristiano Ronaldo
> Lionel Messi
Set player sharpness. Use value from 0 to 100.
Constraints:
- Can be executed only in Career Mode.
- Only for player in user team
void SetPlayerSharpness(playerid, new_sharpness)
None
-- Set Messi sharpness to 100
-- Will work only if Messi is in your team
SetPlayerSharpness(158023, 100)
Set player morale. Use value from 0 to 100.
Min. Morale levels (may be different if you use an mod which changes them):
- Below 15 for Very Unhappy
- 40 for Unhappy
- 65 for Content
- 75 for Happy
- 95 for Very Happy
Constraints:
- Can be executed only in Career Mode.
- Only for player in user team
void SetPlayerMorale(playerid, new_morale)
None
-- Set Messi morale to 95 (Very Happy)
-- Will work only if Messi is in your team
SetPlayerMorale(158023, 95)
Set player form. Use value from 0 to 100.
Min. Form levels (may be different if you use an mod which changes them):
- Below 25 for Bad
- 50 for Poor
- 65 for Okay
- 75 for Good
- 90 for Excellent
Constraints:
- Can be executed only in Career Mode.
- Only for player in user team
void SetPlayerForm(playerid, new_form)
None
-- Set Messi form to 90 (Excellent)
-- Will work only if Messi is in your team
SetPlayerForm(158023, 90)
Set player match fitness/durability/fitness/stamina (call it as you want ;)).
Use value from 5 to 95. Where 5 is completly tired and 95 is almost full fit. I don't recommend to set the value below 5 as it will probably bug the stamina bar. Above 95 may bug the whole player/game.
Constraints:
- Can be executed only in Career Mode.
void SetPlayerFitness(playerid, new_fitness)
None
-- Set Messi fitness to 95 (Almost Full Fit)
SetPlayerFitness(158023, 95)
Players in Manager Career mode that are in team managed by user got developement plans. Data stored in these plans got higher priority than fields in players table. Following fields are part of the developement plan:
- All attributes
- Workrates
- Skillmoves
- Weakfoot
Constraints:
- Can be executed only in Career Mode.
bool PlayerHasDevelopementPlan(int playerid)
Type: Bool
- True if player has developement plan
- False if player doesn't have developement plan
PlayerHasDevelopementPlan(158023)
Players in Manager Career mode that are in team managed by user got developement plans. Data stored in these plans got higher priority than fields in players table. Following fields are part of the developement plan:
- All attributes
- Workrates
- Skillmoves
- Weakfoot
Use this to set corresponding XP points for given field. Use fieldnames same as in players table
Constraints:
- Can be executed only in Career Mode.
void PlayerSetValueInDevelopementPlan(int playerid, string field_name, int value)
None
local bIsInCM = IsInCM();
if (bIsInCM) then
ReloadPlayersManager()
if (PlayerHasDevelopementPlan(158023)) then
PlayerSetValueInDevelopementPlan(158023, "composure", 99)
end
end
Get the current season stats of all players. Game generate the stats only for players that play in the same competitions as you + european & international cups.
array GetPlayersStats()
Type: Array
Array of items: Key(string)-Value(int) pair.
Valid keys:
- teamid
- playerid
- compobjid
- avg (needs to be devided by num of apps to get correct avg)
- goals
- yellow
- red
- app
- assists
- clean_sheets
- motm (not sure if data is correct)
- two_yellow (not sure if data is correct)
- goals_conceded (not sure if data is correct)
- saves (not sure if data is correct)
local stats = GetPlayersStats()
Log(string.format("GetPlayersStats - N of items: %d", #stats))
-- First player, firt competition
local player = stats[1]
Log(string.format(
"%s (ID: %d) - Goals: %d",
GetPlayerName(player.playerid), player.playerid, player.goals
))
> GetPlayersStats - N of items: 6962
> Pierluigi Gollini (ID: 211515) - Goals: 0
Get the current season stats for player by ID.
Array GetPlayerStats(int playerid)
Type: Array
Array of items: Key(string)-Value(int) pair.
Valid keys:
- teamid
- playerid
- compobjid
- avg (needs to be devided by num of apps to get correct avg)
- goals
- yellow
- red
- app
- assists
- clean_sheets
- motm (not sure if data is correct)
- two_yellow (not sure if data is correct)
- goals_conceded (not sure if data is correct)
- saves (not sure if data is correct)
-- 211515 = Pierluigi Gollini
-- He got stats in my career, may not in yours.
local stats = GetPlayerStats(211515)
Log(string.format("GetPlayerStats - N of items: %d", #stats))
for i=1, #stats do
local player = stats[i]
Log(string.format(
"%s (ID: %d) in Competition: %s - Goals: %d",
GetPlayerName(player.playerid), player.playerid, GetCompetitionNameByObjID(player.compobjid), player.goals
))
end
> GetPlayerStats - N of items: 3
> Pierluigi Gollini (ID: 211515) in Competition: FIFA World Cup� - Goals: 0
> Pierluigi Gollini (ID: 211515) in Competition: EC Qualifiers - Goals: 0
> Pierluigi Gollini (ID: 211515) in Competition: UECL - Goals: 0
Delete Player by ID from the game.
if player_current_teamid is 0 then the tool will call GetTeamIdFromPlayerId internally
To be more precise, the function will:
- Transfer Player to Free Agents
- Delete first playerid related record from "players" table
- Delete all playerid related records from "teamplayerlinks" table
void DeletePlayer(int playerid, int player_current_teamid=0)
None
-- Delete Messi
DeletePlayer(158023)
Create new player. By default the player is assigned to Free Agents team. Use TransferPlayer to move him to other team.
Leave playerid = 0 for random ID. players_row_data is table of items: Key(string)-Value(string) pair. where key is the fieldname of entry in "players" database table.
int CreatePlayer(int playerid, table players_row_data)
Type: Int
- The ID of created player.
- OnError: Return 0 and write error in log file.
-- Example creates Jerzy Dudek in Free Agents team
local playerid = 44897
-- Make sure we won't create duplicate
assert(PlayerExists(playerid) == false, string.format("Can't create. Player with ID: playerid %d already exists", playerid))
-- That will be inserted into players table
-- Missing fields will be replaced with lowest possible value by default (except playerid)
local player_data = {
skintypecode = "2",
trait2 = "0",
haircolorcode = "6",
facialhairtypecode = "3",
curve = "14",
jerseystylecode = "0",
agility = "68",
tattooback = "0",
accessorycode4 = "0",
gksavetype = "0",
positioning = "16",
tattooleftarm = "0",
hairtypecode = "150",
standingtackle = "19",
preferredposition3 = "-1",
longpassing = "27",
penalties = "24",
animfreekickstartposcode = "0",
isretiring = "0",
longshots = "19",
gkdiving = "86",
interceptions = "22",
shoecolorcode2 = "15",
crossing = "14",
potential = "86",
gkreflexes = "90",
finishingcode1 = "0",
reactions = "84",
composure = "50",
vision = "52",
contractvaliduntil = "2025",
finishing = "13",
dribbling = "14",
slidingtackle = "18",
accessorycode3 = "0",
accessorycolourcode1 = "0",
headtypecode = "2508",
driref = "90",
sprintspeed = "56",
height = "187",
hasseasonaljersey = "1",
tattoohead = "0",
preferredposition2 = "-1",
strength = "73",
shoetypecode = "1",
birthdate = "142605",
preferredposition1 = "0",
tattooleftleg = "0",
ballcontrol = "26",
phypos = "85",
shotpower = "59",
trait1 = "268435456",
socklengthcode = "0",
weight = "78",
hashighqualityhead = "0",
gkglovetypecode = "1",
tattoorightarm = "0",
balance = "61",
gender = "0",
headassetid = "44897",
gkkicking = "78",
defspe = "60",
internationalrep = "4",
shortpassing = "33",
freekickaccuracy = "27",
skillmoves = "0",
faceposerpreset = "0",
usercaneditname = "0",
avatarpomid = "0",
attackingworkrate = "0",
finishingcode2 = "0",
aggression = "42",
acceleration = "62",
paskic = "78",
headingaccuracy = "11",
iscustomized = "0",
eyebrowcode = "0",
runningcode2 = "0",
modifier = "1",
gkhandling = "83",
eyecolorcode = "6",
jerseysleevelengthcode = "1",
accessorycolourcode3 = "0",
accessorycode1 = "0",
playerjointeamdate = "160139",
headclasscode = "0",
defensiveworkrate = "0",
tattoofront = "0",
nationality = "37",
preferredfoot = "2",
sideburnscode = "0",
weakfootabilitytypecode = "3",
jumping = "71",
personality = "2",
gkkickstyle = "3",
stamina = "44",
marking = "26",
accessorycolourcode4 = "0",
gkpositioning = "85",
headvariation = "0",
skillmoveslikelihood = "0",
shohan = "83",
skintonecode = "3",
shortstyle = "0",
overallrating = "86",
smallsidedshoetypecode = "500",
emotion = "2",
runstylecode = "0",
jerseyfit = "0",
accessorycode2 = "0",
shoedesigncode = "0",
shoecolorcode1 = "0",
hairstylecode = "0",
bodytypecode = "5",
animpenaltiesstartposcode = "0",
pacdiv = "86",
runningcode1 = "0",
preferredposition4 = "-1",
volleys = "13",
accessorycolourcode2 = "0",
tattoorightleg = "0",
facialhaircolorcode = "3"
}
local created_playerid = CreatePlayer(playerid, player_data)
-- Create the name
local editedplayernames_row_data = {
playerid = string.format("%d", created_playerid),
firstname = "Jerzy",
surname = "Dudek",
playerjerseyname = "Dudek"
}
local row = InsertDBTableRow("editedplayernames", editedplayernames_row_data)
Log(string.format("Created Player - %s %s (ID: %s). Check Free Agents.", editedplayernames_row_data.firstname, editedplayernames_row_data.surname, editedplayernames_row_data.playerid))
> Created Player - Jerzy Dudek (ID: 44897). Check Free Agents.
Checks if Player with given playerid exists. Player ids must be unique, so use this function to make sure you won't create duplicated players.
bool PlayerExists(int playerid)
Type: Bool
- True if player exists
- False if player doesn't exists
- OnError: Return False and write error in log file.
-- Probably you don't have any guy with this ID
if PlayerExists(1) then
Log("Player with ID: 1 exists")
else
Log("Player with ID: 1 doesn't exists")
end
-- Messi, should be there.
if PlayerExists(158023) then
Log("Player with ID: 158023 exists")
else
Log("Player with ID: 158023 doesn't exists")
end
> Player with ID: 1 doesn't exists
> Player with ID: 158023 exists
WARNING
This can damage/break your career save (especially if you do something stupid, like trying to transfer player who is on loan in other club). Use with caution. Remember about backups. Tested only in Manager Career Mode. May not work in Player Career Mode
Immediately transfer player to any club (including yours).
Can be used even if the transfer window is closed.
Wage only matters if you transfer the player to your club.
if from_teamid is 0 then the tool will call GetTeamIdFromPlayerId internally
if release_clause is -1 then there won't be any release clause
Constraints:
- Can be executed only in Career Mode.
void TransferPlayer(playerid, to_teamid, transfersum, wage, contract_length_in_months, from_teamid=0, release_clause=-1)
or
void cTransferPlayer(playerid, from_teamid, to_teamid, transfersum, release_clause, wage, contract_length_in_months)
None
-- Transfer
-- Cristiano Ronaldo (playerid: 20801)
-- To Manchester United (ID: 11)
-- For 500 euro/usd/gbp
-- Wage = 600
-- contract length = 60 months (5 years)
playerid = 20801
if (IsPlayerPresigned(playerid)) then
-- Delete presigned contract to force transfer
DeletePresignedContract(playerid)
end
if (IsPlayerLoanedOut(playerid)) then
-- Terminate loan to force transfer
TerminateLoan(playerid)
end
TransferPlayer(20801, 11, 500, 600, 60)
WARNING
This can damage/break your career save. Use with caution. Remember about backups. Tested only in Manager Career Mode. May not work in Player Career Mode
Immediately loan player to any club (including yours).
Can be used even if the transfer window is closed.
if from_teamid is 0 then the tool will call GetTeamIdFromPlayerId internally
For now keep the loantobuy
== -1
. I don't know how it works exactly, maybe will fix it later.
Constraints:
- Can be executed only in Career Mode.
void LoanPlayer(playerid, to_teamid, length_in_months, loantobuy, from_teamid=0)
or
void cLoanPlayer(playerid, from_teamid, to_teamid, length_in_months, loantobuy)
None
-- Loan
-- Cristiano Ronaldo (playerid: 20801)
-- To Manchester United (ID: 11)
-- contract length = 12 months (1 year)
-- loantobuy = -1 (no loan to buy)
local playerid = 20801
local to_teamid = 11
if (IsPlayerPresigned(playerid)) then
-- Delete presigned contract to force loan
DeletePresignedContract(playerid)
end
if (IsPlayerLoanedOut(playerid)) then
-- Terminate loan to force new loan
TerminateLoan(playerid)
end
LoanPlayer(playerid, to_teamid, 12, -1)
WARNING
This can damage/break your career save (especially if you do something stupid, like trying to release player who is on loan in other club). Use with caution. Remember about backups.
Release player from current club.
Under the hood it's just transfering the player to free agents, like that:
player_teamid = GetTeamIdFromPlayerId(playerid)
free_agents_teamid = 111592
cTransferPlayer(playerid, player_teamid, free_agents_teamid, 0, 0, 0, 12)
Constraints:
- Can be executed only in Career Mode.
void ReleasePlayerFromTeam(playerid)
None
-- Make Messi Free Agent
ReleasePlayerFromTeam(158023)
WARNING
This can damage/break your career save. Use with caution. Remember about backups.
Terminates player loan. The player will immediately back to his club.
Constraints:
- Can be executed only in Career Mode.
void TerminateLoan(playerid)
None
-- Juan Camilo Hern�ndez will immediately back to Watford (if he is loaned out in your career)
playerid = 237034 -- Juan Camilo Hern�ndez
if (IsPlayerLoanedOut(playerid)) then
TerminateLoan(playerid)
end
WARNING
This can damage/break your career save. Use with caution. Remember about backups.
Delete player related record from career_presignedcontract table.
Constraints:
- Can be executed only in Career Mode.
void DeletePresignedContract(playerid)
none
-- Delete Juan Camilo Hern�ndez presigned contract(if he has one)
playerid = 237034 -- Juan Camilo Hern�ndez
if (IsPlayerPresigned(playerid)) then
DeletePresignedContract(playerid)
end
Check if player is loaned out.
Constraints:
- Can be executed only in Career Mode.
bool IsPlayerLoanedOut(playerid)
Type: Bool
- True if player is loaned out
- False if player isn't loaned out
-- Check if Juan Camilo Hern�ndez is loaned out
playerid = 237034 -- Juan Camilo Hern�ndez
if (IsPlayerLoanedOut(playerid)) then
Log("Player is Loaned out")
else
Log("Player isn't Loaned out")
end
Check if player is has presigned contract. To be more precise, it checks if the player reladed record exist in career_presignedcontract table
Constraints:
- Can be executed only in Career Mode.
bool IsPlayerPresigned(playerid)
Type: Bool
- True if player has got record in career_presignedcontract
- False if player hasn't got record in career_presignedcontract
-- Juan Camilo Hern�ndez will immediately back to Watford (if he is loaned out in your career)
playerid = 237034 -- Juan Camilo Hern�ndez
if (IsPlayerPresigned(playerid)) then
Log("Player is presigned")
else
Log("Player isn't presigned")
end
Check if player with given playerid is on transfer list. If given teamid == 0 then the tool will call GetTeamIdFromPlayerId internally.
Constraints:
- Can be executed only in Career Mode.
bool IsPlayerTransferListed(int playerid, int teamid=0)
or
bool cIsPlayerTransferListed(int playerid, int teamid)
Type: Bool
- True if player is on transfer list
- False if player isn't on transfer list
local bIsInCM = IsInCM();
if (bIsInCM) then
-- Check if Messi is on transfer list
local is_on_transferlist = IsPlayerTransferListed(158023)
if (is_on_transferlist) then
Log("Player is on transfer list")
else
Log("Player is not on transfer list")
end
end
Check if player with given playerid is on loan list. If given teamid == 0 then the tool will call GetTeamIdFromPlayerId internally.
Constraints:
- Can be executed only in Career Mode.
bool IsPlayerLoanListed(int playerid, int teamid=0)
or
bool cIsPlayerLoanListed(int playerid, int teamid)
Type: Bool
- True if player is on loan list
- False if player isn't on loan list
local bIsInCM = IsInCM();
if (bIsInCM) then
-- Check if Messi is on loan list
local is_on_loanlist = IsPlayerLoanListed(158023)
if (is_on_loanlist) then
Log("Player is on loan list")
else
Log("Player is not on loan list")
end
end
Adds player with given playerid to transfer list. If given teamid == 0 then the tool will call GetTeamIdFromPlayerId internally.
WARNING!!
Altho it's possible to make player transfer and loan listed, you shouldn't do that as it doesn't happen in "natural" game environment. So, player should be only on loan list or only on transfer list.
Constraints:
- Can be executed only in Career Mode.
void AddPlayerToTransferList(int playerid, int teamid=0)
or
void cAddPlayerToTransferList(int playerid, int teamid)
None
local bIsInCM = IsInCM();
if (bIsInCM) then
-- Make Messi transferlisted
AddPlayerToTransferList(158023)
end
Adds player with given playerid to loan list. If given teamid == 0 then the tool will call GetTeamIdFromPlayerId internally.
WARNING!!
Altho it's possible to make player transfer and loan listed, you shouldn't do that as it doesn't happen in "natural" game environment. So, player should be only on loan list or only on transfer list.
Constraints:
- Can be executed only in Career Mode.
void AddPlayerToLoanList(int playerid, int teamid=0)
or
void cAddPlayerToLoanList(int playerid, int teamid)
None
local bIsInCM = IsInCM();
if (bIsInCM) then
-- Make Messi loanlisted
AddPlayerToLoanList(158023)
end
Remove player with given playerid from transfer and loan list.
If given teamid == 0 then the tool will call GetTeamIdFromPlayerId internally.
Constraints:
- Can be executed only in Career Mode.
void RemovePlayerFromLists(int playerid, int teamid=0)
or
void cRemovePlayerFromLists(int playerid, int teamid)
None
local bIsInCM = IsInCM();
if (bIsInCM) then
-- Remove Messi from transfer and loan list
RemovePlayerFromLists(158023)
end
Remove player with given playerid from transfer list If given teamid == 0 then the tool will call GetTeamIdFromPlayerId internally.
Constraints:
- Can be executed only in Career Mode.
void RemovePlayerFromTransferList(int playerid, int teamid=0)
or
void cRemovePlayerFromTransferList(int playerid, int teamid)
None
local bIsInCM = IsInCM();
if (bIsInCM) then
-- Remove Messi from transfer list
RemovePlayerFromTransferList(158023)
end
Remove player with given playerid from loan list If given teamid == 0 then the tool will call GetTeamIdFromPlayerId internally.
Constraints:
- Can be executed only in Career Mode.
void RemovePlayerFromLoanList(int playerid, int teamid=0)
or
void cRemovePlayerFromLoanList(int playerid, int teamid)
None
local bIsInCM = IsInCM();
if (bIsInCM) then
-- Remove Messi from loan list
RemovePlayerFromLoanList(158023)
end
Create Transfer or Loan offer for player.
Offer type can be any value between 0 and 5 (maybe 6). Default offer type is 5. Game commonly uses offer type 3 or 5. For loan offer use offer type == 2 (sometimes you may get loan to buy offer instead of normal offer).
Created offer should appear in-game after 2-5 days. Transfer window probably must be open.
You can use this to create offers for your players and also to initiate transfers between CPU teams. Using this doesn't guarantee that the player will change his team. There is always chance that player or team will break negotiations.
The unrealistic transfer offers may not even appear. For example if you will try to create an transfer offer for Messi from AFC Wimbledon game may ignore it and not even show it (because AFC Wimbledon doesn't have enough transfer budget). If the transfer offer will somehow appear then for 99% it will fail later on when Messi will negotiate his wage with team (AFC Wimbledon doesn't have enough wage budget to cover Messi salary).
Constraints:
- Can be executed only in Career Mode.
void CreateOfferForPlayer(int playerid, int offer_from_teamid, int offer_type=5)
or
void cCreateOfferForPlayer(int playerid, int offer_from_teamid, int offer_type)
None
local bIsInCM = IsInCM();
if (bIsInCM) then
-- Create offer for Messi (playerid: 158023)
-- From Manchester City (teamid: 10)
-- With offer type == 5
CreateOfferForPlayer(158023, 10, 5)
end
Get names of database tables that we can access (same tables are available in Database Editor)
array GetDBTablesNames()
Type: Array of strings
- List of database tables names
- OnError: Return empty string and write error in log file.
local tables = GetDBTablesNames()
Log(type(tables))
Log(type(tables[1]))
Log(tables[1])
> table
> string
> assetcryptokeys
Get field (column) and their description for database table
table GetDBTableFields(string table_name)
Type: Array of DBFieldDescription
-- Get field names for career_users table_
local fields = GetDBTableFields("career_users")
-- Number of fields
Log(#fields)
Log(fields[1]["name"])
Log(fields[2]["name"])
Log(fields[3]["name"])
Log(fields[4]["name"])
> 16
> sponsorid
> leagueseasonmessagesent
> seasoncount
> playertype
Get all valid rows for database table
array GetDBTableRows(string table_name)
Type: Array of DBRow
-- Get all rows for teams table
local rows = GetDBTableRows("teams")
-- Number of rows
Log(#rows)
-- 1st row
local row = rows[1]
Log(row["teamname"]["value"])
Log(row["teamid"]["value"])
-- 6th row
local row = rows[6]
Log(row["teamname"]["value"])
Log(row["teamid"]["value"])
> 763
> Arsenal
> 1
> Everton
> 7
Inserts new row into database table.
table InsertDBTableRow(string table_name, table row_data)
Return newly created row
Type: DBRow
-- Assign custom name to Messi (Playerid: 158023)
local row_data = {
playerid = "158023",
firstname = "aaa",
surname = "bbb",
playerjerseyname = "ccc"
}
local row = InsertDBTableRow("editedplayernames", row_data)
Log(type(row))
-- That's how to verify if row has been inserted
if (row.addr == "0") then
Log("Insert row failed. Check logs for more info")
return
end
Log(row["playerid"]["value"])
> table
> 158023
Delete row from database table.
bool InsertDBTableRow(string table_name, table row_data)
Type: Bool
- True if row has been deleted
- False if failed
-- Assign custom name to Messi (Playerid: 158023)
local row_data = {
playerid = "158023",
firstname = "aaa",
surname = "bbb",
playerjerseyname = "ccc"
}
local row = InsertDBTableRow("editedplayernames", row_data)
-- That's how to verify if row has been inserted
if (row.addr == "0") then
Log("Insert row failed. Check logs for more info")
return
end
-- Delete the row that we just created
local success = DeleteDBTableRow("editedplayernames", row)
if (success) then
Log("Row deleted")
else
Log("Failed to delete row")
end
Row deleted
Edit field in database table
bool EditDBTableField(table field)
Type: Bool
- True if field edited succesfully
- False if failed
local success = false;
-- Get all rows for manager table
local rows = GetDBTableRows("manager")
-- first row
local row = rows[1]
-- Current Name of the manager
Log(row.firstname.value)
row.firstname.value = "Edited Firstname"
-- Commit
success = EditDBTableField(row["firstname"])
assert(success, "EditDBTableField false for firstname")
-- Current NationalityID of the manager
Log(row.nationality.value)
row.nationality.value = "37"
-- Commit
success = EditDBTableField(row["nationality"])
assert(success, "EditDBTableField false for nationality")
-- Check if values has changed
Log("After Edit")
-- Get all rows for manager table
local rows = GetDBTableRows("manager")
-- first row
local row = rows[1]
Log(row.firstname.value)
Log(row.nationality.value)
> Mikel
> 45
> After Edit
> Edited Firstname
> 37
Set the directory where generated images will be saved. Directory must exist. Path is relative to the game installation directory, so "LiveEditorMods\root\Legacy\data\ui\imgAssets\heads" will store images in "<YOUR_GAME_INSTALLATION_DIR>\LiveEditorMods\root\Legacy\data\ui\imgAssets\heads"
Constraints:
- Can be executed only in Career Mode.
void PlayerCaptureSetOutputDirectory(string output_directory)
void
-- Execute only if we are in career mode
if not IsInCM() then return end
-- Path is relative to the game installation directory
-- <default> means that the minifaces will be generated to your current Live Editor Mods directory (C:\FC 24 Live Editor\mods\root\Legacy\data\ui\imgAssets\heads if you didn't changed it')
PlayerCaptureSetOutputDirectory("<default>")
-- 0 - Head and shoulders
-- 1 - Head
-- 2 - Body
PlayerCaptureSetCamera(1)
-- 256x256
PlayerCaptureSetSize(256, 256)
-- Image Type
-- 0 - PNG
-- 1 - DDS
PlayerCaptureSetType(1)
-- Add Messi Capture
PlayerCaptureAddPlayer(158023, GetTeamIdFromPlayerId(158023))
-- Add Cristiano Ronaldo Capture
PlayerCaptureAddPlayer(20801, GetTeamIdFromPlayerId(20801))
-- Add Haaland Capture
PlayerCaptureAddPlayer(239085, GetTeamIdFromPlayerId(239085))
-- Start Capturing
PlayerCaptureStart()
Set size of the image output
Constraints:
- Can be executed only in Career Mode.
void PlayerCaptureSetSize(int width, int height)
void
-- Execute only if we are in career mode
if not IsInCM() then return end
-- Path is relative to the game installation directory
-- <default> means that the minifaces will be generated to your current Live Editor Mods directory (C:\FC 24 Live Editor\mods\root\Legacy\data\ui\imgAssets\heads if you didn't changed it')
PlayerCaptureSetOutputDirectory("<default>")
-- 0 - Head and shoulders
-- 1 - Head
-- 2 - Body
PlayerCaptureSetCamera(1)
-- 256x256
PlayerCaptureSetSize(256, 256)
-- Image Type
-- 0 - PNG
-- 1 - DDS
PlayerCaptureSetType(1)
-- Add Messi Capture
PlayerCaptureAddPlayer(158023, GetTeamIdFromPlayerId(158023))
-- Add Cristiano Ronaldo Capture
PlayerCaptureAddPlayer(20801, GetTeamIdFromPlayerId(20801))
-- Add Haaland Capture
PlayerCaptureAddPlayer(239085, GetTeamIdFromPlayerId(239085))
-- Start Capturing
PlayerCaptureStart()
Set type of the image output 0 - PNG 1 - DDS (DXT5)
Constraints:
- Can be executed only in Career Mode.
void PlayerCaptureSetType(int typ)
void
-- Execute only if we are in career mode
if not IsInCM() then return end
-- Path is relative to the game installation directory
-- <default> means that the minifaces will be generated to your current Live Editor Mods directory (C:\FC 24 Live Editor\mods\root\Legacy\data\ui\imgAssets\heads if you didn't changed it')
PlayerCaptureSetOutputDirectory("<default>")
-- 0 - Head and shoulders
-- 1 - Head
-- 2 - Body
PlayerCaptureSetCamera(1)
-- 256x256
PlayerCaptureSetSize(256, 256)
-- Image Type
-- 0 - PNG
-- 1 - DDS
PlayerCaptureSetType(1)
-- Add Messi Capture
PlayerCaptureAddPlayer(158023, GetTeamIdFromPlayerId(158023))
-- Add Cristiano Ronaldo Capture
PlayerCaptureAddPlayer(20801, GetTeamIdFromPlayerId(20801))
-- Add Haaland Capture
PlayerCaptureAddPlayer(239085, GetTeamIdFromPlayerId(239085))
-- Start Capturing
PlayerCaptureStart()
Set Capture Camera 0 - Head and Shoulders
1 - Head
2 - Body
Constraints:
- Can be executed only in Career Mode.
void PlayerCaptureSetCamera(int cameraID)
void
-- Execute only if we are in career mode
if not IsInCM() then return end
-- Path is relative to the game installation directory
-- <default> means that the minifaces will be generated to your current Live Editor Mods directory (C:\FC 24 Live Editor\mods\root\Legacy\data\ui\imgAssets\heads if you didn't changed it')
PlayerCaptureSetOutputDirectory("<default>")
-- 0 - Head and shoulders
-- 1 - Head
-- 2 - Body
PlayerCaptureSetCamera(1)
-- 256x256
PlayerCaptureSetSize(256, 256)
-- Image Type
-- 0 - PNG
-- 1 - DDS
PlayerCaptureSetType(1)
-- Add Messi Capture
PlayerCaptureAddPlayer(158023, GetTeamIdFromPlayerId(158023))
-- Add Cristiano Ronaldo Capture
PlayerCaptureAddPlayer(20801, GetTeamIdFromPlayerId(20801))
-- Add Haaland Capture
PlayerCaptureAddPlayer(239085, GetTeamIdFromPlayerId(239085))
-- Start Capturing
PlayerCaptureStart()
Add player to the queue for generating minifaces. Call PlayerCaptureStart to start generating.
Constraints:
- Can be executed only in Career Mode.
void PlayerCaptureAddPlayer(int playerid, int teamid)
void
-- Execute only if we are in career mode
if not IsInCM() then return end
-- Path is relative to the game installation directory
-- <default> means that the minifaces will be generated to your current Live Editor Mods directory (C:\FC 24 Live Editor\mods\root\Legacy\data\ui\imgAssets\heads if you didn't changed it')
PlayerCaptureSetOutputDirectory("<default>")
-- 0 - Head and shoulders
-- 1 - Head
-- 2 - Body
PlayerCaptureSetCamera(1)
-- 256x256
PlayerCaptureSetSize(256, 256)
-- Image Type
-- 0 - PNG
-- 1 - DDS
PlayerCaptureSetType(1)
-- Add Messi Capture
PlayerCaptureAddPlayer(158023, GetTeamIdFromPlayerId(158023))
-- Add Cristiano Ronaldo Capture
PlayerCaptureAddPlayer(20801, GetTeamIdFromPlayerId(20801))
-- Add Haaland Capture
PlayerCaptureAddPlayer(239085, GetTeamIdFromPlayerId(239085))
-- Start Capturing
PlayerCaptureStart()
Generate minifaces for players in queue. Add players by calling PlayerCaptureAddPlayer
On my PC it takes around 2s to generate one miniface, so be prepared that if you want to generate a lot of minifaces you will need to wait a while.
Constraints:
- Can be executed only in Career Mode.
void PlayerCaptureStart()
void
-- Execute only if we are in career mode
if not IsInCM() then return end
-- Path is relative to the game installation directory
-- <default> means that the minifaces will be generated to your current Live Editor Mods directory (C:\FC 24 Live Editor\mods\root\Legacy\data\ui\imgAssets\heads if you didn't changed it')
PlayerCaptureSetOutputDirectory("<default>")
-- 0 - Head and shoulders
-- 1 - Head
-- 2 - Body
PlayerCaptureSetCamera(1)
-- 256x256
PlayerCaptureSetSize(256, 256)
-- Image Type
-- 0 - PNG
-- 1 - DDS
PlayerCaptureSetType(1)
-- Add Messi Capture
PlayerCaptureAddPlayer(158023, GetTeamIdFromPlayerId(158023))
-- Add Cristiano Ronaldo Capture
PlayerCaptureAddPlayer(20801, GetTeamIdFromPlayerId(20801))
-- Add Haaland Capture
PlayerCaptureAddPlayer(239085, GetTeamIdFromPlayerId(239085))
-- Start Capturing
PlayerCaptureStart()
Get user club transfer budget
Constraints:
- Can be executed only in Career Mode.
int GetTransferBudget()
Type: Int
- Transfer budget value
SetTransferBudget(6777656)
local transfer_budget = GetTransferBudget()
Log("transfer_budget: " .. transfer_budget)
Log(type(transfer_budget))
> transfer_budget: 6777656
> number
Set user club transfer budget
Constraints:
- Can be executed only in Career Mode.
void SetTransferBudget(int new_transfer_budget)
Type: void
SetTransferBudget(6777656)
local transfer_budget = GetTransferBudget()
Log("transfer_budget: " .. transfer_budget)
Log(type(transfer_budget))
> transfer_budget: 6777656
> number