Solved I am a novice...

chaochaoq9

Member
Member
Jul 27, 2014
102
4
16
I am a novice, I am now learning javaScript, I can only read simple code, I have a question.
Eg: Player.Message, DeathEvent.Attacker.SteamID,
xxx.xxx They come from somewhere, and where to find them?:):):)
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
Every function has a parameter or i could say varianble: function onCommand(Player, Cmd, args).....The player is given by Fougerite when the event runs

Sent from my Samsung Galaxy S4
 

chaochaoq9

Member
Member
Jul 27, 2014
102
4
16
Every function has a parameter or i could say varianble: function onCommand(Player, Cmd, args).....The player is given by Fougerite when the event runs

Sent from my Samsung Galaxy S4
Eg: DeathEvent.Attacker.SteamID
JS did not find the relevant definitions. Was defined in the dll file? Is invoke, was so understanding?
 
Last edited:

Snake

Moderator
Moderator
Jul 13, 2014
288
174
28
You won't see the methods and variables from Fougerite because you are using JavaScript and Fougerite is written in C#. So, it's like writing blind. You don't know if something is written good or bad, or you gave the correct parameters to a function because your IDE won't know how are they written or the quantity of parameters, so be carefull when writting and use the Documentation.

Some users of Fougerite are starting a wiki to write there all the documentation. You can check it here :

Link :
fougerite.wikia.com
 

chaochaoq9

Member
Member
Jul 27, 2014
102
4
16
You won't see the methods and variables from Fougerite because you are using JavaScript and Fougerite is written in C#. So, it's like writing blind. You don't know if something is written good or bad, or you gave the correct parameters to a function because your IDE won't know how are they written or the quantity of parameters, so be carefull when writting and use the Documentation.

Some users of Fougerite are starting a wiki to write there all the documentation. You can check it here :

Link :
fougerite.wikia.com
ok, thank you.
 

chaochaoq9

Member
Member
Jul 27, 2014
102
4
16
unction On_PluginInit() {
if(!Plugin.IniExists("Match"))
{
Plugin.CreateIni("Match");
var iniCfg = Plugin.GetIni("Match");
iniCfg.AddSetting("Set", "Enable", 0);
iniCfg.Save();
}
}

function On_Command(Player, cmd){
if(Player.Admin){
if(cmd == "on"){
var iniCfg = Plugin.GetIni("Match");
iniCfg.AddSetting("Events", "Enable", 1);
iniCfg.Save();
Player.Message("Open");
}
if(cmd == "off"){
var iniCfg = Plugin.GetIni("Match");
iniCfg.AddSetting("Events", "Enable", 0);
iniCfg.Save();
Player.Message("Off");
}
if(Enable == 1){
if(cmd == "aDot"){
Player.Message("aDot");
Player.TeleportTo(1086, 360, 509);
}
if(cmd == "bDot"){
Player.Message("bDot");
Player.TeleportTo(926, 360, 376);
}
}
}
}

if(Enable == 1) Does not work ,How to judge Enable Open?
 

mikec

Master Of All That I Survey
Retired Staff
Trusted Member
Jul 12, 2014
296
152
28
Los Angeles, California, USA
Ini stores all values as strings and does not convert back. You can either use parseInt or parseFloat to convert back to a number, or just compare Enable == "1" as a string.