Disable the Account
#1

Hello everybody I am a new Scripter and i need the help of all you.

This is the accountdisable command
PHP код:
dcmd_accountdisable(playeridparams[])
{
        new 
TargetID,Reason[64];
        if(
pInfo[playerid][Adminlevel] < 7) return SendClientMessage(playeridCOLOR_RED""ERROR_MESSAGE"");
        if(
sscanf(params"us"TargetIDReason)) return SendClientMessage(playeridCOLOR_RED"USAGE: /accountdisable [id] [Reason]");
        if(
TargetID == INVALID_PLAYER_ID || !IsPlayerConnected(TargetID )) return SendClientMessage(playeridCOLOR_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"targetnameTargetIDReason);
               
SendClientMessageToAll(COLOR_HOTPINKstr);
               
format(str1,sizeof(str1),"**KICK: %s (%d) (ACCOUNT DISABLED) Account Disabled"targetnameTargetID);
               
SendClientMessageToAll(COLOR_HOTPINKstr1);
               
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
Reply
#2

Use getdate() function.

For example (it involves that you have something to save account data)

PHP код:

CMD
:daysban(playeridparams[])
{
      new 
daysaccount_name[25];
      if(
sscanf(params"s[25]d"account_namedays)) 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;

Reply
#3

Can to help mee and show mee all code's.

I dont understand with getdate()

Show mee all code please.
Reply
#4

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.
Reply
#5

But help mee where to add this.

PHP код:
new YearMonthDay;
getdate(YearMonthDay);
printf("%02d/%02d/%d"DayMonthYear);
 
new 
Days getdate();
printf("Days since the start of the year: %d"Days); 
And add it on accountdisable command
Reply
#6

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)
Reply
#7

PHP код:
D:\Formated\fsdf\filterscripts\Project.pwn(3271) : error 017undefined symbol "DaysBanned"
D:\Formated\fsdf\filterscripts\Project.pwn(5471) : error 017undefined 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
Reply
#8

Help mee please
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)