Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#include <colorchat>
#include <fun>
new const PLUGIN[] = "Global Offensive";
new const VERSION[] = "1.1p";
new const AUTHOR[] = "DeRoiD";
#define MAX 50
#define PointsMin 3
#define PointsMax 8
#define Drop 10
#define MarkMin 25
#pragma semicolon 1
new WeaponNames[MAX][32], WeaponMdls[MAX][48], Weapons[MAX], WeaponDrop[MAX], AllWeapon;
new UsingWeapon[3][33], uWeapon[MAX][33], Chest[33], pKey[33], Points[33], Rang[33], Kills[33],
aThing[33], aTarget[33], aPoints[33], Prefix[32];
new Folder[48], SkinFile[48], SaveFile[48], RegisterFile[48], DefaultSkinFile[48], RangFile[48], MenuMod[33], SayText;
new WeaponinMarket[33], inMarket[33], MarketPoints[33], Choosen[33];
new SavedPassword[33][32], bool:Loged[33], Password[33][32];
new DefaultSkin[31][32], NeedKills[30], Rangs[30][32];
new const eWeapon[][] =
{
"weapon_famas", "weapon_usp", "weapon_awp", "weapon_mp5navy", "weapon_m3", "weapon_m4a1",
"weapon_deagle", "weapon_ak47", "weapon_knife", "weapon_flashbang", "weapon_hegrenade",
"weapon_smokegrenade", "weapon_c4"
};
new const FirstWeaponNames[][][] =
{
{ "AK47", "weapon_ak47" },
{ "M4A1", "weapon_m4a1" },
{ "AWP", "weapon_awp" },
{ "FAMAS", "weapon_famas" },
{ "MP5", "weapon_mp5navy" },
{ "SHOTGUN", "weapon_mp3" }
};
new const SecondaryWeaponNames[][][] =
{
{ "DEAGLE", "weapon_deagle" },
{ "USP", "weapon_usp" }
};
public plugin_precache() {
new Line[128], Data[4][48], Len;
AllWeapon++;
get_configsdir(Folder, 47);
format(SkinFile, 47, "%s/csgo/skins.cfg", Folder);
format(SaveFile, 47, "%s/csgo/save.ini", Folder);
format(RangFile, 47, "%s/csgo/rangs.cfg", Folder);
format(RegisterFile, 47, "%s/csgo/reg.ini", Folder);
format(DefaultSkinFile, 47, "%s/csgo/dskins.cfg", Folder);
format(Prefix, 31, "[Global Offensive]");
if(file_exists(RangFile))
{
for(new i; i < file_size(RangFile, 1); i++)
{
read_file(RangFile, i, Line, 127, Len);
parse(Line, Data[0], 31, Data[1], 31);
copy(Rangs[i], 31, Data[0]);
NeedKills[i] = str_to_num(Data[1]);
}
}
if(file_exists(SkinFile))
{
for(new i; i < file_size(SkinFile, 1); i++)
{
read_file(SkinFile, i, Line, 127, Len);
if(strlen(Line) < 5 || Line[0] == ';')
continue;
parse(Line, Data[0], 31, Data[1], 31, Data[2], 47, Data[3], 31);
Weapons[AllWeapon] = str_to_num(Data[0]);
copy(WeaponNames[AllWeapon], 31, Data[1]);
if(ValidMdl(Data[2])) {
precache_model(Data[2]);
copy(WeaponMdls[AllWeapon], 47, Data[2]);
}
WeaponDrop[AllWeapon] = str_to_num(Data[3]);
AllWeapon++;
}
}
if(file_exists(DefaultSkinFile))
{
for(new i; i < file_size(DefaultSkinFile, 1); i++)
{
read_file(DefaultSkinFile, i, Line, 127, Len);
if(strlen(Line) < 5 || Line[0] == ';')
continue;
parse(Line, Data[0], 31, Data[1], 47);
if(ValidMdl(Data[1])) {
precache_model(Data[1]);
copy(DefaultSkin[str_to_num(Data[0])], 47, Data[1]);
}
}
}
}
public plugin_init() {
register_dictionary("globaloffensive.txt");
register_plugin(PLUGIN, VERSION, AUTHOR);
register_cvar(PLUGIN, VERSION, FCVAR_SERVER);
register_clcmd("say /menu", "MenuOpen");
register_clcmd("say /reg", "RegMenu");
register_clcmd("say /gun", "Guns");
register_concmd("Cost", "MarketCost");
register_concmd("Gift", "GiftPoint");
register_concmd("UserPassword", "PlayerPassword");
SayText = get_user_msgid("SayText");
register_forward(FM_ClientUserInfoChanged, "NameChange");
RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1);
for(new i; i < sizeof(eWeapon); i++)
{
RegisterHam(Ham_Item_Deploy, eWeapon[i], "WeaponSwitch", 1);
}
register_clcmd("say", "Say");
register_clcmd("say_team", "Say");
set_task(67.3, "Message", 7217, _, _, "b");
}
public Message()
{
print_color(0, "!g%s%L", Prefix, LANG_SERVER, "MSG", PLUGIN, VERSION, AUTHOR);
}
public Guns(id)
{
if(Choosen[id] < 1)
{
Choosen[id] = 0;
WeaponMenu(id);
}
}
public PlayerSpawn(id)
{
if(is_user_alive(id))
{
Choosen[id] = 0;
if(user_has_weapon(id, CSW_C4))
{
strip_user_weapons(id);
give_item(id, "weapon_c4");
give_item(id, "weapon_knife");
WeaponMenu(id);
return PLUGIN_HANDLED;
}
strip_user_weapons(id);
give_item(id, "weapon_knife");
WeaponMenu(id);
if(cs_get_user_team(id) == CS_TEAM_CT)
{
cs_set_user_defuse(id, 1);
}
}
return PLUGIN_CONTINUE;
}
public Say(id)
{
new Chat[256], Name[32], cChat[256];
read_args(Chat, 255);
remove_quotes(Chat);
get_user_name(id, Name, 31);
if(strlen(Chat) > 1)
{
formatex(cChat, 255, "^4[%s] ^3%s^1: %s", Rangs[Rang[id]], Name, Chat);
}
ColorChat(0, TEAM_COLOR, cChat);
return PLUGIN_HANDLED;
}