Custom hKeyValues "Gifts_CreateGift"#4
Open
DarklSide wants to merge 9 commits into
Open
Conversation
Если index = 0 и свой hKeyValues: https://github.com/R1KO/Gifts/blob/master/addons/sourcemod/scripting/include/gifts_core.inc#L86 то в глобальном g_hKeyValues его не найдет: https://github.com/R1KO/Gifts/blob/master/addons/sourcemod/scripting/Gifts_Core.sp#L384
Owner
|
Если 0 то в натив нужно передать KV со своими данными подарка. |
Contributor
Author
|
@R1KO KeyValues hKeyValues = new KeyValues("0");
KvSetString(hKeyValues, "Model", modelsPhy[iGift]);
KvSetString(hKeyValues, "Lifetime", "30.0");
KvSetString(hKeyValues, "TextToAll", "{NAME} поднял подарок и получит Бонус!");
iIndex = Gifts_CreateGift(iClient, fPos, 0, hKeyValues);При этом чтобы проходил проверку и следовательно брал gift: Добавил в gifts.cfg ключ "0" [хотя можно было не добавлять в нем "TextToAll" и "TextToPlayer", оставляя это модулю] и счетчик от 0: P.S.: при этом нужно не забыть проверить границы "Gifts_GetGiftsCount". |
Owner
|
@DarklSide Я переписал логику так, как я её вижу, глянь как тебе. Нужно еще проверить перед тем как вливать. |
Contributor
Author
|
Мы все равно будем переходить по ключу "0": KeyValues hKeyValues = new KeyValues("custom");
KvSetNum(hKeyValues, "is_custom", 1);
KvSetString(hKeyValues, "Model", "models/items/cs_gift.mdl");
KvSetString(hKeyValues, "Lifetime", "30.0");
KvSetString(hKeyValues, "TextToAll", "{NAME} поднял подарок и получит Бонус!");
int iIndex = Gifts_CreateGift(iClient, fPos, 0, hKeyValues);
delete hKeyValues;
PrintToChat(iClient, "Gifts_CreateGift: %d", iIndex); |
Contributor
Author
|
Если custom gift удалится по времени, то из глобального kv его не удалим. |
Owner
Та в принципе пофиг. после смены карты глобальный кв вернется в первоначальный вид |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Если index = 0 и свой hKeyValues:
https://github.com/R1KO/Gifts/blob/master/addons/sourcemod/scripting/include/gifts_core.inc#L86
то в глобальном g_hKeyValues его не найдет:
https://github.com/R1KO/Gifts/blob/master/addons/sourcemod/scripting/Gifts_Core.sp#L384