Help on a cmd -
Driver546465 - 28.04.2015
i want a cmd to reset inactive players accounts every 2 weeks mean any player has 2 weeks with out join server with this cmd his account will be removed auto after i used the cmd!! help
Re: Help on a cmd -
Driver546465 - 28.04.2015
help
Re: Help on a cmd -
[KHK]Khalid - 28.04.2015
Basically you create a variable to hold login data (i.e LastLogin=day/month/year), save this variable for player into a file or your database (depends how you're dealing with accounts and other stuff) and update that variable everytime they log in/off. Here's some code from some mode I'd been working on, it should help you out:
pawn Код:
COMMAND:clearunusedaccounts(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
{
return Error(playerid, "You are not logged into rcon!");
}
new mnth, yr;
if(sscanf(params, "ii", mnth, yr))
{
return MessageBox(playerid, "~r~~h~~h~USAGE", "/clearunusedaccounts <month> <year>");
}
new days;
if(IsMonth31(mnth))
days = 31;
else if(mnth == 2 && IsMonth29(yr))
days = 29;
else if(mnth == 2 && !IsMonth29(yr))
days = 28;
else
days = 30;
for(new i = 0; i < days; i++)
{
mysql_query(sprintf("DELETE FROM players WHERE LastOn='%d/%d/%d'", i, mnth, yr));
}
return 1;
}
// OnLoggedIn
new tmpip[64],day,month,year;
getdate(year,month,day);
format(tmpip,sizeof tmpip,"%d/%d/%d",day,month,year);
format(PData[playerid][laston], 64, "%s", tmpip);
Re: Help on a cmd -
Driver546465 - 28.04.2015
ty did this work on dini?
Re: Help on a cmd -
[KHK]Khalid - 28.04.2015
Quote:
Originally Posted by Driver546465
ty did this work on dini?
|
MySQL, however feel free to modify it to fit your mode.
Re: Help on a cmd -
Driver546465 - 28.04.2015
ok thanks
Re: Help on a cmd -
Driver546465 - 28.04.2015
i get this errors
"day" shadows a variable at a preceding level
"month" shadows a variable at a preceding level
"year" shadows a variable at a preceding level
Re: Help on a cmd -
[KHK]Khalid - 28.04.2015
Change the variable names since you probably have variables with the same names.
pawn Код:
// OnLoggedIn
new tmpip[64],dayy,monthh,yearr;
getdate(yearr,monthh,dayy);
format(tmpip,sizeof tmpip,"%d/%d/%d",dayy,monthh,yearr);
format(PData[playerid][laston], 64, "%s", tmpip);
Re: Help on a cmd -
Driver546465 - 28.04.2015
those ones
// OnLoggedIn
new tmpip[64],dayy,monthh,yearr;
getdate(yearr,monthh,dayy);
format(tmpip,sizeof tmpip,"%d/%d/%d",dayy,monthh,yearr);
format(PData[playerid][laston], 64, "%s", tmpip);
On Playerlogin(playerid)?
how to fix those
undefined symbol "PData"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line