Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public PlVers:__version =
- {
- version = 5,
- filevers = "1.7.3-dev+5265",
- date = "18/10/2017",
- time = "23:43:06"
- };
- new Float:NULL_VECTOR[3];
- new String:NULL_STRING[4];
- public Extension:__ext_core =
- {
- name = "Core",
- file = "core",
- autoload = 0,
- required = 0,
- };
- new MaxClients;
- new TFHoliday:TFHoliday_Birthday;
- new TFHoliday:TFHoliday_Halloween;
- new TFHoliday:TFHoliday_Christmas;
- new TFHoliday:TFHoliday_EndOfTheLine;
- new TFHoliday:TFHoliday_CommunityUpdate;
- new TFHoliday:TFHoliday_ValentinesDay;
- new TFHoliday:TFHoliday_MeetThePyro;
- new TFHoliday:TFHoliday_SpyVsEngyWar;
- new TFHoliday:TFHoliday_FullMoon;
- new TFHoliday:TFHoliday_HalloweenOrFullMoon;
- new TFHoliday:TFHoliday_HalloweenOrFullMoonOrValentines;
- new TFHoliday:TFHoliday_AprilFools;
- public Extension:__ext_tf2 =
- {
- name = "TF2 Tools",
- file = "game.tf2.ext",
- autoload = 0,
- required = 1,
- };
- public Extension:__ext_sdktools =
- {
- name = "SDKTools",
- file = "sdktools.ext",
- autoload = 1,
- required = 1,
- };
- new String:TFResourceNames[18][0];
- public Extension:__ext_regex =
- {
- name = "Regex Extension",
- file = "regex.ext",
- autoload = 1,
- required = 1,
- };
- new bool:CSkipList[66] =
- {
- 0, 4, 13421772, 5077314, 16728128, 1635151433, 543451500, 1701407843, 1763734638, 2019910766, 6890784, 1701407811, 622883950, 1936269417, 1953459744, 544106784, 1701667175, 0, 7546113, 1417240915, 846493797, 0, 6582116, 3, 4, 909124871, 88, 3, 29477, 1417240915, 846493797, 0, 1433691463, 1299342707, 1634956133, 2035574119, 25968, 1601465957, 7890025, 1952540771, 0, 1600615277, 1701667182, 0, 1634886000, 29549, 0, 1634886000, 29549, 0, 1634886000, 29549, 0, 1634886000, 29549, 0, 1717920891, 1953264993, 125, 1, 1717920891, 1953264993, 125, 0, 1634038907, 1819239277
- };
- new Handle:CTrie;
- new CTeamColors[1][3] =
- {
- {
- 13421772, 5077314, 16728128
- }
- };
- public Extension:__ext_tf2items =
- {
- name = "TF2Items",
- file = "tf2items.ext.2.ep2v",
- autoload = 0,
- required = 1,
- };
- public SharedPlugin:__pl_tf2idb =
- {
- name = "tf2idb",
- file = "tf2idb.smx",
- required = 1,
- };
- public SharedPlugin:__pl_unusual =
- {
- name = "unusual",
- file = "unusual.smx",
- required = 1,
- };
- public SharedPlugin:__pl_FF2 =
- {
- name = "freak_fortress_2",
- file = "freak_fortress_2.smx",
- required = 0,
- };
- new ClientItemData[66][10][3];
- new String:SteamUsed[66][64];
- new String:ClientSteamID[66][64];
- new String:EffectsList[256];
- new String:PermissionsFile[256];
- new Effect[66];
- new Quality[66];
- new ClientItems[66];
- new NbOfEffect[66];
- new ItemDataInLoad[66];
- new bool:SQLite;
- new bool:IsFF2Enabled;
- new bool:StopItemLoading[66];
- new bool:AT_Choice_add[66];
- new Permission[22];
- new FlagsList[21] =
- {
- 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 32768, 65536, 131072, 262144, 524288, 1048576, 16384
- };
- new Handle:db;
- new Handle:c_tag;
- new Handle:c_TeamRest;
- new Handle:c_PanelFlag;
- new Handle:c_FF2;
- new Handle:g_hItem;
- public Plugin:myinfo =
- {
- name = "Unusual - 2017",
- description = "Add Unusual effects on your weapons",
- author = "Erreur 500 and StoKer",
- version = "2.19",
- url = "bramrekots@gmail.com"
- };
- public __ext_core_SetNTVOptional()
- {
- MarkNativeAsOptional("GetFeatureStatus");
- MarkNativeAsOptional("RequireFeature");
- MarkNativeAsOptional("AddCommandListener");
- MarkNativeAsOptional("RemoveCommandListener");
- MarkNativeAsOptional("BfWriteBool");
- MarkNativeAsOptional("BfWriteByte");
- MarkNativeAsOptional("BfWriteChar");
- MarkNativeAsOptional("BfWriteShort");
- MarkNativeAsOptional("BfWriteWord");
- MarkNativeAsOptional("BfWriteNum");
- MarkNativeAsOptional("BfWriteFloat");
- MarkNativeAsOptional("BfWriteString");
- MarkNativeAsOptional("BfWriteEntity");
- MarkNativeAsOptional("BfWriteAngle");
- MarkNativeAsOptional("BfWriteCoord");
- MarkNativeAsOptional("BfWriteVecCoord");
- MarkNativeAsOptional("BfWriteVecNormal");
- MarkNativeAsOptional("BfWriteAngles");
- MarkNativeAsOptional("BfReadBool");
- MarkNativeAsOptional("BfReadByte");
- MarkNativeAsOptional("BfReadChar");
- MarkNativeAsOptional("BfReadShort");
- MarkNativeAsOptional("BfReadWord");
- MarkNativeAsOptional("BfReadNum");
- MarkNativeAsOptional("BfReadFloat");
- MarkNativeAsOptional("BfReadString");
- MarkNativeAsOptional("BfReadEntity");
- MarkNativeAsOptional("BfReadAngle");
- MarkNativeAsOptional("BfReadCoord");
- MarkNativeAsOptional("BfReadVecCoord");
- MarkNativeAsOptional("BfReadVecNormal");
- MarkNativeAsOptional("BfReadAngles");
- MarkNativeAsOptional("BfGetNumBytesLeft");
- MarkNativeAsOptional("BfWrite.WriteBool");
- MarkNativeAsOptional("BfWrite.WriteByte");
- MarkNativeAsOptional("BfWrite.WriteChar");
- MarkNativeAsOptional("BfWrite.WriteShort");
- MarkNativeAsOptional("BfWrite.WriteWord");
- MarkNativeAsOptional("BfWrite.WriteNum");
- MarkNativeAsOptional("BfWrite.WriteFloat");
- MarkNativeAsOptional("BfWrite.WriteString");
- MarkNativeAsOptional("BfWrite.WriteEntity");
- MarkNativeAsOptional("BfWrite.WriteAngle");
- MarkNativeAsOptional("BfWrite.WriteCoord");
- MarkNativeAsOptional("BfWrite.WriteVecCoord");
- MarkNativeAsOptional("BfWrite.WriteVecNormal");
- MarkNativeAsOptional("BfWrite.WriteAngles");
- MarkNativeAsOptional("BfRead.ReadBool");
- MarkNativeAsOptional("BfRead.ReadByte");
- MarkNativeAsOptional("BfRead.ReadChar");
- MarkNativeAsOptional("BfRead.ReadShort");
- MarkNativeAsOptional("BfRead.ReadWord");
- MarkNativeAsOptional("BfRead.ReadNum");
- MarkNativeAsOptional("BfRead.ReadFloat");
- MarkNativeAsOptional("BfRead.ReadString");
- MarkNativeAsOptional("BfRead.ReadEntity");
- MarkNativeAsOptional("BfRead.ReadAngle");
- MarkNativeAsOptional("BfRead.ReadCoord");
- MarkNativeAsOptional("BfRead.ReadVecCoord");
- MarkNativeAsOptional("BfRead.ReadVecNormal");
- MarkNativeAsOptional("BfRead.ReadAngles");
- MarkNativeAsOptional("BfRead.GetNumBytesLeft");
- MarkNativeAsOptional("PbReadInt");
- MarkNativeAsOptional("PbReadFloat");
- MarkNativeAsOptional("PbReadBool");
- MarkNativeAsOptional("PbReadString");
- MarkNativeAsOptional("PbReadColor");
- MarkNativeAsOptional("PbReadAngle");
- MarkNativeAsOptional("PbReadVector");
- MarkNativeAsOptional("PbReadVector2D");
- MarkNativeAsOptional("PbGetRepeatedFieldCount");
- MarkNativeAsOptional("PbSetInt");
- MarkNativeAsOptional("PbSetFloat");
- MarkNativeAsOptional("PbSetBool");
- MarkNativeAsOptional("PbSetString");
- MarkNativeAsOptional("PbSetColor");
- MarkNativeAsOptional("PbSetAngle");
- MarkNativeAsOptional("PbSetVector");
- MarkNativeAsOptional("PbSetVector2D");
- MarkNativeAsOptional("PbAddInt");
- MarkNativeAsOptional("PbAddFloat");
- MarkNativeAsOptional("PbAddBool");
- MarkNativeAsOptional("PbAddString");
- MarkNativeAsOptional("PbAddColor");
- MarkNativeAsOptional("PbAddAngle");
- MarkNativeAsOptional("PbAddVector");
- MarkNativeAsOptional("PbAddVector2D");
- MarkNativeAsOptional("PbRemoveRepeatedFieldValue");
- MarkNativeAsOptional("PbReadMessage");
- MarkNativeAsOptional("PbReadRepeatedMessage");
- MarkNativeAsOptional("PbAddMessage");
- MarkNativeAsOptional("Protobuf.ReadInt");
- MarkNativeAsOptional("Protobuf.ReadFloat");
- MarkNativeAsOptional("Protobuf.ReadBool");
- MarkNativeAsOptional("Protobuf.ReadString");
- MarkNativeAsOptional("Protobuf.ReadColor");
- MarkNativeAsOptional("Protobuf.ReadAngle");
- MarkNativeAsOptional("Protobuf.ReadVector");
- MarkNativeAsOptional("Protobuf.ReadVector2D");
- MarkNativeAsOptional("Protobuf.GetRepeatedFieldCount");
- MarkNativeAsOptional("Protobuf.SetInt");
- MarkNativeAsOptional("Protobuf.SetFloat");
- MarkNativeAsOptional("Protobuf.SetBool");
- MarkNativeAsOptional("Protobuf.SetString");
- MarkNativeAsOptional("Protobuf.SetColor");
- MarkNativeAsOptional("Protobuf.SetAngle");
- MarkNativeAsOptional("Protobuf.SetVector");
- MarkNativeAsOptional("Protobuf.SetVector2D");
- MarkNativeAsOptional("Protobuf.AddInt");
- MarkNativeAsOptional("Protobuf.AddFloat");
- MarkNativeAsOptional("Protobuf.AddBool");
- MarkNativeAsOptional("Protobuf.AddString");
- MarkNativeAsOptional("Protobuf.AddColor");
- MarkNativeAsOptional("Protobuf.AddAngle");
- MarkNativeAsOptional("Protobuf.AddVector");
- MarkNativeAsOptional("Protobuf.AddVector2D");
- MarkNativeAsOptional("Protobuf.RemoveRepeatedFieldValue");
- MarkNativeAsOptional("Protobuf.ReadMessage");
- MarkNativeAsOptional("Protobuf.ReadRepeatedMessage");
- MarkNativeAsOptional("Protobuf.AddMessage");
- VerifyCoreVersion();
- return 0;
- }
- Float:operator*(Float:,_:)(Float:oper1, oper2)
- {
- return oper1 * float(oper2);
- }
- bool:StrEqual(String:str1[], String:str2[], bool:caseSensitive)
- {
- return strcmp(str1, str2, caseSensitive) == 0;
- }
- CharToLower(chr)
- {
- if (IsCharUpper(chr))
- {
- return chr | 32;
- }
- return chr;
- }
- Handle:StartMessageOne(String:msgname[], client, flags)
- {
- new players[1];
- players[0] = client;
- return StartMessage(msgname, players, 1, flags);
- }
- ShowMOTDPanel(client, String:title[], String:msg[], type)
- {
- new String:num[4];
- IntToString(type, num, 3);
- new KeyValues:kv = KeyValues.KeyValues("data", "", "");
- KeyValues.SetString(kv, "title", title);
- KeyValues.SetString(kv, "type", num);
- KeyValues.SetString(kv, "msg", msg);
- ShowVGUIPanel(client, "info", kv, true);
- CloseHandle(kv);
- kv = MissingTAG:0;
- return 0;
- }
- SetEntityHealth(entity, amount)
- {
- static bool:gotconfig;
- static String:prop[32];
- if (!gotconfig)
- {
- new Handle:gc = LoadGameConfigFile("core.games");
- new bool:exists = GameConfGetKeyValue(gc, "m_iHealth", prop, 32);
- CloseHandle(gc);
- if (!exists)
- {
- strcopy(prop, 32, "m_iHealth");
- }
- gotconfig = true;
- }
- decl String:cls[64];
- new PropFieldType:type;
- new offset;
- if (!GetEntityNetClass(entity, cls, 64))
- {
- ThrowError("SetEntityHealth not supported by this mod: Could not get serverclass name");
- return 0;
- }
- offset = FindSendPropInfo(cls, prop, type, 0, 0);
- if (0 >= offset)
- {
- ThrowError("SetEntityHealth not supported by this mod");
- return 0;
- }
- if (type == PropFieldType:2)
- {
- SetEntDataFloat(entity, offset, float(amount), false);
- }
- else
- {
- SetEntProp(entity, PropType:0, prop, amount, 4, 0);
- }
- return 0;
- }
- TFClassType:TF2_GetPlayerClass(client)
- {
- return GetEntProp(client, PropType:0, TFResourceNames, 4, 0);
- }
- TF2_RemoveWeaponSlot(client, slot)
- {
- new weaponIndex;
- while ((weaponIndex = GetPlayerWeaponSlot(client, slot)) != -1)
- {
- new extraWearable = GetEntPropEnt(weaponIndex, PropType:0, "m_hExtraWearable", 0);
- if (extraWearable != -1)
- {
- TF2_RemoveWearable(client, extraWearable);
- }
- extraWearable = GetEntPropEnt(weaponIndex, PropType:0, "m_hExtraWearableViewModel", 0);
- if (extraWearable != -1)
- {
- TF2_RemoveWearable(client, extraWearable);
- }
- RemovePlayerItem(client, weaponIndex);
- AcceptEntityInput(weaponIndex, "Kill", -1, -1, 0);
- }
- return 0;
- }
- CPrintToChat(client, String:message[])
- {
- CCheckTrie();
- new var1;
- if (client <= 0 || client > MaxClients)
- {
- ThrowError("Invalid client index %i", client);
- }
- if (!IsClientInGame(client))
- {
- ThrowError("Client %i is not in game", client);
- }
- decl String:buffer[1024];
- decl String:buffer2[1024];
- SetGlobalTransTarget(client);
- Format(buffer, 1024, "\x01%s", message);
- VFormat(buffer2, 1024, buffer, 3);
- CReplaceColorCodes(buffer2, 0, false, 1024);
- CSendMessage(client, buffer2, 0);
- return 0;
- }
- CSendMessage(client, String:message[], author)
- {
- if (!author)
- {
- author = client;
- }
- decl String:buffer[256];
- decl String:game[16];
- GetGameFolderName(game, 16);
- strcopy(buffer, 256, message);
- new UserMsg:index = GetUserMessageId("SayText2");
- if (index == UserMsg:-1)
- {
- if (StrEqual(game, "dod", true))
- {
- new team = GetClientTeam(author);
- if (team)
- {
- decl String:temp[16];
- new var2 = CTeamColors;
- Format(temp, 16, "\x07%06X", var2[0][var2][team + -1]);
- ReplaceString(buffer, 256, "\x03", temp, false);
- }
- else
- {
- ReplaceString(buffer, 256, "\x03", "\x04", false);
- }
- }
- PrintToChat(client, "%s", buffer);
- return 0;
- }
- new Handle:buf = StartMessageOne("SayText2", client, 132);
- new var1;
- if (GetFeatureStatus(FeatureType:0, "GetUserMessageType") && GetUserMessageType() == 1)
- {
- PbSetInt(buf, "ent_idx", author, -1);
- PbSetBool(buf, "chat", true, -1);
- PbSetString(buf, "msg_name", buffer, -1);
- PbAddString(buf, "params", "");
- PbAddString(buf, "params", "");
- PbAddString(buf, "params", "");
- PbAddString(buf, "params", "");
- }
- else
- {
- BfWriteByte(buf, author);
- BfWriteByte(buf, 1);
- BfWriteString(buf, buffer);
- }
- EndMessage();
- return 0;
- }
- CCheckTrie()
- {
- if (!CSkipList[0])
- {
- CSkipList[0] = InitColorTrie();
- }
- return 0;
- }
- CReplaceColorCodes(String:buffer[], author, bool:removeTags, maxlen)
- {
- CCheckTrie();
- if (!removeTags)
- {
- ReplaceString(buffer, maxlen, "{default}", "\x01", false);
- }
- else
- {
- ReplaceString(buffer, maxlen, "{default}", "", false);
- ReplaceString(buffer, maxlen, "{teamcolor}", "", false);
- }
- new var1;
- if (author && !removeTags)
- {
- new var2;
- if (author < 0 || author > MaxClients)
- {
- ThrowError("Invalid client index %i", author);
- }
- if (!IsClientInGame(author))
- {
- ThrowError("Client %i is not in game", author);
- }
- ReplaceString(buffer, maxlen, "{teamcolor}", "\x03", false);
- }
- new cursor;
- new value;
- decl String:tag[32];
- decl String:buff[32];
- decl output[maxlen];
- strcopy(output, maxlen, buffer);
- new Handle:regex = CompileRegex("{[a-zA-Z0-9]+}", 0, "", 0, 0);
- new i;
- while (i < 1000)
- {
- if (MatchRegex(regex, buffer[cursor], 0) < 1)
- {
- CloseHandle(regex);
- strcopy(buffer, maxlen, output);
- return 0;
- }
- GetRegexSubString(regex, 0, tag, 32);
- CStrToLower(tag);
- cursor = StrContains(buffer[cursor], tag, false) + cursor + 1;
- strcopy(buff, 32, tag);
- ReplaceString(buff, 32, "{", "", true);
- ReplaceString(buff, 32, "}", "", true);
- if (GetTrieValue(CSkipList[0], buff, value))
- {
- if (removeTags)
- {
- ReplaceString(output, maxlen, tag, "", false);
- }
- else
- {
- Format(buff, 32, "\x07%06X", value);
- ReplaceString(output, maxlen, tag, buff, false);
- }
- }
- i++;
- }
- LogError("[MORE COLORS] Infinite loop broken.");
- return 0;
- }
- CStrToLower(String:buffer[])
- {
- new len = strlen(buffer);
- new i;
- while (i < len)
- {
- buffer[i] = CharToLower(buffer[i]);
- i++;
- }
- return 0;
- }
- Handle:InitColorTrie()
- {
- new Handle:hTrie = CreateTrie();
- SetTrieValue(hTrie, "aliceblue", any:15792383, true);
- SetTrieValue(hTrie, "allies", any:5077314, true);
- SetTrieValue(hTrie, "ancient", any:15420235, true);
- SetTrieValue(hTrie, "antiquewhite", any:16444375, true);
- SetTrieValue(hTrie, "aqua", any:65535, true);
- SetTrieValue(hTrie, "aquamarine", any:8388564, true);
- SetTrieValue(hTrie, "arcana", any:11396444, true);
- SetTrieValue(hTrie, "axis", any:16728128, true);
- SetTrieValue(hTrie, "azure", any:32767, true);
- SetTrieValue(hTrie, "beige", any:16119260, true);
- SetTrieValue(hTrie, "bisque", any:16770244, true);
- SetTrieValue(hTrie, "black", any:0, true);
- SetTrieValue(hTrie, "blanchedalmond", any:16772045, true);
- SetTrieValue(hTrie, "blue", any:10079487, true);
- SetTrieValue(hTrie, "blueviolet", any:9055202, true);
- SetTrieValue(hTrie, "brown", any:10824234, true);
- SetTrieValue(hTrie, "burlywood", any:14596231, true);
- SetTrieValue(hTrie, "cadetblue", any:6266528, true);
- SetTrieValue(hTrie, "chartreuse", any:8388352, true);
- SetTrieValue(hTrie, "chocolate", any:13789470, true);
- SetTrieValue(hTrie, "collectors", any:11141120, true);
- SetTrieValue(hTrie, "common", any:11584473, true);
- SetTrieValue(hTrie, "community", any:7385162, true);
- SetTrieValue(hTrie, "coral", any:16744272, true);
- SetTrieValue(hTrie, "cornflowerblue", any:6591981, true);
- SetTrieValue(hTrie, "cornsilk", any:16775388, true);
- SetTrieValue(hTrie, "corrupted", any:10693678, true);
- SetTrieValue(hTrie, "crimson", any:14423100, true);
- SetTrieValue(hTrie, "cyan", any:65535, true);
- SetTrieValue(hTrie, "darkblue", any:139, true);
- SetTrieValue(hTrie, "darkcyan", any:35723, true);
- SetTrieValue(hTrie, "darkgoldenrod", any:12092939, true);
- SetTrieValue(hTrie, "darkgray", any:11119017, true);
- SetTrieValue(hTrie, "darkgrey", any:11119017, true);
- SetTrieValue(hTrie, "darkgreen", any:25600, true);
- SetTrieValue(hTrie, "darkkhaki", any:12433259, true);
- SetTrieValue(hTrie, "darkmagenta", any:9109643, true);
- SetTrieValue(hTrie, "darkolivegreen", any:5597999, true);
- SetTrieValue(hTrie, "darkorange", any:16747520, true);
- SetTrieValue(hTrie, "darkorchid", any:10040012, true);
- SetTrieValue(hTrie, "darkred", any:9109504, true);
- SetTrieValue(hTrie, "darksalmon", any:15308410, true);
- SetTrieValue(hTrie, "darkseagreen", any:9419919, true);
- SetTrieValue(hTrie, "darkslateblue", any:4734347, true);
- SetTrieValue(hTrie, "darkslategray", any:3100495, true);
- SetTrieValue(hTrie, "darkslategrey", any:3100495, true);
- SetTrieValue(hTrie, "darkturquoise", any:52945, true);
- SetTrieValue(hTrie, "darkviolet", any:9699539, true);
- SetTrieValue(hTrie, "deeppink", any:16716947, true);
- SetTrieValue(hTrie, "deepskyblue", any:49151, true);
- SetTrieValue(hTrie, "dimgray", any:6908265, true);
- SetTrieValue(hTrie, "dimgrey", any:6908265, true);
- SetTrieValue(hTrie, "dodgerblue", any:2003199, true);
- SetTrieValue(hTrie, "exalted", any:13421773, true);
- SetTrieValue(hTrie, "firebrick", any:11674146, true);
- SetTrieValue(hTrie, "floralwhite", any:16775920, true);
- SetTrieValue(hTrie, "forestgreen", any:2263842, true);
- SetTrieValue(hTrie, "frozen", any:4817843, true);
- SetTrieValue(hTrie, "fuchsia", any:16711935, true);
- SetTrieValue(hTrie, "fullblue", any:255, true);
- SetTrieValue(hTrie, "fullred", any:16711680, true);
- SetTrieValue(hTrie, "gainsboro", any:14474460, true);
- SetTrieValue(hTrie, "genuine", any:5076053, true);
- SetTrieValue(hTrie, "ghostwhite", any:16316671, true);
- SetTrieValue(hTrie, "gold", any:16766720, true);
- SetTrieValue(hTrie, "goldenrod", any:14329120, true);
- SetTrieValue(hTrie, "gray", any:13421772, true);
- SetTrieValue(hTrie, "grey", any:13421772, true);
- SetTrieValue(hTrie, "green", any:4128574, true);
- SetTrieValue(hTrie, "greenyellow", any:11403055, true);
- SetTrieValue(hTrie, "haunted", any:3732395, true);
- SetTrieValue(hTrie, "honeydew", any:15794160, true);
- SetTrieValue(hTrie, "hotpink", any:16738740, true);
- SetTrieValue(hTrie, "immortal", any:14986803, true);
- SetTrieValue(hTrie, "indianred", any:13458524, true);
- SetTrieValue(hTrie, "indigo", any:4915330, true);
- SetTrieValue(hTrie, "ivory", any:16777200, true);
- SetTrieValue(hTrie, "khaki", any:15787660, true);
- SetTrieValue(hTrie, "lavender", any:15132410, true);
- SetTrieValue(hTrie, "lavenderblush", any:16773365, true);
- SetTrieValue(hTrie, "lawngreen", any:8190976, true);
- SetTrieValue(hTrie, "legendary", any:13839590, true);
- SetTrieValue(hTrie, "lemonchiffon", any:16775885, true);
- SetTrieValue(hTrie, "lightblue", any:11393254, true);
- SetTrieValue(hTrie, "lightcoral", any:15761536, true);
- SetTrieValue(hTrie, "lightcyan", any:14745599, true);
- SetTrieValue(hTrie, "lightgoldenrodyellow", any:16448210, true);
- SetTrieValue(hTrie, "lightgray", any:13882323, true);
- SetTrieValue(hTrie, "lightgrey", any:13882323, true);
- SetTrieValue(hTrie, "lightgreen", any:10092441, true);
- SetTrieValue(hTrie, "lightpink", any:16758465, true);
- SetTrieValue(hTrie, "lightsalmon", any:16752762, true);
- SetTrieValue(hTrie, "lightseagreen", any:2142890, true);
- SetTrieValue(hTrie, "lightskyblue", any:8900346, true);
- SetTrieValue(hTrie, "lightslategray", any:7833753, true);
- SetTrieValue(hTrie, "lightslategrey", any:7833753, true);
- SetTrieValue(hTrie, "lightsteelblue", any:11584734, true);
- SetTrieValue(hTrie, "lightyellow", any:16777184, true);
- SetTrieValue(hTrie, "lime", any:65280, true);
- SetTrieValue(hTrie, "limegreen", any:3329330, true);
- SetTrieValue(hTrie, "linen", any:16445670, true);
- SetTrieValue(hTrie, "magenta", any:16711935, true);
- SetTrieValue(hTrie, "maroon", any:8388608, true);
- SetTrieValue(hTrie, "mediumaquamarine", any:6737322, true);
- SetTrieValue(hTrie, "mediumblue", any:205, true);
- SetTrieValue(hTrie, "mediumorchid", any:12211667, true);
- SetTrieValue(hTrie, "mediumpurple", any:9662680, true);
- SetTrieValue(hTrie, "mediumseagreen", any:3978097, true);
- SetTrieValue(hTrie, "mediumslateblue", any:8087790, true);
- SetTrieValue(hTrie, "mediumspringgreen", any:64154, true);
- SetTrieValue(hTrie, "mediumturquoise", any:4772300, true);
- SetTrieValue(hTrie, "mediumvioletred", any:13047173, true);
- SetTrieValue(hTrie, "midnightblue", any:1644912, true);
- SetTrieValue(hTrie, "mintcream", any:16121850, true);
- SetTrieValue(hTrie, "mistyrose", any:16770273, true);
- SetTrieValue(hTrie, "moccasin", any:16770229, true);
- SetTrieValue(hTrie, "mythical", any:8931327, true);
- SetTrieValue(hTrie, "navajowhite", any:16768685, true);
- SetTrieValue(hTrie, "navy", any:128, true);
- SetTrieValue(hTrie, "normal", any:11711154, true);
- SetTrieValue(hTrie, "oldlace", any:16643558, true);
- SetTrieValue(hTrie, "olive", any:10404687, true);
- SetTrieValue(hTrie, "olivedrab", any:7048739, true);
- SetTrieValue(hTrie, "orange", any:16753920, true);
- SetTrieValue(hTrie, "orangered", any:16729344, true);
- SetTrieValue(hTrie, "orchid", any:14315734, true);
- SetTrieValue(hTrie, "palegoldenrod", any:15657130, true);
- SetTrieValue(hTrie, "palegreen", any:10025880, true);
- SetTrieValue(hTrie, "paleturquoise", any:11529966, true);
- SetTrieValue(hTrie, "palevioletred", any:14184595, true);
- SetTrieValue(hTrie, "papayawhip", any:16773077, true);
- SetTrieValue(hTrie, "peachpuff", any:16767673, true);
- SetTrieValue(hTrie, "peru", any:13468991, true);
- SetTrieValue(hTrie, "pink", any:16761035, true);
- SetTrieValue(hTrie, "plum", any:14524637, true);
- SetTrieValue(hTrie, "powderblue", any:11591910, true);
- SetTrieValue(hTrie, "purple", any:8388736, true);
- SetTrieValue(hTrie, "rare", any:4942335, true);
- SetTrieValue(hTrie, "red", any:16728128, true);
- SetTrieValue(hTrie, "rosybrown", any:12357519, true);
- SetTrieValue(hTrie, "royalblue", any:4286945, true);
- SetTrieValue(hTrie, "saddlebrown", any:9127187, true);
- SetTrieValue(hTrie, "salmon", any:16416882, true);
- SetTrieValue(hTrie, "sandybrown", any:16032864, true);
- SetTrieValue(hTrie, "seagreen", any:3050327, true);
- SetTrieValue(hTrie, "seashell", any:16774638, true);
- SetTrieValue(hTrie, "selfmade", any:7385162, true);
- SetTrieValue(hTrie, "sienna", any:10506797, true);
- SetTrieValue(hTrie, "silver", any:12632256, true);
- SetTrieValue(hTrie, "skyblue", any:8900331, true);
- SetTrieValue(hTrie, "slateblue", any:6970061, true);
- SetTrieValue(hTrie, "slategray", any:7372944, true);
- SetTrieValue(hTrie, "slategrey", any:7372944, true);
- SetTrieValue(hTrie, "snow", any:16775930, true);
- SetTrieValue(hTrie, "springgreen", any:65407, true);
- SetTrieValue(hTrie, "steelblue", any:4620980, true);
- SetTrieValue(hTrie, "strange", any:13593138, true);
- SetTrieValue(hTrie, "tan", any:13808780, true);
- SetTrieValue(hTrie, "teal", any:32896, true);
- SetTrieValue(hTrie, "thistle", any:14204888, true);
- SetTrieValue(hTrie, "tomato", any:16737095, true);
- SetTrieValue(hTrie, "turquoise", any:4251856, true);
- SetTrieValue(hTrie, "uncommon", any:11584473, true);
- SetTrieValue(hTrie, "unique", any:16766720, true);
- SetTrieValue(hTrie, "unusual", any:8802476, true);
- SetTrieValue(hTrie, "valve", any:10817401, true);
- SetTrieValue(hTrie, "vintage", any:4678289, true);
- SetTrieValue(hTrie, "violet", any:15631086, true);
- SetTrieValue(hTrie, "wheat", any:16113331, true);
- SetTrieValue(hTrie, "white", any:16777215, true);
- SetTrieValue(hTrie, "whitesmoke", any:16119285, true);
- SetTrieValue(hTrie, "yellow", any:16776960, true);
- SetTrieValue(hTrie, "yellowgreen", any:10145074, true);
- return hTrie;
- }
- public __pl_FF2_SetNTVOptional()
- {
- MarkNativeAsOptional("FF2_IsFF2Enabled");
- MarkNativeAsOptional("FF2_GetBossUserId");
- MarkNativeAsOptional("FF2_GetBossIndex");
- MarkNativeAsOptional("FF2_GetBossTeam");
- MarkNativeAsOptional("FF2_GetBossSpecial");
- MarkNativeAsOptional("FF2_GetBossMaxHealth");
- MarkNativeAsOptional("FF2_GetBossCharge");
- MarkNativeAsOptional("FF2_SetBossCharge");
- MarkNativeAsOptional("FF2_GetClientDamage");
- MarkNativeAsOptional("FF2_GetRoundState");
- MarkNativeAsOptional("FF2_GetRageDist");
- MarkNativeAsOptional("FF2_HasAbility");
- MarkNativeAsOptional("FF2_GetAbilityArgument");
- MarkNativeAsOptional("FF2_GetAbilityArgumentFloat");
- MarkNativeAsOptional("FF2_GetAbilityArgumentString");
- MarkNativeAsOptional("FF2_RandomSound");
- MarkNativeAsOptional("FF2_StopMusic");
- MarkNativeAsOptional("FF2_GetSpecialKV");
- MarkNativeAsOptional("FF2_GetQueuePoints");
- MarkNativeAsOptional("FF2_SetQueuePoints");
- MarkNativeAsOptional("FF2_GetFF2flags");
- MarkNativeAsOptional("FF2_SetFF2flags");
- MarkNativeAsOptional("FF2_DoAbility");
- return 0;
- }
- public void:OnPluginStart()
- {
- CreateConVar("unusual_version", "2.19", "Unusual version", 270592, false, 0.0, false, 0.0);
- c_tag = CreateConVar("unusual_tag", "1", "Enable 'unusual' tag", 262144, true, 0.0, true, 1.0);
- c_TeamRest = CreateConVar("unusual_team_restriction", "0", "0 = no restriction, 1 = red, 2 = blue can't have unusual effects", 262144, true, 0.0, true, 2.0);
- c_PanelFlag = CreateConVar("unusual_panel_flag", "0", "0 = ADMFLAG_ROOT, 1 = ADMFLAG_GENERIC", 262144, true, 0.0, true, 1.0);
- c_FF2 = CreateConVar("unusual_fix_ff2boss", "1", "0 = boss can have unusual effects, 1 = boss can't", 262144, true, 0.0, true, 1.0);
- RegConsoleCmd("unusual", OpenMenu, "Get unusual effect on your weapons", 0);
- RegAdminCmd("unusual_control", ControlPlayer, 2, "", "", 0);
- RegAdminCmd("unusual_permissions", reloadPermissions, 2, "", "", 0);
- LoadTranslations("unusual.phrases");
- Connect();
- BuildPath(PathType:0, EffectsList, 256, "configs/%s", "unusual_list.cfg");
- BuildPath(PathType:0, PermissionsFile, 256, "configs/%s", "unusual_permissions.cfg");
- decl String:PlayerInfo[64];
- new i = 1;
- while (i < MaxClients)
- {
- if (IsValidClient(i))
- {
- GetClientAuthId(i, AuthIdType:1, PlayerInfo, 64, true);
- strcopy(ClientSteamID[i], 64, PlayerInfo);
- }
- new j;
- while (j < 10)
- {
- ClientItemData[i][j][0] = -1;
- j++;
- }
- i++;
- }
- g_hItem = TF2Items_CreateItem(48);
- TF2Items_SetNumAttributes(g_hItem, 1);
- return void:0;
- }
- public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
- {
- CreateNative("UE_RemoveEffect", Native_RemoveEffect);
- CreateNative("UE_RemovePlayerEffects", Native_RemovePlayerEffects);
- CreateNative("UE_GetUnusualEffectPermission", Native_GetUnusualEffectPermission);
- CreateNative("UE_SetUnusualEffectPermission", Native_SetUnusualEffectPermission);
- return APLRes:0;
- }
- public void:OnMapStart()
- {
- if (LoadPermissions())
- {
- LogMessage("Unusual effects permissions loaded !");
- if (LibraryExists("freak_fortress_2"))
- {
- IsFF2Enabled = FF2_IsFF2Enabled();
- }
- }
- else
- {
- LogMessage("Error while charging permissions !");
- IsFF2Enabled = false;
- }
- return void:0;
- }
- public void:OnConfigsExecuted()
- {
- if (GetConVarBool(c_tag))
- {
- TagsCheck("unusual");
- }
- return void:0;
- }
- TagsCheck(String:tag[])
- {
- new Handle:hTags = FindConVar("sv_tags");
- decl String:tags[256];
- GetConVarString(hTags, tags, 255);
- if (!StrContains(tags, tag, false) > -1)
- {
- decl String:newTags[256];
- Format(newTags, 255, "%s,%s", tags, tag);
- SetConVarString(hTags, newTags, false, false);
- }
- CloseHandle(hTags);
- return 0;
- }
- public void:OnClientAuthorized(iClient, String:auth[])
- {
- strcopy(ClientSteamID[iClient], 64, auth);
- new j;
- while (j < 10)
- {
- ClientItemData[iClient][j][0] = -1;
- j++;
- }
- return void:0;
- }
- Connect()
- {
- if (SQL_CheckConfig("unusual"))
- {
- SQL_TConnect(Connected, "unusual", any:0);
- }
- else
- {
- new String:error[256];
- SQLite = true;
- new Handle:kv = CreateKeyValues("", "", "");
- KvSetString(kv, "driver", "sqlite");
- KvSetString(kv, "database", "unusual");
- db = SQL_ConnectCustom(kv, error, 255, false);
- CloseHandle(kv);
- if (db)
- {
- LogMessage("Loading : Connected to SQLite Database");
- CreateDbSQLite();
- }
- else
- {
- LogMessage("Loading : Failed to connect: %s", error);
- }
- }
- return 0;
- }
- public Connected(Handle:owner, Handle:hndl, String:error[], any:data)
- {
- if (hndl)
- {
- LogMessage("Loading : Connected to MySQL Database");
- SQL_TQuery(hndl, SQLErrorCheckCallback, "SET NAMES 'utf8'", any:0, DBPriority:1);
- db = hndl;
- SQL_CreateTables();
- return 0;
- }
- LogError("Failed to connect! Error: %s", error);
- LogMessage("Loading : Failed to connect! Error: %s", error);
- SetFailState("SQL Error. See error logs for details.");
- return 0;
- }
- SQL_CreateTables()
- {
- new len;
- decl String:query[512];
- len = Format(query[len], 512 - len, "CREATE TABLE IF NOT EXISTS `unusual_data` (") + len;
- len = Format(query[len], 512 - len, "`ue_ID` int(10) unsigned NOT NULL AUTO_INCREMENT, ") + len;
- len = Format(query[len], 512 - len, "`user_steamID` VARCHAR(64) NOT NULL, ") + len;
- len = Format(query[len], 512 - len, "`item_ID` int(11) NOT NULL DEFAULT '-1', ") + len;
- len = Format(query[len], 512 - len, "`effect_ID` int(11) NOT NULL DEFAULT '-1', ") + len;
- len = Format(query[len], 512 - len, "`quality_ID` int(11) NOT NULL DEFAULT '-1', ") + len;
- len = Format(query[len], 512 - len, "PRIMARY KEY (`ue_ID`)") + len;
- len = Format(query[len], 512 - len, ") ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;") + len;
- if (SQL_FastQuery(db, query, -1))
- {
- LogMessage("Loading : Table Created");
- }
- return 0;
- }
- CreateDbSQLite()
- {
- new len;
- decl String:query[512];
- len = Format(query[len], 512 - len, "CREATE TABLE IF NOT EXISTS `unusual_data` (") + len;
- len = Format(query[len], 512 - len, " `ID` INTEGER PRIMARY KEY AUTOINCREMENT,") + len;
- len = Format(query[len], 512 - len, " `user_steamID` VARCHAR(64),") + len;
- len = Format(query[len], 512 - len, " `item_ID` INTEGER DEFAULT -1,") + len;
- len = Format(query[len], 512 - len, " `effect_ID` INTEGER DEFAULT -1,") + len;
- len = Format(query[len], 512 - len, " `quality_ID` INTEGER DEFAULT -1") + len;
- len = Format(query[len], 512 - len, ");") + len;
- if (SQL_FastQuery(db, query, -1))
- {
- LogMessage("Loading : Table Created");
- }
- return 0;
- }
- public SQLErrorCheckCallback(Handle:owner, Handle:hndl, String:error[], any:data)
- {
- if (!StrEqual("", error, true))
- {
- LogError("SQL Error: %s", error);
- }
- return 0;
- }
- GetClientID(String:PlayerSteamID[64])
- {
- if (StrEqual(PlayerSteamID, "", true))
- {
- return -1;
- }
- new iClient = -1;
- new i = 1;
- while (i < MaxClients)
- {
- if (IsValidClient(i))
- {
- if (StrEqual(ClientSteamID[i], PlayerSteamID, true))
- {
- iClient = i;
- i++;
- }
- }
- i++;
- }
- return iClient;
- }
- bool:IsValidClient(iClient)
- {
- if (0 >= iClient)
- {
- return false;
- }
- if (iClient > MaxClients)
- {
- return false;
- }
- return IsClientInGame(iClient);
- }
- public Action:OpenMenu(iClient, Args)
- {
- FirstMenu(iClient);
- return Action:0;
- }
- public Action:ControlPlayer(iClient, Args)
- {
- new i = 1;
- while (i < MaxClients)
- {
- if (IsClientInGame(i))
- {
- Updating(i);
- }
- i++;
- }
- if (IsValidClient(iClient))
- {
- PrintToChat(iClient, "All Players have been controlled !");
- }
- else
- {
- LogMessage("All Players have been controlled !");
- }
- return Action:0;
- }
- public Action:reloadPermissions(iClient, Args)
- {
- if (LoadPermissions())
- {
- if (IsValidClient(iClient))
- {
- PrintToChat(iClient, "Unusual effects permissions reloaded !");
- }
- else
- {
- LogMessage("Unusual effects permissions reloaded !");
- }
- }
- else
- {
- if (IsValidClient(iClient))
- {
- PrintToChat(iClient, "Error while recharging permissions !");
- }
- LogMessage("Error while recharging permissions !");
- }
- return Action:0;
- }
- bool:LoadPermissions()
- {
- new Handle:kv = CreateKeyValues("Unusual_permissions", "", "");
- if (!FileToKeyValues(kv, PermissionsFile))
- {
- LogError("Can't open %s file", "unusual_permissions.cfg");
- CloseHandle(kv);
- return false;
- }
- KvGotoFirstSubKey(kv, true);
- Permission[0] = KvGetNum(kv, "0", 0);
- Permission[1] = KvGetNum(kv, "a", 0);
- Permission[2] = KvGetNum(kv, "b", 0);
- Permission[3] = KvGetNum(kv, "c", 0);
- Permission[4] = KvGetNum(kv, "d", 0);
- Permission[5] = KvGetNum(kv, "e", 0);
- Permission[6] = KvGetNum(kv, "f", 0);
- Permission[7] = KvGetNum(kv, "g", 0);
- Permission[8] = KvGetNum(kv, "h", 0);
- Permission[9] = KvGetNum(kv, "i", 0);
- Permission[10] = KvGetNum(kv, "j", 0);
- Permission[11] = KvGetNum(kv, "k", 0);
- Permission[12] = KvGetNum(kv, "l", 0);
- Permission[13] = KvGetNum(kv, "m", 0);
- Permission[14] = KvGetNum(kv, "n", 0);
- Permission[15] = KvGetNum(kv, "o", 0);
- Permission[16] = KvGetNum(kv, "p", 0);
- Permission[17] = KvGetNum(kv, "q", 0);
- Permission[18] = KvGetNum(kv, "r", 0);
- Permission[19] = KvGetNum(kv, "s", 0);
- Permission[20] = KvGetNum(kv, "t", 0);
- Permission[21] = KvGetNum(kv, "z", 0);
- CloseHandle(kv);
- return true;
- }
- bool:isAuthorized(iClient, bool:Strict)
- {
- new Limit = GetLimit(GetUserFlagBits(iClient));
- if (Limit == -1)
- {
- return true;
- }
- new var1;
- if (Strict && NbOfEffect[iClient] < Limit)
- {
- return true;
- }
- new var2;
- if (!Strict && NbOfEffect[iClient] <= Limit)
- {
- return true;
- }
- return false;
- }
- GetLimit(flags)
- {
- new Limit;
- new i;
- if (!flags)
- {
- return Permission[0];
- }
- do {
- new var2;
- if (FlagsList[i] & flags && (Limit < Permission[i + 1] || Permission[i + 1] == -1))
- {
- Limit = Permission[i + 1];
- }
- i++;
- new var3;
- if (!(Limit != -1 && i < 21))
- {
- return Limit;
- }
- } while (var3);
- return Limit;
- }
- public void:OnClientDisconnect(iClient)
- {
- if (!IsValidClient(iClient))
- {
- return void:0;
- }
- new i;
- while (i < 10)
- {
- ClientItemData[iClient][i][0] = -1;
- i++;
- }
- return void:0;
- }
- Updating(iClient)
- {
- new String:buffer[128];
- Format(buffer, 128, "SELECT COUNT(`user_steamID`) AS NB FROM unusual_data WHERE `user_steamID` = '%s'", ClientSteamID[iClient]);
- SQL_TQuery(db, T_ClientControl, buffer, iClient, DBPriority:1);
- return 0;
- }
- public T_ClientControl(Handle:owner, Handle:hndl, String:error[], any:iClient)
- {
- if (!SQL_GetRowCount(hndl))
- {
- NbOfEffect[iClient] = 0;
- return 0;
- }
- while (SQL_FetchRow(hndl))
- {
- NbOfEffect[iClient] = SQL_FetchInt(hndl, 0, 0);
- }
- if (!isAuthorized(iClient, false))
- {
- CPrintToChat(iClient, "%t", "Sent6");
- RemoveEffect(iClient, ClientSteamID[iClient], "-1");
- }
- else
- {
- new String:buffer[128];
- Format(buffer, 128, "SELECT DISTINCT `effect_ID` FROM unusual_data WHERE `user_steamID` = '%s'", ClientSteamID[iClient]);
- SQL_TQuery(db, T_ClientControl2, buffer, iClient, DBPriority:1);
- }
- return 0;
- }
- public T_ClientControl2(Handle:owner, Handle:hndl, String:error[], any:iClient)
- {
- if (!SQL_GetRowCount(hndl))
- {
- return 0;
- }
- new Handle:kv = CreateKeyValues("Unusual_effects", "", "");
- if (!FileToKeyValues(kv, EffectsList))
- {
- LogError("[UNUSUAL] Could not open file %s", "unusual_list.cfg");
- CloseHandle(kv);
- return 0;
- }
- new EffectID;
- new String:EffectFlag[4];
- new String:str_EffectID[8];
- while (SQL_FetchRow(hndl))
- {
- EffectID = SQL_FetchInt(hndl, 0, 0);
- Format(str_EffectID, 8, "%i", EffectID);
- if (!KvJumpToKey(kv, str_EffectID, false))
- {
- LogMessage("DB contain effectID that do not exist: %i", EffectID);
- KvRewind(kv);
- }
- KvGetString(kv, "flag", EffectFlag, 2, "");
- KvRewind(kv);
- if (!IsClientUEAllowed(iClient, EffectFlag))
- {
- new String:buffer[128];
- Format(buffer, 128, "SELECT `item_ID` FROM unusual_data WHERE `user_steamID` = '%s' AND `effect_ID` = %i", ClientSteamID[iClient], EffectID);
- SQL_TQuery(db, T_ClientRemoveEffect, buffer, iClient, DBPriority:1);
- }
- }
- CloseHandle(kv);
- return 0;
- }
- public T_ClientRemoveEffect(Handle:owner, Handle:hndl, String:error[], any:iClient)
- {
- if (!SQL_GetRowCount(hndl))
- {
- return 0;
- }
- while (SQL_FetchRow(hndl))
- {
- new String:str_ItemID[12];
- Format(str_ItemID, 10, "%i", SQL_FetchInt(hndl, 0, 0));
- RemoveEffect(iClient, ClientSteamID[iClient], str_ItemID);
- }
- return 0;
- }
- FixItemSlot(iItemDefinitionIndex, TFClassType:Class)
- {
- if (Class == TFClassType:9)
- {
- if (iItemDefinitionIndex == 1141)
- {
- return 0;
- }
- if (iItemDefinitionIndex == 15003)
- {
- return 0;
- }
- if (iItemDefinitionIndex == 15016)
- {
- return 0;
- }
- if (iItemDefinitionIndex == 15044)
- {
- return 0;
- }
- if (iItemDefinitionIndex == 15047)
- {
- return 0;
- }
- }
- if (iItemDefinitionIndex == 1141)
- {
- return 1;
- }
- if (iItemDefinitionIndex == 15003)
- {
- return 1;
- }
- if (iItemDefinitionIndex == 15016)
- {
- return 1;
- }
- if (iItemDefinitionIndex == 15044)
- {
- return 1;
- }
- if (iItemDefinitionIndex == 15047)
- {
- return 1;
- }
- return -1;
- }
- public Action:TF2Items_OnGiveNamedItem(iClient, String:classname[], iItemDefinitionIndex, &Handle:hItem)
- {
- if (!IsValidClient(iClient))
- {
- return Action:0;
- }
- if (IsFakeClient(iClient))
- {
- return Action:0;
- }
- new TeamRestriction = GetConVarInt(c_TeamRest);
- if (TeamRestriction + 1 == GetClientTeam(iClient))
- {
- return Action:0;
- }
- new var1;
- if (GetConVarInt(c_FF2) && IsFF2Enabled)
- {
- if (iClient == FF2_GetBossUserId(0))
- {
- return Action:0;
- }
- }
- new var2;
- if (iItemDefinitionIndex == 739 || iItemDefinitionIndex == 142)
- {
- return Action:0;
- }
- if (StrEqual(classname, "tf_wearable", true))
- {
- return Action:0;
- }
- new String:strItemDefSlot[4];
- Format(strItemDefSlot, 3, "%i", TF2IDB_GetItemSlot(iItemDefinitionIndex));
- new ItemDefSlot = FixItemSlot(iItemDefinitionIndex, TF2_GetPlayerClass(iClient));
- if (0 > ItemDefSlot)
- {
- ItemDefSlot = StringToInt(strItemDefSlot, 10);
- }
- new var3;
- if (ItemDefSlot >= 10 || ItemDefSlot < 0)
- {
- return Action:0;
- }
- if (iItemDefinitionIndex != ClientItemData[iClient][ItemDefSlot][0])
- {
- if (ItemDataInLoad[iClient])
- {
- if (ItemDataInLoad[iClient] >= 3)
- {
- StopItemLoading[iClient] = 1;
- ItemDataInLoad[iClient] = 1;
- }
- }
- else
- {
- ItemDataInLoad[iClient] = 1;
- }
- ClientItemData[iClient][ItemDefSlot][0] = iItemDefinitionIndex;
- ClientItemData[iClient][ItemDefSlot][1] = -1;
- ClientItemData[iClient][ItemDefSlot][2] = -1;
- if (ItemDataInLoad[iClient] != 2)
- {
- CreateTimer(0.2, TimerUpdateWeapon, iClient, 0);
- ItemDataInLoad[iClient] = 2;
- }
- return Action:0;
- }
- new var4;
- if (ItemDataInLoad[iClient] && ClientItemData[iClient][ItemDefSlot][1] > -1)
- {
- TF2Items_SetAttribute(g_hItem, 0, 134, 1065353216 * ClientItemData[iClient][ItemDefSlot][1]);
- if (ClientItemData[iClient][ItemDefSlot][2] > -1)
- {
- TF2Items_SetQuality(g_hItem, ClientItemData[iClient][ItemDefSlot][2]);
- hItem = g_hItem;
- return Action:1;
- }
- }
- return Action:0;
- }
- public Action:TimerUpdateWeapon(Handle:timer, any:iClient)
- {
- ItemDataInLoad[iClient] = 3;
- new String:itembuffer[1024];
- new i;
- while (GetMaximumNumberSlot(iClient) >= i)
- {
- if (StrEqual(itembuffer, "", true))
- {
- Format(itembuffer, 1024, "`item_ID` = '%i'", ClientItemData[iClient][i]);
- }
- else
- {
- Format(itembuffer, 1024, "%s OR `item_ID` = '%i'", itembuffer, ClientItemData[iClient][i]);
- }
- i++;
- }
- if (StopItemLoading[iClient] == true)
- {
- StopItemLoading[iClient] = 0;
- ItemDataInLoad[iClient] = 0;
- return Action:0;
- }
- new String:PlayerInfo[64];
- GetClientAuthId(iClient, AuthIdType:1, PlayerInfo, 64, true);
- new String:buffer[1024];
- Format(buffer, 1024, "SELECT `item_ID`, `effect_ID`, `quality_ID` FROM unusual_data WHERE `user_steamID` = '%s' AND ( %s )", PlayerInfo, itembuffer);
- SQL_TQuery(db, T_UpdateClientItemDataSlot, buffer, iClient, DBPriority:1);
- return Action:0;
- }
- public T_UpdateClientItemDataSlot(Handle:owner, Handle:hndl, String:error[], any:iClient)
- {
- if (!SQL_GetRowCount(hndl))
- {
- ItemDataInLoad[iClient] = 0;
- return 0;
- }
- new String:strItemDefSlot[4];
- new ItemDefSlot;
- while (SQL_FetchRow(hndl))
- {
- Format(strItemDefSlot, 3, "%i", TF2IDB_GetItemSlot(SQL_FetchInt(hndl, 0, 0)));
- ItemDefSlot = FixItemSlot(SQL_FetchInt(hndl, 0, 0), TF2_GetPlayerClass(iClient));
- if (0 > ItemDefSlot)
- {
- ItemDefSlot = StringToInt(strItemDefSlot, 10);
- }
- new var1;
- if (ItemDefSlot >= 10 || ItemDefSlot < 0)
- {
- ItemDataInLoad[iClient] = 0;
- return 0;
- }
- if (StopItemLoading[iClient] == true)
- {
- StopItemLoading[iClient] = 0;
- ItemDataInLoad[iClient] = 0;
- return 0;
- }
- if (SQL_FetchInt(hndl, 0, 0) != ClientItemData[iClient][ItemDefSlot][0])
- {
- ItemDataInLoad[iClient] = 0;
- return 0;
- }
- ClientItemData[iClient][ItemDefSlot][1] = SQL_FetchInt(hndl, 1, 0);
- ClientItemData[iClient][ItemDefSlot][2] = SQL_FetchInt(hndl, 2, 0);
- }
- UpdateWeapon(iClient);
- return 0;
- }
- UpdateWeapon(iClient)
- {
- if (!IsValidClient(iClient))
- {
- ItemDataInLoad[iClient] = 0;
- new i;
- while (i < 10)
- {
- ClientItemData[iClient][i][0] = -1;
- ClientItemData[iClient][i][1] = -1;
- ClientItemData[iClient][i][2] = -1;
- i++;
- }
- return 0;
- }
- new Clip[6];
- new Ammo[6];
- new SlotMax = GetMaximumNumberSlot(iClient);
- new i;
- while (i <= SlotMax)
- {
- Clip[i] = GetClip(iClient, i);
- Ammo[i] = GetAmmo(iClient, i);
- TF2_RemoveWeaponSlot(iClient, i);
- i++;
- }
- ItemDataInLoad[iClient] = 0;
- TF2_RegeneratePlayer(iClient);
- new iHealth = GetClientHealth(iClient);
- if (GetClientHealth(iClient) > iHealth)
- {
- SetEntityHealth(iClient, iHealth);
- }
- new i;
- while (i <= SlotMax)
- {
- new var1;
- if (Clip[i] != -1 && Clip[i] < GetClip(iClient, i))
- {
- SetClip(iClient, i, Clip[i]);
- }
- new var2;
- if (Ammo[i] != -1 && Ammo[i] < GetAmmo(iClient, i))
- {
- SetAmmo(iClient, i, Ammo[i]);
- }
- i++;
- }
- Updating(iClient);
- return 0;
- }
- GetMaximumNumberSlot(iClient)
- {
- new TFClassType:Class = TF2_GetPlayerClass(iClient);
- if (TFClassType:0 >= Class)
- {
- return 0;
- }
- new SlotMax = 2;
- if (Class == TFClassType:8)
- {
- SlotMax = 4;
- }
- else
- {
- if (Class == TFClassType:9)
- {
- SlotMax = 5;
- }
- }
- return SlotMax;
- }
- GetClip(iClient, WeapSlot)
- {
- new weapon = GetPlayerWeaponSlot(iClient, WeapSlot);
- if (IsValidEntity(weapon))
- {
- new iAmmo = FindSendPropInfo("CTFWeaponBase", "m_iClip1", 0, 0, 0);
- return GetEntData(weapon, iAmmo, 4);
- }
- return -1;
- }
- GetAmmo(iClient, WeapSlot)
- {
- new weapon = GetPlayerWeaponSlot(iClient, WeapSlot);
- if (IsValidEntity(weapon))
- {
- new iOffset = GetEntProp(weapon, PropType:0, "m_iPrimaryAmmoType", 1, 0) * 4;
- new iAmmo = FindSendPropInfo("CTFPlayer", "m_iAmmo", 0, 0, 0);
- return GetEntData(iClient, iOffset + iAmmo, 4);
- }
- return -1;
- }
- SetClip(iClient, WeapSlot, newAmmo)
- {
- new weapon = GetPlayerWeaponSlot(iClient, WeapSlot);
- if (IsValidEntity(weapon))
- {
- new iAmmoTable = FindSendPropInfo("CTFWeaponBase", "m_iClip1", 0, 0, 0);
- SetEntData(weapon, iAmmoTable, newAmmo, 4, true);
- }
- return 0;
- }
- SetAmmo(iClient, WeapSlot, newAmmo)
- {
- new weapon = GetPlayerWeaponSlot(iClient, WeapSlot);
- if (IsValidEntity(weapon))
- {
- new iOffset = GetEntProp(weapon, PropType:0, "m_iPrimaryAmmoType", 1, 0) * 4;
- new iAmmoTable = FindSendPropInfo("CTFPlayer", "m_iAmmo", 0, 0, 0);
- SetEntData(iClient, iOffset + iAmmoTable, newAmmo, 4, true);
- }
- return 0;
- }
- FirstMenu(iClient)
- {
- if (IsValidClient(iClient))
- {
- new TeamRestriction = GetConVarInt(c_TeamRest);
- if (TeamRestriction + 1 == GetClientTeam(iClient))
- {
- if (TeamRestriction == 1)
- {
- CPrintToChat(iClient, "%t", "Sent1", "Red");
- return 0;
- }
- if (TeamRestriction == 2)
- {
- CPrintToChat(iClient, "%t", "Sent1", "Blue");
- return 0;
- }
- }
- new var1;
- if (GetConVarInt(c_FF2) && IsFF2Enabled)
- {
- if (iClient == FF2_GetBossUserId(0))
- {
- CPrintToChat(iClient, "%t", "Sent1", "Boss");
- return 0;
- }
- }
- new String:PlayerInfo[64];
- GetClientAuthId(iClient, AuthIdType:1, PlayerInfo, 64, true);
- strcopy(SteamUsed[iClient], 64, PlayerInfo);
- new Handle:Menu1 = CreateMenu(Menu1_1, MenuAction:28);
- SetMenuTitle(Menu1, "What do you want ?");
- AddMenuItem(Menu1, "0", "Add/modify weapons", 0);
- AddMenuItem(Menu1, "1", "Delete effects", 0);
- AddMenuItem(Menu1, "2", "Show effects", 0);
- new var2;
- if ((GetConVarInt(c_PanelFlag) && GetUserFlagBits(iClient) & 16384) || (GetConVarInt(c_PanelFlag) == 1 && (GetUserFlagBits(iClient) & 2 || GetUserFlagBits(iClient) & 16384)))
- {
- AddMenuItem(Menu1, "3", "Admin tools: Add/modify", 0);
- AddMenuItem(Menu1, "4", "Admin tools: Delete", 0);
- }
- SetMenuExitButton(Menu1, true);
- DisplayMenu(Menu1, iClient, 0);
- }
- return 0;
- }
- public Menu1_1(Handle:menu, MenuAction:action, iClient, args)
- {
- if (action == MenuAction:16)
- {
- CloseHandle(menu);
- }
- else
- {
- if (action == MenuAction:4)
- {
- if (args)
- {
- if (args == 1)
- {
- DeleteWeapPanel(iClient);
- }
- if (args == 2)
- {
- FirstMenu(iClient);
- ShowMOTDPanel(iClient, "Unusual effects", "https://wiki.teamfortress.com/wiki/Unusual/", 2);
- }
- if (args == 3)
- {
- AT_Choice_add[iClient] = 1;
- AT_OnlinePlayers_Menu(iClient);
- }
- if (args == 4)
- {
- AT_Choice_add[iClient] = 0;
- AT_First_Menu(iClient);
- }
- }
- QualityMenu(iClient);
- }
- }
- return 0;
- }
- DeleteWeapPanel(iClient)
- {
- new String:buffer[256];
- Format(buffer, 255, "SELECT `item_ID` FROM unusual_data WHERE `user_steamID` = '%s'", SteamUsed[iClient]);
- SQL_TQuery(db, T_DeleteWeapPanel, buffer, iClient, DBPriority:1);
- return 0;
- }
- public T_DeleteWeapPanel(Handle:owner, Handle:hndl, String:error[], any:iClient)
- {
- new Handle:YourItemsMenu = CreateMenu(YourItemsMenuAnswer, MenuAction:28);
- SetMenuTitle(YourItemsMenu, "What items ?");
- if (!SQL_GetRowCount(hndl))
- {
- CPrintToChat(iClient, "%t", "Sent3");
- return 0;
- }
- new WeapID;
- new String:ItemsName[64];
- new String:strWeapID[12];
- AddMenuItem(YourItemsMenu, "-1", "All", 0);
- while (SQL_FetchRow(hndl))
- {
- WeapID = SQL_FetchInt(hndl, 0, 0);
- Format(strWeapID, 10, "%i", WeapID);
- TF2IDB_GetItemName(WeapID, ItemsName, 64);
- AddMenuItem(YourItemsMenu, strWeapID, ItemsName, 0);
- }
- SetMenuExitButton(YourItemsMenu, true);
- DisplayMenu(YourItemsMenu, iClient, 0);
- return 0;
- }
- public YourItemsMenuAnswer(Handle:menu, MenuAction:action, iClient, args)
- {
- if (action == MenuAction:16)
- {
- CloseHandle(menu);
- }
- else
- {
- if (action == MenuAction:4)
- {
- new String:WeapID[12];
- GetMenuItem(menu, args, WeapID, 10, 0, "", 0);
- if (IsValidClient(iClient))
- {
- RemoveEffect(iClient, SteamUsed[iClient], WeapID);
- }
- }
- }
- return 0;
- }
- bool:RemoveEffect(iClient, String:PlayerSteamID[64], String:WeapID[])
- {
- new clientControled = GetClientID(PlayerSteamID);
- if (StrEqual(WeapID, "-1", true))
- {
- new String:buffer[256];
- Format(buffer, 255, "DELETE FROM unusual_data WHERE `user_steamID` = '%s'", PlayerSteamID);
- SQL_TQuery(db, SQLErrorCheckCallback, buffer, any:0, DBPriority:1);
- new var1;
- if (iClient != clientControled && IsValidClient(iClient))
- {
- if (IsValidClient(clientControled))
- {
- CPrintToChat(iClient, "%t", "Sent11", clientControled);
- }
- CPrintToChat(iClient, "%t", "Sent4", PlayerSteamID);
- }
- if (clientControled != -1)
- {
- new i;
- while (i < 10)
- {
- ClientItemData[clientControled][i][1] = -1;
- ClientItemData[clientControled][i][2] = -1;
- i++;
- }
- if (IsValidClient(clientControled))
- {
- CPrintToChat(clientControled, "%t", "Sent10");
- }
- }
- }
- else
- {
- new String:buffer[256];
- Format(buffer, 255, "DELETE FROM unusual_data WHERE `user_steamID` = '%s' AND `item_ID` = %i", PlayerSteamID, StringToInt(WeapID, 10));
- SQL_TQuery(db, SQLErrorCheckCallback, buffer, any:0, DBPriority:1);
- new var2;
- if (iClient != clientControled && IsValidClient(iClient))
- {
- CPrintToChat(iClient, "%t", "Sent12", StringToInt(WeapID, 10));
- }
- if (clientControled != -1)
- {
- new var3;
- if (GetClientTeam(clientControled) == 2 || GetClientTeam(clientControled) == 3)
- {
- new String:strItemDefSlot[4];
- Format(strItemDefSlot, 2, "%i", TF2IDB_GetItemSlot(StringToInt(WeapID, 10)));
- new ItemDefSlot = FixItemSlot(StringToInt(WeapID, 10), TF2_GetPlayerClass(clientControled));
- if (0 > ItemDefSlot)
- {
- ItemDefSlot = StringToInt(strItemDefSlot, 10);
- }
- ClientItemData[clientControled][ItemDefSlot][1] = -1;
- ClientItemData[clientControled][ItemDefSlot][2] = -1;
- }
- if (IsValidClient(clientControled))
- {
- CPrintToChat(clientControled, "%t", "Sent12", StringToInt(WeapID, 10));
- }
- }
- }
- if (clientControled != -1)
- {
- new var4;
- if (GetClientTeam(clientControled) == 2 || GetClientTeam(clientControled) == 3)
- {
- UpdateWeapon(clientControled);
- }
- new var5;
- if (IsValidClient(iClient) && IsValidClient(clientControled))
- {
- if (clientControled == iClient)
- {
- DeleteWeapPanel(iClient);
- }
- FirstMenu(iClient);
- }
- }
- return true;
- }
- QualityMenu(iClient)
- {
- new clientControled = GetClientID(SteamUsed[iClient]);
- if (clientControled == -1)
- {
- CPrintToChat(iClient, "%t", "Sent9");
- return 0;
- }
- if (!isAuthorized(clientControled, true))
- {
- CPrintToChat(iClient, "%t", "Sent7");
- FirstMenu(iClient);
- return 0;
- }
- new EntitiesID = GetEntPropEnt(clientControled, PropType:1, "m_hActiveWeapon", 0);
- if (0 > EntitiesID)
- {
- CPrintToChat(iClient, "%t", "Sent14");
- return 0;
- }
- ClientItems[iClient] = GetEntProp(EntitiesID, PropType:0, "m_iItemDefinitionIndex", 4, 0);
- new var1;
- if (ClientItems[iClient] == 739 || ClientItems[iClient] == 142)
- {
- CPrintToChat(iClient, "%t", "Sent13");
- FirstMenu(iClient);
- return 0;
- }
- decl String:Title[64];
- decl String:WeapName[64];
- new Handle:Qltymenu = CreateMenu(QltymenuAnswer, MenuAction:28);
- TF2IDB_GetItemName(ClientItems[iClient], WeapName, 64);
- Format(Title, 64, "Select a quality: %s", WeapName);
- SetMenuTitle(Qltymenu, Title);
- AddMenuItem(Qltymenu, "0", "normal", 0);
- AddMenuItem(Qltymenu, "1", "rarity1", 0);
- AddMenuItem(Qltymenu, "2", "rarity2", 0);
- AddMenuItem(Qltymenu, "3", "vintage", 0);
- AddMenuItem(Qltymenu, "4", "rarity3", 0);
- AddMenuItem(Qltymenu, "5", "rarity4", 0);
- AddMenuItem(Qltymenu, "6", "unique", 0);
- AddMenuItem(Qltymenu, "7", "community", 0);
- AddMenuItem(Qltymenu, "8", "developer", 0);
- AddMenuItem(Qltymenu, "9", "selfmade", 0);
- AddMenuItem(Qltymenu, "10", "customized", 0);
- AddMenuItem(Qltymenu, "11", "strange", 0);
- AddMenuItem(Qltymenu, "12", "completed", 0);
- AddMenuItem(Qltymenu, "13", "haunted", 0);
- SetMenuExitButton(Qltymenu, true);
- DisplayMenu(Qltymenu, iClient, 0);
- return 0;
- }
- public QltymenuAnswer(Handle:menu, MenuAction:action, iClient, args)
- {
- if (action == MenuAction:16)
- {
- CloseHandle(menu);
- }
- else
- {
- if (action == MenuAction:4)
- {
- Quality[iClient] = args;
- PanelEffect(iClient);
- }
- }
- return 0;
- }
- PanelEffect(iClient)
- {
- new String:EffectID[8];
- new String:EffectName[128];
- new String:EffectFlag[4];
- new Handle:UnusualMenu = CreateMenu(UnusualMenuAnswer, MenuAction:28);
- SetMenuTitle(UnusualMenu, "Select an unusual effect:");
- AddMenuItem(UnusualMenu, "0", "Show effects", 0);
- new Handle:kv = CreateKeyValues("Unusual_effects", "", "");
- if (!FileToKeyValues(kv, EffectsList))
- {
- LogError("[UNUSUAL] Could not open file %s", "unusual_list.cfg");
- CloseHandle(kv);
- return 0;
- }
- if (!KvGotoFirstSubKey(kv, true))
- {
- LogMessage("ERROR: Can't find unusual effects in %s", "unusual_list.cfg");
- CloseHandle(kv);
- return 0;
- }
- do {
- KvGetSectionName(kv, EffectID, 8);
- KvGetString(kv, "name", EffectName, 128, "");
- KvGetString(kv, "flag", EffectFlag, 2, "");
- if (IsClientUEAllowed(iClient, EffectFlag))
- {
- AddMenuItem(UnusualMenu, EffectID, EffectName, 0);
- }
- } while (KvGotoNextKey(kv, true));
- CloseHandle(kv);
- SetMenuExitButton(UnusualMenu, true);
- DisplayMenu(UnusualMenu, iClient, 0);
- return 0;
- }
- public UnusualMenuAnswer(Handle:menu, MenuAction:action, iClient, args)
- {
- if (action == MenuAction:16)
- {
- CloseHandle(menu);
- }
- else
- {
- if (action == MenuAction:4)
- {
- if (args)
- {
- new String:strEffect[8];
- GetMenuItem(menu, args, strEffect, 8, 0, "", 0);
- Effect[iClient] = StringToInt(strEffect, 10);
- if (IsValidClient(iClient))
- {
- AddUnusualEffect(iClient);
- }
- }
- PanelEffect(iClient);
- ShowMOTDPanel(iClient, "Unusual effects", "http://bit.ly/l77777", 2);
- return 0;
- }
- }
- return 0;
- }
- bool:IsClientUEAllowed(iClient, String:EffectFlag[])
- {
- new var1;
- if (StrEqual(EffectFlag, "0", true) || StrEqual(EffectFlag, "", true) || StrEqual(EffectFlag, "-1", true))
- {
- return true;
- }
- new flag = GetUserFlagBits(iClient);
- new var2;
- if (flag & 2 || flag & 16384)
- {
- return true;
- }
- if (GetUEFlag(EffectFlag) & flag)
- {
- return true;
- }
- return false;
- }
- GetUEFlag(String:Value[])
- {
- new String:FlagsLetter[21][4] = "T";
- new i;
- while (i < 21)
- {
- if (StrEqual(Value, FlagsLetter[i], true))
- {
- return FlagsList[i];
- }
- i++;
- }
- return -1;
- }
- bool:AddUnusualEffect(iClient)
- {
- if (0 > ClientItems[iClient])
- {
- return false;
- }
- new var1;
- if (ClientItems[iClient] == 739 || ClientItems[iClient] == 142)
- {
- CPrintToChat(iClient, "%t", "Sent13");
- return false;
- }
- if (TF2IDB_GetItemSlot(ClientItems[iClient]) >= 5)
- {
- return false;
- }
- if (StrEqual(SteamUsed[iClient], "", true))
- {
- CPrintToChat(iClient, "%t", "Sent5");
- }
- new String:buffer[256];
- Format(buffer, 255, "SELECT * FROM unusual_data WHERE `user_steamID` = '%s' AND `item_ID` = '%i'", SteamUsed[iClient], ClientItems[iClient]);
- SQL_TQuery(db, T_UpdateClient, buffer, iClient, DBPriority:1);
- return false;
- }
- public T_UpdateClient(Handle:owner, Handle:hndl, String:error[], any:iClient)
- {
- new clientControled = GetClientID(SteamUsed[iClient]);
- new var1;
- if (clientControled == -1 || !IsValidClient(clientControled))
- {
- CPrintToChat(iClient, "%t", "Sent9");
- return 0;
- }
- if (!isAuthorized(clientControled, true))
- {
- CPrintToChat(iClient, "%t", "Sent7");
- return 0;
- }
- if (!SQL_GetRowCount(hndl))
- {
- new String:buffer[256];
- if (!SQLite)
- {
- Format(buffer, 256, "INSERT INTO unusual_data (`user_steamID`,`item_ID`,`effect_ID`,`quality_ID`) VALUES ('%s','%i','%i','%i')", SteamUsed[iClient], ClientItems[iClient], Effect[iClient], Quality[iClient]);
- SQL_TQuery(db, SQLErrorCheckCallback, buffer, any:0, DBPriority:1);
- }
- else
- {
- Format(buffer, 256, "INSERT INTO unusual_data VALUES ('%s','%i','%i','%i')", SteamUsed[iClient], ClientItems[iClient], Effect[iClient], Quality[iClient]);
- SQL_TQuery(db, SQLErrorCheckCallback, buffer, any:0, DBPriority:1);
- }
- if (IsValidClient(clientControled))
- {
- NbOfEffect[clientControled]++;
- }
- }
- else
- {
- new String:buffer[256];
- while (SQL_FetchRow(hndl))
- {
- Format(buffer, 256, "UPDATE unusual_data SET `effect_ID` = %i, `quality_ID` = %i WHERE `user_steamID` = '%s' AND `item_ID` = %i", Effect[iClient], Quality[iClient], SteamUsed[iClient], ClientItems[iClient]);
- SQL_TQuery(db, SQLErrorCheckCallback, buffer, any:0, DBPriority:1);
- }
- }
- new var2;
- if (GetClientTeam(clientControled) == 2 || GetClientTeam(clientControled) == 3)
- {
- new String:strItemDefSlot[4];
- Format(strItemDefSlot, 2, "%i", TF2IDB_GetItemSlot(ClientItems[iClient]));
- new ItemDefSlot = FixItemSlot(ClientItems[iClient], TF2_GetPlayerClass(clientControled));
- if (0 > ItemDefSlot)
- {
- ItemDefSlot = StringToInt(strItemDefSlot, 10);
- }
- ClientItemData[clientControled][ItemDefSlot][1] = Effect[iClient];
- ClientItemData[clientControled][ItemDefSlot][2] = Quality[iClient];
- }
- if (IsValidClient(clientControled))
- {
- UpdateWeapon(clientControled);
- }
- if (IsValidClient(iClient))
- {
- CPrintToChat(iClient, "%t", "Sent8");
- }
- new var3;
- if (clientControled != iClient && IsValidClient(clientControled))
- {
- CPrintToChat(clientControled, "%t", "Sent8");
- }
- new var4;
- if (IsValidClient(iClient) && IsValidClient(clientControled))
- {
- FirstMenu(iClient);
- }
- return 0;
- }
- AT_First_Menu(iClient)
- {
- new Handle:AdMenu = CreateMenu(AT_First_Menu_Ans, MenuAction:28);
- SetMenuTitle(AdMenu, "Admin Tools: Which kind of player ?");
- AddMenuItem(AdMenu, "0", "Players on the server", 0);
- AddMenuItem(AdMenu, "1", "Players from the BD", 0);
- SetMenuExitButton(AdMenu, true);
- DisplayMenu(AdMenu, iClient, 0);
- return 0;
- }
- public AT_First_Menu_Ans(Handle:menu, MenuAction:action, iClient, args)
- {
- if (action == MenuAction:16)
- {
- CloseHandle(menu);
- }
- else
- {
- if (action == MenuAction:4)
- {
- if (args)
- {
- AT_BDPlayers_Menu(iClient);
- }
- AT_OnlinePlayers_Menu(iClient);
- }
- }
- return 0;
- }
- AT_OnlinePlayers_Menu(iClient)
- {
- new Handle:AdMenu = CreateMenu(AT_OnlinePlayers_Menu_Ans, MenuAction:28);
- new String:str_PlayerID[8];
- new String:str_PlayerName[128];
- new count;
- SetMenuTitle(AdMenu, "Admin Tools: Player selection");
- new i;
- while (i < MaxClients)
- {
- new var1;
- if (IsValidClient(i) && iClient != i && IsClientInGame(i) && !IsFakeClient(i))
- {
- Format(str_PlayerID, 5, "%d", i);
- GetClientName(i, str_PlayerName, 128);
- AddMenuItem(AdMenu, str_PlayerID, str_PlayerName, 0);
- count++;
- }
- i++;
- }
- if (count)
- {
- SetMenuExitButton(AdMenu, true);
- DisplayMenu(AdMenu, iClient, 0);
- return 0;
- }
- CPrintToChat(iClient, "%t", "Sent2");
- CloseHandle(AdMenu);
- FirstMenu(iClient);
- return 0;
- }
- public AT_OnlinePlayers_Menu_Ans(Handle:menu, MenuAction:action, iClient, args)
- {
- if (action == MenuAction:16)
- {
- CloseHandle(menu);
- }
- else
- {
- if (action == MenuAction:4)
- {
- new String:str_PlayerID[8];
- new String:PlayerInfo[64];
- GetMenuItem(menu, args, str_PlayerID, 5, 0, "", 0);
- GetClientAuthId(StringToInt(str_PlayerID, 10), AuthIdType:1, PlayerInfo, 64, true);
- strcopy(SteamUsed[iClient], 64, PlayerInfo);
- if (!IsValidClient(StringToInt(str_PlayerID, 10)))
- {
- CPrintToChat(iClient, "%t", "Sent9");
- AT_OnlinePlayers_Menu(iClient);
- }
- else
- {
- if (AT_Choice_add[iClient])
- {
- QualityMenu(iClient);
- }
- DeleteWeapPanel(iClient);
- }
- }
- }
- return 0;
- }
- AT_BDPlayers_Menu(iClient)
- {
- new String:buffer[256];
- Format(buffer, 255, "SELECT DISTINCT `user_steamID` FROM unusual_data ORDER BY `user_steamID`");
- SQL_TQuery(db, AT_BDPlayers_Menu_2, buffer, iClient, DBPriority:1);
- return 0;
- }
- public AT_BDPlayers_Menu_2(Handle:owner, Handle:hndl, String:error[], any:iClient)
- {
- if (!SQL_GetRowCount(hndl))
- {
- CPrintToChat(iClient, "%t", "Sent2");
- FirstMenu(iClient);
- return 0;
- }
- new Handle:AdMenu = CreateMenu(AT_BDPlayers_Menu_Ans, MenuAction:28);
- SetMenuTitle(AdMenu, "Admin Tools: Player selection");
- new String:PlayerInfo[64];
- while (SQL_FetchRow(hndl))
- {
- SQL_FetchString(hndl, 0, PlayerInfo, 64, 0);
- AddMenuItem(AdMenu, PlayerInfo, PlayerInfo, 0);
- }
- SetMenuExitButton(AdMenu, true);
- DisplayMenu(AdMenu, iClient, 0);
- return 0;
- }
- public AT_BDPlayers_Menu_Ans(Handle:menu, MenuAction:action, iClient, args)
- {
- if (action == MenuAction:16)
- {
- CloseHandle(menu);
- }
- else
- {
- if (action == MenuAction:4)
- {
- new String:PlayerInfo[64];
- GetMenuItem(menu, args, PlayerInfo, 64, 0, "", 0);
- strcopy(SteamUsed[iClient], 64, PlayerInfo);
- DeleteWeapPanel(iClient);
- }
- }
- return 0;
- }
- public Native_RemoveEffect(Handle:plugin, numParams)
- {
- new String:PlayerSteamID[64];
- new String:WeapID[12];
- GetNativeString(1, PlayerSteamID, 64, 0);
- if (0 > GetNativeCell(2))
- {
- return 0;
- }
- Format(WeapID, 10, "%d", GetNativeCell(2));
- return RemoveEffect(-1, PlayerSteamID, WeapID);
- }
- public Native_RemovePlayerEffects(Handle:plugin, numParams)
- {
- new String:PlayerSteamID[64];
- GetNativeString(1, PlayerSteamID, 64, 0);
- return RemoveEffect(-1, PlayerSteamID, "-1");
- }
- public Native_GetUnusualEffectPermission(Handle:plugin, numParams)
- {
- new Bit = GetNativeCell(1);
- if (Bit == -1)
- {
- return Permission[0];
- }
- new i;
- while (Bit != FlagsList[i] && i < 21)
- {
- i++;
- }
- if (i < 21)
- {
- return Permission[i + 1];
- }
- LogError("INVALID FLAGBIT !");
- return -2;
- }
- public Native_SetUnusualEffectPermission(Handle:plugin, numParams)
- {
- new Bit = GetNativeCell(1);
- new Limit = GetNativeCell(2);
- if (Limit < -1)
- {
- LogError("INVALID LIMIT !");
- return 0;
- }
- new String:FlagBitToLetter[22][4] = "X";
- new Handle:kv = CreateKeyValues("Unusual_permissions", "", "");
- if (!FileToKeyValues(kv, PermissionsFile))
- {
- LogError("Can't open %s file", "unusual_permissions.cfg");
- CloseHandle(kv);
- return 0;
- }
- KvGotoFirstSubKey(kv, true);
- if (Bit == -1)
- {
- KvSetNum(kv, "0", Limit);
- }
- else
- {
- new i;
- while (Bit != FlagsList[i] && i < 21)
- {
- i++;
- }
- if (i < 21)
- {
- KvSetNum(kv, FlagBitToLetter[i + 1], Limit);
- }
- CloseHandle(kv);
- LogError("INVALID FLAGBIT !");
- return 0;
- }
- KvRewind(kv);
- if (!KeyValuesToFile(kv, PermissionsFile))
- {
- CloseHandle(kv);
- LogError("Plugin ERROR : Can't save %s modifications !", "unusual_permissions.cfg");
- return 0;
- }
- CloseHandle(kv);
- return LoadPermissions();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement