Help Me To Make A Disable Command With mysql
#1

I Want A Disable Command For Cops And Robbers I Have A Disable Command But It Saves In INI

So Please Help Me To Make A Disable Command For Mysql Or How To change It From INI To SQL

+1 Rep Will Be Given Thanks
Reply
#2

If you wanna learn how to use SQLLite or MYSQL you should check this out.
https://sampforum.blast.hk/showthread.php?tid=360911

if you'll have any problems just tell us your problem and we'll help, but if you have zero code to show us we can't really help you.
Reply
#3

Here The Disable Command

Quote:

COMMAND:disable(playerid, params[])
{
if(PlayerInfo[playerid][pSpawn] == 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
#4

Please Help Me With This
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)