sadly it is.
This is based on the OLD Runescape, back when it was at it's zenith of popularity.
PHP Code:
/*
PLEASE NOTE THAT THIS PLUGIN HAS ALOT OF BORROWED CODE, IT'S BECAUSE I AM LAZY AND I DIDN'T FEEL LIKE CHECKING FOR FUNCTIONS
NERGAL
List of Plugins I borrowed code from
------------------------------------
Cosmetic Leveling Mod by noodleboy347
Saxton Hale plugin by Rainbolt Dash & Flamin' Sarge
Saxton Hale Menu by Dr.ShakShuka
*/
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <morecolors>
#include <tf2>
#include <tf2_stocks>
#include <tf2items>
#define PLUGIN_VERSION "1.0"
new playerLevel[MAXPLAYERS+1];
new playerExp[MAXPLAYERS+1];
new playerExpMax[MAXPLAYERS+1];
new Handle:levelHUD[MAXPLAYERS+1] = INVALID_HANDLE;
new Handle:hudLevel;
new Handle:hudEXP;
new Handle:hudPlus1;
new Handle:hudPlus2;
new Handle:hudLevelUp;
new Handle:rs_enable;
new Handle:cvar_level_default;
new Handle:cvar_level_max;
new Handle:cvar_exp_default;
new Handle:cvar_exp_onkill;
new Handle:cvar_exp_ondmg;
public Plugin:myinfo = {
name = "Runescape Mod",
author = "Assyrian/Nergal, noodleboy347, ",
description = "Runescape mod for medieval mode",
version = PLUGIN_VERSION,
url = "http://steamcommunity.com/groups/acvsh"
};
public OnPluginStart()
{
CreateConVar("rs_version", PLUGIN_VERSION, "Version of the plugin");
rs_enable = CreateConVar("rs_enabled", "1", "Enables Runescape mod");
cvar_level_default = CreateConVar("rs_level_default", "1", "Default level for players when they join");
cvar_level_max = CreateConVar("rs_level_max", "99", "Maxmimum level players can reach and use to calculate damage");
cvar_exp_default = CreateConVar("rs_exp_default", "83", "Default max experience for players when they join");
cvar_exp_onkill = CreateConVar("rs_exp_onkill", "116", "Experience to gain on kill");
cvar_exp_ondmg = CreateConVar("rs_exp_damage_mult", "0.25", "Experience multiplier for damage");
AutoExecConfig(true, "RuneScapeMod");
// = CreateConVar("", "0", "", FCVAR_PLUGIN, true, 0.0, true, 1.0);
hudLevel = CreateHudSynchronizer();
hudEXP = CreateHudSynchronizer();
hudPlus1 = CreateHudSynchronizer();
hudPlus2 = CreateHudSynchronizer();
hudLevelUp = CreateHudSynchronizer();
HookEvent("player_spawn", event_player_spawn);
HookEvent("player_death", event_player_death, EventHookMode_Pre);
HookEvent("player_hurt", event_hurt, EventHookMode_Pre);
//RegConsoleCmd("rs", RSMenu);
for (new client = 0; client <= MaxClients; client++)
{
if (IsValidClient(client, false)) SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
}
/*public OnConfigsExecuted()
{
}
new sgShieldProp = CreateEntityByName("prop_dynamic");
new Float:tempVec[3] = {0.0,...}; //vector to teleport it to
DispatchKeyValue(sgShieldProp, "model", "models/buildables/sentry_shield.mdl");
DispatchKeyValue(sgShieldProp, "skin", "0"); //0 is red, 1 is blu
DispatchSpawn(sgShieldProp);
TeleportEntity(sgShieldProp, tempVec, NULL_VECTOR, NULL_VECTOR);
AcceptEntityInput(sgShieldProp, "TurnOn");
*/
public OnClientPutInServer(client)
{
if (GetConVarBool(rs_enable))
{
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
playerLevel[client] = GetConVarInt(cvar_level_default);
playerExp[client] = 0;
playerExpMax[client] = GetConVarInt(cvar_exp_default);
levelHUD[client] = CreateTimer(5.0, DrawHud, client, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
}
//SetMenuExitBackButton(menu, true);
public Action:DrawHud(Handle:timer, any:client)
{
if (IsClientInGame(client))
{
if(playerExp[client] >= playerExpMax[client] && playerLevel[client] < GetConVarInt(cvar_level_max))
{
LevelUp(client, playerLevel[client] + 1);
}
SetHudTextParams(0.14, 0.90, 2.0, 100, 200, 255, 150);
ShowSyncHudText(client, hudLevel, "Level: %i", playerLevel[client]);
SetHudTextParams(0.14, 0.93, 2.0, 255, 200, 100, 150);
if(playerLevel[client] >= GetConVarInt(cvar_level_max))
{
ShowSyncHudText(client, hudEXP, "MAX LEVEL REACHED", playerExp[client], playerExpMax[client]);
}
else
{
ShowSyncHudText(client, hudEXP, "EXP: %i/%i", playerExp[client], playerExpMax[client]);
}
}
return Plugin_Continue;
}
/*public Action:Equipment(Handle:hTimer, any:clientid)
{
new client = GetClientOfUserId(clientid);
if (!IsValidClient(client) || !IsPlayerAlive(client))
return Plugin_Continue;
new weapon = GetPlayerWeaponSlot(client, TFWeaponSlot_Primary);
new index = -1;
if (weapon > MaxClients && IsValidEdict(weapon))
{
index = GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex");
switch (index)
{
}
}
weapon = GetPlayerWeaponSlot(client, TFWeaponSlot_Secondary);
if (weapon > MaxClients && IsValidEdict(weapon))
{
index = GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex");
switch (index)
{
}
}
weapon = GetPlayerWeaponSlot(client, TFWeaponSlot_Melee);
if (weapon > MaxClients && IsValidEdict(weapon))
{
index = GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex");
switch (index)
{
}
}
return Plugin_Continue;
}*/
public Action:event_player_spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (!IsValidClient(client, false))
{
return Plugin_Continue;
}
new TFClassType:playerclass = TF2_GetPlayerClass(client);
switch (playerclass)
{
case TFClass_Scout, TFClass_Engineer, TFClass_Pyro, TFClass_Spy, TFClass_Soldier, TFClass_Heavy:
{
TF2_SetPlayerClass(client, TFClass_Soldier, _, false);
}
case TFClass_DemoMan: TF2_SetPlayerClass(client, TFClass_DemoMan, _, false);
case TFClass_Medic: TF2_SetPlayerClass(client, TFClass_Medic, _, false);
case TFClass_Sniper: TF2_SetPlayerClass(client, TFClass_Sniper, _, false);
}
TF2_RemoveAllWeapons(client);
SetEntPropFloat(client, Prop_Send, "m_flMaxspeed", 300.0);
SetEntPropFloat(client, Prop_Send, "m_iHealth", 200.0);
return Plugin_Continue;
}
public Action:event_player_death(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new damage = GetEventInt(event, "damageamount");
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
if (!IsValidClient(client) || !IsValidClient(attacker))
{
return Plugin_Continue;
}
new originalhp = GetClientHealth(client);
new Float:health = RoundFloat(damage * 0.133 / 5.0 + originalhp);
SetEntPropFloat(attacker, Prop_Send, "m_iHealth", health);
if (health > 300)
{
SetEntPropFloat(attacker, Prop_Send, "m_iHealth", 300.0);
}
if (attacker > 0 && attacker <= MaxClients && attacker != client && GetConVarInt(cvar_exp_onkill) >= 1 && playerLevel[attacker] < GetConVarInt(cvar_level_max) && IsClientInGame(attacker))
{
new expBoost1 = GetConVarInt(cvar_exp_onkill);
playerExp[client] = playerExp[client] + expBoost1;
SetHudTextParams(0.28, 0.93, 1.0, 255, 100, 100, 150, 1);
ShowSyncHudText(client, hudPlus2, "+%i", expBoost1);
}
return Plugin_Changed;
}
public Action:event_hurt(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
new damage = GetEventInt(event, "damageamount");
if (!IsValidClient(attacker) || !IsValidClient(client) || client == attacker)
{
return Plugin_Continue;
}
new percent = GetConVarFloat(cvar_exp_ondmg);
new Float:rawdamage = (damage * Float:percent);
new experience = RoundToNearest(Float:rawdamage);
if (!(experience <= 0) && attacker > 0 && attacker <= MaxClients && IsClientInGame(attacker) && (attacker != client) && playerLevel[attacker] < GetConVarInt(cvar_level_max))
{
if (experience >= playerExpMax[attacker])
{
experience = playerExpMax[attacker];
}
playerExp[attacker] = playerExp[attacker] + experience;
SetHudTextParams(0.24, 0.93, 1.0, 255, 100, 100, 150, 1);
ShowSyncHudText(client, hudPlus1, "+%i", experience);
}
return Plugin_Continue;
}
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3])
{
if (attacker > 0 && victim != attacker)
{
if (damagetype & DMG_CRIT)
{
return Plugin_Continue;
}
decl Float:vec1[3];
decl Float:vec2[3];
GetEntPropVector(attacker, Prop_Send, "m_vecOrigin", vec1); //Spot of attacker
GetEntPropVector(victim, Prop_Send, "m_vecOrigin", vec2); //Spot of victim
new Float:dist = GetVectorDistance(vec1, vec2, false); //Calculates the distance between target and attacker
new String:classname[64];
if (IsValidEdict(weapon)) GetEdictClassname(weapon, classname, sizeof(classname));
/*melee and range damage formulas
damage = 5 + C + C*D/64
damage = 5 + C * (D + 64) / 64
damage = 5 + C * (1 + D/64)
C = "combat style"
D = "damage modifier"
*/
}
stock SpawnWeapon(client, String:name[], index, level, qual, String:att[])
{
new Handle:hWeapon = TF2Items_CreateItem(OVERRIDE_ALL|FORCE_GENERATION);
if (hWeapon == INVALID_HANDLE)
return -1;
TF2Items_SetClassname(hWeapon, name);
TF2Items_SetItemIndex(hWeapon, index);
TF2Items_SetLevel(hWeapon, level);
TF2Items_SetQuality(hWeapon, qual);
new String:atts[32][32];
new count = ExplodeString(att, " ; ", atts, 32, 32);
if (count > 0)
{
TF2Items_SetNumAttributes(hWeapon, count/2);
new i2 = 0;
for (new i = 0; i < count; i += 2)
{
TF2Items_SetAttribute(hWeapon, i2, StringToInt(atts[i]), StringToFloat(atts[i+1]));
i2++;
}
}
else
TF2Items_SetNumAttributes(hWeapon, 0);
new entity = TF2Items_GiveNamedItem(client, hWeapon);
CloseHandle(hWeapon);
EquipPlayerWeapon(client, entity);
return entity;
}
stock bool:IsValidClient(client, bool:bReplay = true)
{
if (client <= 0 || client > MaxClients)
return false;
if (!IsClientInGame(client))
return false;
if (bReplay && (IsClientSourceTV(client) || IsClientReplay(client)))
return false;
return true;
}
stock LevelUp(client, level)
{
playerLevel(client) = level;
playerExp(client) -= playerExpMax(client);
SetHudTextParams(0.22, 0.90, 5.0, 100, 255, 100, 150, 2);
ShowSyncHudText(client, hudLevelUp, "LEVEL UP!");
playerExpMax(client) = RoundFloat((playerExpMax(client)*1.10) + playerExpMax(client));
if (level == GetConVarInt(cvar_level_max))
{
playerExpMax[client] = 0;
}
CPrintToChatAllEx(client, "{teamcolor}%N{default} has grown to: {green}Level %i", client, playerLevel[client]);
}