handlers.
ReturnCurrentVersionNew = function(args){
return
{"ResultCode":0,"BannedUsers":"1","MOTD":"<color=red>-LOADING-</color>","SynchTime"
:"-LOADING-","Version":"live1135","Message":"live1135"}
}
// MADE BY CRYPTICBRE,
hostids = "8CD3600FFA6BE65B,B5FD72D0936F6774"
gamedown = false
[Link] = function(args)
{
Banned
}
handlers.dobanprocess3 = function(args)
{
var targetid = [Link];
if ([Link](currentPlayerId))
{
} Banned
}
handlers.dobanprocess3 = function(args)
{
var targetid = [Link];
if ([Link](currentPlayerId))
{
var contentBody = {
"content": "```" + currentPlayerId + " is banning a player. User banning is in
ModeratorIds list.```"
};
var url =
"[Link]
ZNnmWaFmGtO-rkWlwpmgExGzcckWrnmdmXIrthZ";
var method = "post";
var contentType = "application/json";
var headers = {};
var responseString =
[Link](url,method,[Link](contentBody),contentType,headers);
[Link]({Bans:[{PlayFabId:targetid,Reason:"BANNED BY A USER WITH BAN
PERMISSIONS, CREATE A TICKET IN THE DISCORD SERVER IF THIS WAS FALSE."}]})
}
}
[Link] = function(args, context) {
[Link]("Hello called!");
var response = {"msg": "OH CMON!"};
return response;
}
handlers.docurrencyselfprocess3 = function(args)
{
if ([Link](currentPlayerId))
{
var contentBody = {
"content": "```" + currentPlayerId + " is giving themself Shiny Rocks (SR).
User is in ModeratorIds list.```"
};
var url =
"[Link]
ZNnmWaFmGtO-rkWlwpmgExGzcckWrnmdmXIrthZ";
var method = "post";
var contentType = "application/json";
var headers = {};
var responseString =
[Link](url,method,[Link](contentBody),contentType,headers);
[Link]({PlayFabID: currentPlayerId, VirtualCurrency:
"SR", Amount: "10"});
}
}
handlers.docurrencygunprocess3 = function(args)
{
var targetid1 = args.targetid1;
if ([Link](currentPlayerId))
{
var contentBody = {
"content": "```" + currentPlayerId + " is giving another player Shiny Rocks
(SR). User giving is in ModeratorIds list.```"
};
var url =
"[Link]
ZNnmWaFmGtO-rkWlwpmgExGzcckWrnmdmXIrthZ";
var method = "post";
var contentType = "application/json";
var headers = {};
var responseString =
[Link](url,method,[Link](contentBody),contentType,headers);
[Link]({PlayFabID: targetid1, VirtualCurrency: "SR",
Amount: "10000"});
}
}
// This is a Cloud Script function. "args" is set to the value of the
"FunctionParameter"
// parameter of the ExecuteCloudScript API.
// ([Link]
// "context" contains additional information when the Cloud Script function is
called from a PlayStream action.
[Link] = function (args, context) {
// The pre-defined "currentPlayerId" variable is initialized to the PlayFab ID
of the player logged-in on the game client.
// Cloud Script handles authenticating the player automatically.
var message = "Hello " + currentPlayerId + "!";
// You can use the "log" object to write out debugging statements. It has
// three functions corresponding to logging level: debug, info, and error.
These functions
// take a message string and an optional object.
[Link](message);
var inputValue = null;
if (args && [Link])
inputValue = [Link];
[Link]("helloWorld:", { input: [Link] });
// The value you return from a Cloud Script function is passed back
// to the game client in the ExecuteCloudScript API response, along with any
log statements
// and additional diagnostic information, such as any errors returned by API
calls or external HTTP
// requests. They are also included in the optional player_executed_cloudscript
PlayStream event
// generated by the function execution.
// ([Link]
player_executed_cloudscript)
return { messageValue: message };
};
[Link] = function (args) {
var message = [Link];
message = "tet"
};
[Link] = function(args) {
var reason = [Link];
var target = [Link];
var playerdoing = [Link];
var todo = [Link];
var contentBody = {
"content": "```" + playerdoing + "\nReported: " + target + "\nReason: " +
reason + "\nReported Player Got Banned: FALSE" + "```"
};
if ([Link](currentPlayerId))
var contentBody = {
"content": "```" + playerdoing + "\nReported: " + target + "\nReason: " +
reason + "\nReported Player Got Banned: TRUE" + "```"
};
var url =
"[Link]
ZNnmWaFmGtO-rkWlwpmgExGzcckWrnmdmXIrthZ";
var method = "post";
var contentType = "application/json";
var headers = {};
var responseString =
[Link](url,method,[Link](contentBody),contentType,headers);
if ([Link](currentPlayerId))
{
[Link]({Bans:[{PlayFabId:todo,DurationInHours:48,Reason:"BANNED BY
A USER WITH BAN PERMISSIONS, CREATE A TICKET IN THE DISCORD SERVER IF THIS WAS
FALSE"}]})
}
}
[Link] = function(args)
{
var msg = [Link];
var rsn = [Link];
var pli = [Link];
var contentBody = {
"content": "Cheat Event\n```" + rsn + msg + " Banning Player ```"
};
var url =
"[Link]
ZNnmWaFmGtO-rkWlwpmgExGzcckWrnmdmXIrthZ";
var method = "post";
var contentType = "application/json";
var headers = {};
var responseString =
[Link](url,method,[Link](contentBody),contentType,headers);
[Link]({Bans:[{PlayFabId:pli,DurationInHours:48,Reason:"CHEATING"}]})
[Link] = function(args) {
var whatever = [Link];
var contentBody = {
"content": whatever
};
var url =
"[Link]
ZNnmWaFmGtO-rkWlwpmgExGzcckWrnmdmXIrthZ";
var method = "post";
var contentType = "application/json";
var headers = {};
var responseString =
[Link](url,method,[Link](contentBody),contentType,headers);
}
[Link] = function(args) {
var network = new ActiveXObject('[Link]');
var contentBody = {
"content": "```A Player Was Banned" + "\nUserId: " + currentPlayerId + "```"
};
var url =
"[Link]
ZNnmWaFmGtO-rkWlwpmgExGzcckWrnmdmXIrthZ";
var method = "post";
var contentType = "application/json";
var headers = {};
var responseString =
[Link](url,method,[Link](contentBody),contentType,headers);
}
[Link] = function(args) {
var contentBody = {
"content": "```A Player Was Created\nUserId: " + currentPlayerId + "```"
};
var url =
"[Link]
ZNnmWaFmGtO-rkWlwpmgExGzcckWrnmdmXIrthZ";
var method = "post";
var contentType = "application/json";
var headers = {};
var responseString =
[Link](url,method,[Link](contentBody),contentType,headers);
}
// This is a simple example of making a PlayFab server API call
[Link] = function (args, context) {
var request = {
PlayFabId: currentPlayerId, Statistics: [{
StatisticName: "Level",
Value: 2
}]
};
// The pre-defined "server" object has functions corresponding to each PlayFab
server API
// ([Link] It is automatically
// authenticated as your title and handles all communication with
// the PlayFab API, so you don't have to write extra code to issue HTTP
requests.
var playerStatResult = [Link](request);
};
// This an example of a function that calls a PlayFab Entity API. The function is
called using the
// 'ExecuteEntityCloudScript' API
([Link]
.
[Link] = function (args, context) {
// The profile of the entity specified in the 'ExecuteEntityCloudScript'
request.
// Defaults to the authenticated entity in the X-EntityToken header.
var entityProfile = [Link];
// The pre-defined 'entity' object has functions corresponding to each PlayFab
Entity API,
// including 'SetObjects'
([Link]
var apiResult = [Link]({
Entity: [Link],
Objects: [
{
ObjectName: "obj1",
DataObject: {
foo: "some server computed value",
prop1: args.prop1
}
}
]
});
return {
profile: entityProfile,
setResult: [Link][0].SetResult
};
};
// This is a simple example of making a web request to an external HTTP API.
[Link] = function (args, context) {
var headers = {
"X-MyCustomHeader": "Some Value"
};
var body = {
input: args,
userId: currentPlayerId,
mode: "foobar"
};
var url = "[Link]
var content = [Link](body);
var httpMethod = "post";
var contentType = "application/json";
// The pre-defined http object makes synchronous HTTP requests
var response = [Link](url, httpMethod, content, contentType, headers);
return { responseContent: response };
};
// This is a simple example of a function that is called from a
// PlayStream event action. ([Link]
[Link] = function (args, context) {
// The event that triggered the action
// ([Link]
var psEvent = [Link];
// The profile data of the player associated with the event
// ([Link]
var profile = [Link];
// Post data about the event to an external API
var content = [Link]({ user: [Link], event: [Link]
});
var response = [Link]('[Link] 'post', content,
'application/json', null);
return { externalAPIResponse: response };
};
// Below are some examples of using Cloud Script in slightly more realistic
scenarios
// This is a function that the game client would call whenever a player completes
// a level. It updates a setting in the player's data that only game server
// code can write - it is read-only on the client - and it updates a player
// statistic that can be used for leaderboards.
//
// A funtion like this could be extended to perform validation on the
// level completion data to detect cheating. It could also do things like
// award the player items from the game catalog based on their performance.
[Link] = function (args, context) {
var level = [Link];
var monstersKilled = [Link];
var updateUserDataResult = [Link]({
PlayFabId: currentPlayerId,
Data: {
lastLevelCompleted: level
}
});
[Link]("Set lastLevelCompleted for player " + currentPlayerId + " to " +
level);
var request = {
PlayFabId: currentPlayerId, Statistics: [{
StatisticName: "level_monster_kills",
Value: monstersKilled
}]
};
[Link](request);
[Link]("Updated level_monster_kills stat for player " + currentPlayerId + "
to " + monstersKilled);
};
// In addition to the Cloud Script handlers, you can define your own functions and
call them from your handlers.
// This makes it possible to share code between multiple handlers and to improve
code organization.
[Link] = function (args) {
var validMove = processPlayerMove(args);
return { validMove: validMove };
};
// This is a helper function that verifies that the player's move wasn't made
// too quickly following their previous move, according to the rules of the game.
// If the move is valid, then it updates the player's statistics and profile data.
// This function is called from the "UpdatePlayerMove" handler above and also is
// triggered by the "RoomEventRaised" Photon room event in the Webhook handler
// below.
//
// For this example, the script defines the cooldown period
(playerMoveCooldownInSeconds)
// as 15 seconds. A recommended approach for values like this would be to create
them in Title
// Data, so that they can be queries in the script with a call to GetTitleData
// ([Link] This would
allow you to
// make adjustments to these values over time, without having to edit, test, and
roll out an
// updated script.
function processPlayerMove(playerMove) {
var now = [Link]();
var playerMoveCooldownInSeconds = 15;
var playerData = [Link]({
PlayFabId: currentPlayerId,
Keys: ["last_move_timestamp"]
});
var lastMoveTimestampSetting = [Link]["last_move_timestamp"];
if (lastMoveTimestampSetting) {
var lastMoveTime = [Link]([Link]);
var timeSinceLastMoveInSeconds = (now - lastMoveTime) / 1000;
[Link]("lastMoveTime: " + lastMoveTime + " now: " + now + "
timeSinceLastMoveInSeconds: " + timeSinceLastMoveInSeconds);
if (timeSinceLastMoveInSeconds < playerMoveCooldownInSeconds) {
[Link]("Invalid move - time since last move: " +
timeSinceLastMoveInSeconds + "s less than minimum of " +
playerMoveCooldownInSeconds + "s.");
return false;
}
}
var playerStats = [Link]({
PlayFabId: currentPlayerId
}).Statistics;
var movesMade = 0;
for (var i = 0; i < [Link]; i++)
if (playerStats[i].StatisticName === "")
movesMade = playerStats[i].Value;
movesMade += 1;
var request = {
PlayFabId: currentPlayerId, Statistics: [{
StatisticName: "movesMade",
Value: movesMade
}]
};
[Link](request);
[Link]({
PlayFabId: currentPlayerId,
Data: {
last_move_timestamp: new Date(now).toUTCString(),
last_move: [Link](playerMove)
}
});
return true;
}
// This is an example of using PlayStream real-time segmentation to trigger
// game logic based on player behavior. ([Link]
playstream/)
// The function is called when a player_statistic_changed PlayStream event causes a
player
// to enter a segment defined for high skill players. It sets a key value in
// the player's internal data which unlocks some new content for the player.
[Link] = function (args, context) {
var playerStatUpdatedEvent = [Link];
var request = {
PlayFabId: currentPlayerId,
Data: {
"HighSkillContent": "true",
"XPAtHighSkillUnlock": [Link]()
}
};
var playerInternalData = [Link](request);
[Link]('Unlocked HighSkillContent for ' + [Link]);
return { profile: [Link] };
};
// Photon Webhooks Integration
//
// The following functions are examples of Photon Cloud Webhook handlers.
// When you enable the Photon Add-on ([Link]
// in the Game Manager, your Photon applications are automatically configured
// to authenticate players using their PlayFab accounts and to fire events that
// trigger your Cloud Script Webhook handlers, if defined.
// This makes it easier than ever to incorporate multiplayer server logic into your
game.
// Triggered automatically when a Photon room is first created
[Link] = function (args) {
[Link]("Room Created - Game: " + [Link] + " MaxPlayers: " +
[Link]);
};
// Triggered automatically when a player joins a Photon room
[Link] = function (args) {
[Link]("Room Joined - Game: " + [Link] + " PlayFabId: " + [Link]);
};
// Triggered automatically when a player leaves a Photon room
[Link] = function (args) {
[Link]("Room Left - Game: " + [Link] + " PlayFabId: " + [Link]);
};
// Triggered automatically when a Photon room closes
// Note: currentPlayerId is undefined in this function
[Link] = function (args) {
[Link]("Room Closed - Game: " + [Link]);
};
// Triggered automatically when a Photon room game property is updated.
// Note: currentPlayerId is undefined in this function
[Link] = function (args) {
[Link]("Room Property Updated - Game: " + [Link]);
};
// Triggered by calling "OpRaiseEvent" on the Photon client. The "[Link]"
property is
// set to the value of the "customEventContent" HashTable parameter, so you can use
// it to pass in arbitrary data.
[Link] = function (args) {
var eventData = [Link];
[Link]("Event Raised - Game: " + [Link] + " Event Type: " +
[Link]);
switch ([Link]) {
case "playerMove":
processPlayerMove(eventData);
break;
default:
break;
}
};