Raised This Month: $32 Target: $400
 8% 

[Req] a give coins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 07-26-2019 , 03:40   [Req] a give coins
Reply With Quote #1

Hi all . i want a plugin for give coins players in 1 h playing jailbreak . the cmd of coins = Jbed_give_coins_ex "Name" "5000"
i want players type /getgift for get 5000 coins in 1 h .
Mikaeel123 is offline
Noam
Member
Join Date: Jun 2019
Old 07-29-2019 , 15:51   Re: [Req] a give coins
Reply With Quote #2

Quote:
/* Plugin generated by AMXX-Studio */

#include < amxmodx >

#include < fvault >

native set_user_cash( id, cash );

native get_user_cash( id );

new szVault[ ] = "PayCheckVault";

#define MAX_PLAYERS 32

#define PAYCHECK_GIVES 2500

#define TIME_TO_TAKE_PAYCHECK 30

#define VOX_STARTS_FROM 5

#define PAYCHECK_SOUND "JB/paycheck.mp3"

#define TASK_COUNT 4455

new iNextPayCheck;

new iCount, iTimeSpent[ MAX_PLAYERS + 1 ], iConnected[ MAX_PLAYERS + 1 ], bool:bChecked[ MAX_PLAYERS + 1 ];

public plugin_init( )
{
register_plugin( "Paycheck - cash every round hour.", "1.0", "slzzzzzzz" );

register_saycmd( "playerstime", "Show_Players_Time" );

register_saycmd( "pt", "Show_Players_Time" );

register_saycmd( "paycheck", "CmdPayCheck" );

register_saycmd( "pc", "CmdPayCheck" );

set_next_paycheck( );

set_task( float( iNextPayCheck - get_systime( ) ), "PayCheck_Ready" );
}

public plugin_precache( )
{
#if defined PAYCHECK_SOUND
precache_sound( PAYCHECK_SOUND );
#endif
}

public client_authorized( id )
{
static szData[ 5 ];

bChecked[ id ] = false;

iConnected[ id ] = floatround( get_gametime( ) );

if( ! ( fvault_get_data( szVault, GetAuth( id ), szData, charsmax( szData ) ) ) )
{
iTimeSpent[ id ] = 0;

return;
}

iTimeSpent[ id ] = str_to_num( szData );
}

public client_disconnect( id )
{
new iTemp, szData[ 5 ];

iTemp = iTimeSpent[ id ] + ( floatround( get_gametime( ) ) - iConnected[ id ] );

num_to_str( iTemp, szData, charsmax( szData ) );

fvault_set_data( szVault, GetAuth( id ), szData );
}

public CmdPayCheck( id )
{
if( get_systime( ) < iNextPayCheck )
{
ColorChat( id, "Paycheck will be ready in ^4%.1f ^1minutes.", ( iNextPayCheck - get_systime( ) ) / 60.0 );

return 1;
}

if( bChecked[ id ] )
{
ColorChat( id, "You already took your paycheck" );

return 1;
}

new Float:iTotal = float( iTimeSpent[ id ] + ( floatround( get_gametime( ) ) - iConnected[ id ] ) );

iTotal/=60.0; // Amount of minutes the player has spent in the last hour.

if( iTotal < 1.0 )
{
ColorChat( id, "You haven't even spent a minute in the last hour, ^4fuck off mate^1." );

return 1;
}

fvault_remove_key( szVault, GetAuth( id ) );

new Float:fPerMinute = PAYCHECK_GIVES / 60.0; // Amount of cash players recieve per minute.

new iCash = floatround( fPerMinute * iTotal );

set_user_cash( id, get_user_cash( id ) + iCash );

bChecked[ id ] = true;

ColorChat( id, "You got ^4%d^1 cash, for playing ^3%.1f ^1minutes in the last ^4hour^1.", iCash, iTotal );

return 1;
}

public Show_Players_Time( id )
{
new iMenu = menu_create( "\wPaycheck Menu \d- \rHow much time players spent in the last hour\w?", "Handler" );

new Float:iTotal;

new iCallback = menu_makecallback( "cb_disabled" );

static szMenu[ 120 ];

for( new i = 1 ; i <= MAX_PLAYERS ; i++ )
{
if( !is_user_connected( i ) )
continue;

iTotal = float( iTimeSpent[ i ] + ( floatround( get_gametime( ) ) - iConnected[ i ] ) );

iTotal/=60.0;

formatex( szMenu, charsmax( szMenu ), "%s \d- \y%.1f \wMinutes", GetName( i ), iTotal );

menu_additem( iMenu, szMenu, _, _, iCallback );
}

menu_setprop( iMenu, MPROP_EXIT, MEXIT_ALL );

menu_display( id, iMenu );
}

public Handler( id, iMenu, item )
{
menu_destroy( iMenu );

return 1;
}

public cb_disabled( id, iMenu, item )
{
return ITEM_DISABLED;
}

public PayCheck_Ready( )
{
iCount = TIME_TO_TAKE_PAYCHECK;

#if defined PAYCHECK_SOUND
client_cmd( 0, "mp3 play ^"sound/%s^"", PAYCHECK_SOUND );
#endif

arrayset( bChecked, false, MAX_PLAYERS );

set_task( 1.0, "CmdCountDown", TASK_COUNT, _, _, "b" );

}

public CmdCountDown( )
{
if( iCount <= 0 )
{
remove_task( TASK_COUNT );

fvault_clear( szVault );

arrayset( iTimeSpent, 0, MAX_PLAYERS );

arrayset( iConnected, floatround( get_gametime( ) ), MAX_PLAYERS );

set_next_paycheck( );

set_task( float( iNextPayCheck - get_systime( ) ), "PayCheck_Ready" );

ColorChat( 0, "You can no longer take your ^4paycheck^1, the next paycheck will be available in ^3one hour^1." );

return;
}

set_hudmessage( 255, 0, 0, -1.0, 0.16, 0, 6.0, 1.0 );

show_hudmessage( 0, "Time left to use paycheck:^n%d", iCount );

if( iCount <= VOX_STARTS_FROM )
client_cmd( 0, "spk vox/%s", GetWord( iCount ) );

iCount--;
}

/* Coldwar ahatih */
stock set_next_paycheck( )
iNextPayCheck = get_systime() + 3600 - (get_systime() % 3600);
/* */

stock GetAuth( id )
{
static szAuth[ 45 ];

get_user_authid( id, szAuth, charsmax( szAuth ) );

if( containi( szAuth, "VALVE_" ) != -1 || containi( szAuth, "ID_LAN" ) != -1 )
get_user_ip( id, szAuth, charsmax( szAuth ), 1 );

return szAuth;
}

stock GetWord( iNum )
{
static szWord[ 17 ];

num_to_word( iNum, szWord, charsmax( szWord ) );

return szWord;
}

stock GetName( id )
{
static szName[ 32 ];

get_user_name( id, szName, charsmax( szName ) );

return szName;
}

stock register_saycmd( const cmd[ ], const function[ ] )
{
static Func[ 60 ];

static const szSymbols[ ] [ ] = { "/", "!", "" };

for( new i = 0 ; i < sizeof( szSymbols ) ; i++ )
{
formatex( Func, charsmax( Func ), "say %s%s", szSymbols[ i ], cmd );

register_clcmd( Func, function );
}
}

stock ColorChat( const id, const string[ ], { Float, Sql, Resul,_ }:... )
{
new msg[ 191 ], players[ 32 ], count = 1;
static len;
len = formatex( msg, charsmax( msg ), "^4[AMXX]^1 " );
vformat( msg[ len ], charsmax( msg ) - len, string, 3 );
if( id )
players[ 0 ] = id;
else
get_players( players, count, "ch" );
for( new i = 0; i < count; i++ )
{
if( is_user_connected( players[ i ] ) )
{
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ),_, players[ i ] );
write_byte( players[ i ] );
write_string( msg );
message_end( );
}
}
return 1;
}
change natives + change command.
and its every 1 hour i mean 15:00 16:00 17:00 18:00 and etc.
Noam is offline
thEsp
BANNED
Join Date: Aug 2017
Old 07-29-2019 , 16:20   Re: [Req] a give coins
Reply With Quote #3

Put the code on [small] or [php] tags, so it's human-readable.
thEsp is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 07-29-2019 , 19:49   Re: [Req] a give coins
Reply With Quote #4

Code:
#include <amxmodx> #include <nvault> #define HOUR 3600 #define AWARD 5000 new vault_name[] = "vault_timestamps"; new player_timestamp[33]; public plugin_init(){     register_clcmd("say /claim", "clcmd_claim"); } public client_putinserver(id){     LoadData(id); } public client_disconnected(id){     player_timestamp[id] = 0; } public clcmd_claim(id){     new time_left = get_systime() - player_timestamp[id];     if (time_left >= HOUR){         SaveData(id);         new name[32]; get_user_name(id, name, charsmax(name));         server_cmd("jbed_give_coins_ex ^"%s^" %d", name, AWARD);         client_print(id, print_chat, "You succesfully claimed %d", AWARD);     } else {         client_print(id, print_chat, "Try again in %d minutes", (HOUR - time_left) / 60);     } } stock LoadData(id){     new key[32], timestamp, temp[2];     new vault = nvault_open(vault_name);     get_user_authid(id, key, charsmax(key));     nvault_lookup(vault, key, temp, 1, timestamp);     player_timestamp[id] = timestamp;     nvault_close(vault); } stock SaveData(id){     player_timestamp[id] = get_systime();     new key[32];     new vault = nvault_open(vault_name);     get_user_authid(id, key, charsmax(key));     nvault_touch(vault, key, player_timestamp[id]);     nvault_close(vault); }
__________________
Relaxing is offline
Old 07-30-2019, 03:47
Snitch
This message has been deleted by Snitch. Reason: Trash Hl
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 07-30-2019 , 04:16   Re: [Req] a give coins
Reply With Quote #5

Ty all :X
Mikaeel123 is offline
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 07-30-2019 , 04:21   Re: [Req] a give coins
Reply With Quote #6

Ty relaxing very much :X
Mikaeel123 is offline
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 07-31-2019 , 09:29   Re: [Req] a give coins
Reply With Quote #7

Relaxing what cmd i use ??? i use /claim but not get
Mikaeel123 is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 08-01-2019 , 09:42   Re: [Req] a give coins
Reply With Quote #8

Are you sure that's not working?
__________________
Relaxing is offline
Mikaeel123
Senior Member
Join Date: Oct 2018
Old 08-02-2019 , 02:50   Re: [Req] a give coins
Reply With Quote #9

Yes im sure 100%
Mikaeel123 is offline
Reply



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 02:36.


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