Raised This Month: $51 Target: $400
 12% 

need small help!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bakir123
Senior Member
Join Date: Jan 2015
Location: Palestine, Hebron
Old 02-21-2017 , 14:04   need small help!
Reply With Quote #1

hi guys
i using this small code:

PHP Code:
// Say "/gun"
public clcmd_saygun(id)
{
    
fm_give_item(id"weapon_m4a1")
    
ColorChat(0GREY"^x04[GUN]^x03 %s^x01 has used his/her^x04 gun day!"g_playername[id]) 

i want only one thing
i want that player can use this command only one time per 24 hours (day)

only player can use this command everyday
and he can't use this command again before passage 24 hours

anyhelp ?
bakir123 is offline
Send a message via Skype™ to bakir123
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-21-2017 , 15:06   Re: need small help!
Reply With Quote #2

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

#include <amxmodx>
#include <nvault>

#define PLUGIN "1 day cmd"
#define VERSION "1.0"
#define AUTHOR "Natsheh"

#define SECONDS_INYEAR        31104000
#define SECONDS_INMONTH        2592000
#define SECONDS_INDAY        86400

new nVault;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
nVault nvault_open("clcmd_perday")
    if(
nVault == INVALID_HANDLE)
        
set_fail_state("Fuck this is not working....")
    
    
register_clcmd("say /onetimeuseperday""user_clcmd")
}

public 
plugin_end()
{
    
nvault_close(nVault); // we close this shitty vault
}

public 
user_clcmd(id)
{
    new 
authid[32]
    
get_user_authid(idauthid31)
    new 
currtime calculate_thetime();
    new 
time_displacement = (currtime nvault_get(nVaultauthid));
    
    if(
time_displacement <= SECONDS_INDAY)
    {
        
// your code here..
        
        
        
new string[24]
        
num_to_str(currtimestring23)
        
nvault_set(nVaultauthidstring)
    }
    else
        
client_print(idprint_chat"you still need %d seconds to use this command!"time_displacement)
}

stock calculate_thetime()
{
    new 
sDay[6], sMonth[6], sYear[6];
    
get_time("%d"sDaycharsmax(sDay))
    
get_time("%m"sMonthcharsmax(sMonth));
    
get_time("%Y"sYearcharsmax(sYear))
    
    return (
str_to_num(sYear) * SECONDS_INYEAR str_to_num(sDay) * SECONDS_INDAY str_to_num(sMonth) * SECONDS_INMONTH);


here an example!!
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 02-22-2017 at 14:04.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-21-2017 , 15:08   Re: need small help!
Reply With Quote #3

PHP Code:
#include <nVault> 
That "V" will prevent the plugin from compiling.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-21-2017 , 15:16   Re: need small help!
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
PHP Code:
#include <nVault> 
That "V" will prevent the plugin from compiling.
it compiles fine for me...

have you even tried to compile??
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 02-21-2017 at 15:23.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-21-2017 , 15:23   Re: need small help!
Reply With Quote #5

Not all compilers say the same thing:

PHP Code:
AMX Mod X Compiler 1.8.3-manual

Copyright 
(c1997-2006 ITB CompuPhase

Copyright 
(c2004-2013 AMX Mod X Team



plugin
.sma(2) : fatal error 100cannot read from file"nVault"



Compilation aborted.

1 Error
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-21-2017 , 15:28   Re: need small help!
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
Not all compilers say the same thing:

PHP Code:
AMX Mod X Compiler 1.8.3-manual

Copyright 
(c1997-2006 ITB CompuPhase

Copyright 
(c2004-2013 AMX Mod X Team



plugin
.sma(2) : fatal error 100cannot read from file"nVault"



Compilation aborted.

1 Error
..
i changed the V > to > v can you rest in peace now !?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 02-21-2017 at 15:32.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-21-2017 , 17:14   Re: need small help!
Reply With Quote #7

Are you telling me to die?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 02-22-2017 , 08:06   Re: need small help!
Reply With Quote #8

Quote:
Originally Posted by Natsheh View Post
..
i changed the V > to > v can you rest in peace now !?
Quote:
Originally Posted by OciXCrom View Post
Are you telling me to die?
I lold.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-22-2017 , 08:16   Re: need small help!
Reply With Quote #9

Quote:
Originally Posted by OciXCrom View Post
Are you telling me to die?
maybe . . .
__________________
edon1337 is offline
SkumTomteN
Veteran Member
Join Date: Oct 2013
Location: Asgard
Old 02-22-2017 , 09:34   Re: need small help!
Reply With Quote #10

kek'd
__________________
Contact: Steam
Videos: Youtube
SkumTomteN 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 04:06.


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