Need small help Plz "Temporay Ban"
#1

PHP код:
CMD:tempban(playerid,params[])
{
    if(
pInfo[playerid][pLevel] >= 2)
    {
       new 
idreason[50], Jfile[100];
       new 
year,month,day,hour,minuite,second,Hours,BanTime,d,h,m,Temp;
       if(
sscanf(params"uis[50]"idHoursreason)) return SCM(playeridyellow"SERVER : /tempban <Player ID> <Hours> <Reason>");
       if(
IsPlayerConnected(id) )
       {
       
//   if(pInfo[playerid][pLevel] <= pInfo[id][pLevel]) return ShowMessage(playerid, red, 6);
          
getdate(yearmonthday);
          
gettime(hour,minuite,second);
        
BanTime gettime() + (Hours*3600);
          if(
pInfo[id][Logged] == 1)
          {
              
format(Jfile100ACCOUNTS_PATHGetName(id));
              new 
INI:ACCOUNT INI_Open(Jfile);
              
INI_WriteInt(ACCOUNT"TempBan"BanTime);
              
INI_Close(ACCOUNT);
          } 
          
Temp BanTime gettime();
          
format(Jstring,sizeof(Jstring),"%s has been Temporarily Banned by Administrator %s for %s | Reason: %s <Date: %d/%d/%d> <Time: %d:%d>",GetName(id),GetName(playerid),ConvertTime(Temp,m,h,d),reason,day,month,year,hour,minuite);
          
SCMToAll(red,Jstring);
          
Temp BanTime gettime();
          
format(JLstring,sizeof(JLstring),"{37C8C8}Administrator %s has Temp banned you for %s REASON |: \"%s\"\n\nVisit "WEBSITE" for more informations"GetName(playerid),ConvertTime(Temp,m,h,d),reason);
          
ShowPlayerDialog(id,JDIALOGS+200,DIALOG_STYLE_MSGBOX,"{FF0000}You are BANNED",JLstring,"OK","");
          
format(Jstring,sizeof(Jstring),"[TEMP BAN] %s has Temp banned %s for %s | reason: ",GetName(playerid),GetName(id),ConvertTime(BanTime,m,h,d),reason);
          
WriteToLog(Jstring,"Bans");
          
CommandToAdmins(playerid,"tempban");
         return 
SetTimerEx("KickPlayer",100,false,"d"id);
        }
        else return 
ShowMessage(playeridred3);
    }
    else return 
ShowMessage(playeridred1);

this code work fine without saving temp ban
but it will crash server when i add this.

PHP код:
          if(pInfo[id][Logged] == 1)
          {
              
format(Jfile100ACCOUNTS_PATHGetName(id));
              new 
INI:ACCOUNT INI_Open(Jfile);
              
INI_WriteInt(ACCOUNT"TempBan"BanTime);
              
INI_Close(ACCOUNT);
          } 
Thanks.
Reply
#2

can you give me "ACCOUNTS_PATH" define ?
Reply
#3

#define ACCOUNTS_PATH "JLadmin/Users/%s.ini"
Reply
#4

Is "JLadmin/Users/" is exist inside scriptfiles directory?
Reply
#5

Yeah it is in Script file Folder well all other saving system working fine only this cmd crash server.
Reply
#6

Why the return SetTimerEx?
Im not sure wether this causes it but remove it and replace with a seperated line like
SetTimerEx
return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)