AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   need small help! (https://forums.alliedmods.net/showthread.php?t=294171)

bakir123 02-21-2017 14:04

need small help!
 
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 ?

Natsheh 02-21-2017 15:06

Re: need small help!
 
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!!

OciXCrom 02-21-2017 15:08

Re: need small help!
 
PHP Code:

#include <nVault> 

That "V" will prevent the plugin from compiling.

Natsheh 02-21-2017 15:16

Re: need small help!
 
Quote:

Originally Posted by OciXCrom (Post 2497271)
PHP Code:

#include <nVault> 

That "V" will prevent the plugin from compiling.

it compiles fine for me...

have you even tried to compile??

OciXCrom 02-21-2017 15:23

Re: need small help!
 
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


Natsheh 02-21-2017 15:28

Re: need small help!
 
Quote:

Originally Posted by OciXCrom (Post 2497280)
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 !?

OciXCrom 02-21-2017 17:14

Re: need small help!
 
Are you telling me to die?

georgik57 02-22-2017 08:06

Re: need small help!
 
Quote:

Originally Posted by Natsheh (Post 2497281)
..
i changed the V > to > v can you rest in peace now !?

Quote:

Originally Posted by OciXCrom (Post 2497303)
Are you telling me to die?

I lold.

edon1337 02-22-2017 08:16

Re: need small help!
 
Quote:

Originally Posted by OciXCrom (Post 2497303)
Are you telling me to die?

maybe . . .

SkumTomteN 02-22-2017 09:34

Re: need small help!
 
kek'd


All times are GMT -4. The time now is 02:47.

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