Raised This Month: $ Target: $400
 0% 

[CSGO] usp for ct


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
sim242
AlliedModders Donor
Join Date: Dec 2012
Location: England
Old 07-04-2017 , 16:50   Re: [CSGO] usp for ct
Reply With Quote #7

This should work Let me know if it doesn't.

Code:
//Pragma
#pragma semicolon 1
#pragma newdecls required

//Sourcemod Includes
#include <sourcemod>
#include <sdktools>
#include <cstrike>

//Plugin Info
public Plugin myinfo = 
{
	name = "USP on round start", 
	author = "Keith Warren (Drixevel)", 
	description = "Gives a USP to CT players on round start.", 
	version = "1.0.0", 
	url = "http://www.drixevel.com/"
};

public void OnPluginStart()
{
	HookEvent("round_start", Event_OnRoundStart);
}

public void Event_OnRoundStart(Event event, const char[] name, bool dontBroadcast)
{
	CreateTimer(1.0, Timer_GiveUSP, _, TIMER_FLAG_NO_MAPCHANGE);
}

public Action Timer_GiveUSP(Handle timer)
{
	for (int i = 1; i <= MaxClients; i++)
	{
		if (IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == CS_TEAM_CT)
		{
			char weaponName[32];
			int weaponIndex = GetPlayerWeaponSlot(i, CS_SLOT_SECONDARY);
			GetEntityClassname(weaponIndex, weaponName, sizeof(weaponName));
			
			if (StrEqual(weaponName, "weapon_hkp2000"))
			{
				AcceptEntityInput(weaponIndex, "Kill");
				RemovePlayerItem(i, weaponIndex);
				
				int weapon = GivePlayerItem2(i, "weapon_usp_silencer");
				EquipPlayerWeapon(i, weapon);
			}
		}
	}
}

int GivePlayerItem2(int client, const char[] item)
{
	int team = GetClientTeam(client);
	SetEntProp(client, Prop_Send, "m_iTeamNum", team == 3 ? 2 : 3);
	int weapon = GivePlayerItem(client, item);
	SetEntProp(client, Prop_Send, "m_iTeamNum", team);
	return weapon;
}
__________________
Steam - Sim
Request a private plugin
Not accepting requests at this time
sim242 is offline
Send a message via Skype™ to sim242
 



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 05:03.


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