Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ============================================================
- // Project Information
- // ============================================================
- // Project : Roleplay Server
- // Author : Zapk
- // Description : A new lightweight roleplaying framework.
- // ============================================================
- // I highly recommend using Script_Player_Persistence with this.
- // Do not modify anything in this file!
- // ============================================================
- // Set variables.
- $oocmute = 0;
- $RoleplayServer::Version = "0.3.0";
- // Dev function to reload the scripts.
- function RS_Reload()
- {
- exec("./server.cs");
- }
- // Load libraries.
- exec("./lib/color.cs");
- //exec("./lib/decals.cs");
- // Load preferences file.
- if(isFile("Add-Ons/System_ReturnToBlockland/server.cs") && !$RTB::Hooks::ServerControl)
- {
- exec("Add-Ons/System_ReturnToBlockland/hooks/serverControl.cs");
- }
- RTB_registerPref("Disable Player Names", "Roleplay - Basic", "$RoleplayServer::DisablePlayerNames", "bool", "Server_Roleplay", 1, 0, 0);
- RTB_registerPref("Disable Typing Names", "Roleplay - Basic", "$RoleplayServer::DisableTypingNames", "bool", "Server_Roleplay", 1, 0, 0);
- RTB_registerPref("Local OOC", "Roleplay - Radiuses", "$RoleplayServer::RadiusLOOC", "int 1 64", "Server_Roleplay", 16, 0, 0);
- RTB_registerPref("Talking", "Roleplay - Radiuses", "$RoleplayServer::RadiusTalking", "int 1 64", "Server_Roleplay", 16, 0, 0);
- RTB_registerPref("/recognize", "Roleplay - Radiuses", "$RoleplayServer::RadiusRecognize", "int 1 64", "Server_Roleplay", 16, 0, 0);
- RTB_registerPref("/w", "Roleplay - Radiuses", "$RoleplayServer::RadiusWhispering", "int 1 64", "Server_Roleplay", 4, 0, 0);
- RTB_registerPref("/y", "Roleplay - Radiuses", "$RoleplayServer::RadiusYelling", "int 1 64", "Server_Roleplay", 32, 0, 0);
- RTB_registerPref("Talking", "Roleplay - Timeouts", "$RoleplayServer::TimeoutTalking", "int 100 60000", "Server_Roleplay", 1000, 0, 0);
- RTB_registerPref("OOC", "Roleplay - Timeouts", "$RoleplayServer::TimeoutOOC", "int 100 60000", "Server_Roleplay", 10000, 0, 0);
- RTB_registerPref("Local OOC", "Roleplay - Timeouts", "$RoleplayServer::TimeoutLOOC", "int 100 60000", "Server_Roleplay", 1000, 0, 0);
- RTB_registerPref("Reporting", "Roleplay - Timeouts", "$RoleplayServer::TimeoutAdminChat", "int 100 60000", "Server_Roleplay", 5000, 0, 0);
- RTB_registerPref("/roll", "Roleplay - Timeouts", "$RoleplayServer::TimeoutRoll", "int 100 60000", "Server_Roleplay", 2000, 0, 0);
- RTB_registerPref("/setName", "Roleplay - Timeouts", "$RoleplayServer::TimeoutSetName", "int 100 60000", "Server_Roleplay", 10000, 0, 0);
- RTB_registerPref("/setFreq", "Roleplay - Timeouts", "$RoleplayServer::TimeoutSetFreq", "int 100 60000", "Server_Roleplay", 5000, 0, 0);
- RTB_registerPref("/recognize", "Roleplay - Timeouts", "$RoleplayServer::TimeoutRecognize", "int 100 60000", "Server_Roleplay", 5000, 0, 0);
- // Load other branches.
- exec("./src/datablocks.cs");
- // Makes particle datablocks for each icon so clients download them.
- function RS_LoadIcons()
- {
- %pattern = "Add-Ons/Server_Roleplay/res/icons/*.png";
- %file = findFirstFile(%pattern);
- while(isFile(%file))
- {
- %dbName = "RS_Icon_" @ getSafeVariableName(fileBase( %file ));
- if(!isObject(nameToID( %dbName )))
- {
- datablock ParticleData(_RS_TempIcon)
- {
- textureName = strreplace(%file, ".png", "");
- };
- _RS_TempIcon.setName( %dbName );
- echo("Roleplay Server: Added datablock '" @ %dbName @ "' for icon '" @ fileName(%file) @ "'.");
- }
- %file = findNextFile(%pattern);
- }
- }
- schedule(0, 0, "RS_LoadIcons");
- function gameConnection::getUserIcon(%this)
- {
- %icon = "user";
- if(%this.isAdmin)
- {
- %icon = "star";
- if(%this.isSuperAdmin)
- {
- %icon = "shield";
- }
- }
- return %icon;
- }
- package RS_Package
- {
- function serverCmdStartTalking(%this)
- {
- if($RoleplayServer::DisableTypingNames)
- {
- return;
- }
- Parent::serverCmdStartTalking(%this);
- }
- function gameConnection::onClientEnterGame(%this) //set the warned variable so it can be used later
- {
- if($warned[%this] < 1)
- {
- $warned[%this] = 0;
- }
- }
- function serverCmdwarn(%this, %target, %msg) //warn a player of their wrongdoing
- {
- if (!%this.isAdmin)
- {
- messageClient(%target, '', "\c3[You have been warned by \c6" @ %this.name @ "\c3 for ''\c6" @ %msg @ "\c3''\c3]");
- $warned[%target] += 1;
- }
- }
- function serverCmdtimeswarned(%this, %target) //see how many times a player has been warned
- {
- if (!%this.isAdmin)
- {
- messageClient("\c3" @ %target @ "\c6 has been warned \c3" @ $warned[%target] @ "\c6 times.");
- }
- }
- function serverCmdclearwarns(%this, %target) //clear how many times a player has been warned
- {
- if (!%this.isAdmin)
- {
- $warned[%target] = 0;
- }
- }
- function serverCmdtoggleOOC(%this) //turn the OOC off
- {
- if (!%this.isAdmin)
- {
- if ($oocmute == 0)
- {
- $oocmute = 1;
- announce("\c6The \c3OOC \c6has been disabled!");
- }
- else if($oocmute == 1)
- {
- $oocmute = 0;
- announce("\c6The \c3OOC \c6has been enabled!");
- }
- }
- }
- function serverCmdMute(%this, %target) //mute a player from using the OOC
- {
- if (!%this.isAdmin)
- {
- $mute[%target] = 1;
- messageClient(%target, '', "\c6You have been OOC muted by \c3" @ %this.name);
- echo(%this.name SPC "muted" SPC %target.name);
- messageClient(%this, '', "\c6You muted \c3" @ %target.name);
- }
- }
- function serverCmdTeamMessageSent(%this, %msg) //use the OOC (shortcut)
- {
- if ($oocmute == 1)
- {
- messageClient("\c3The OOC is disabled!");
- }
- else
- {
- if ($mute[%this] = 1)
- {
- messageClient("\c3You are muted!");
- }
- else
- {
- serverCmdOOC(%this, %msg);
- }
- }
- }
- function serverCmdMessageSent(%this, %msg)
- {
- if(!%this.hasSpawnedOnce || !isObject(%this.player))
- {
- //If they haven't spawned, OOC.
- if ($oocmute == 1) //Check if the OOC is on or off
- {
- messageClient("\c3The OOC is disabled!");
- }
- else
- {
- if ($mute[%this] = true)
- {
- messageClient("\c3You are muted!");
- }
- else
- {
- serverCmdOOC(%this, %msg);
- }
- }
- return;
- }
- else if(%this.roleplayName $= "")
- {
- //Warn people who have no character name.
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>You do not have a character name. Type /rpHelp.');
- return;
- }
- if(%msg $= "")
- {
- //Get rid of empty messages.
- return;
- }
- %firstLetter = getSubStr(%msg, 0, 1);
- %rest = getSubStr(%msg, 1, strlen(%msg));
- if(%firstLetter $= ",")
- {
- serverCmdLOOC(%this, %rest);
- return;
- }
- if(%firstLetter $= "^")
- {
- serverCmdAdminChat(%this, %rest);
- return;
- }
- if(!%this.isAdmin && getSimTime() - %this.lastCommandUse["messageSent"] <= $RoleplayServer::Timeout["Talking"])
- {
- %secondsLeft = mCeil(($RoleplayServer::Timeout["Talking"] - (getSimTime() - %this.lastCommandUse["messageSent"])) / 1000);
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>Please wait %1 second%2 to talk again.', %secondsLeft, %secondsLeft == 1 ? "" : "s");
- return;
- }
- %this.lastCommandUse["messageSent"] = getSimTime();
- %msg = StripMLControlChars(%msg);
- %pos = %this.player.getPosition();
- %image = %this.player.getMountedImage(0);
- //If they're talking through a handheld radio.
- if(isObject(%image) && %image.getName() $= "RadioImage" && %this.radioFrequency !$= "")
- {
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(!isObject(%client.player))
- continue;
- if(%client.player.hasRadio() && %client.radioFrequency $= %this.radioFrequency)
- {
- //If they have a radio and are on the same frequency.
- messageClient(%client, '', '<color:6F9922>%1 (Radio): "%2"', %client.getOtherCharacterName(%this), %msg);
- %client.play2D(RoleplayChatSound);
- }
- else if(VectorDist(%client.player.getPosition(), %pos) <= $RoleplayServer::Radius["Talking"])
- {
- //Or if they're close enough to hear the voice.
- messageClient(%client, '', '<color:F8D690>%1 (Radio):, "%2"', %client.getOtherCharacterName(%this), %msg);
- %client.play2D(RoleplayChatSound);
- }
- }
- %this.player.playThread(3,"talk");
- %this.player.schedule(strlen(%msg) * 50, playThread, 3, "root");
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") radioed '" @ %msg @ "'", "\c1");
- return;
- }
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(!isObject(%client.player))
- continue;
- if(VectorDist(%client.player.getPosition(), %pos) <= $RoleplayServer::Radius["Talking"])
- {
- messageClient(%client, '', '<color:F8D690>%1: "%2"', %client.getOtherCharacterName(%this), %msg);
- %client.play2D(RoleplayChatSound);
- }
- }
- %this.player.playThread(3,"talk");
- %this.player.schedule(strlen(%msg) * 50, playThread, 3, "root");
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") said '" @ %msg @ "'", "\c1", true);
- }
- function WeaponImage::onMount(%this, %obj, %slot)
- {
- if(!%this.armReady)
- {
- // If their hand was already up, put it down.
- %obj.playThread(1, "root");
- }
- %client = %obj.client;
- %item = %this.item;
- if(isObject(%client) && %item.roleplayDescription !$= "")
- {
- if(%item.uiName $= "Radio")
- {
- %hasFreq = %client.radioFrequency !$= "";
- if(!%hasFreq)
- {
- messageClient(%client, '', "\c6You don't have a frequency set. Use \c6/setFreq [frequency]\c6. Your radio won't work until you do so.");
- }
- }
- %client.centerPrint("<font:Palatino Linotype:30><color:A5505E>\xab " @ %item.uiName @ (%hasFreq ? " - " @ %client.radioFrequency @ "MHz \xbb" : " \xbb") @ "<br><color:48333E>" @ %item.roleplayDescription, 4);
- }
- return Parent::onMount(%this, %obj, %slot);
- }
- function GameConnection::onClientEnterGame(%this)
- {
- Parent::onClientEnterGame(%this);
- messageClient(%this, '', '\c6You are now talking in-character by default, %1.', %this.getPlayerName());
- if(%this.isAdmin && !%this.hasRPA)
- {
- messageClient(%this, '', '\c6Uh-oh, you\'re missing <color:A6130C>Client_RoleplayAdmin \c6and will not be able to see logs in your console. Ask the host for the link.');
- }
- %this.loadRoleplayData();
- }
- function GameConnection::onClientLeaveGame(%this)
- {
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") left the game.");
- if(isObject(%this.f8Zone))
- {
- %this.f8Zone.delete();
- }
- Parent::onClientLeaveGame(%this);
- }
- function GameConnection::autoAdminCheck(%this)
- {
- %parent = Parent::autoAdminCheck(%this);
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") joined the game.");
- messageClient(%this, '', '\c7Hey %1, this is a roleplay server. Type <color:A6130C>/rpHelp\c7 for info.', %this.getPlayerName());
- messageClient(%this, '', '\c6Texture \c7& \c6Sound \c7downloads are required to see some roleplay content properly.');
- // Admin client handshake.
- commandToClient(%this, 'RPA_Handshake');
- return %parent;
- }
- function fxDTSBrick::onActivate(%this, %player, %client, %position, %vector)
- {
- Parent::onActivate(%this, %player, %client, %position, %vector);
- }
- function doQuitGame()
- {
- if(isObject(ServerGroup))
- {
- saveAllRoleplayData();
- }
- Parent::doQuitGame();
- }
- function gameConnection::spawnPlayer(%this)
- {
- %parent = Parent::spawnPlayer(%this);
- if($RoleplayServer::DisablePlayerNames)
- {
- %this.player.schedule(0, "setShapeNameDistance", 0);
- }
- %this.player.tooltipLoop();
- return %parent;
- }
- function ItemData::onPickup(%this, %obj, %user, %amount)
- {
- Parent::onPickup(%this, %obj, %user, %amount);
- serverCmdReport("c3\ " @ %user @ "\c6picked up an \c3" @ %obj @ "\c6 !");
- }
- function Weapon::onPickup(%this, %obj, %player, %amount)
- {
- Parent::onPickup(%this, %obj, %player, %amount);
- serverCmdReport("c3\ " @ %user @ "\c6picked up an \c3" @ %obj @ "\c6 !");
- }
- function Item::schedulePop(%this)
- {
- Parent::schedulePop(%this);
- }
- };
- activatePackage(RS_Package);
- function GameConnection::loadRoleplayData(%this)
- {
- %name = "config/server/roleplay/data/" @ %this.getBLID() @ ".txt";
- %file = new FileObject();
- %file.openForRead(%name);
- if(!%file)
- {
- error("ERROR: GameConnection::loadRoleplayData(" @ %this @ " (BLID: " @ %this.getBLID() @ ")) - failed to open file '" @ %name @ "' for read");
- %file.delete();
- return;
- }
- echo("Loading roleplay data for BLID " @ %this.getBLID());
- while(!%file.isEOF())
- {
- %line = %file.readLine();
- %var = getField(%line, 0);
- %val = getFields(%line, 1, 999);
- if(strpos(%var, "//") == 0 || %val $= "")
- {
- continue;
- }
- switch$(%var)
- {
- case "name":
- %this.roleplayName = %val;
- case "freq":
- %this.radioFrequency = %val;
- case "recog":
- %rID = getField(%val, 0);
- %rName = getField(%val, 1);
- %this.recognizes[%rID, %rName] = true;
- }
- }
- %file.close();
- %file.delete();
- %this.roleplaySaveLoop(true);
- }
- function gameConnection::saveRoleplayData(%this)
- {
- %name = "config/server/roleplay/data/" @ %this.getBLID() @ ".txt";
- %file = new FileObject();
- %file.openForWrite(%name);
- if(!%file)
- {
- error("ERROR: GameConnection::saveRoleplayData(" @ %this @ " (BLID: " @ %this.getBLID() @ ")) - failed to open file '" @ %name @ "' for write");
- %file.delete();
- return;
- }
- echo("Saving roleplay data for BLID " @ %this.getBLID());
- %file.writeLine("//Roleplay data for " @ %this.getPlayerName() @ ", generated at " @ getDateTime());
- if(%this.roleplayName !$= "")
- %file.writeLine("name" TAB %this.roleplayName);
- if(%this.radioFrequency !$= "")
- %file.writeLine("freq" TAB %this.radioFrequency);
- %i = 0;
- while(true)
- {
- %tag = %this.getTaggedField(%i);
- if(%tag $= "")
- {
- break;
- }
- %var = getField(%tag, 0);
- %val = getFields(%tag, 1, 999);
- if(strpos(%var, "recognizes") == 0)
- {
- %realVar = getSubStr(%var, 10, strlen(%var) - 10);
- %splitPos = strpos(%realVar, "_");
- %bl_id = getSubStr(%realVar, 0, %splitPos);
- %theirName = getSubStr(%realVar, %splitPos + 1, strlen(%var) - %splitPos);
- %file.writeLine("recog" TAB %bl_id TAB %theirName);
- }
- %i++;
- }
- %file.close();
- %file.delete();
- }
- function gameConnection::roleplaySaveLoop(%this, %firstTime)
- {
- cancel(%this.roleplaySaveLoop);
- if(!%firstTime && !isEventPending($LoadSaveFile_Tick_Schedule))
- {
- %this.saveRoleplayData();
- }
- %this.roleplaySaveLoop = %this.schedule(5 * 60000, "roleplaySaveLoop");
- }
- function saveAllRoleplayData()
- {
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- ClientGroup.getObject(%i).saveRoleplayData();
- }
- }
- function RS_Log(%line, %color, %superAdmin)
- {
- if(%line $= "")
- {
- return;
- }
- %dateTime = getDateTime();
- %date = strreplace(firstWord(%dateTime), "/", "-");
- %fileName = "config/server/roleplay/logs/" @ %date @ ".txt";
- %file = new FileObject();
- %file.openForAppend(%fileName);
- %file.writeLine("[" @ %dateTime @ "] " @ %line);
- %file.close();
- %file.delete();
- echo("[Logged]" SPC %line);
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(%client.isAdmin && (!%superAdmin || %client.isSuperAdmin))
- {
- commandToClient(%client, 'RP_Log', %color @ %line, %superAdmin);
- }
- }
- }
- function Player::tooltipLoop(%this)
- {
- cancel(%this.tooltipLoop);
- if(!isObject(%this.client))
- {
- return;
- }
- %eye = %this.getEyePoint();
- %vec = %this.getEyeVector();
- %ray = containerRaycast(%eye, VectorAdd( %eye, VectorScale( %vec, $RoleplayServer::Radius["Yelling"] ) ), $Typemasks::PlayerObjectType, %this);
- if(isObject( %obj = firstWord(%ray) ))
- {
- %objC = %obj.client;
- if(isObject(%objC))
- {
- if(%this.client.recognizes[%objC.getBLID(), %objC.roleplayName])
- {
- commandToClient(%this.client, 'centerPrint', "<br><br><br><br>\c6" @ %this.client.getOtherCharacterName(%objC), 0.2);
- }
- else
- {
- %hue = (mSin($Sim::Time) + 1) * 0.5;
- %hex = rgbToHex( HSVtoRGB(%hue, 0.5, 1) );
- commandToClient(%this.client, 'centerPrint', "<br><br><br><br><color:" @ %hex @ ">You do not recognize this person.", 0.2);
- }
- }
- else
- {
- commandToClient(%this.client, 'clearCenterPrint');
- }
- }
- %this.tooltipLoop = %this.schedule(64, "tooltipLoop");
- }
- function Player::hasRadio(%this)
- {
- %max = %this.getDatablock().maxTools;
- for(%i = 0; %i < %max; %i++)
- {
- if(%this.tool[%i].uiName $= "Radio")
- {
- return true;
- }
- }
- return false;
- }
- function serverCmdRPHelp(%this)
- {
- messageClient(%this, '', '\c6This server is running <color:A6130C>Roleplay Server \c6version %1 by Zapkraft.', $RoleplayServer::Version);
- messageClient(%this, '', '\c6\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97');
- messageClient(%this, '', '\c6Talking normally produces an in-character message, unless you\'re loading.');
- messageClient(%this, '', '\c6To talk out-of-character globally, use team chat.');
- messageClient(%this, '', '\c6To talk out-of-character to those around you, place a comma (<color:A6130C>,\c6) before your message.');
- messageClient(%this, '', '\c6To perform an action, type <color:A6130C>/me\c6 before your message.');
- messageClient(%this, '', '\c6To describe a local event, type <color:A6130C>/it\c6 before your message.');
- messageClient(%this, '', '\c6To yell, type <color:A6130C>/y\c6 before your message.');
- messageClient(%this, '', '\c6To whisper, type <color:A6130C>/w\c6 before your message.');
- messageClient(%this, '', '\c6To set your character\'s name, type <color:A6130C>/setName [full name]\c6.');
- messageClient(%this, '', '\c6For help with radios, type <color:A6130C>/radioHelp\c6.');
- messageClient(%this, '', '\c6To make people in a radius recognize your name, type <color:A6130C>/recognize\c6.');
- messageClient(%this, '', '\c6To roll a random number, type <color:A6130C>/roll [max]\c6.');
- messageClient(%this, '', '\c6To report a rule-breaker to the admins (or talk to other admins if you are one), place an at-sign (<color:A6130C>@\c6) before your message.');
- if(%this.isAdmin)
- {
- messageClient(%this, '', '\c6You are an admin. To see the admin-only commands, type \c0/adminHelp\c6.');
- }
- messageClient(%this, '', '\c6\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97');
- messageClient(%this, '', '\c6Use the <color:A6130C>PageUp \c6and <color:A6130C>PageDown \c6keys to scroll (by default).');
- }
- function serverCmdRPCInfo(%this)
- {
- serverCmdRPHelp(%this);
- }
- function serverCmdRadioHelp(%this)
- {
- messageClient(%this, '', '\c6Radios are useful for communicating from a distance.');
- messageClient(%this, '', '\c6\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97');
- messageClient(%this, '', '\c6Talking with a Radio item out will radio in to your current frequency.');
- messageClient(%this, '', '\c6To change your frequency, type <color:A6130C>/setFreq [frequency]\c6.');
- messageClient(%this, '', '\c6Those around will be able to hear you talk into your radio.');
- messageClient(%this, '', '\c6Radio messages show up green if heard through a speaker, and yellow if by voice.');
- messageClient(%this, '', '\c6\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97');
- messageClient(%this, '', '\c6Use the <color:A6130C>PageUp \c6and <color:A6130C>PageDown \c6keys to scroll (by default).');
- }
- function serverCmdAdminHelp(%this)
- {
- if(!%this.isAdmin)
- {
- messageClient(%this, '', '\c6You aren\'t an admin. You don\'t need to see the admin help.');
- return;
- }
- messageClient(%this, '', '\c6Admin commands;');
- messageClient(%this, '', '\c6\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97');
- if(isFunction("clearFootsteps"))
- {
- // If they have Server_Stride, help them with that too.
- messageClient(%this, '', '<color:A6130C>/clearFootsteps \c6- Clears all custom footstep & footprint settings.');
- messageClient(%this, '', '<color:A6130C>/setFootstep [string material] [bool hasFootprints]\c6- Assigns the material to your current paint colour.');
- }
- messageClient(%this, '', '<color:A6130C>/who \c6- Displays all the players within yelling distance of you.');
- messageClient(%this, '', '<color:A6130C>/whoIs [name] \c6- Displays all the players with names or character names matching the input.');
- messageClient(%this, '', '<color:A6130C>/event [text] \c6- Describes a global in-character event.');
- messageClient(%this, '', '\c6\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97\x97');
- messageClient(%this, '', '\c6Use the <color:A6130C>PageUp \c6and <color:A6130C>PageDown \c6keys to scroll (by default).');
- }
- function serverCmdOOC(%this, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13, %a14, %a15, %a16, %a17, %a18, %a19, %a20, %a21, %a22, %a23, %a24, %a25, %a26, %a27, %a28, %a29, %a30, %a31, %a32)
- { //Check if the OOC is muted.
- if ($oocmute == 1)
- {
- if (!%this.isAdmin)
- {
- continue;
- }
- messageClient("\c3The OOC is disabled!");
- }
- else if($mute[%this] = 1)
- {
- messageClient("\c3You are muted!");
- return;
- }
- if(!%this.isAdmin && getSimTime() - %this.lastCommandUse["ooc"] <= $RoleplayServer::Timeout["OOC"])
- {
- %secondsLeft = mCeil(($RoleplayServer::Timeout["OOC"] - (getSimTime() - %this.lastCommandUse["ooc"])) / 1000);
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>Please wait %1 second%2 to use OOC again.', %secondsLeft, %secondsLeft == 1 ? "" : "s");
- return;
- }
- %this.lastCommandUse["ooc"] = getSimTime();
- %msg = trim(%a1 SPC %a2 SPC %a3 SPC %a4 SPC %a5 SPC %a6 SPC %a7 SPC %a8 SPC %a9 SPC %a10 SPC %a11 SPC %a12 SPC %a13 SPC %a14 SPC %a15 SPC %a16 SPC %a17 SPC %a18 SPC %a19 SPC %a20 SPC %a21 SPC %a22 SPC %a23 SPC %a24 SPC %a25 SPC %a26 SPC %a27 SPC %a28 SPC %a29 SPC %a30 SPC %a31 SPC %a32);
- %msg = StripMLControlChars(%msg);
- %msg = strreplace(%msg, "https://", "http://");
- if(strpos(%msg, "http://") == 0)
- {
- %msg = getSubStr(%msg, 7, strlen(%msg) - 7);
- %link = firstWord(%msg);
- %rest = restWords(%msg);
- %msg = trim("<a:" @ %link @ ">" @ %link @ "</a>" SPC %rest);
- }
- if(%msg $= "")
- {
- return;
- }
- messageAll('', '%1<color:A6130C>[OOC] \c6%2<color:DDDDDD>: %3', "<bitmap:Add-Ons/Server_Roleplay/res/icons/" @ %this.getUserIcon() @ "> ", %this.getPlayerName(), %msg);
- serverPlay2D(RoleplayChatSound);
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") via OOC '" @ %msg @ "'", "\c1");
- }
- function serverCmdLOOC(%this, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13, %a14, %a15, %a16, %a17, %a18, %a19, %a20, %a21, %a22, %a23, %a24, %a25, %a26, %a27, %a28, %a29, %a30, %a31, %a32)
- {
- if(!isObject(%this.player))
- {
- return;
- }
- else if(%this.roleplayName $= "")
- {
- //Warn people who have no character name.
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>You do not have a character name. Type /rpHelp.');
- return;
- }
- if(!%this.isAdmin && getSimTime() - %this.lastCommandUse["looc"] <= $RoleplayServer::Timeout["LOOC"])
- {
- %secondsLeft = mCeil(($RoleplayServer::Timeout["LOOC"] - (getSimTime() - %this.lastCommandUse["looc"])) / 1000);
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>Please wait %1 second%2 to use LOOC again.', %secondsLeft, %secondsLeft == 1 ? "" : "s");
- return;
- }
- %this.lastCommandUse["looc"] = getSimTime();
- %msg = trim(%a1 SPC %a2 SPC %a3 SPC %a4 SPC %a5 SPC %a6 SPC %a7 SPC %a8 SPC %a9 SPC %a10 SPC %a11 SPC %a12 SPC %a13 SPC %a14 SPC %a15 SPC %a16 SPC %a17 SPC %a18 SPC %a19 SPC %a20 SPC %a21 SPC %a22 SPC %a23 SPC %a24 SPC %a25 SPC %a26 SPC %a27 SPC %a28 SPC %a29 SPC %a30 SPC %a31 SPC %a32);
- %msg = StripMLControlChars(%msg);
- if(%msg $= "")
- {
- return;
- }
- %pos = %this.player.getPosition();
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(!isObject(%client.player))
- continue;
- if(VectorDist(%client.player.getPosition(), %pos) <= $RoleplayServer::Radius["LOOC"])
- {
- messageClient(%client, '', '<color:A6130C>[LOOC] <color:F8D690>%1: %2', %client.getOtherCharacterName(%this), %msg);
- %client.play2D(RoleplayChatSound);
- }
- }
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") via LOOC '" @ %msg @ "'", "\c1");
- }
- function serverCmdAdminChat(%this, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13, %a14, %a15, %a16, %a17, %a18, %a19, %a20, %a21, %a22, %a23, %a24, %a25, %a26, %a27, %a28, %a29, %a30, %a31, %a32)
- {
- if(!%this.isAdmin && getSimTime() - %this.lastCommandUse["ac"] <= $RoleplayServer::Timeout["AdminChat"])
- {
- %secondsLeft = mCeil(($RoleplayServer::Timeout["AdminChat"] - (getSimTime() - %this.lastCommandUse["ac"])) / 1000);
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>Please wait %1 second%2 to report again.', %secondsLeft, %secondsLeft == 1 ? "" : "s");
- return;
- }
- %this.lastCommandUse["ac"] = getSimTime();
- %msg = trim(%a1 SPC %a2 SPC %a3 SPC %a4 SPC %a5 SPC %a6 SPC %a7 SPC %a8 SPC %a9 SPC %a10 SPC %a11 SPC %a12 SPC %a13 SPC %a14 SPC %a15 SPC %a16 SPC %a17 SPC %a18 SPC %a19 SPC %a20 SPC %a21 SPC %a22 SPC %a23 SPC %a24 SPC %a25 SPC %a26 SPC %a27 SPC %a28 SPC %a29 SPC %a30 SPC %a31 SPC %a32);
- %msg = StripMLControlChars(%msg);
- if(%msg $= "")
- {
- return;
- }
- if(!%this.isAdmin) // Handle it as a report.
- {
- %foundOne = false;
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(%client.isAdmin || %client == %this)
- {
- messageClient(%client, '', '%1<color:A6130C>[Report] \c6%2<color:33DDDD>: %3', "<bitmap:Add-Ons/Server_Roleplay/res/icons/" @ %this.getUserIcon() @ "> ", %this.getPlayerName(), %msg);
- %client.play2D(RoleplayChatSound);
- if(%client.isAdmin)
- %foundOne = true;
- }
- }
- if(!%foundOne)
- {
- messageClient(%this, '', '\c6No admins were online to hear your report!');
- }
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") reports '" @ %msg @ "'", "\c1");
- }
- else // Handle it as admin-chat.
- {
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(%client.isAdmin)
- {
- messageClient(%client, '', '%1<color:A6130C>[Admin Chat] \c6%2<color:33DDDD>: %3', "<bitmap:Add-Ons/Server_Roleplay/res/icons/" @ %this.getUserIcon() @ "> ", %this.getPlayerName(), %msg);
- %client.play2D(RoleplayChatSound);
- }
- }
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") via admin chat '" @ %msg @ "'", "\c1");
- }
- }
- function serverCmdMe(%this, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13, %a14, %a15, %a16, %a17, %a18, %a19, %a20, %a21, %a22, %a23, %a24, %a25, %a26, %a27, %a28, %a29, %a30, %a31, %a32)
- {
- if(!%this.isAdmin && getSimTime() - %this.lastCommandUse["me"] <= $RoleplayServer::Timeout["Talking"])
- {
- %secondsLeft = mCeil(($RoleplayServer::Timeout["Talking"] - (getSimTime() - %this.lastCommandUse["me"])) / 1000);
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>Please wait %1 second%2 to perform again.', %secondsLeft, %secondsLeft == 1 ? "" : "s");
- return;
- }
- %this.lastCommandUse["me"] = getSimTime();
- %player = %this.player;
- if(!isObject(%player))
- {
- return;
- }
- else if(%this.roleplayName $= "")
- {
- //Warn people who have no character name.
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>You do not have a character name. Type /rpHelp.');
- return;
- }
- %msg = trim(%a1 SPC %a2 SPC %a3 SPC %a4 SPC %a5 SPC %a6 SPC %a7 SPC %a8 SPC %a9 SPC %a10 SPC %a11 SPC %a12 SPC %a13 SPC %a14 SPC %a15 SPC %a16 SPC %a17 SPC %a18 SPC %a19 SPC %a20 SPC %a21 SPC %a22 SPC %a23 SPC %a24 SPC %a25 SPC %a26 SPC %a27 SPC %a28 SPC %a29 SPC %a30 SPC %a31 SPC %a32);
- %msg = StripMLControlChars(%msg);
- if(%msg $= "")
- {
- return;
- }
- %pos = %player.getPosition();
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(!isObject(%client.player))
- continue;
- if(VectorDist(%client.player.getPosition(), %pos) <= $RoleplayServer::Radius["Talking"])
- {
- messageClient(%client, '', '<color:F8D690>** %1 %2', %client.getOtherCharacterName(%this), %msg);
- %client.play2D(RoleplayChatSound);
- }
- }
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") used '/me " @ %msg @ "'");
- }
- function serverCmdIt(%this, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13, %a14, %a15, %a16, %a17, %a18, %a19, %a20, %a21, %a22, %a23, %a24, %a25, %a26, %a27, %a28, %a29, %a30, %a31, %a32)
- {
- if(!%this.isAdmin && getSimTime() - %this.lastCommandUse["it"] <= $RoleplayServer::Timeout["Talking"])
- {
- %secondsLeft = mCeil(($RoleplayServer::Timeout["Talking"] - (getSimTime() - %this.lastCommandUse["it"])) / 1000);
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>Please wait %1 second%2 to perform again.', %secondsLeft, %secondsLeft == 1 ? "" : "s");
- return;
- }
- %this.lastCommandUse["it"] = getSimTime();
- %player = %this.player;
- if(!isObject(%player))
- {
- return;
- }
- else if(%this.roleplayName $= "")
- {
- //Warn people who have no character name.
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>You do not have a character name. Type /rpHelp.');
- return;
- }
- %msg = trim(%a1 SPC %a2 SPC %a3 SPC %a4 SPC %a5 SPC %a6 SPC %a7 SPC %a8 SPC %a9 SPC %a10 SPC %a11 SPC %a12 SPC %a13 SPC %a14 SPC %a15 SPC %a16 SPC %a17 SPC %a18 SPC %a19 SPC %a20 SPC %a21 SPC %a22 SPC %a23 SPC %a24 SPC %a25 SPC %a26 SPC %a27 SPC %a28 SPC %a29 SPC %a30 SPC %a31 SPC %a32);
- %msg = StripMLControlChars(%msg);
- if(%msg $= "")
- {
- return;
- }
- %pos = %player.getPosition();
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(!isObject(%client.player))
- continue;
- if(VectorDist(%client.player.getPosition(), %pos) <= $RoleplayServer::Radius["Talking"])
- {
- messageClient(%client, '', '<color:F8D690>** %1', %msg);
- %client.play2D(RoleplayChatSound);
- }
- }
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") used '/it " @ %msg @ "'");
- }
- function serverCmdW(%this, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13, %a14, %a15, %a16, %a17, %a18, %a19, %a20, %a21, %a22, %a23, %a24, %a25, %a26, %a27, %a28, %a29, %a30, %a31, %a32)
- {
- if(!isObject(%this.player))
- {
- return;
- }
- else if(%this.roleplayName $= "")
- {
- //Warn people who have no character name.
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>You do not have a character name. Type /rpHelp.');
- return;
- }
- if(!%this.isAdmin && getSimTime() - %this.lastCommandUse["w"] <= $RoleplayServer::Timeout["Talking"])
- {
- %secondsLeft = mCeil(($RoleplayServer::Timeout["Talking"] - (getSimTime() - %this.lastCommandUse["w"])) / 1000);
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>Please wait %1 second%2 to whisper again.', %secondsLeft, %secondsLeft == 1 ? "" : "s");
- return;
- }
- %this.lastCommandUse["w"] = getSimTime();
- %msg = trim(%a1 SPC %a2 SPC %a3 SPC %a4 SPC %a5 SPC %a6 SPC %a7 SPC %a8 SPC %a9 SPC %a10 SPC %a11 SPC %a12 SPC %a13 SPC %a14 SPC %a15 SPC %a16 SPC %a17 SPC %a18 SPC %a19 SPC %a20 SPC %a21 SPC %a22 SPC %a23 SPC %a24 SPC %a25 SPC %a26 SPC %a27 SPC %a28 SPC %a29 SPC %a30 SPC %a31 SPC %a32);
- %msg = StripMLControlChars(%msg);
- if(%msg $= "")
- {
- return;
- }
- %pos = %this.player.getPosition();
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(!isObject(%client.player))
- continue;
- if(VectorDist(%client.player.getPosition(), %pos) <= $RoleplayServer::Radius["Whispering"])
- {
- messageClient(%client, '', '<color:F8D690>%1 (Whisper): "%2"', %client.getOtherCharacterName(%this), %msg);
- %client.play2D(RoleplayChatSound);
- }
- }
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") used '/w " @ %msg @ "'");
- }
- function serverCmdY(%this, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13, %a14, %a15, %a16, %a17, %a18, %a19, %a20, %a21, %a22, %a23, %a24, %a25, %a26, %a27, %a28, %a29, %a30, %a31, %a32)
- {
- if(!isObject(%this.player))
- {
- return;
- }
- else if(%this.roleplayName $= "")
- {
- //Warn people who have no character name.
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>You do not have a character name. Type /rpHelp.');
- return;
- }
- if(!%this.isAdmin && getSimTime() - %this.lastCommandUse["y"] <= $RoleplayServer::Timeout["Talking"])
- {
- %secondsLeft = mCeil(($RoleplayServer::Timeout["Talking"] - (getSimTime() - %this.lastCommandUse["y"])) / 1000);
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>Please wait %1 second%2 to yell again.', %secondsLeft, %secondsLeft == 1 ? "" : "s");
- return;
- }
- %this.lastCommandUse["y"] = getSimTime();
- %msg = trim(%a1 SPC %a2 SPC %a3 SPC %a4 SPC %a5 SPC %a6 SPC %a7 SPC %a8 SPC %a9 SPC %a10 SPC %a11 SPC %a12 SPC %a13 SPC %a14 SPC %a15 SPC %a16 SPC %a17 SPC %a18 SPC %a19 SPC %a20 SPC %a21 SPC %a22 SPC %a23 SPC %a24 SPC %a25 SPC %a26 SPC %a27 SPC %a28 SPC %a29 SPC %a30 SPC %a31 SPC %a32);
- %msg = StripMLControlChars(%msg);
- if(%msg $= "")
- {
- return;
- }
- %pos = %this.player.getPosition();
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(!isObject(%client.player))
- continue;
- if(VectorDist(%client.player.getPosition(), %pos) <= $RoleplayServer::Radius["Yelling"])
- {
- messageClient(%client, '', '<color:F8D690>%1 (Yell): "%2"', %client.getOtherCharacterName(%this), %msg);
- %client.play2D(RoleplayChatSound);
- }
- }
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") used '/y " @ %msg @ "'");
- }
- function serverCmdRoll(%this, %max)
- {
- if(!%this.isAdmin && getSimTime() - %this.lastCommandUse["roll"] <= $RoleplayServer::Timeout["Roll"])
- {
- %secondsLeft = mCeil(($RoleplayServer::Timeout["Roll"] - (getSimTime() - %this.lastCommandUse["roll"])) / 1000);
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>Please wait %1 second%2 to roll again.', %secondsLeft, %secondsLeft == 1 ? "" : "s");
- return;
- }
- %this.lastCommandUse["roll"] = getSimTime();
- %player = %this.player;
- if(!isObject(%player))
- {
- return;
- }
- else if(%this.roleplayName $= "")
- {
- //Warn people who have no character name.
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>You do not have a character name. Type /rpHelp.');
- return;
- }
- %max = mClamp(%max, 1, 9999);
- %rand = getRandom(%max);
- %pos = %player.getPosition();
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(!isObject(%client.player))
- continue;
- if(VectorDist(%client.player.getPosition(), %pos) <= $RoleplayServer::Radius["Talking"])
- {
- messageClient(%client, '', '<color:800080>** %1 has rolled %2 out of %3', %client.getOtherCharacterName(%this), %rand, %max);
- %client.play2D(RoleplayChatSound);
- }
- }
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") used '/roll " @ %max @ "'");
- }
- function getSafeRoleplayName(%this)
- {
- %this = StripMLControlChars(%this);
- %this = strreplace(%this, "[", "");
- %this = strreplace(%this, "]", "");
- %this = strreplace(%this, "{", "");
- %this = strreplace(%this, "}", "");
- %this = strreplace(%this, "(", "");
- %this = strreplace(%this, ")", "");
- %this = strreplace(%this, "_", "");
- return %this;
- }
- function serverCmdSetName(%this, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
- {
- if(!%this.isAdmin && getSimTime() - %this.lastCommandUse["setName"] <= $RoleplayServer::Timeout["SetName"])
- {
- %secondsLeft = mCeil(($RoleplayServer::Timeout["SetName"] - (getSimTime() - %this.lastCommandUse["setName"])) / 1000);
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>Please wait %1 second%2 to set your name again.', %secondsLeft, %secondsLeft == 1 ? "" : "s");
- return;
- }
- %this.lastCommandUse["setName"] = getSimTime();
- %name = trim(%a1 SPC %a2 SPC %a3 SPC %a4 SPC %a5 SPC %a6 SPC %a7 SPC %a8 SPC %a9 SPC %a10);
- %name = getSubStr(%name, 0, 42);
- %name = getSafeRoleplayName(%name);
- if(strlwr(%name) $= "somebody")
- {
- messageClient(%this, '', "\c6Nice try. You can't set your name to 'somebody'.");
- return;
- }
- %this.roleplayName = %name;
- messageClient(%this, '', '\c6You have set your roleplay name to \c6%1\c6.', %this.roleplayName);
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") used '/setName " @ %name @ "'", "\c5");
- }
- function serverCmdSetFreq(%this, %freq)
- {
- if(!isObject(%this.player))
- {
- return;
- }
- else if(%this.roleplayName $= "")
- {
- //Warn people who have no character name.
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>You do not have a character name. Type /rpHelp.');
- return;
- }
- %image = %this.player.getMountedImage(0);
- if(!isObject(%image) || %image.getName() !$= "RadioImage")
- {
- messageClient(%this, '', "\c6You must be holding a radio.");
- return;
- }
- if(!%this.isAdmin && getSimTime() - %this.lastCommandUse["setFreq"] <= $RoleplayServer::Timeout["SetFreq"])
- {
- %secondsLeft = mCeil(($RoleplayServer::Timeout["SetFreq"] - (getSimTime() - %this.lastCommandUse["setFreq"])) / 1000);
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>Please wait %1 second%2 to set your frequency again.', %secondsLeft, %secondsLeft == 1 ? "" : "s");
- return;
- }
- %this.lastCommandUse["setFreq"] = getSimTime();
- %freq = mFloatLength(%freq, 1);
- if(%freq < 88)
- {
- messageClient(%this, '', '\c6The frequency must be higher than 88.');
- return;
- }
- if(%freq > 188)
- {
- messageClient(%this, '', '\c6The frequency must be lower than 188.');
- return;
- }
- %this.radioFrequency = %freq;
- messageClient(%this, '', '\c6You have set your radio\'s frequency to \c6%1\c6.', %this.radioFrequency);
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") used '/setFreq " @ %freq @ "'");
- }
- function serverCmdWho(%this)
- {
- if(!isObject(%this.player))
- {
- return;
- }
- if(!%this.isAdmin)
- {
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>You do not have access to that command, %1.', %this.getPlayerName());
- %obj.client.play2D(RoleplayChatSound);
- return;
- }
- messageClient(%this, '', '\c6Players within yelling distance:');
- %pos = %this.player.getPosition();
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(!isObject(%client.player))
- continue;
- %dist = VectorDist(%client.player.getPosition(), %pos);
- if(VectorDist(%client.player.getPosition(), %pos) <= $RoleplayServer::Radius["Yelling"])
- {
- %foundOne = true;
- messageClient(%this, '', '\c6\xbb \c6%1 \c6(%2m)', %client.getPlayerName(), %dist);
- }
- }
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") used '/who'");
- }
- function serverCmdWhoIs(%this, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)
- {
- if(!%this.isAdmin)
- {
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>You do not have access to that command, %1.', %this.getPlayerName());
- %obj.client.play2D(RoleplayChatSound);
- return;
- }
- %name = trim(%a1 SPC %a2 SPC %a3 SPC %a4 SPC %a5 SPC %a6 SPC %a7 SPC %a8 SPC %a9 SPC %a10);
- %name = StripMLControlChars(%name);
- %foundOne = false;
- messageClient(%this, '', '\c6Players matching \'\c6%1\c6\':', %name);
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(strpos(strlwr(%client.roleplayName), strlwr(%name)) > -1)
- {
- messageClient(%this, '', '\c6\xbb \c6%1 \c6is the character of \c6%2\c6.', %client.roleplayName, %client.getPlayerName());
- %foundOne = true;
- }
- if(strpos(strlwr(%client.getPlayerName()), strlwr(%name)) > -1)
- {
- messageClient(%this, '', '\c6\xbb \c6%1\c6\'s character is \c6%2\c6.', %client.getPlayerName(), %client.roleplayName);
- %foundOne = true;
- }
- }
- if(!%foundOne)
- {
- messageClient(%this, '', '\c6No players found with that character name or username.');
- }
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") used '/whoIs " @ %name @ "'");
- }
- function serverCmdEvent(%this, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13, %a14, %a15, %a16, %a17, %a18, %a19, %a20, %a21, %a22, %a23, %a24, %a25, %a26, %a27, %a28, %a29, %a30, %a31, %a32)
- {
- if(!%this.isAdmin)
- {
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>You do not have access to that command, %1.', %this.getPlayerName());
- %obj.client.play2D(RoleplayChatSound);
- return;
- }
- %msg = trim(%a1 SPC %a2 SPC %a3 SPC %a4 SPC %a5 SPC %a6 SPC %a7 SPC %a8 SPC %a9 SPC %a10 SPC %a11 SPC %a12 SPC %a13 SPC %a14 SPC %a15 SPC %a16 SPC %a17 SPC %a18 SPC %a19 SPC %a20 SPC %a21 SPC %a22 SPC %a23 SPC %a24 SPC %a25 SPC %a26 SPC %a27 SPC %a28 SPC %a29 SPC %a30 SPC %a31 SPC %a32);
- %msg = StripMLControlChars(%msg);
- if(%msg $= "")
- {
- return;
- }
- %pos = %player.getPosition();
- for(%i = 0; %i < ClientGroup.getCount(); %i++)
- {
- %client = ClientGroup.getObject(%i);
- if(!isObject(%client.player))
- continue;
- if(VectorDist(%client.player.getPosition(), %pos) <= $RoleplayServer::Radius["Talking"])
- {
- messageClient(%client, '', '<color:F8D690>** %1', %msg);
- %client.play2D(RoleplayChatSound);
- }
- }
- messageAll('', '<color:DD6600>%1', %msg);
- serverPlay2D(RoleplayChatSound);
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") used '/event " @ %msg @ "'");
- }
- function gameConnection::getOtherCharacterName(%this, %client)
- {
- if(%this == %client || %this.recognizes[%client.getBLID(), %client.roleplayName])
- {
- return %client.roleplayName;
- }
- return "Somebody";
- }
- function serverCmdRecognize(%this)
- {
- if(!isObject(%this.player))
- {
- return;
- }
- else if(%this.roleplayName $= "")
- {
- //Warn people who have no character name.
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>You do not have a character name. Type /rpHelp.');
- return;
- }
- if(!%this.isAdmin && getSimTime() - %this.lastCommandUse["recognize"] <= $RoleplayServer::Timeout["Recognize"])
- {
- %secondsLeft = mCeil(($RoleplayServer::Timeout["Recognize"] - (getSimTime() - %this.lastCommandUse["recognize"])) / 1000);
- messageClient(%this, '', '<bitmap:Add-Ons/Server_Roleplay/res/icons/comment> <color:DDDDFF>Please wait %1 second%2 to recognize yourself again.', %secondsLeft, %secondsLeft == 1 ? "" : "s");
- return;
- }
- %this.lastCommandUse["recognize"] = getSimTime();
- //$RoleplayServer::Radius["Recognize"]
- initContainerRadiusSearch(%this.player.getPosition(), $RoleplayServer::Radius["Recognize"], $Typemasks::PlayerObjectType);
- while(%obj = containerSearchNext())
- {
- if(%obj == %this.player)
- continue;
- if(!isObject(%obj.client))
- continue;
- if(%obj.client.recognizes[%this.getBLID(), %this.roleplayName])
- continue;
- messageClient(%obj.client, '', '<color:F8D690>You now recognize %1.', %this.roleplayName);
- %obj.client.play2D(RoleplayChatSound);
- %obj.client.recognizes[%this.getBLID(), %this.roleplayName] = true;
- }
- messageClient(%this, '', '<color:F8D690>People within a %1 stud radius now recognize your name.', $RoleplayServer::Radius["Recognize"]);
- %this.play2D(RoleplayChatSound);
- RS_Log(%this.getPlayerName() SPC "(" @ %this.getBLID() @ ") used '/recognize'");
- }
- function getRandomNamedBrick(%group, %name)
- {
- %name = "_" @ %name;
- for(%a = 0; %a < %group.NTNameCount; %a++)
- {
- if(%group.NTName[%a] !$= %name || %group.NTObjectCount[%name] < 0)
- {
- continue;
- }
- %n = %group.NTObjectCount[%name];
- return %group.NTObject[%name, getRandom(0, %n - 1)];
- }
- return 0;
- }
- registerOutputEvent("fxDTSBrick", "doRoleplayItem", "string 200 100" TAB "int 1 60 30");
- function fxDTSBrick::doRoleplayItem(%this, %name, %time)
- {
- %target = getRandomNamedBrick(%this.getGroup(), %name);
- if(!isObject(%target))
- {
- return;
- }
- %items = 0;
- for(%i = 0; %i < %target.getNumUpBricks(); %i++)
- {
- %brick = %target.getUpBrick(%i);
- if(isObject(%brick.item))
- {
- %item[%items] = %brick.item.getDatablock();
- %items++;
- }
- }
- if(!%items)
- {
- return;
- }
- %chosen = %item[getRandom(0, %items - 1)];
- if(isObject(%chosen))
- {
- %popTime = $Game::Item::PopTime;
- $Game::Item::PopTime = %time * 1000;
- %this.spawnItem("0 0 2", %chosen);
- $Game::Item::PopTime = %popTime;
- }
- }
- // Admin client handshake.
- function serverCmdRPA_Handshake(%this)
- {
- %this.hasRPA = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement