/disable with days doesn't work
#1

when i am doing ex:"/disable 1 2 (Test 2 days)"
gives +1Month +15 days

Код:
COMMAND:disable(playerid, params[])
{
    if(PlayerInfo[playerid][pSpawned] == 1)
    {
    new TargetID, string[256], R[256], DU;

    if(PlayerInfo[playerid][pAdminlevel] < 1)
    {
    SendClientMessage(playerid,COLOR_ERROR,""ERROR_MSG"");
    return 1;
    }

    if(sscanf(params, "ud", TargetID,DU))
    {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /disable (Name/Id) (Days) (Reason).");
    return 1;
    }
    sscanf(params, "uds[256]", TargetID, DU, R);

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

	if(DU > 14)
	{
	SendClientMessage(playerid,COLOR_ERROR,"You Cannot Disable Player Account for More than 14 Days.");
	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 = "No Reason Given.";
	}

	new D,M,Y,H,Mi,S,BX,CA;

    getdate(Y,M,D);
	gettime(H,Mi,S);

    BX = D+DU;

	if(M == 12 && BX > 31)
    {
	Y++;
	}
    if(BX > 30 && M == 4 || M == 6 || M == 9 || M == 11)
    {
	CA = BX-30;
	M++;
	}
    else
	if(BX > 31 && M == 1 || M == 3 || M == 5 || M == 7 || M == 8 || M == 10 || M == 12)
    {
	CA = BX-31;
	M++;
	}
    else
	if(M == 2 && BX > 29 && Y%4 == 0)
    {
	CA = BX-29;
	M++;
	}
    else
	if(M == 2 && BX > 28 && Y%4 != 0)
    {
	CA = BX-28;
	M++;
	}
    else CA = BX;

    new INI:File = INI_Open(UserDisablePath(TargetID));
    INI_SetTag(File,"Disable Data");
    INI_WriteInt(File,"DisableExp",CA);
    INI_WriteInt(File,"DisableM",M);
    INI_WriteInt(File,"DisableY",Y);
    INI_WriteInt(File,"DisableH",H);
    INI_WriteInt(File,"DisableMi",Mi);
    INI_WriteString(File,"Reason",R);
    INI_WriteString(File,"DisabledBy",PlayerInfo[playerid][pName]);
    INI_Close(File);

    new File:Log = fopen("DisabledPlayers.txt",io_append);
    fwrite(Log, PlayerInfo[TargetID][pName]);
    fwrite(Log,"\n");
    fclose(Log);

    DisableInfo[TargetID][pDisableExp] = CA;
    DisableInfo[TargetID][pDisableM] = M;
    DisableInfo[TargetID][pDisableY] = Y;

    SetPlayerPosEx(TargetID,264.905700, 77.614082, 1001.039062, 269.327789,6,0);

    new Day = DisableInfo[TargetID][pDisableExp], Month = DisableInfo[TargetID][pDisableM], Year = DisableInfo[TargetID][pDisableY];

    format(string, sizeof(string), "Your Account Has Been Disabled By The Adminstration For %i Days (Expires %i-%i-%i)",DU,Day,Month,Year);
	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;
}
Reply
#2

any help?
Reply
#3

i got an idea for you instead of making /disable you can replace it with an cmd /ban and you set it to temp or perm

Quote:

CMD:ban(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 2) return Error(playerid, "You are not authorized to use this command");
new giveplayerid, time, reason[64], string[128];
if(sscanf(params, "iis[64]", giveplayerid, time, reason)) return Syntax(playerid, "ban", "[playerid/PartOfName] [time(days) 0 = perm] [reason]");
if(!IsPlayerConnected(giveplayerid)) return Error(playerid, "Invalid player specified!");
if(playerid == giveplayerid) return Error(playerid, "You cannot ban youself, Chris McLeary.");
if(PlayerInfo[playerid][pAdmin] < PlayerInfo[giveplayerid][pAdmin]) return Error(playerid, "You cannot ban a equal or higher level admin.");
//PlayerInfo[giveplayerid][pBanned] = 1;
BanPlayer(playerid, giveplayerid, time, reason);
format(string, sizeof(string), "AdmCmd: %s was banned by %s for %s, reason: %s ", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), time, reason);
Log("logs/ban.log", string);
return 1;
}

Reply
#4

First of all you copied that from your gm right? Also i got cmd /ban
Reply
#5

anyone
Reply
#6

bumb...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)