Total register accounts.
#1

Hello!
I am using ladmin system, i want to script if a player register ,then it should show whats the total registered account
example : "Total registered account are %d" like this
How can i script like that? please anyone tell me.
Reply
#2

Put this at the end of this command \\dcmd_register(playerid,params[])\\

pawn Код:
new qwe[256];
        format(qwe, 255, "/ladmin/acc.ini");
       
        //If file for how manyy people are registered does not exist... make one
        if( !dini_Exists( qwe ) )
        {
            dini_Create(qwe);
            dini_IntSet(qwe, "accounts", 0);
        }
       
        //Update how many people are registered
        new noa;
        new str[128];
        noa = dini_Int(qwe,"accounts");
        dini_IntSet(qwe, "accounts", noa+1);
       
        //Send Message to show how many people are regustered
        format(str, sizeof(str), "%i users are currently registered", noa+1);
        SendClientMessage(playerid, green, str);
Tested and working

EDIT:::

Should look something like this

pawn Код:
dcmd_register(playerid,params[])
{
    if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"ACCOUNT: You are already registered and logged in.");
    if (udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"ACCOUNT: This account already exists, please use '/login [password]'.");
    if (strlen(params) == 0) return SendClientMessage(playerid,red,"ACCOUNT: Correct usage: '/register [password]'");
    if (strlen(params) < 4 || strlen(params) > 20) return SendClientMessage(playerid,red,"ACCOUNT: Password length must be greater than three characters");
    if (udb_Create(PlayerName2(playerid),params))
    {
        new file[256],name[MAX_PLAYER_NAME], tmp3[100];
        new strdate[20], year,month,day;    getdate(year, month, day);
        GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(name));
        GetPlayerIp(playerid,tmp3,100); dini_Set(file,"ip",tmp3);
//      dini_Set(file,"password",params);
        dUserSetINT(PlayerName2(playerid)).("registered",1);
        format(strdate, sizeof(strdate), "%d/%d/%d",day,month,year);
        dini_Set(file,"RegisteredDate",strdate);
        dUserSetINT(PlayerName2(playerid)).("loggedin",1);
        dUserSetINT(PlayerName2(playerid)).("banned",0);
        dUserSetINT(PlayerName2(playerid)).("level",0);
        dUserSetINT(PlayerName2(playerid)).("LastOn",0);
        dUserSetINT(PlayerName2(playerid)).("money",0);
        dUserSetINT(PlayerName2(playerid)).("kills",0);
        dUserSetINT(PlayerName2(playerid)).("deaths",0);
        dUserSetINT(PlayerName2(playerid)).("hours",0);
        dUserSetINT(PlayerName2(playerid)).("minutes",0);
        dUserSetINT(PlayerName2(playerid)).("seconds",0);
        PlayerInfo[playerid][LoggedIn] = 1;
        PlayerInfo[playerid][Registered] = 1;
        SendClientMessage(playerid, green, "ACCOUNT: You are now registered, and have been automaticaly logged in");
        PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
        new qwe[256];
        format(qwe, 255, "/ladmin/acc.ini");

        //If file for how manyy people are registered does not exist... make one
        if( !dini_Exists( qwe ) )
        {
            dini_Create(qwe);
            dini_IntSet(qwe, "accounts", 0);
        }

        //Update how many people are registered
        new noa;
        new str[128];
        noa = dini_Int(qwe,"accounts");
        dini_IntSet(qwe, "accounts", noa+1);

        //Send Message to show how many people are regustered
        format(str, sizeof(str), "%i users are currently registered", noa+1);
        SendClientMessage(playerid, green, str);

        return 1;
    }
    return 1;
}
Reply
#3

ty very much dude +rep
And is it possible to do , how many loggins?
Reply
#4

is that how many people are logged in currently? or how many times users have loggedin in total?
Reply
#5

how many times users have loggedin in total.
Reply
#6

Another question :/

Is that all users together? or Seperate users

EG "12 users have logged in 200 times"
or "You have logged in 200 times"
Reply
#7

All together
Reply
#8

Heres the whole script :S couldn't be bothered with copy paste, as there are 4 places you need to add/edit

http://pastebin.com/MUtzbPqw

Use that... if you have added/edited stuff and want to put my bits of code in your code then do the following

Search for "//CHANGE STARTS HERE"

That's where the code i have added starts, then it stops again at "//CHANGE ENDS HERE"

I have tested, and it seems to be working.
Reply
#9

ty very much dude you are awesome !!!!! D <33
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)