Idk where is the bug. And Help mee to fix all it.
#1

Hello everybody i create from help of Samp Forum Disable command.
Idk where is the bug but look this now

PHP код:
dcmd_disable(playeridparams[])
{
      new 
daysaccount_name[25], TargetID;
      if(
sscanf(params"s[25]d"account_namedays)) return SCM(playerid, -1"SYNTAX : /daysban [Account name] [Days]");
      
pInfo[playerid][DaysBanned] = getdate() + days;
      
KickWithMessage(TargetID,"You Have Been Removed From The Server.");
      return 
1;

PHP код:
enum PlayerInfo
{
    
Pass[129], //User's password
    
Adminlevel//User's admin level
    
VIPlevel//User's vip level
    
Money//User's money
    
Scores//User's scores
    
Kills//User's kills
    
Deaths//User's deaths
    
Adisable,
    
Banned,
    
Pills,
    
Savedskin,
    
Last,
    
NoPM,
    
Drugs,
    
DaysBanned

PHP код:
public loadaccount_Players_Data(playeridname[], value[])
{
    
INI_String("Password"pInfo[playerid][Pass],129); /*we will use INI_String to load user's password.
    ("Password",.. will load user's password inside of user's path. 'pInfo[playerid][Pass]',...We have defined our user's variable above called, pInfo. Now it's time to use it here to load user's password. '129',... 129 is a length of a hashed user's password. Whirlpool will hash 128 characters + NULL*/
    
INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);/*We will use INI_Int to load user's admin level. INI_Int stands for INI_Integer. This load an admin level. */
    
INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
    
INI_Int("Money",pInfo[playerid][Money]); //As explained above
    
INI_Int("Scores",pInfo[playerid][Scores]);//As explained above
    
INI_Int("Kills",pInfo[playerid][Kills]);//As explained above
    
INI_Int("Deaths",pInfo[playerid][Deaths]);//As explained above
    
INI_Int("Adisable",pInfo[playerid][Adisable]);
    
INI_Int("Banned",pInfo[playerid][Banned]);
    
INI_Int("Pills",pInfo[playerid][Pills]);
    
INI_Int("Savedskin",pInfo[playerid][Savedskin]);
    
INI_Int("Last",pInfo[playerid][Last]);
    
INI_Int("NoPM",pInfo[playerid][NoPM]);
    
INI_Int("Drugs",pInfo[playerid][Drugs]);
    
INI_Int("DaysBanned",pInfo[playerid][DaysBanned]);
    return 
1;

PHP код:
public OnPlayerConnect(playerid)
{
    new 
YearMonthDay;
    
getdate(YearMonthDay);
    
printf("%02d/%02d/%d"DayMonthYear);
    new 
Days getdate();
    
printf("Days since the start of the year: %d"Days);
    
    if(
pInfo[playerid][DaysBanned] > getdate()) return SCM(playerid, -1"You're still banned !"); 
PHP код:
public OnPlayerDisconnect(playeridreason)
{
        if(
playerid == INVALID_PLAYER_ID || !IsPlayerConnected(playerid)) return SCM(playerid, -1,"");
        print(
"INVALID_PLAYER_ID CALLED");
        if(
fexist(Path(playerid)))
        {
// then
        
new INI:file INI_Open(Path(playerid)); //will open their file
        
INI_SetTag(file,"Players_Data");//We will set a tag inside of user's account called "Players_Data"
        
INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you've set his/her admin level, then his/her admin level will be saved inside of his/her account
        
INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
        
INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his money inside of his account
        
INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//We will save his score inside of his account
        
INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
        
INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
        
INI_WriteInt(file,"Adisable",pInfo[playerid][Adisable]);
        
INI_WriteInt(file,"Banned",pInfo[playerid][Banned]);
        
INI_WriteInt(file,"Pills",pInfo[playerid][Pills]);
        
INI_WriteInt(file,"Savedskin",pInfo[playerid][Savedskin]);
        
INI_WriteInt(file,"Last",pInfo[playerid][Last]);
        
INI_WriteInt(file,"NoPM",pInfo[playerid][NoPM]);
        
INI_WriteInt(file,"Drugs",pInfo[playerid][Drugs]);
        
INI_WriteInt(file,"DaysBanned",pInfo[playerid][DaysBanned]); 
And now when i disable somebody for 1 day now i get this -.- .
I goto on scriptfiles on save account and get this.

PHP код:
[Players_Data]
Password C91DF73E7704DA5647541716E26AF2C71FAGDDSDGDSFV345GYTEWDGETWEG34GDSGWE356G4GETGE2A4F09CA4814BF583298A74
AdminLevel 
0
VIPLevel 
0
Money 
0
Scores 
0
Kills 
0
Deaths 
0
Adisable 
0
Banned 
0
Savedskin 
= -1
Last 
= -1
NoPM 
0
Drugs 
0
Pills 
0
DaysBanned 
161 
Reply
#2

Try reading this it will help you with the temp ban https://sampforum.blast.hk/showthread.php?tid=254915
Reply
#3

Can you fix it ?
Reply
#4

The issue is in the disable command but with lack of information, there's not much I can do. Let me explain few mistakes though.

pawn Код:
pInfo[playerid][DaysBanned] = getdate() + days;
stores to the variable for the player who typed the command. You'll need to use gettime() function and it will return the current timestamp. Then you'll need to convert the days into seconds and add it with the current unix timestamp and save it in the file.
pawn Код:
KickWithMessage(TargetID,"You Have Been Removed From The Server.");
TargetID is by default 0. If you want it for online players, use "r" specifier in sscanf otherwise you do not need it for offline players.
Reply
#5

Idk how to fix it -.-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)