Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////
- //GLOBAL STUFF//
- ////////////////
- #include <sourcemod>
- #include <sdktools>
- #include <tf2>
- #include <tf2_stocks>
- #include <colors>
- #include <clientprefs>
- #pragma semicolon 1
- #define PLUGIN_VERSION "1.14"
- #define PLUGIN_AUTHOR "Modified by 404: User Not Found, Originally created by noodleboy347"
- #define PLUGIN_NAME "[TF2] Special Donator Features"
- #define PLUGIN_URL "http://www.alliedmods.net"
- #define PLUGIN_DESCRIPTION "Speciality Donator Features"
- #define NO_ATTACH 0
- #define ATTACH_NORMAL 1
- #define ATTACH_HEAD 2
- #define PREMIUMFLAG ADMFLAG_CUSTOM1
- #define ADMINFLAG ADMFLAG_GENERIC
- #define TAG "{green}[{lightgreen}DONATE{green}]{default}"
- new Handle:cvar_enable;
- new Handle:cvar_ads_enable;
- new Handle:cvar_ads_int;
- new Handle:cvar_swapteams;
- new Handle:cvar_color;
- new Handle:cvar_playerblack;
- new Handle:cvar_playerred;
- new Handle:cvar_playerblue;
- new Handle:cvar_playergreen;
- new Handle:cvar_playeryellow;
- new Handle:cvar_playerpurple;
- new Handle:cvar_playercyan;
- new Handle:cvar_glow;
- new Handle:cvar_infcloak;
- new Handle:cvar_metal;
- new Handle:cvar_stunballs;
- new Handle:cvar_jarates;
- new Handle:cvar_milks;
- new Handle:cvar_uber;
- new Handle:cvar_clip;
- new cEnable;
- new cAdsEnable;
- new Float:cAdsInterval;
- new cInfCloak;
- new cColor;
- new cPlayerBlack;
- new cPlayerRed;
- new cPlayerBlue;
- new cPlayerGreen;
- new cPlayerYellow;
- new cPlayerPurple;
- new cPlayerCyan;
- new cGlow;
- new cSwap;
- new cStunballs;
- new cJarates;
- new cMilks;
- new cMetal;
- new Float:cUber;
- new cClip;
- new Handle:tCloak[MAXPLAYERS+1];
- new Handle:tGlow[MAXPLAYERS+1];
- new bool:pBlack[MAXPLAYERS+1];
- new bool:pRed[MAXPLAYERS+1];
- new bool:pBlue[MAXPLAYERS+1];
- new bool:pGreen[MAXPLAYERS+1];
- new bool:pYellow[MAXPLAYERS+1];
- new bool:pPurple[MAXPLAYERS+1];
- new bool:pCyan[MAXPLAYERS+1];
- new bool:pGlow[MAXPLAYERS+1];
- new bool:pFirstSpawn[MAXPLAYERS+1];
- //////////////////////
- //PLUGIN INFORMATION//
- //////////////////////
- public Plugin:myinfo =
- {
- name = PLUGIN_NAME,
- author = PLUGIN_AUTHOR,
- description = PLUGIN_DESCRIPTION,
- version = PLUGIN_VERSION,
- url = PLUGIN_URL
- }
- ////////////////
- //PLUGIN START//
- ////////////////
- public OnPluginStart()
- {
- RegConsoleCmd("say", Say);
- RegConsoleCmd("playerblack", Command_Black);
- RegConsoleCmd("playerred", Command_Red);
- RegConsoleCmd("playerblue", Command_Blue);
- RegConsoleCmd("playergreen", Command_Green);
- RegConsoleCmd("playeryellow", Command_Yellow);
- RegConsoleCmd("playerpurple", Command_Purple);
- RegConsoleCmd("playercyan", Command_Cyan);
- RegConsoleCmd("swapteam", Command_Swap);
- RegConsoleCmd("glow", Command_Glow);
- RegAdminCmd("premium_refresh", Command_Refresh, ADMFLAG_ROOT);
- CreateConVar("premium_version", PLUGIN_VERSION, "Plugin version", FCVAR_NOTIFY);
- cvar_enable = CreateConVar("premium_enable", "1", "Enable/Disable the plugin");
- cvar_ads_enable = CreateConVar("premium_advertisement_enable", "1", "Enable/Disable advertisements");
- cvar_ads_int = CreateConVar("premium_advertisement_interval", "300", "Advertisement interval");
- cvar_color = CreateConVar("premium_color", "1", "Give all donators a set color");
- cvar_infcloak = CreateConVar("premium_cloak_infinite", "1", "Infinite Spy Cloak");
- cvar_clip = CreateConVar("premium_extra_clip", "2", "Extra bullets in clip on spawn");
- cvar_uber = CreateConVar("premium_ubercharge", "50", "Percentage of ubercharge for Medics");
- cvar_stunballs = CreateConVar("premium_stunballs", "20", "Increased Stunballs for Scouts");
- cvar_jarates = CreateConVar("premium_jarates", "10", "Increased Jarates for Snipers");
- cvar_milks = CreateConVar("premium_milks", "20", "Increased Milks for Scouts");
- cvar_metal = CreateConVar("premium_metal", "400", "Increased Metal for Engineers");
- cvar_swapteams = CreateConVar("premium_swapteams", "1", "Instantly swap teams");
- cvar_playerblack = CreateConVar("premium_black", "1", "Change player color to black");
- cvar_playerred = CreateConVar("premium_red", "1", "Change player color to red");
- cvar_playerblue = CreateConVar("premium_blue", "1", "Change player color to blue");
- cvar_playergreen = CreateConVar("premium_green", "1", "Change player color to green");
- cvar_playeryellow = CreateConVar("premium_yellow", "1", "Change player color to yellow");
- cvar_playerpurple = CreateConVar("premium_purple", "1", "Change player color to purple");
- cvar_playercyan = CreateConVar("premium_cyan", "1", "Change player color to cyan");
- cvar_glow = CreateConVar("premium_glow", "1", "Give yourself a flaming head");
- HookEvent("player_spawn", Player_Spawn);
- HookEvent("player_changeclass", Player_Change);
- //HookEvent("post_inventory_application", Player_Locker);
- AutoExecConfig();
- LoadTranslations("premium.phrases");
- ReloadConvars();
- CreateTimer(cAdsInterval, Timer_Ad);
- }
- public OnConfigsExecuted()
- {
- ReloadConvars();
- }
- /////////////////////
- //CONNECT TO SERVER//
- /////////////////////
- public OnClientPostAdminCheck(client)
- {
- if(cEnable && GetUserFlagBits(client) & PREMIUMFLAG)
- {
- pGlow[client] = false;
- pFirstSpawn[client] = true;
- }
- }
- public Action:Timer_Ad(Handle:timer, any:client)
- {
- if(cEnable && cAdsEnable && IsValidEntity(client))
- {
- CPrintToChatAll("%t", "Advertisement");
- CreateTimer(cAdsInterval, Timer_Ad);
- }
- }
- ////////////////
- //PLAYER SPAWN//
- ////////////////
- public Player_Spawn(Handle:event, const String:name[], bool:dontBroadcast)
- {
- new client = GetClientOfUserId(GetEventInt(event, "userid"));
- if(cEnable && (GetUserFlagBits(client) && PREMIUMFLAG && IsClientInGame(client)))
- {
- if(pFirstSpawn[client])
- {
- Premium(client);
- }
- }
- }
- ////////////////
- //CHANGE CLASS//
- ////////////////
- public Player_Change(Handle:event, const String:name[], bool:dontBroadcast)
- {
- new client = GetClientOfUserId(GetEventInt(event, "userid"));
- if(cEnable && (GetUserFlagBits(client) & PREMIUMFLAG || IsValidEntity(client)))
- {
- CloseAllHandles(client);
- }
- }
- ///////////////
- //CLOAK TIMER//
- ///////////////
- public Action:Timer_Cloak(Handle:hTimer, any:client)
- {
- if(cEnable && cInfCloak && IsClientInGame(client) && IsValidEntity(client) && IsClientConnected(client))
- {
- new cond = GetEntProp(client, Prop_Send, "m_nPlayerCond");
- if(cond & 16)
- SetEntPropFloat(client, Prop_Send, "m_flCloakMeter", 100.0);
- }
- tCloak[client] = CreateTimer(0.1, Timer_Cloak, client);
- }
- ////////
- //GLOW//
- ////////
- public Action:Command_Glow(client, args)
- {
- if(cEnable && cGlow)
- {
- if(GetUserFlagBits(client) && PREMIUMFLAG)
- {
- if(pGlow[client] == false)
- {
- CreateParticle("burningplayer_red", 300.0, client, ATTACH_HEAD);
- pGlow[client] = true;
- tGlow[client] = CreateTimer(300.0, Timer_Glow, client);
- }
- else
- {
- CPrintToChat(client, "%s %t", TAG, "AlreadyGlowing");
- }
- CPrintToChat(client, "%t", "ToggleGlow", client);
- }
- else
- {
- CPrintToChat(client, "%s %t", TAG, "NoAccess");
- }
- }
- return Plugin_Handled;
- }
- public Action:Timer_Glow(Handle:timer, any:client)
- {
- pGlow[client] = false;
- }
- ///////////////////////
- //PLAYER COLOR: BLACK//
- ///////////////////////
- public Action:Command_Black(client, args)
- {
- if(cEnable && cPlayerBlack)
- {
- if(GetUserFlagBits(client) && PREMIUMFLAG)
- {
- if(pBlack[client] == false)
- {
- SetEntityRenderColor(client, 0, 0, 0, 255);
- pBlack[client] = true;
- }
- else
- {
- SetClientColor(client, cColor);
- pBlack[client] = false;
- }
- CPrintToChat(client, "%t", "ToggleBlack", client);
- }
- else
- {
- CPrintToChat(client, "%s %t", TAG, "NoAccess");
- }
- }
- return Plugin_Handled;
- }
- /////////////////////
- //PLAYER COLOR: RED//
- /////////////////////
- public Action:Command_Red(client, args)
- {
- if(cEnable && cPlayerRed)
- {
- if(GetUserFlagBits(client) && PREMIUMFLAG)
- {
- if(pRed[client] == false)
- {
- SetEntityRenderColor(client, 255, 100, 100, 255);
- pRed[client] = true;
- }
- else
- {
- SetClientColor(client, cColor);
- pRed[client] = false;
- }
- CPrintToChat(client, "%t", "ToggleRed", client);
- }
- else
- {
- CPrintToChat(client, "%s %t", TAG, "NoAccess");
- }
- }
- return Plugin_Handled;
- }
- //////////////////////
- //PLAYER COLOR: BLUE//
- //////////////////////
- public Action:Command_Blue(client, args)
- {
- if(cEnable && cPlayerBlue)
- {
- if(GetUserFlagBits(client) && PREMIUMFLAG)
- {
- if(pBlue[client] == false)
- {
- SetEntityRenderColor(client, 100, 100, 255, 255);
- pBlue[client] = true;
- }
- else
- {
- SetClientColor(client, cColor);
- pBlue[client] = false;
- }
- CPrintToChat(client, "%t", "ToggleBlue", client);
- }
- else
- {
- CPrintToChat(client, "%s %t", TAG, "NoAccess");
- }
- }
- return Plugin_Handled;
- }
- ///////////////////////
- //PLAYER COLOR: GREEN//
- ///////////////////////
- public Action:Command_Green(client, args)
- {
- if(cEnable && cPlayerGreen)
- {
- if(GetUserFlagBits(client) && PREMIUMFLAG)
- {
- if(pGreen[client] == false)
- {
- SetEntityRenderColor(client, 100, 255, 100, 255);
- pGreen[client] = true;
- }
- else
- {
- SetClientColor(client, cColor);
- pGreen[client] = false;
- }
- CPrintToChat(client, "%t", "ToggleGreen", client);
- }
- else
- {
- CPrintToChat(client, "%s %t", TAG, "NoAccess");
- }
- }
- return Plugin_Handled;
- }
- ////////////////////////
- //PLAYER COLOR: YELLOW//
- ////////////////////////
- public Action:Command_Yellow(client, args)
- {
- if(cEnable && cPlayerYellow)
- {
- if(GetUserFlagBits(client) && PREMIUMFLAG)
- {
- if(pYellow[client] == false)
- {
- SetEntityRenderColor(client, 255, 255, 100, 255);
- pYellow[client] = true;
- }
- else
- {
- SetClientColor(client, cColor);
- pYellow[client] = false;
- }
- CPrintToChat(client, "%t", "ToggleYellow", client);
- }
- else
- {
- CPrintToChat(client, "%s %t", TAG, "NoAccess");
- }
- }
- return Plugin_Handled;
- }
- ////////////////////////
- //PLAYER COLOR: PURPLE//
- ////////////////////////
- public Action:Command_Purple(client, args)
- {
- if(cEnable && cPlayerPurple)
- {
- if(GetUserFlagBits(client) && PREMIUMFLAG)
- {
- if(pPurple[client] == false)
- {
- SetEntityRenderColor(client, 255, 100, 255, 255);
- pPurple[client] = true;
- }
- else
- {
- SetClientColor(client, cColor);
- pPurple[client] = false;
- }
- CPrintToChat(client, "%t", "TogglePurple", client);
- }
- else
- {
- CPrintToChat(client, "%s %t", TAG, "NoAccess");
- }
- }
- return Plugin_Handled;
- }
- ///////////////////////
- //PLAYER COLOR: CYAN///
- ///////////////////////
- public Action:Command_Cyan(client, args)
- {
- if(cEnable && cPlayerCyan)
- {
- if(GetUserFlagBits(client) && PREMIUMFLAG)
- {
- if(pCyan[client] == false)
- {
- SetEntityRenderColor(client, 100, 255, 255, 255);
- pCyan[client] = true;
- }
- else
- {
- SetClientColor(client, cColor);
- pCyan[client] = false;
- }
- CPrintToChat(client, "%t", "ToggleCyan", client);
- }
- else
- {
- CPrintToChat(client, "%s %t", TAG, "NoAccess");
- }
- }
- return Plugin_Handled;
- }
- /////////////////////
- //INSTANT TEAM SWAP//
- /////////////////////
- public Action:Command_Swap(client, args)
- {
- if(cEnable && cSwap && (GetUserFlagBits(client) & PREMIUMFLAG))
- {
- new team = GetClientTeam(client);
- if(team == 2)
- {
- ChangeClientTeam(client, 3);
- CPrintToChat(client, "%s %t", TAG, "TeamBLU");
- }
- if(team == 3)
- {
- ChangeClientTeam(client, 2);
- CPrintToChat(client, "%s %t", TAG, "TeamRED");
- }
- }
- return Plugin_Handled;
- }
- /////////////////////////////////
- //DONATOR BENEFITS LIST COMMAND//
- /////////////////////////////////
- public Action:Say(client, args)
- {
- if(cEnable && IsValidEntity(client))
- {
- new String:message[192];
- GetCmdArgString(message, sizeof(message));
- StripQuotes(message);
- if(StrEqual(message, "!benefits"))
- {
- DisplayPremiumFeatures(client);
- }
- }
- }
- ////////////////
- //PREMIUM MENU//
- ////////////////
- DisplayPremiumFeatures(client)
- {
- if(IsValidEntity(client))
- {
- new Handle:featurepanel = CreatePanel();
- DrawPanelItem(featurepanel, "Donator Features");
- if(cPlayerBlue)
- DrawPanelText(featurepanel, "Donating gives you the following benefits:");
- if(cGlow)
- DrawPanelText(featurepanel, "- Give yourself a glow!");
- if(cPlayerRed)
- DrawPanelText(featurepanel, "- Access to player color changing");
- if(cInfCloak)
- DrawPanelText(featurepanel, "- Infinite Spy cloak");
- if(cSwap)
- DrawPanelText(featurepanel, "- Change teams instantly");
- if(cUber > 0)
- DrawPanelText(featurepanel, "- Increased ubercharge on spawn");
- if(cClip)
- DrawPanelText(featurepanel, "- Increased clip size (More ammo!)");
- if(cStunballs)
- DrawPanelText(featurepanel, "- More Baseballs for Scouts");
- if(cJarates)
- DrawPanelText(featurepanel, "- More Jarates for Snipers");
- if(cMilks)
- DrawPanelText(featurepanel, "- More Milks for Scouts");
- if(cMetal)
- DrawPanelText(featurepanel, "- More Metal for Engineers");
- if(!(GetUserFlagBits(client) & ADMFLAG_CUSTOM1))
- {
- DrawPanelText(featurepanel, " ");
- DrawPanelItem(featurepanel, "Donate today!");
- }
- DrawPanelText(featurepanel, " ");
- DrawPanelItem(featurepanel, "Exit");
- SendPanelToClient(featurepanel, client, Panel_Features, 60);
- CloseHandle(featurepanel);
- }
- }
- //////////////////
- //PANEL HANDLERS//
- //////////////////
- public Panel_Features(Handle:menu, MenuAction:action, param1, param2)
- {
- if(param2 == 2)
- {
- CPrintToChat(param1, "%s %t", TAG, "WebAd");
- }
- if(action == MenuAction_End)
- {
- CloseHandle(menu);
- }
- }
- public Panel_Premium(Handle:menu, MenuAction:action, param1, param2)
- {
- if(action == MenuAction_End)
- {
- CloseHandle(menu);
- }
- }
- /////////////
- //PARTICLES//
- /////////////
- stock Handle:CreateParticle(String:type[], Float:time, entity, attach=NO_ATTACH, Float:xOffs=0.0, Float:yOffs=0.0, Float:zOffs=0.0)
- {
- new particle = CreateEntityByName("info_particle_system");
- if (IsValidEdict(particle)) {
- decl Float:pos[3];
- GetEntPropVector(entity, Prop_Send, "m_vecOrigin", pos);
- pos[0] += xOffs;
- pos[1] += yOffs;
- pos[2] += zOffs;
- TeleportEntity(particle, pos, NULL_VECTOR, NULL_VECTOR);
- DispatchKeyValue(particle, "effect_name", type);
- if (attach != NO_ATTACH) {
- SetVariantString("!activator");
- AcceptEntityInput(particle, "SetParent", entity, particle, 0);
- if (attach == ATTACH_HEAD) {
- SetVariantString("head");
- AcceptEntityInput(particle, "SetParentAttachmentMaintainOffset", particle, particle, 0);
- }
- }
- DispatchKeyValue(particle, "targetname", "present");
- DispatchSpawn(particle);
- ActivateEntity(particle);
- AcceptEntityInput(particle, "Start");
- return CreateTimer(time, DeleteParticle, particle);
- } else {
- LogError("(CreateParticle): Could not create info_particle_system");
- }
- return INVALID_HANDLE;
- }
- public Action:DeleteParticle(Handle:timer, any:particle)
- {
- if (IsValidEdict(particle)) {
- new String:classname[64];
- GetEdictClassname(particle, classname, sizeof(classname));
- if (StrEqual(classname, "info_particle_system", false)) {
- RemoveEdict(particle);
- }
- }
- }
- /////////////////
- //REFRESH CVARS//
- /////////////////
- public Action:Command_Refresh(client, args)
- {
- if(IsValidEntity(client))
- CPrintToChat(client, "%s Successfully refreshed all cvars.", TAG);
- else
- ReplyToCommand(client, "%s Successfully refreshed all cvars.", TAG);
- ReloadConvars();
- return Plugin_Handled;
- }
- //////////
- //STOCKS//
- //////////
- Premium(client)
- {
- new TFClassType:pClass = TF2_GetPlayerClass(client);
- if(cJarates > 1)
- SetGrenadeAmmo(client, cJarates, 58, 1);
- if(cStunballs > 1)
- SetGrenadeAmmo(client, cStunballs, 44, 2);
- if(cMilks > 1)
- SetGrenadeAmmo(client, cMilks, 222, 1);
- if(pClass == TFClass_Medic)
- SetEntPropFloat(GetPlayerWeaponSlot(client, 1), Prop_Send, "m_flChargeLevel", cUber * 0.01);
- if(pClass != TFClass_Heavy && pClass != TFClass_Medic && pClass != TFClass_Pyro && pClass != TFClass_Sniper)
- SetEntProp(GetPlayerWeaponSlot(client, 0), Prop_Send, "m_iClip1", GetEntProp(GetPlayerWeaponSlot(client, 0), Prop_Send, "m_iClip1") + cClip);
- if(pClass == TFClass_Engineer)
- SetEntData(client, FindDataMapOffs(client, "m_iAmmo") + (3 * 4), cMetal, 4, true);
- if(cColor > 0)
- SetClientColor(client, cColor);
- CreatePremiumTimers(client);
- }
- ReloadConvars()
- {
- cEnable = GetConVarInt(cvar_enable);
- cAdsEnable = GetConVarInt(cvar_ads_enable);
- cAdsInterval = GetConVarFloat(cvar_ads_int);
- cInfCloak = GetConVarInt(cvar_infcloak);
- cColor = GetConVarInt(cvar_color);
- cClip = GetConVarInt(cvar_clip);
- cUber = GetConVarFloat(cvar_uber);
- cStunballs = GetConVarInt(cvar_stunballs);
- cJarates = GetConVarInt(cvar_jarates);
- cMilks = GetConVarInt(cvar_milks);
- cUber = GetConVarFloat(cvar_uber);
- cSwap = GetConVarInt(cvar_swapteams);
- cMetal = GetConVarInt(cvar_metal);
- cPlayerBlack = GetConVarInt(cvar_playerblack);
- cPlayerRed = GetConVarInt(cvar_playerred);
- cPlayerBlue = GetConVarInt(cvar_playerblue);
- cPlayerGreen = GetConVarInt(cvar_playergreen);
- cPlayerYellow = GetConVarInt(cvar_playeryellow);
- cPlayerPurple = GetConVarInt(cvar_playerpurple);
- cPlayerCyan = GetConVarInt(cvar_playercyan);
- cGlow = GetConVarInt(cvar_glow);
- }
- SetGrenadeAmmo(client, ammo, index, slot)
- {
- new weapon = GetPlayerWeaponSlot(client, slot);
- if (IsValidEntity(weapon))
- {
- if (GetEntProp(weapon, Prop_Send, "m_iItemDefinitionIndex") == index)
- {
- new iOffset = GetEntProp(weapon, Prop_Send, "m_iPrimaryAmmoType", 1)*4;
- new iAmmoTable = FindSendPropInfo("CTFPlayer", "m_iAmmo");
- SetEntData(client, iAmmoTable+iOffset, ammo, 4, true);
- }
- }
- }
- SetClientColor(client, color)
- {
- switch(color)
- {
- case 0:
- SetEntityRenderColor(client, 255, 255, 255, 255); //DEFAULT
- case 1:
- SetEntityRenderColor(client, 100, 255, 100, 255); //GREEN
- case 2:
- SetEntityRenderColor(client, 255, 100, 100, 255); //RED
- case 3:
- SetEntityRenderColor(client, 100, 100, 255, 255); //BLUE
- case 4:
- SetEntityRenderColor(client, 255, 255, 100, 255); //YELLOW
- case 5:
- SetEntityRenderColor(client, 100, 255, 255, 255); //CYAN
- case 6:
- SetEntityRenderColor(client, 255, 100, 255, 255); //PURPLE
- }
- }
- CreatePremiumTimers(client)
- {
- tCloak[client] = CreateTimer(0.1, Timer_Cloak, client);
- }
- CloseAllHandles(client)
- {
- tCloak[client] = INVALID_HANDLE;
- tGlow[client] = INVALID_HANDLE;
- }
- //////////////
- //DISCONNECT//
- //////////////
- public OnClientDisconnect(client)
- {
- CloseAllHandles(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement