Last active
March 29, 2024 15:51
-
-
Save ArKaNeMaN/970685239663cb1b7a7791c0d2c55c6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <amxmodx> | |
#include <json> | |
#include <VipModular> | |
#include <reapi_molotov_api> | |
/* | |
Параметры: | |
Check - Проверять ли наличие молотова у игрока перед выдачей | |
Пример: | |
{ | |
"Type": "WellAsGood-Molotov", | |
"Check": true | |
} | |
*/ | |
#pragma semicolon 1 | |
#pragma compress 1 | |
public stock const PluginName[] = "[VipM-I] WellAsGood`s Molotov"; | |
public stock const PluginVersion[] = "1.0.0"; | |
public stock const PluginAuthor[] = "ArKaNeMaN"; | |
public stock const PluginURL[] = "t.me/arkanaplugins"; | |
new const TYPE_NAME[] = "WellAsGood-Molotov"; | |
public VipM_IC_OnInitTypes() { | |
register_plugin(PluginName, PluginVersion, PluginAuthor); | |
VipM_IC_RegisterType(TYPE_NAME); | |
VipM_IC_RegisterTypeEvent(TYPE_NAME, ItemType_OnRead, "@OnRead"); | |
VipM_IC_RegisterTypeEvent(TYPE_NAME, ItemType_OnGive, "@OnGive"); | |
} | |
@OnRead(const JSON:jItem, const Trie:tParams) { | |
TrieDeleteKey(tParams, "Name"); | |
TrieSetCell(tParams, "Check", false); | |
if (json_object_has_value(jItem, "Check", JSONBoolean)) { | |
TrieSetCell(tParams, "Check", json_object_get_bool(jItem, "Check")); | |
} | |
} | |
@OnGive(const UserId, const Trie:tParams) { | |
if ( | |
!VipM_Params_GetBool(tParams, "Check", false) | |
|| !rp_molotov_check(UserId) | |
) { | |
rp_getting_molotov(UserId); | |
return VIPM_CONTINUE; | |
} | |
return VIPM_STOP; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment