if ( dialogid == Register2 )
{
if ( response )
{
new
String[ 245 ]
;
if ( strlen( inputtext ) == 0)
return ShowDialog( playerid, Register2, DIALOG_STYLE_PASSWORD, "{FFFFFF}Enter Password", ""#COL_RED"No password entered!\n{FFFFFF}Please enter your desired password:", "Enter", "");
if ( strlen( inputtext ) < 4 || strlen( inputtext ) > 20)
return ShowDialog( playerid, Register2, DIALOG_STYLE_PASSWORD, "{FFFFFF}Enter Password", ""#COL_RED"Minimum password length is 4 and maximum is 20!\n{FFFFFF}Please enter your desired password:", "Enter", "");
if ( BUD::RegisterName( PlayerName2( playerid ), inputtext ) )
{
new Date[5],DateStr[ 50 ];
getdate( Date[ 0 ], Date[ 1 ], Date[ 2 ] );
gettime( Date[ 3 ], Date[ 4 ]);
format( DateStr, 50, "%i/%i/%i %d:%d", Date[ 2 ], Date[ 1 ], Date[ 0 ], Date[ 3 ], Date[ 4 ] );
new iUID = BUD::GetNameUID( PlayerName2( playerid ) );
BUD::MultiSet( iUID, "ss", "Password", inputtext, "Registered", DateStr );
format( String, sizeof( String ), ""#COL_GREEN"Account succesfully created!\n\n\
"#COL_LIGHTBLUE"Account: {FFFFFF}%s\n\
"#COL_LIGHTBLUE"Password: {FFFFFF}%s\n\
"#COL_LIGHTBLUE"Account id: {FFFFFF}%d\n\
Remember! Don't give your password to anyone!\n\n\
{FFFFFF}Would you like to login?",PlayerName2( playerid ),inputtext,iUID+2 );
ShowDialog( playerid, Register3, BOX, "{FFFFFF}Account created!", String, "Login", "");
foreach(Player, Admin)
{
if ( P_DATA[ Admin ][ P_Level ] > 2 )
{
FormMessage( Admin, -1, "> "COL_ORANGE"%s{FFFFFF} registered an account!", PlayerName2( playerid ) );
}
}
}
else
{
foreach(Player, Admin)
{
if ( P_DATA[ Admin ][ P_Level ] > 2 )
{
FormMessage( Admin, -1, "> "COL_ORANGE"%s{FFFFFF} failed to register an account!", PlayerName2( playerid ) );
}
}
}
}
}
|
Originally Posted by SsHad
As I'm trying to create something Like that so When a User registers it should send a Message to everyone regarding that
Derp has registered making the server have total 9 players |
new nameplaerr[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
BUD::GetNameUID( nameplaerr[], sizeof(nameplaerr));
format(string, sizeof(string), "%s has joined the server.", nameplaerr);
SendClientMessageToAll(0xC4C4C4FF, string);
error 029: invalid expression, assumed zero
new DBResult:Answer;
Answer = BUD::RunQuery("SELECT COUNT(*) FROM `users`",true);
db_get_field(Answer,0,string,sizeof(string));
RegAccounts = strval(string);
|
From my opinion, The only way i know is
1. Create a variable. 2. Increase the variable value ( ++; ) when player registers. 3. Save the variable in the database. 4. Call the variable in Send Client Message when players registers. |
|
Originally Posted by iZN
Why don't you create an value for registered ID? Registered ID will be assign to the player when they register. Then you can simple place your Registered ID variable, that's it!
|
new DBResult:Answer;
Answer = BUD::RunQuery("SELECT COUNT(*) FROM `users`",true);
db_get_field(Answer,0,string,sizeof(string));
iUID = strval(string);
format(string, sizeof(string), "Total players %s.", Answer);
SendClientMessageToAll(0xC4C4C4FF, string);
Total players 3/11/2013 9:37.