Giving something to an offline user
-
OciXCrom
Извън линия - Администратор
- Мнения: 7206
- Регистриран на: 06 Окт 2016, 19:20
- Местоположение: /resetscore
- Се отблагодари: 117 пъти
- Получена благодарност: 1295 пъти
- Обратна връзка:
Giving something to an offline user
I don't plan to add such a feature in the main plugin, but a sub-plugin can be made to do it. You can post a request if you decide to use it.
Giving something to an offline user
I decided to use the plugin, can you please make an external plugin for the request?
About giving xp to an offline user.
PS# A small question about your plugin, do I can give xp by using give_user_xp(id,10) instead of set_user_xp(id, get_user_xp(id) + 10) ? I just removed the prefix to show an example
About giving xp to an offline user.
PS# A small question about your plugin, do I can give xp by using give_user_xp(id,10) instead of set_user_xp(id, get_user_xp(id) + 10) ? I just removed the prefix to show an example
-
JackEyedJones
Извън линия - Потребител
- Мнения: 399
- Регистриран на: 10 Сеп 2018, 17:26
- Местоположение: Plovdiv, Bulgaria, Europe, Entire World
- Се отблагодари: 4 пъти
- Получена благодарност: 69 пъти
- Обратна връзка:
Giving something to an offline user
There must be such native which adds XP on the top of the current user's one XP which contains the 2nd argument itself so you dont have to type get_user_xp(id). Or the current one to be reworked.
give_user_xp(id, 10) in this case the #10 must be 3rd argument in the native structure i think.
give_user_xp(id, 10) in this case the #10 must be 3rd argument in the native structure i think.
Giving something to an offline user
Код за потвърждение: Избери целия код
/**
* Gives a specific amount of XP to the client.
*
* @note If the "reward" parameter is set, the plugin will ignore the amount set
* in the "amount" parameter and will attempt to give the XP set in the
* configuration file by the specific keyword set in the "reward" parameter.
*
* @param id Client index.
* @param amount XP amount.
* @param reward Reward keyword.
* @param source XP source.
* @return Amount of XP given.
*/
native crxranks_give_user_xp(id, amount = 0, reward[] = "", CRXRanks_XPSources:source = CRXRANKS_XPS_PLUGIN)
the set_user_xp
Код за потвърждение: Избери целия код
/**
* Sets the exact amount of XP that th client has.
*
* @param id Client index.
* @param amount XP amount.
* @param source XP source.
* @return Amount of XP given.
*/
native crxranks_set_user_xp(id, amount, CRXRanks_XPSources:source = CRXRANKS_XPS_PLUGIN)
-
JackEyedJones
Извън линия - Потребител
- Мнения: 399
- Регистриран на: 10 Сеп 2018, 17:26
- Местоположение: Plovdiv, Bulgaria, Europe, Entire World
- Се отблагодари: 4 пъти
- Получена благодарност: 69 пъти
- Обратна връзка:
Giving something to an offline user
Код за потвърждение: Избери целия код
#define crxranks_give_user_xp(%0, %1) crxranks_set_user_exp(%0, crxranks_get_user_exp(%0) + %1)
-
OciXCrom
Извън линия - Администратор
- Мнения: 7206
- Регистриран на: 06 Окт 2016, 19:20
- Местоположение: /resetscore
- Се отблагодари: 117 пъти
- Получена благодарност: 1295 пъти
- Обратна връзка:
Giving something to an offline user
My plugin already has such a native, so yes, you can simply do crxranks_give_user_xp(id, 10) instead of using two functions. Don't do what JackEyedJones said in the post above - the native is already there.
About the command to give XP to offline players, try this:
The command is crxranks_give_offline_xp <player> <xp>. It works with nVault. If you're using MySQL, let me know.
About the command to give XP to offline players, try this:
Код за потвърждение: Избери целия код
#include <amxmodx>
#include <amxmisc>
#include <cromchat>
#include <crxranks>
#include <nvault>
new g_iVault
public plugin_init()
{
register_plugin("CRXRanks: Give Offline XP", "1.0", "OciXCrom")
register_concmd("crxranks_give_offline_xp", "Cmd_GiveXP", ADMIN_RCON, "<player> <xp to give>")
}
public plugin_end()
{
if(g_iVault)
nvault_close(g_iVault)
}
public Cmd_GiveXP(id, iLevel, iCid)
{
if(!cmd_access(id, iLevel, iCid, 3))
return PLUGIN_HANDLED
if(!g_iVault)
{
new szVault[32]
crxranks_get_setting("VAULT_NAME", szVault, charsmax(szVault))
g_iVault = nvault_open(szVault)
}
new szPlayer[CRXRANKS_MAX_PLAYER_INFO_LENGTH], szXP[CRXRANKS_MAX_XP_LENGTH]
read_argv(1, szPlayer, charsmax(szPlayer))
read_argv(2, szXP, charsmax(szXP))
new szCurrentXP[CRXRANKS_MAX_XP_LENGTH], szNewXP[CRXRANKS_MAX_XP_LENGTH], szName[32]
get_user_name(id, szName, charsmax(szName))
if(nvault_get(g_iVault, szPlayer, szCurrentXP, charsmax(szCurrentXP)))
num_to_str(str_to_num(szCurrentXP) + str_to_num(szXP), szNewXP, charsmax(szNewXP))
else
copy(szNewXP, charsmax(szNewXP), szXP)
nvault_set(g_iVault, szPlayer, szNewXP)
CC_SendMessage(0, "ADMIN &x03%s &x01gave &x04%s XP &x01to offline user &x03%s", szName, szXP, szPlayer)
return PLUGIN_HANDLED
}
Giving something to an offline user
Will this work with SteamID saving method?
Edit: Also if I gave him the XP and in the same map he connects, will it load? Or map needs to be changed?
Tested it, and it worked! thanks man
Edit: Also if I gave him the XP and in the same map he connects, will it load? Or map needs to be changed?
Tested it, and it worked! thanks man
-
OciXCrom
Извън линия - Администратор
- Мнения: 7206
- Регистриран на: 06 Окт 2016, 19:20
- Местоположение: /resetscore
- Се отблагодари: 117 пъти
- Получена благодарност: 1295 пъти
- Обратна връзка:
Giving something to an offline user
It will work with any method and no, the map doesn't need to change. If everything's good, shall I lock the thread?
-
- Подобни теми
- Отговори
- Преглеждания
- Последно мнение
-
- 2 Отговори
- 2336 Преглеждания
-
Последно мнение от OciXCrom
-
- 3 Отговори
- 696 Преглеждания
-
Последно мнение от ChillX
-
- 3 Отговори
- 817 Преглеждания
-
Последно мнение от bustA
-
- 5 Отговори
- 2967 Преглеждания
-
Последно мнение от Drea<M>40BG ;]]
-
- 3 Отговори
- 2162 Преглеждания
-
Последно мнение от Midnight1337
-
- 4 Отговори
- 1498 Преглеждания
-
Последно мнение от V.A.L.V.E
-
- 3 Отговори
- 1428 Преглеждания
-
Последно мнение от Infamous2018
Кой е на линия
Потребители разглеждащи този форум: 0 регистрирани и 21 госта