Raised This Month: $47 Target: $400
 11% 

ammo/money for staying active


Post New Thread Reply   
 
Thread Tools Display Modes
itoxicreal
Senior Member
Join Date: Jun 2018
Old 03-24-2021 , 19:04   Re: ammo/money for staying active
Reply With Quote #11

Quote:
Originally Posted by OciXCrom View Post
Code:
#include <amxmodx> #include <cromchat> #include <cstrike> #include <nvault> #if !defined client_disconnected     #define client_disconnected client_disconnect #endif #if !defined MAX_PLAYERS     const MAX_PLAYERS = 32 #endif #if !defined MAX_NAME_LENGTH     const MAX_NAME_LENGTH = 32 #endif #if !defined MAX_AUTHID_LENGTH     const MAX_AUTHID_LENGTH = 64 #endif const TIME_REQUIRED = 10 const REWARD_AMOUNT = 10 const MAX_NUM_LENGTH = 16 const Float:TIME_FREQ = 60.0 new const REWARD_NAME[] = "$" // Reset the player's time if he isn't in the server longer than this many seconds const Float:MAX_OUT_TIME = 300.0 new Trie:g_tPlayers new g_szInfo[MAX_PLAYERS + 1][MAX_AUTHID_LENGTH] new g_iPlayedTime[MAX_PLAYERS + 1] public plugin_init() {     register_plugin("Time Rewards", "1.0", "OciXCrom")     CC_SetPrefix("&x04[Time Rewards]")     g_tPlayers = TrieCreate() } public plugin_end() {     TrieDestroy(g_tPlayers) } public client_authorized(id) {     new szData[MAX_NUM_LENGTH * 2]     get_user_authid(id, g_szInfo[id], charsmax(g_szInfo[]))     if(TrieGetString(g_tPlayers, g_szInfo[id], szData, charsmax(szData)))     {         new szTime[16], szStamp[16]         parse(szData, szTime, charsmax(szTime), szStamp, charsmax(szStamp))         g_iPlayedTime[id] = get_systime() - str_to_num(szStamp) > MAX_OUT_TIME ? 0 : str_to_num(szTime)     }         set_task(TIME_FREQ, "increase_played_time", id, .flags = "b") } public client_disconnected(id) {     new szData[MAX_NUM_LENGTH * 2]     formatex(szData, charsmax(szData), "%i %i", g_iPlayedTime[id], get_systime())     TrieSetString(g_tPlayers, g_szInfo[id], szData)     remove_task(id) } public increase_played_time(id) {     if(!(++g_iPlayedTime[id] % TIME_REQUIRED))     {         new szName[MAX_NAME_LENGTH]         get_user_name(id, szName, charsmax(szName))         CC_SendMessage(0, "&x03%s &x01received &x04%i%s for playing &x04%i &x01minutes (&x04%i &x01total).", szName, REWARD_AMOUNT, REWARD_NAME, TIME_REQUIRED, g_iPlayedTime[id])         cs_set_user_money(id, cs_get_user_money(id) + REWARD_AMOUNT)     } }
can you make it so the individual player gets the message only, like "You received --- for playing ---- minutes"
itoxicreal is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-24-2021 , 19:17   Re: ammo/money for staying active
Reply With Quote #12

CC_SendMessage(0

=>

CC_SendMessage(id
__________________


Dear admins. If somehow you managed to read this, plz fix.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
itoxicreal
Senior Member
Join Date: Jun 2018
Old 03-24-2021 , 20:41   Re: ammo/money for staying active
Reply With Quote #13

tysmm
itoxicreal is offline
lantimilan
Senior Member
Join Date: May 2016
Location: KOSOVA
Old 03-25-2021 , 05:07   Re: ammo/money for staying active
Reply With Quote #14

Oci can you add and plus 3 kills who stay 10 min active ?
lantimilan is offline
Send a message via MSN to lantimilan
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-25-2021 , 08:28   Re: ammo/money for staying active
Reply With Quote #15

3 kills where? Those kills won't be registered in CSStats so I don't see the point.
__________________


Dear admins. If somehow you managed to read this, plz fix.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
lantimilan
Senior Member
Join Date: May 2016
Location: KOSOVA
Old 03-25-2021 , 13:59   Re: ammo/money for staying active
Reply With Quote #16

I thought of something more beautiful to give him the will to be active
lantimilan is offline
Send a message via MSN to lantimilan
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-25-2021 , 14:42   Re: ammo/money for staying active
Reply With Quote #17

Unfortunately CSStats *still* doesn't have natives for modifying player data.
__________________


Dear admins. If somehow you managed to read this, plz fix.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-25-2021 , 20:01   Re: ammo/money for staying active
Reply With Quote #18

I wish there was a way to do it with Pawn, but there's not, I've tried.

https://forums.alliedmods.net/showpo...56&postcount=8
__________________
Bugsy is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-25-2021 , 20:48   Re: ammo/money for staying active
Reply With Quote #19

Still hoping someone with decent C++ knowledge posts a pull request with such natives. Would love to see them in 1.10.
__________________


Dear admins. If somehow you managed to read this, plz fix.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:59.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode