Accounts registered textdraw help! -
nhunor58 - 29.12.2013
Hello guys!
Recently I created a textdraw that when the player connects shows how many accounts are registered,how many are banned and how many clans have been created.But I my problem is that i can't really make it useable,so it shows the real values.(The real count of registered player,etc.)I'm using MySQL r33.
Please show me an example how can i make them so they show the last registered players` Key`,and then i'll make the rest!
Thanks!
Re: Accounts registered textdraw help! -
SilentSoul - 29.12.2013
Make a global variable and increase the amount of that variable ++ , update the textdraw string on each command like ban , register example
pawn Код:
new globalvariable;//at the top.
CMD:ban(playerid,params[])
{
globalvariable ++;
new string[60];
format(string,sizeof(string),"There are %d banned players",globalvariable);
TextDrawSetString(example, string);
TextDrawShowForPlayer(playerid, example);
return 1;
}
Also you've to do the same on each register , if you're using dialogs you have to do that OnDialogResponse callback , if you are using command like /login , /register just incease the variable. hope you understand me.
Re: Accounts registered textdraw help! -
nhunor58 - 29.12.2013
But i want to do something like the textdraw to read these informations from the database..So that number of registered players for example to be read from the database..
Sorry for my english..
Re: Accounts registered textdraw help! -
nhunor58 - 29.12.2013
Someone?
Re: Accounts registered textdraw help! -
Johnson_boy - 29.12.2013
I didn't test this, but something similar should do:
pawn Код:
mysql_tquery(connectionHandle, "SELECT (SELECT COUNT(*) FROM `users`) AS `user_count`, (SELECT COUNT(*) FROM `bans`) AS `ban_count`", "mysql_GetServerStats", "");
public mysql_GetServerStats()
{
if(cache_get_row_count())
{
new users = cache_get_field_content_int(0, "user_count");
new bans = cache_get_field_content_int(0, "ban_count");
new td_string[64];
format(td_string, sizeof(td_string), "Registered users: %d~n~Bans: %d", user_count, ban_count);
TextDrawSetString(textdraw_id, td_string);
}
return 1;
}
Re: Accounts registered textdraw help! -
nhunor58 - 30.12.2013
Thanks,but where shall I add them?
Re: Accounts registered textdraw help! -
nhunor58 - 30.12.2013
Please somebody tell me!
Re: Accounts registered textdraw help! -
nhunor58 - 30.12.2013
Sorry for 3x post,but it's important!
Where shall I put that code?
pawn Код:
mysql_tquery(connectionHandle, "SELECT (SELECT COUNT(*) FROM `users`) AS `user_count`, (SELECT COUNT(*) FROM `bans`) AS `ban_count`", "mysql_GetServerStats", "");
public mysql_GetServerStats()
{
if(cache_get_row_count())
{
new users = cache_get_field_content_int(0, "user_count");
new bans = cache_get_field_content_int(0, "ban_count");
new td_string[64];
format(td_string, sizeof(td_string), "Registered users: %d~n~Bans: %d", user_count, ban_count);
TextDrawSetString(textdraw_id, td_string);
}
return 1;
}