Raised This Month: $51 Target: $400
 12% 

I need Help With one Plugin please


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MasterWindowS
BANNED
Join Date: May 2020
Location: Chile
Old 09-14-2020 , 16:31   I need Help With one Plugin please
Reply With Quote #1

Hello good, I need help with a plugin please. Could someone help me by making the shield unbreakable please? I'd be really grateful.

Code:
#include <sourcemod>
#include <sdktools>

public Plugin:myinfo =
{
	name = "BuyShield",
	author = "backwards",
	description = "Allows players to buy shields by typing !buyshield.",
	version = SOURCEMOD_VERSION,
	url = "http://www.steamcommunity.com/id/mypassword"
}

new ShieldCost = 15300
new bool:RequireBuyZone = false;
Handle BuyStartRoundTimer;

public OnPluginStart()
{
	RegConsoleCmd("sm_escudo", BuyShieldCMD);
	HookEvent("round_prestart", Event_RoundPreStart);
}

public Action BuyShieldCMD(int client, int args) 
{
	if(GetClientTeam(client) != 3)
	{
		PrintToChat(client, "Solo el CT puede tener escudo.")
		return Plugin_Handled;
	}
	
	if(RequireBuyZone)
	{
		new bool:InBuyZone = view_as<bool>(GetEntProp(client, Prop_Send, "m_bInBuyZone"));
		if(!InBuyZone)
		{
			PrintToChat(client, "Lo siento no estas en zona de compra.");
			return Plugin_Handled;
		}
		if (BuyStartRoundTimer == null)
		{
			PrintToChat(client, "El tiempo de compra ha expirado.")
			return Plugin_Handled;
		}
	}
	
	new account = GetEntProp(client, Prop_Send, "m_iAccount");
	if(account < ShieldCost)
	{
		PrintToChat(client, "Lo siento no tienes 15300 para comprarte otro");
		return Plugin_Handled;
	}
	
	new weaponIdx = GetPlayerWeaponSlot(client, 11);
	if(weaponIdx != -1)
	{
		if(IsValidEdict(weaponIdx) && IsValidEntity(weaponIdx))
		{
			decl String:className[128];
			GetEntityClassname(weaponIdx, className, sizeof(className));
			
			if(StrEqual("weapon_shield", className))
			{
				PrintToChat(client, "Aqui tienes un escudo.");
				return Plugin_Handled;
			}
		}
	}
	
	SetEntProp(client, Prop_Send, "m_iAccount", account - ShieldCost);
	GivePlayerItem(client, "weapon_shield");
	PrintToChat(client, "Aqui tienes un escudo.");
	
	return Plugin_Handled;
}

public Event_RoundPreStart(Handle:event, const String:name[], bool:dontBroadcast)
{
	new Float:BuyTime = 45.0;
	ConVar cvarBuyTime = FindConVar("mp_buytime");
	
	if(cvarBuyTime != null)
		BuyTime = float(cvarBuyTime.IntValue);
		
	if (BuyStartRoundTimer != null)
	{
		KillTimer(BuyStartRoundTimer);
		BuyStartRoundTimer = null;
	}
	
	BuyStartRoundTimer = CreateTimer(BuyTime, StopBuying);
}


public Action StopBuying(Handle timer, any client)
{
	BuyStartRoundTimer = null;
	
	return Plugin_Stop;
}
MasterWindowS is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode