Cuberite Forum

Full Version: Get value from another plugin?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is possible, obtain the value of a variable from another plugin?

Plugin:
PHP Code:
variable1 Info[Player]; 

Another plugin:
PHP Code:
InfoGet[Player] = variable1

As "natives", pawno or only with sqlite, txt, etc?
See http://mc-server.xoft.cz/LuaAPI/cPluginManager.html -> CallPlugin for specifics and limitations.

Usage:
Code:
cPluginManager:CallPlugin("PluginName", "FunctionToCall", Optional Parameters)
Thanks for reply i don't see that, something?

Plugin "Game":
PHP Code:
function GetWinner()
      return 
ServerData.Winner;
end 

Plugin "Login":
PHP Code:
function GivePoints()
      
local WinnerName cPluginManager:CallPlugin("Game""GetWinner");
      
PlayerData.points[WinnerName] = PlayerData.points[WinnerName] +1;
end 
First of all, check if there's any errors or warnings in the server console. That is the first place where problems are discovered.

Second, in the GetWinner() function, add logging to verify that you are sending over the proper value:
function GetWinner()
    LOG("Function GetWinner()")
    LOG("  type(ServerData.Winner) = " .. type(ServerData.Winner))
    LOG("  ServerData.Winner = " .. ServerData.Winner)
    return ServerData.Winner
end
Similarly, verify in the GivePoints() function that you're getting what you think you are getting.