Answer the question
In order to leave comments, you need to log in
How to pass value by C# API?
Unable to pass boolean value from variable "bool PeremenayaA = true;" in API "private object ApiFunction()" . An error occurs - The name `PeremenayaA' does not exist in the current context.
[ChatCommand("block")]
public void cmdChatDrawBlock(BasePlayer player)
{
player.SetFlag(BaseEntity.Flags.Reserved3, true);
DrawBlockGUI(player);
if (player != null)
{
bool PeremenayaA = true;
}
}
private object АпиФункция()
{
var Переменная_с_Данными_Отправки = PeremenayaA;
return Переменная_с_Данными_Отправки; //отправляем данные.
}
Answer the question
In order to leave comments, you need to log in
Roman is absolutely right.
Now you are creating a variable, but it remains in the place where you created it.
Or you must have a class field, in which case it would be player.PeremenayaA= true;
Either the function must take a value, such as private object ApiFunction(PeremenayaA) and be called in the same place where you create the variable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question