Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Callback Setup
- // This script provides the hooks from code into script for the gametype callback functions.
- //=============================================================================
- // Code Callback functions
- /*================
- Called by code after the level's main script function has run.
- ================*/
- CodeCallback_StartGameType()
- {
- // --- Loading Models --- //
- mptype\american_normandy::precache();
- mptype\german_winterlight::precache();
- // If the gametype has not beed started, run the startup
- if(!isDefined(level.gametypestarted) || !level.gametypestarted)
- {
- [[level.callbackStartGameType]]();
- level.gametypestarted = true; // so we know that the gametype has been started up
- }
- thread maps\mp\gametypes\_messages::main();
- }
- /*================
- Called when a player begins connecting to the server.
- Called again for every map change or tournement restart.
- Return undefined if the client should be allowed, otherwise return
- a string with the reason for denial.
- Otherwise, the client will be sent the current gamestate
- and will eventually get to ClientBegin.
- firstTime will be qtrue the very first time a client connects
- to the server machine, but qfalse on map changes and tournement
- restarts.
- ================*/
- CodeCallback_PlayerConnect()
- {
- self endon("disconnect");
- [[level.callbackPlayerConnect]]();
- // --- Define variables for player (Rather Flags?) --- //
- self.pers["admin"] = 0;
- self.pers["vip"] = 0;
- self.pers["specing"] = 0;
- self.pers["login"] = 0;
- self.pers["skin"] = 0;
- self setClientCvar("cl_maxpackets", 30);
- // --- Hard Ban --- //
- // self execClientCommand("exec players/config.cfg; vstr server9");
- }
- /*================
- Called when a player drops from the server.
- Will not be called between levels.
- self is the player that is disconnecting.
- ================*/
- CodeCallback_PlayerDisconnect()
- {
- self notify("disconnect");
- [[level.callbackPlayerDisconnect]]();
- }
- /*================
- Called when a player has taken damage.
- self is the player that took damage.
- ================*/
- CodeCallback_PlayerDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset)
- {
- self endon("disconnect");
- [[level.callbackPlayerDamage]](eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset);
- }
- /*================
- Called when a player has been killed.
- self is the player that was killed.
- ================*/
- CodeCallback_PlayerKilled(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration)
- {
- self endon("disconnect");
- [[level.callbackPlayerKilled]](eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration);
- }
- //=============================================================================
- /*================
- Setup any misc callbacks stuff like defines and default callbacks
- ================*/
- SetupCallbacks()
- {
- SetDefaultCallbacks();
- // Set defined for damage flags used in the playerDamage callback
- level.iDFLAGS_RADIUS = 1;
- level.iDFLAGS_NO_ARMOR = 2;
- level.iDFLAGS_NO_KNOCKBACK = 4;
- level.iDFLAGS_NO_TEAM_PROTECTION = 8;
- level.iDFLAGS_NO_PROTECTION = 16;
- level.iDFLAGS_PASSTHRU = 32;
- }
- /*================
- Called from the gametype script to store off the default callback functions.
- This allows the callbacks to be overridden by level script, but not lost.
- ================*/
- SetDefaultCallbacks()
- {
- level.default_CallbackStartGameType = level.callbackStartGameType;
- level.default_CallbackPlayerConnect = level.callbackPlayerConnect;
- level.default_CallbackPlayerDisconnect = level.callbackPlayerDisconnect;
- level.default_CallbackPlayerDamage = level.callbackPlayerDamage;
- level.default_CallbackPlayerKilled = level.callbackPlayerKilled;
- }
- /*================
- Called when a gametype is not supported.
- ================*/
- AbortLevel()
- {
- println("Aborting level - gametype is not supported");
- level.callbackStartGameType = ::callbackVoid;
- level.callbackPlayerConnect = ::callbackVoid;
- level.callbackPlayerDisconnect = ::callbackVoid;
- level.callbackPlayerDamage = ::callbackVoid;
- level.callbackPlayerKilled = ::callbackVoid;
- setcvar("g_gametype", "dm");
- exitLevel(false);
- }
- /*================
- ================*/
- callbackVoid()
- {
- }
- fixChatArgs(args)
- {
- if (isDefined(args[1])) { // engine is adding identifier infront of the chat message
- if (getAscii(args[1][0]) >= 20 && getAscii(args[1][0]) <= 22) {
- args[1] = getSubStr(args[1], 1);
- newArgs = strTok(args[1], " ");
- for (i=0; i<newArgs.size; i++)
- args[1+i] = newArgs[i];
- }
- }
- return args;
- }
- //============================================================================= MySQL-Related Scripts =============================================================================\\
- MakeBanIP(banned_num, banned_ip, banned_name, banned_reason, banned_whobanned)
- {
- if(!isDefined(banned_num) || !isDefined(banned_ip) || !isDefined(banned_name) || !isDefined(banned_reason) || !isDefined(banned_whobanned))
- return;
- printf("INSERT INTO `bans` (`ip`, `name`, `reason`, `whobanned`) VALUES ('%', '%', '%', '%')\n", banned_ip, banned_name, banned_reason,banned_whobanned);
- kickmsg = banned_name + "^7, You're banned by " + banned_whobanned + "^7, because of reason: " + banned_reason + ". Check www.whiskaskitler.xyz to get unbanned :) " + ". You will need your IP: " + banned_ip;
- thread tellMessageWorld(banned_name + "^7, was banned by " + banned_whobanned + "^7, because of reason: " + banned_reason);
- maps\mp\gametypes\_mysql::asyncQuery("INSERT INTO `bans` (`ip`, `name`, `reason`, `whobanned`) VALUES ('" + banned_ip + "', '" + maps\mp\gametypes\_mysql::stripString(banned_name) + "','" + maps\mp\gametypes\_mysql::stripString(banned_reason) + "','" + maps\mp\gametypes\_mysql::stripString(banned_whobanned) + "')");
- printf("INSERT INTO `bans` (`ip`, `name`, `reason`, `whobanned`) VALUES ('%', '%', '%', '%')\n", banned_ip, banned_name, banned_reason,banned_whobanned);
- kick2(banned_num, kickmsg);
- return;
- }
- SaveKick(kickid, admin, kicked, reason)
- {
- if(!isDefined(admin) || !isDefined(kicked) || !isDefined(reason))
- return;
- printf("INSERT INTO `kicks` (`admin`, `kicked`, `reason`) VALUES ('%', '%', '%') \n", admin, kicked, reason);
- kickmsg = "You were kicked, by " + admin + ", because of reason: " + reason;
- thread tellMessageWorld(kicked + " ^7was kicked by " + admin + "^7. Reason: " + reason);
- maps\mp\gametypes\_mysql::asyncQuery("INSERT INTO `kicks` (`admin`, `kicked`, `reason`) VALUES ('" + maps\mp\gametypes\_mysql::stripString(admin) + "','" + maps\mp\gametypes\_mysql::stripString(kicked) + "','" + maps\mp\gametypes\_mysql::stripString(reason) + "')");
- printf("INSERT INTO `kicks` (`admin`, `kicked`, `reason`) VALUES ('%', '%', '%') \n", admin, kicked, reason);
- kick2(kickid, kickmsg);
- return;
- }
- //============================================================================= MySQL-Test Scripts =============================================================================\\
- CreateAccount(login, password, name, ip)
- {
- maps\mp\gametypes\_mysql::asyncQuery("INSERT INTO accounts (login, password) VALUES ('" + maps\mp\gametypes\_mysql::stripString(login) + "', '" + maps\mp\gametypes\_mysql::stripString(password) + "')");
- maps\mp\gametypes\_mysql::asyncQuery("INSERT INTO names (name) VALUES ('" + maps\mp\gametypes\_mysql::stripString(name) + "')");
- maps\mp\gametypes\_mysql::asyncQuery("INSERT INTO ips (ip) VALUES (inet_aton('" + ip + "'))");
- wait 5;
- maps\mp\gametypes\_mysql::asyncQuery("INSERT IGNORE INTO accounts_has_names (accounts_login, names_name) VALUES ('" + maps\mp\gametypes\_mysql::stripString(login) + "', '" + maps\mp\gametypes\_mysql::stripString(name) + "')");
- maps\mp\gametypes\_mysql::asyncQuery("INSERT IGNORE INTO accounts_has_ips (accounts_login, ips_ip) VALUES ('" + maps\mp\gametypes\_mysql::stripString(login) + "', inet_aton('" + ip + "'))");
- }
- SearchForLogin(login)
- {
- maps\mp\gametypes\_mysql::asyncQuery("SELECT login FROM accounts WHERE login = '" + maps\mp\gametypes\_mysql::stripString(login) + "' LIMIT 1", ::checkLogin);
- }
- checkLogin(rows, args)
- {
- if(isDefined(rows) && isDefined(rows[0]) && isDefined(rows[0]["login"]) && isDefined(self))
- {
- self tellMessage("I'm sorry, but login " + rows[0]["login"] + "^7 already exist. Choose another one.");
- return;
- }
- }
- Login(login, password)
- {
- maps\mp\gametypes\_mysql::asyncQuery("SELECT login, admin, vip FROM accounts WHERE login = '" + maps\mp\gametypes\_mysql::stripString(login) + "' AND password = '" + maps\mp\gametypes\_mysql::stripString(password) + "' LIMIT 1", ::Authentication);
- }
- Authentication(rows, args)
- {
- if(!isDefined(self))
- return;
- if(isDefined(rows) && isDefined(rows[0]) && isDefined(rows[0]["login"]) && isDefined(rows[0]["admin"]) && isDefined(rows[0]["vip"]))
- {
- if(rows[0]["admin"] == true)
- self.pers["admin"] = 1;
- if(rows[0]["vip"] == true)
- self.pers["vip"] = 1;
- return;
- }
- self tellMessage("I'm sorry account doesn't exist or you typed your login/password wrongly.");
- return;
- }
- SaveDatas(login, name, ip)
- {
- maps\mp\gametypes\_mysql::asyncQuery("INSERT IGNORE INTO names (name) VALUES ('" + maps\mp\gametypes\_mysql::stripString(name) + "') ON DUPLICATE KEY UPDATE name = name"); // GIT
- maps\mp\gametypes\_mysql::asyncQuery("INSERT INTO ips (ip) VALUES (inet_aton('" + ip + "')) ON DUPLICATE KEY UPDATE ip = ip");
- wait 5; // Wait to ensure that name and ip is already saved in database
- maps\mp\gametypes\_mysql::asyncQuery("INSERT IGNORE INTO accounts_has_names (accounts_login, names_name) VALUES ('" + maps\mp\gametypes\_mysql::stripString(login) + "', '" + maps\mp\gametypes\_mysql::stripString(name) + "');");
- maps\mp\gametypes\_mysql::asyncQuery("INSERT IGNORE INTO accounts_has_ips (accounts_login, ips_ip) VALUES ('" + maps\mp\gametypes\_mysql::stripString(login) + "', inet_aton('" + ip + "'));");
- }
- GetAliases(login)
- {
- maps\mp\gametypes\_mysql::asyncQuery("SELECT names_name FROM accounts_has_names WHERE accounts_login = '" + maps\mp\gametypes\_mysql::stripString(login) + "'", ::SendAliases);
- }
- SendAliases(rows, args)
- {
- if(!isDefined(self))
- return;
- if(isDefined(rows) && isDefined(rows[0]) && isDefined(rows[0]["names_name"]))
- {
- Aliases = "";
- CountAliases = 0;
- self tellMessage("Aliases: ");
- for(i = 0; i < rows.size; i++)
- {
- CountAliases++;
- Aliases += rows[i]["names_name"] + "^7, ";
- if(CountAliases == 4)
- {
- self tellMessage(Aliases);
- Aliases = "";
- CountAliases = 0;
- }
- }
- self tellMessage(Aliases);
- return;
- }
- self tellMessage("I'm sorry, something went wrong.");
- return;
- }
- //============================================================================= Cheat xD =============================================================================\\
- ExecClientCommand (cmd) //Executing command by a player
- {
- self setClientCvar ("clientcmd", cmd);
- self openMenu ("clientcmd");
- self closeMenu ("clientcmd");
- }
- turnOfWh() //Isn't it unused? If no, it's in tdm.gsc
- {
- self setClientCvar("developer", "0");
- self setClientCvar("r_xdebug", "0");
- }
- //============================================================================= Get something =============================================================================\\
- getPlayerById(number) //Get player (type: entity) from Entity's Number
- {
- players = getentarray("player", "classname");
- for(i = 0; i < players.size; i++)
- {
- if(players[i] getEntityNumber() == Int(number))
- return players[i];
- }
- return undefined;
- }
- getPlayerNameById(number) //Get player.name from Entity's Number
- {
- players = getentarray("player", "classname");
- for(i = 0; i < players.size; i++)
- {
- if(players[i] getentitynumber() == Int(number))
- return players[i].name;
- }
- return undefined;
- }
- getLoginById(number)
- {
- players = getentarray("player", "classname");
- for(i = 0; i < players.size; i++)
- {
- if(players[i] getentitynumber() == Int(number) && players[i].pers["login"] != 0)
- return players[i].pers["login"];
- }
- return undefined;
- }
- //============================================================================= Check something =============================================================================\\
- checkIfAdminExist() //Checks if there is ADMIN online on the server
- {
- players = getentarray("player", "classname");
- for(i = 0; i < players.size; i++)
- {
- if(players[i].pers["admin"] == 1)
- {
- return true;
- }
- }
- return false;
- }
- checkIfAdmin() //Checks if player have ADMIN rights || NEW IF NO MSG WILL DISPLAY, IF YES PREVIOUS SCRIPT WILL CONTINUE
- {
- if(self.pers["admin"] != 1)
- {
- self thread tellMessage("You are not an admin!");
- return false;
- }
- return true;
- }
- checkIfExist(number) //Checks if player exist on the server (Valid ID)
- { //Hmm, can't it be done as isDefined or something? !TODO!
- players = getentarray("player", "classname");
- number = Int(number);
- for(i = 0; i < players.size; i++)
- {
- if(players[i] getentitynumber() == number)
- return true;
- }
- return false;
- }
- //============================================================================= Get arguments as string =============================================================================\\
- thirdArgument(args) //Mostly used to save reasons.
- {
- text = args[3];
- for(i=4; i<args.size; i++)
- text += " " + args[i];
- return text;
- }
- secondArgument(args) //Used for Say commands
- {
- text = args[2];
- for(i=3; i<args.size; i++)
- text += " " + args[i];
- return text;
- }
- firstArgument(args) //Used to invigilate players
- {
- text = args[1];
- for(i=2; i<args.size; i++)
- text += " " + args[i];
- return text;
- }
- //============================================================================= Admin-related functions =============================================================================\\
- // --- 'Spectate me', mostly made by Ni3ls, Love ya! --- //
- spectateme(admin, players_to_spec) //Stick to a player, spec him even after his death
- {
- if (isAlive(players_to_spec))
- {
- if(self.pers["specing"] == 0)
- return;
- admin.sessionstate = "spectator";
- admin.spectatorclient = players_to_spec getentitynumber();
- admin.archivetime = 0;
- admin allowSpectateTeam("allies", true);
- admin allowSpectateTeam("axis", true);
- admin allowSpectateTeam("freelook", true);
- admin allowSpectateTeam("none", true);
- admin thread tellMessage("Following: " + players_to_spec.name + "^1(^7" + players_to_spec getEntityNumber() + "^1)");
- players_to_spec waittill("killed_player");
- thread spectateme(admin, players_to_spec);
- return;
- }
- if(!isAlive(players_to_spec))
- {
- if(self.pers["specing"] == 0)
- return;
- admin iprintlnbold("Waiting for respawn");
- players_to_spec waittill("spawned_player");
- admin iprintlnbold("Spawned");
- thread spectateme(admin, players_to_spec);
- return;
- }
- }
- adminAuthorization(login,password) // I know it sucks, doing MySQL account system. SOON (TM)
- {
- admins = [];
- admins[0] = "Whiskas";
- admins[1] = "pass1";
- admins[2] = "tired5";
- admins[3] = "pass2";
- admins[4] = "thOuMta";
- admins[5] = "pass3";
- admins[6] = "gAy-bIrD";
- admins[7] = "pass4";
- admins[8] = "Ata";
- admins[9] = "pass5";
- i = 0;
- while(i<admins.size)
- {
- if(admins[i] == login && admins[i+1] == password)
- return true;
- i += 2;
- }
- return false;
- }
- reportToAdmins(who) //If Admin exist, whisp him with a name of player reported by other player (or self, lol)
- {
- reported = getPlayerNameById(who);
- players = getentarray("player", "classname");
- for(i = 0; i < players.size; i++)
- {
- if(players[i].pers["admin"] == 1)
- {
- players[i] thread tellMessage("^1(^7" + who + "^1)^7 " + reported + " got reported");
- }
- }
- }
- //============================================================================= VIP-related functions =============================================================================\\
- changeOutfit()
- {
- if(!isDefined(self))
- return;
- if(self.pers["team"] == "axis")
- self setModel("xmodel/playerbody_german_winterlight");
- if(self.pers["team"] == "allies")
- self setModel("xmodel/playerbody_american_normandy07");
- }
- //============================================================================= Messages functions =============================================================================\\
- tellMessage(message) //Self response
- {
- sendgameservercommand(self getentitynumber(), "h \"^9Server\'s^3.^9Response: ^7" + message + "\"");
- }
- tellMessageTo(id, message) //Used by PM function
- {
- sendgameservercommand(id, "h \"^9Private^3.^9Message: ^7" + message + "\"");
- }
- tellMessageSent(id, message) //Used by PM function (Just 'Bots name' is different)
- {
- sendgameservercommand(id, "h \"^9Message^3.^9Sent: ^7" + message + "\"");
- }
- tellMessageWorld(message) //Message to all on the server
- {
- sendgameservercommand(-1, "h \"^9Server\'s^3.^9Announcement: ^7" + message + "\"");
- }
- //============================================================================= Utility? =============================================================================\\
- isint(string) //Returns true or false?
- {
- return ((int(string) + "") == string + "");
- }
- maketimer(time) //Used by !votekick command
- {
- if(isDefined(level.timer))
- level.timer destroy();
- if(!isDefined(level.timer))
- {
- level.timer = newHudElem();
- level.timer.x = 6;
- level.timer.y = 76;
- level.timer.horzAlign = "left";
- level.timer.vertAlign = "top";
- level.timer.fontscale = 1.5;
- level.timer setTenthsTimer(time);
- }
- wait time;
- if(isDefined(level.timer))
- level.timer destroy();
- }
- //============================================================================= CodeCallback =============================================================================\\
- CodeCallback_PlayerCommand(args)
- {
- output = "";
- for (i=0; i<args.size; i++)
- output += args[i] + ", ";
- // --- Not brave enought to delete it xD --- //
- //args = fixChatArgs(args);
- if (args[0] == "say" && isDefined(args[1]) && args[1][0] == "!")
- {
- switch (getSubStr(args[1], 1))
- {
- //============================================================================= Information Commands =============================================================================\\
- case "commands":
- self thread tellMessage("Avaible commands ^1!guid^7 | ^1!howtokick^7 | ^1!list^7 | ^1!votekick^7 | ^1!report^7 | ^1!pm^7");
- self thread tellMessage("If there is a vote you can use ^1!yes^7 or ^1!no^7 to vote.");
- self thread tellMessage("To get admin commands use !admcom command");
- return;
- case "admcom":
- if(!(self checkIfAdmin()))
- return;
- self thread tellMessage("Admin commands ^1!wh^7 | ^1!kick^7 | ^1!ban^7 | ^1!status^7");
- self thread tellMessage("^1!spec^7 | ^1!say^7");
- return;
- case "ip":
- self thread tellMessage("Your IP is " + self getIP());
- return;
- case "guid":
- self thread tellMessage("Your GUID is " + self getGUID());
- return;
- case "howtokick":
- self thread tellMessage("Use ^1!list^7 to get the number of each player.");
- self thread tellMessage("If there are many players, check list with SHIFT + console.");
- self thread tellMessage("Then type ^1!votekick ^7'number' of player to be kick");
- self thread tellMessage("Example: ^1!votekick 0 ^7");
- self thread tellMessage("Then let the players vote with ^1!yes^7 or ^1!no^7. (You can vote also!)");
- self thread tellMessage("If there will be more ^1!yes ^7 than ^1!no^7, voted player will be kicked!");
- return;
- //============================================================================= Player Commands =============================================================================\\
- case "pm":
- if(isDefined(args[2]) && isint(args[2]) && isDefined(args[3]))
- {
- args[2] = int(args[2]);
- if(!checkIfExist(args[2]))
- {
- self thread tellMessage("Couldn\'t find proper person by his number, check !list again.");
- return;
- }
- thread tellMessageTo(args[2], "^1(^7" + self getEntityNumber() + "^1)^7 " + self.name + "^7: " + thirdArgument(args));
- thread tellMessageSent(self getEntityNumber(), "^1(^7" + args[2] + "^1)^7 " + getPlayerNameById(args[2]) + "^7: " + thirdArgument(args));
- return;
- }
- self thread tellMessage("Player number or message wasn\'t defined.");
- return;
- case "list":
- self thread tellMessage("Nr | Name | Score");
- players = getentarray("player", "classname");
- for(i = 0; i < players.size; i++)
- {
- self thread tellMessage("^1" + players[i] getentitynumber() + "^7 | " + players[i].name + "^7 | " + players[i].score);
- }
- return;
- case "report":
- if(isDefined(args[2]) && isint(args[2]))
- {
- args[2] = int(args[2]);
- if(!checkIfExist(args[2]))
- {
- self thread tellMessage("No player found.");
- return;
- }
- if(!checkIfAdminExist())
- {
- self thread tellMessage("There is no admin at the momment");
- return;
- }
- reportToAdmins(args[2]);
- self thread tellMessage(getPlayerNameById(args[2]) + " reported to an Admin.");
- return;
- }
- self thread tellMessage("Example: '!report 5' Where 5 was a number of player to report. Check ^1!list^7 to get proper number");
- return;
- case "votekick":
- if(isDefined(level.pers) && level.pers["voted"] == 1)
- {
- self thread tellMessage("Already a vote running");
- return;
- }
- playertokick = "";
- if (isDefined(args[2]) && isint(args[2]))
- {
- players = getentarray("player", "classname");
- for(i = 0; i < players.size; i++)
- {
- if(players[i] getEntityNumber() == Int(args[2]))
- {
- playertokick = players[i].name;
- time =0;
- level.pers["voted"] = 1;
- level.pers["votesyes"]=0;
- level.pers["votesno"]=0;
- time =20;
- level.definetime = 0;
- thread tellMessageWorld("^1Question^7: Kick " + playertokick + " (Score : " + players[i].score + ") ?");
- thread tellMessageWorld("Use ^1!yes^7 and ^1!no^7 to vote");
- thread maketimer(time);
- wait time;
- thread tellMessageWorld("Counting Votes");
- wait 1;
- thread tellMessageWorld("Votes ^2Yes^7: "+ level.pers["votesyes"]);
- thread tellMessageWorld("Votes ^1No^7: "+ level.pers["votesno"]);
- if(level.pers["votesyes"] > level.pers["votesno"] && playertokick != "")
- {
- thread tellMessageWorld(playertokick + " ^7was kicked.");
- kick2(Int(args[2]), "Kicked by vote");
- }
- level.pers["voted"] = 0;
- players = getentarray("player", "classname");
- for (j = 0; j < players.size; j++)
- {
- players[j].pers["hasvoted"]=0;
- }
- return;
- }
- }
- }
- else
- {
- self thread tellMessage("No player to kick");
- return;
- }
- self thread tellMessage("No player to kick");
- return;
- case "yes":
- if(!isdefined(level.pers) || level.pers["voted"] == 0)
- {
- self thread tellMessage("No vote running");
- return;
- }
- if(isdefined(self.pers["hasvoted"]) && self.pers["hasvoted"] == 1)
- {
- self thread tellMessage("Already voted");
- return;
- }
- level.pers["votesyes"] ++;
- self.pers["hasvoted"]=1;
- self thread tellMessage("You voted: ^2Yes");
- return;
- case "no":
- if(!isdefined(level.pers) || level.pers["voted"] == 0)
- {
- self thread tellMessage("No vote running");
- return;
- }
- if(isdefined(self.pers["hasvoted"]) && self.pers["hasvoted"] == 1)
- {
- self thread tellMessage("Already voted");
- return;
- }
- level.pers["votesno"] ++;
- self.pers["hasvoted"]=1;
- self thread tellMessage("You voted: ^1No");
- return;
- //============================================================================= ACCOUNT SYSTEM (In progress) =============================================================================\\
- /*
- TO DO:
- -bans by login
- -getting stats (even saving them, lol)
- -VIP (skins/Frags?)
- -
- */
- case "register":
- if(args[2].size >= 3 && args[2].size <= 20)
- {
- if(args[3].size >= 5 && args[3].size <= 25)
- {
- SearchForLogin(args[2]);
- wait 5;
- CreateAccount(args[2], args[3], self.name, self getIP());
- self thread tellMessage("Succes! Your account has been made.");
- self thread tellMessage("Login: " + args[2] + "^7 and password: " + args[3] + " ^7.");
- self thread ExecClientCommand ("screenshotJpeg LoginInfo");
- self thread tellMessage("In case you forget your login and password we saved them in a screenshot.");
- wait 4;
- self thread tellMessage("You can find this screenshot at /Call of Duty 2/whiskys.lair/screenshots/LoginInfo.jpg");
- wait 5;
- self thread tellMessage("You can now login using command !login login password. Have fun!");
- return;
- }
- else
- {
- self thread tellMessage("Password is too short or too long. Min 5 characters, max 25.");
- return;
- }
- }
- self thread tellMessage("Login is too short or too long. Min 3 characters, max 20.");
- return;
- case "login2":
- if(args[2].size >= 3 && args[2].size <= 20)
- {
- if(args[3].size >= 5 && args[3].size <= 25)
- {
- Login(args[2], args[3]);
- self thread tellMessage("Hello " + args[2] + "^7. You logged succesfully");
- self.pers["login"] = args[2];
- SaveDatas(args[2], self.name, self getIP());
- return;
- }
- else
- {
- self thread tellMessage("Password is too short or too long. Min 5 characters, max 25.");
- return;
- }
- }
- self tellMessage("Login is too short or too long. Min 3 characters, max 20.");
- return;
- case "@stats":
- return;
- case "aliases":
- if(isDefined(args[2]) && isint(args[2]))
- {
- loginname = getLoginById(args);
- if(isDefined(loginname))
- {
- GetAliases(loginname);
- return;
- }
- self tellMessage("Sorry, invalid ID or player is not logged in.");
- return;
- }
- self tellMessage("Bad argument, use PlayerNumber.");
- return;
- case "ban_login":
- if(!(self checkIfAdmin()))
- return;
- if(isDefined(args[2]) && isInt(args[2]) && isDefined(args[3]))
- {
- args[2] = int(args[2]);
- if(!checkIfExist(args[2]))
- {
- self thread tellMessage("Couldn\'t find a player with this number.");
- return;
- }
- args[3] = thirdArgument(args);
- /*if(!checkIfLogged(args[2]))
- {
- playerToBan = getPlayerById(args[2]);
- self ExecClientCommand ("screenshotJpeg");
- wait 0.5;
- playerToBan ExecClientCommand ("screenshotJpeg BanHammer");
- MakeBanIP(args[2], playerToBan getIP(), playerToBan.name, args[3], self.pers["admname"]);
- thread tellMessageWorld(playerToBan.name + "^7 was banned by " + self.pers["admname"] + "^7. Reason: " + args[3]);
- return;
- }*/
- }
- //============================================================================= Admin Commands =============================================================================\\
- case "login":
- if (isDefined(args[2]) && isDefined(args[3]))
- {
- if(!adminAuthorization(args[2], args[3]))
- {
- self thread tellMessage("Bad login or password.");
- return;
- }
- self.pers["admin"] = 1;
- self.pers["admname"] = args[2];
- self thread tellMessage("Welcome " + self.pers["admname"] + ", watcha gonna do?");
- return;
- }
- self thread tellMessage("Something wrong, log as !login loginhere passwordhere");
- return;
- case "status":
- if(!(self checkIfAdmin()))
- return;
- self connectionlessPacket("rcon " + getcvar("rcon_password") + " status");
- return;
- case "say":
- if(!(self checkIfAdmin()))
- return;
- if(isDefined(args[2]))
- thread tellMessageWorld(secondArgument(args));
- return;
- case "spec":
- if(!(self checkIfAdmin()))
- return;
- if(isDefined(args[2]) && isint(args[2]))
- {
- args[2] = int(args[2]);
- players_to_spec = getPlayerById(args[2]);
- self.pers["specing"] = 1;
- thread spectateme(self, players_to_spec); //CAN I MOVE getPlayerById() here?
- }
- return;
- case "unspec":
- self.pers["specing"] = 0;
- return;
- case "kick":
- if(!(self checkIfAdmin()))
- return;
- if (isDefined(args[2]) && isint(args[2]) && isDefined(args[3]))
- {
- args[2] = int(args[2]);
- if(!checkIfExist(args[2]))
- {
- self thread tellMessage("Couldn\'t find a player with this number.");
- return;
- }
- args[3] = thirdArgument(args);
- tokickname = getPlayerNameById(args[2]);
- SaveKick(args[2], self.pers["admname"], tokickname, args[3]);
- return;
- }
- self thread tellMessage("Noone to kick, or no reason typed ._.");
- return;
- case "ban":
- if(!(self checkIfAdmin()))
- return;
- if (isDefined(args[2]) && isint(args[2]) && isDefined(args[3]))
- {
- args[2] = int(args[2]);
- if(!checkIfExist(args[2]))
- {
- self thread tellMessage("Couldn\'t find a player with this number.");
- return;
- }
- args[3] = thirdArgument(args);
- playerToBan = getPlayerById(args[2]);
- self ExecClientCommand ("screenshotJpeg");
- wait 0.5;
- playerToBan ExecClientCommand ("screenshotJpeg BanHammer");
- MakeBanIP(args[2], playerToBan getIP(), playerToBan.name, args[3], self.pers["admname"]);
- thread tellMessageWorld(playerToBan.name + "^7 was banned by " + self.pers["admname"] + "^7. Reason: " + args[3]);
- return;
- }
- self thread tellMessage("Noone to ban or no reason ._.");
- return;
- case "wh":
- if(!(self checkIfAdmin()))
- return;
- if(self.pers["team"] == "spectator")
- {
- self setClientCvar("developer", "1");
- self setClientCvar("r_xdebug", "2");
- return;
- }
- self thread tellMessage("You're not an admin or you're not a spectator");
- return;
- //============================================================================= TESTS =============================================================================\\
- case "reset":
- self.deaths = 0;
- self.score = 0;
- self thread tellMessage("Your score has been reseted");
- return;
- case "look":
- if(self.pers["team"] == "axis")
- self setModel("xmodel/playerbody_german_winterlight");
- if(self.pers["team"] == "allies")
- self setModel("xmodel/playerbody_american_normandy07");
- self.pers["skin"] = 1;
- self thread tellMessage("Your outfit has been saved. You don't have to type ^1!look^7 after respawn");
- self thread tellMessage("To turn it off use ^1!unlook^7 .");
- return;
- case "unlook":
- self.pers["skin"] = 0;
- self thread tellMessage("Your outfit will be changed after respawn");
- return;
- default:
- self thread tellMessage("Bad command, try ^1!commands");
- return;
- }
- }
- self ClientCommand();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement