Command is Not Working. (/disable) INI Problem
#1

Hello,
My Command is Not Working (/disable) its usage is - /disable (Name/ID) (Days) (Reason).
When I Just Use /disable it show me (USAGE) so it is done.
When I Use With Full Usage it Show me (ERROR) Unknown Command.
Here i've Given Some Pics.

When i use Only /disable



Now When i use command with Full Usage


it say unknwon command


my Command Code.
pawn Код:
COMMAND:disable(playerid, params[])
{
    new TargetID, string[256], R[100], Days;

    if(PlayerInfo[playerid][pSpawned] == 1)
    {
   
    if(PlayerInfo[playerid][pAdminlevel] < 1)
    {
    SendClientMessage(playerid,COLOR_ERROR,""ERROR_MSG"");
    return 1;
    }
   
    if(sscanf(params, "ud", TargetID,Days))
    {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /disable (Name/Id) (Days) (Reason).");
    return 1;
    }
    sscanf(params, "uds[100]", TargetID, Days, R);

    if(!IsPlayerConnected(TargetID) || TargetID == INVALID_PLAYER_ID)
    {
    SendClientMessage(playerid, COLOR_ERROR, "That Player Is Not Connected.");
    return 1;
    }

    if(IsPlayerNPC(TargetID))
    {
    SendClientMessage(playerid,COLOR_ERROR,"You Cannot Kick a BOT.");
    return 1;
    }

    if(PlayerInfo[playerid][pAdminlevel] < 2 && PlayerInfo[TargetID][pAdminlevel] > 0)
    {
    format(string, sizeof(string), "%s (%d) is Server Admin, Can Not Be Attacked.",PlayerInfo[TargetID][pName],TargetID);
    SendClientMessage(playerid,COLOR_ERROR, string);
    return 1;
    }

    if (PlayerInfo[TargetID][pAdminlevel] > 0 && PlayerInfo[playerid][pAdminlevel] < 3)
    {
    SendClientMessage(playerid,COLOR_ERROR,"You Cannot Attack On An Admin With Admin Powers.");
    return 1;
    }

    if(!strlen(R))
    {
    R = "No Reason Given.";
    }
   
    new AdminName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,AdminName,sizeof(AdminName));
   
    new Expiry = gettime()+(60*60*24*Days);

    //-------This Thing Bugs..-------------------
    new INI:File = INI_Open(UserDPath(TargetID));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"DisableExp",Expiry);
    INI_WriteString(File,"DisabledBy",AdminName);
    INI_WriteString(File,"Reason",R);
    INI_Close(File);
    ///------------------------------------------
    new File:logg = fopen("DPlayers.txt",io_append);
    fwrite(logg, PlayerInfo[TargetID][pName]);
    fwrite(logg,"\n");
    fclose(logg);


    new D,M,Y,H,MI,S;
    TimestampToDate(DisableInfo[playerid][pDisableExp],Y,M,D,H,MI,S,GMT_H,GMT_M);
   
    format(string, sizeof(string), "Your Account Has Been Disabled By The Adminstration For %i Days (Expires %i-%i-%i)",Days,D,M,Y);
    SendClientMessage(TargetID,COLOR_ADMIN, string);
    format(string, sizeof(string), "Reason: %s",R);
    SendClientMessage(TargetID,COLOR_ADMIN, string);
   
    format(string, sizeof(string), "%s (%d) Has Been Disabled By An Admin. Reason: %s",PlayerInfo[TargetID][pName], TargetID, R);
    SendClientMessageToAll(COLOR_ADMIN, string);
    format(string, sizeof(string), "***KICK: %s (%d) (ACCOUNT DISABLED) Account Disabled.",PlayerInfo[TargetID][pName], TargetID);
    SendClientMessageToAll(COLOR_ADMIN, string);

    KickEx(TargetID);
    }else{
    SendClientMessage(playerid,COLOR_ERROR,"You Cannot Use This Command While You're Dead.");
    }
    return 1;
}
When i Remove This Code And Use command it works
pawn Код:
//-------This Thing Bugs..-------------------
    new INI:File = INI_Open(UserDPath(TargetID));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"DisableExp",Expiry);
    INI_WriteString(File,"DisabledBy",AdminName);
    INI_WriteString(File,"Reason",R);
    INI_Close(File);
    ///------------------------------------------
but its important code. because it save Disable Info.

UserDPath
pawn Код:
stock UserDPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),DPATH,playername);
    return string;
}
Reply
#2

Did you put in your enum:
DisableExp
DisabledBy
Reason
If yes so just use this
PHP код:
PlayerInfo[targetid][DisableExp] = expiry
And so on....
If not try to put it in your enum of the player info and try what i say.
Tell me what happend.
Reply
#3

I created new enum for Disable..
and i defined DisableExp,DisabledBy, and Reason in enum..
Enum is DisableInfo[TargetID][DisableExp]
Reply
#4

I think you can make when the player register for the first time make two files in two folders one for the info and when for the disable
I think this will be more easier
Or...
You can put the disable enum with the playerInfo enum and use this
PlayerInfo[targetid][blablba] = blabla
As i said before
Reply
#5

But if i use it with player info
then i cant remove anyone disable.
b/c it delete player file from disabled players

btw my problem is why this error is occoured?
Even every think is fine.
and command works without INI saving in command.
Reply
#6

Anyone?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)