08.01.2015, 09:53
(
Последний раз редактировалось danish007; 08.01.2015 в 10:26.
)
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.
When i Remove This Code And Use command it works
but its important code. because it save Disable Info.
UserDPath
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;
}
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);
///------------------------------------------
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;
}