Disable the Account -
arlindi - 08.06.2014
Hello everybody I am a new Scripter and i need the help of all you.
This is the accountdisable command
PHP код:
dcmd_accountdisable(playerid, params[])
{
new TargetID,Reason[64];
if(pInfo[playerid][Adminlevel] < 7) return SendClientMessage(playerid, COLOR_RED, ""ERROR_MESSAGE"");
if(sscanf(params, "us", TargetID, Reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /accountdisable [id] [Reason]");
if(TargetID == INVALID_PLAYER_ID || !IsPlayerConnected(TargetID )) return SendClientMessage(playerid, COLOR_RED, "* Player Is Not Connected.");
if(pInfo[TargetID][Adminlevel] > 0) return SendClientMessage(playerid, -1, "You cant disable admin.");
else
{
pInfo[TargetID][Adisable] =1;
new str[128],str1[128];
new targetname[MAX_PLAYER_NAME];
GetPlayerName(TargetID,targetname,24);
format(str,sizeof(str),"%s (%d) Has Been Disabled By An Admin. Reason: %s", targetname, TargetID, Reason);
SendClientMessageToAll(COLOR_HOTPINK, str);
format(str1,sizeof(str1),"**KICK: %s (%d) (ACCOUNT DISABLED) Account Disabled", targetname, TargetID);
SendClientMessageToAll(COLOR_HOTPINK, str1);
KickWithMessage(TargetID,"You Have Been Removed From The Server.");
print(str);
print(str1);
}
return 1;
}
And now i need to make it with day's.
I want to disable the account with some day's.
Example to disable account for 5 days in the real day's}|
Help mee and i will rep you :P
Re : Disable the Account -
S4t3K - 08.06.2014
Use
getdate() function.
For example (it involves that you have something to save account data)
PHP код:
CMD:daysban(playerid, params[])
{
new days, account_name[25];
if(sscanf(params, "s[25]d", account_name, days)) return SCM(playerid, -1, "SYNTAX : /daysban [Account name] [Days]");
AccountInfo[playerid][DaysBanned] = getdate() + days;
return 1;
}
public OnPlayerConnect(playerid)
{
if(AccountInfo[playerid][DaysBanned] > getdate()) return SCM(playerid, -1, "You're still banned !");
return 1;
}
Re: Disable the Account -
arlindi - 08.06.2014
Can to help mee and show mee all code's.
I dont understand with getdate()
Show mee all code please.
Re : Disable the Account -
S4t3K - 08.06.2014
I don't know what should I show more than this.
It's enough.
getdate() returns the number of days passed since the beginning of the year.
So if you add 5 days to getdate(), it will be (getdate() + 5).
Each time the player will connect, we'll check if the var DaysBanned, which contains (getdate() + 5) is superior to getdate(). If it is, it means that the player is still banned. If it's not, then the player will be able to connect normally.
Re: Disable the Account -
arlindi - 08.06.2014
But help mee where to add this.
PHP код:
new Year, Month, Day;
getdate(Year, Month, Day);
printf("%02d/%02d/%d", Day, Month, Year);
new Days = getdate();
printf("Days since the start of the year: %d", Days);
And add it on accountdisable command
Re : Disable the Account -
S4t3K - 08.06.2014
Nowhere.
It's an example which shows you how to use getdate.
Add the code I've shown you above in your /bandays command. (and under OnPlayerConnect)
Re: Disable the Account -
arlindi - 08.06.2014
PHP код:
D:\Formated\fsdf\filterscripts\Project.pwn(3271) : error 017: undefined symbol "DaysBanned"
D:\Formated\fsdf\filterscripts\Project.pwn(5471) : error 017: undefined symbol "DaysBanned"
Line 3271
PHP код:
if(pInfo[playerid][DaysBanned] > getdate()) return SCM(playerid, -1, "You're still banned !");
Line5471
PHP код:
pInfo[playerid][DaysBanned] = getdate() + days;
Re: Disable the Account -
arlindi - 09.06.2014
Help mee please