PHP Code:
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR "Rowdy"
#define PLUGIN_VERSION "1.03"
#include <sourcemod>
#include <sdktools>
#include <smlib>
#pragma newdecls required
public Plugin myinfo =
{
name = "Replacing Guns?",
author = PLUGIN_AUTHOR,
description = "...",
version = PLUGIN_VERSION,
url = "https://steamcommunity.com/profiles/76561198307962930"
};
public void OnPluginStart()
{
HookEvent("player_spawn", OnPlayerSpawn);
}
public void OnPlayerSpawn(Handle event, char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(GetEventInt(event, "userid"));
ReplaceGuns(client);
}
public void ReplaceGuns(int client) {
int weaponIndex;
char weaponName[64];
if ((weaponIndex = GetPlayerWeaponSlot(client, 1)) != -1) {
if (IsValidEntity(weaponIndex)) {
GetEntityClassname(weaponIndex, weaponName, sizeof(weaponName));
if (StrContains(weaponName, "usp", false) != -1 || StrContains(weaponName, "glock", false) != -1) {
RemovePlayerItem(client, weaponIndex);
AcceptEntityInput(weaponIndex, "Kill");
Client_GiveWeaponAndAmmo(client, "weapon_deagle", true, 90);
}
}
}
int team = GetClientTeam(client);
if(team == 2) {
Client_GiveWeaponAndAmmo(client, "weapon_ak47", true, 90);
Client_GiveWeaponAndAmmo(client, "weapon_knife", true, 1);
Client_GiveWeaponAndAmmo(client, "weapon_hegrenade", true, 2);
Client_GiveWeaponAndAmmo(client, "weapon_flashbang", true, 2);
Client_GiveWeaponAndAmmo(client, "weapon_smokegrenade", true, 1);
} else if (team == 3) {
Client_GiveWeaponAndAmmo(client, "weapon_m4a1", true, 90);
Client_GiveWeaponAndAmmo(client, "weapon_knife", true, 1);
Client_GiveWeaponAndAmmo(client, "weapon_hegrenade", true, 2);
Client_GiveWeaponAndAmmo(client, "weapon_flashbang", true, 2);
Client_GiveWeaponAndAmmo(client, "weapon_smokegrenade", true, 1);
}
}