Raised This Month: $60 Target: $400
 15% 

[Req]Money Reward


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KillerElite
Junior Member
Join Date: Aug 2019
Old 01-08-2020 , 10:54   [Req]Money Reward
Reply With Quote #1

Hi! I want a plugin which gives you $16.000 after 20 minutes played.
KillerElite is offline
SuperrioR
Junior Member
Join Date: Sep 2019
Location: Republic of Moldova
Old 01-09-2020 , 13:57   Re: [Req]Money Reward
Reply With Quote #2

Try this:
Plugin edited by L E V I N

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>

const MONEY 16000
const TIME 20

new g_iUserTime33 ];

#define TASK_pentru 06091993

public plugin_init() {
    
register_plugin
    
(
    .
plugin_name="FCS TIME REWARD?"    ,
    .
version="0.1"        ,
    .
author="ASKHANARU"//lev edits
    
)
    
    
// Add your code here...
    
    
set_task1.0"task_PTRFunctions"TASK_pentru__"b");
}

public 
client_putinserver(id)    g_iUserTime[id]=0
public client_disconnect(id)    g_iUserTime[id]=0

public task_PTRFunctions( )
{
    static 
iPlayers32 ],iPlayersNum;
    
get_playersiPlayersiPlayersNum"ch" );
    if( !
iPlayersNum )    return;

    static 
idi;
    for( 
0iPlayersNumi++ )
    {
        
id iPlayers];

        
g_iUserTimeid ]++;
        static 
iTime;
        
iTime TIME;

        if( 
g_iUserTimeid ] >= iTime 60 )
        {
            
g_iUserTimeid ] -= iTime 60;

            
cs_set_user_money(id,cs_get_user_money(id)+MONEY,1)
        }
    }


Last edited by SuperrioR; 01-09-2020 at 14:00.
SuperrioR is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-09-2020 , 14:13   Re: [Req]Money Reward
Reply With Quote #3

The plugin above won't work after mapchange or if the player was kicked or disconnected for a short time.

Use this:

PHP 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 MAX_NUM_LENGTH 8
const Float:TIME_FREQ 60.0

// Reset the player's time if he isn't in the server longer than this many seconds
const Float:MAX_OUT_TIME 300.0

enum _
:TimeRewards Minutes[MAX_NUM_LENGTH], XP }

// Add as many rewards as you like in this list
new const g_eTimeRewards[][TimeRewards] =
{
    
/* "<minutes required>" <money reward> */
    
"20"16000 }
}

new 
Trie:g_tTimeRewards
new g_szAuthId[MAX_PLAYERS 1][MAX_AUTHID_LENGTH], g_iPlayedTime[MAX_PLAYERS 1], g_iVault

public plugin_init()
{
    
register_plugin("Simple Time Rewards""1.0""OciXCrom")
    
g_iVault nvault_open("CRXSimpleTimeRewards")
    
g_tTimeRewards TrieCreate()

    for(new 
isizeof(g_eTimeRewards); i++)
    {
        
TrieSetCell(g_tTimeRewardsg_eTimeRewards[i][Minutes], g_eTimeRewards[i][XP])
    }

    
CC_SetPrefix("&x04[Time Rewards]")
}

public 
plugin_end()
{
    
nvault_close(g_iVault)
    
TrieDestroy(g_tTimeRewards)
}

public 
client_connect(id)
{
    new 
szPlayedTime[MAX_NUM_LENGTH], iTimeStamp
    get_user_authid
(idg_szAuthId[id], charsmax(g_szAuthId[]))
    
nvault_lookup(g_iVaultg_szAuthId[id], szPlayedTimecharsmax(szPlayedTime), iTimeStamp)

    
g_iPlayedTime[id] = get_systime() - iTimeStamp MAX_OUT_TIME str_to_num(szPlayedTime)
    
set_task(TIME_FREQ"increase_played_time"id, .flags "b")
}

public 
client_disconnected(id)
{
    new 
szPlayedTime[MAX_NUM_LENGTH]
    
num_to_str(g_iPlayedTime[id], szPlayedTimecharsmax(szPlayedTime))
    
nvault_set(g_iVaultg_szAuthId[id], szPlayedTime)
    
remove_task(id)
}

public 
increase_played_time(id)
{
    new 
szPlayedTime[MAX_NUM_LENGTH], iMoney
    num_to_str
(++g_iPlayedTime[id], szPlayedTimecharsmax(szPlayedTime))

    if(
TrieGetCell(g_tTimeRewardsszPlayedTimeiMoney))
    {
        new 
szName[MAX_NAME_LENGTH]
        
get_user_name(idszNamecharsmax(szName))
        
CC_SendMessage(0"&x03%s &x01received &x04%i$ for playing &x04%i &x01minutes."szNameiMoneyg_iPlayedTime[id])
        
cs_set_user_money(idcs_get_user_money(id) + iMoney)
    }

__________________

Last edited by OciXCrom; 01-09-2020 at 14:13.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Adryyy
Member
Join Date: Oct 2011
Old 01-10-2020 , 13:12   Re: [Req]Money Reward
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
The plugin above won't work after mapchange or if the player was kicked or disconnected for a short time.

Use this:

PHP 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 MAX_NUM_LENGTH 8
const Float:TIME_FREQ 60.0

// Reset the player's time if he isn't in the server longer than this many seconds
const Float:MAX_OUT_TIME 300.0

enum _
:TimeRewards Minutes[MAX_NUM_LENGTH], XP }

// Add as many rewards as you like in this list
new const g_eTimeRewards[][TimeRewards] =
{
    
/* "<minutes required>" <money reward> */
    
"20"16000 }
}

new 
Trie:g_tTimeRewards
new g_szAuthId[MAX_PLAYERS 1][MAX_AUTHID_LENGTH], g_iPlayedTime[MAX_PLAYERS 1], g_iVault

public plugin_init()
{
    
register_plugin("Simple Time Rewards""1.0""OciXCrom")
    
g_iVault nvault_open("CRXSimpleTimeRewards")
    
g_tTimeRewards TrieCreate()

    for(new 
isizeof(g_eTimeRewards); i++)
    {
        
TrieSetCell(g_tTimeRewardsg_eTimeRewards[i][Minutes], g_eTimeRewards[i][XP])
    }

    
CC_SetPrefix("&x04[Time Rewards]")
}

public 
plugin_end()
{
    
nvault_close(g_iVault)
    
TrieDestroy(g_tTimeRewards)
}

public 
client_connect(id)
{
    new 
szPlayedTime[MAX_NUM_LENGTH], iTimeStamp
    get_user_authid
(idg_szAuthId[id], charsmax(g_szAuthId[]))
    
nvault_lookup(g_iVaultg_szAuthId[id], szPlayedTimecharsmax(szPlayedTime), iTimeStamp)

    
g_iPlayedTime[id] = get_systime() - iTimeStamp MAX_OUT_TIME str_to_num(szPlayedTime)
    
set_task(TIME_FREQ"increase_played_time"id, .flags "b")
}

public 
client_disconnected(id)
{
    new 
szPlayedTime[MAX_NUM_LENGTH]
    
num_to_str(g_iPlayedTime[id], szPlayedTimecharsmax(szPlayedTime))
    
nvault_set(g_iVaultg_szAuthId[id], szPlayedTime)
    
remove_task(id)
}

public 
increase_played_time(id)
{
    new 
szPlayedTime[MAX_NUM_LENGTH], iMoney
    num_to_str
(++g_iPlayedTime[id], szPlayedTimecharsmax(szPlayedTime))

    if(
TrieGetCell(g_tTimeRewardsszPlayedTimeiMoney))
    {
        new 
szName[MAX_NAME_LENGTH]
        
get_user_name(idszNamecharsmax(szName))
        
CC_SendMessage(0"&x03%s &x01received &x04%i$ for playing &x04%i &x01minutes."szNameiMoneyg_iPlayedTime[id])
        
cs_set_user_money(idcs_get_user_money(id) + iMoney)
    }

why will not work? if i use that plugin from 4 years and i don't have problems?
your code is too useless...you call some things for nothing, why to don't save the trees?

Last edited by Adryyy; 01-10-2020 at 13:13. Reason: filters...
Adryyy is offline
Send a message via Yahoo to Adryyy Send a message via Skype™ to Adryyy
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-10-2020 , 13:33   Re: [Req]Money Reward
Reply With Quote #5

Quote:
Originally Posted by Adryyy View Post
why will not work? if i use that plugin from 4 years and i don't have problems?
your code is too useless...you call some things for nothing, why to don't save the trees?
I think I made my self clear why and when it won't work. Are you not able to read?
I don't see you explaining which part of my code is useless, so if you're gonna scream at someone, at least give reasons for it.

Quote:
why to don't save the trees?
This is not up to me. Many trees are being cut down and burned due to forest fires and... well people. You get the point.

__________________

Last edited by OciXCrom; 01-10-2020 at 13:35.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 01-14-2020 , 12:43   Re: [Req]Money Reward
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
I think I made my self clear why and when it won't work. Are you not able to read?
I don't see you explaining which part of my code is useless, so if you're gonna scream at someone, at least give reasons for it.



This is not up to me. Many trees are being cut down and burned due to forest fires and... well people. You get the point.

Lolled so hard at this one
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Shitty
Member
Join Date: Sep 2019
Old 01-14-2020 , 21:27   Re: [Req]Money Reward
Reply With Quote #7

Just give the guy what he need and dont make a memes in his thread. Also, I laughed at this sentence
Quote:
Originally Posted by Adryyy View Post
why to don't save the trees?
__________________
Quote:
Originally Posted by OciXCrom View Post
WhAt Is WaTeRing aNd TowErInG?!
Shitty is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-15-2020 , 07:42   Re: [Req]Money Reward
Reply With Quote #8

I already did, plus included the meme so he gets double benefits. Unfortunately, he doesn't seem interested in checking the thread he posted.
__________________

Last edited by OciXCrom; 01-15-2020 at 07:42.
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 19:49.


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