SA-MP Forums Archive
Check for accounts - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Check for accounts (/showthread.php?tid=607680)



Check for accounts - justjamie - 22.05.2016

Hello
i wanna make a command which checks how many account a player has.

Let's say i made 1 account, it should display this:

Exact_Name (IP) (IPBANNED: YES/NO)

when 4 accounts:

Exact_Name (IP) (IPBANNED: YES/NO)
Exact_Name (IP) (IPBANNED: YES/NO)
Exact_Name (IP) (IPBANNED: YES/NO)
Exact_Name (IP) (IPBANNED: YES/NO)

How do i do this?


Re: Check for accounts - iKevin - 22.05.2016

Check the IP on registration and/or login, then save it to your database and make a command that retrieves the data from the field content and inputs it to a dialog which will be showed to you.


Re: Check for accounts - justjamie - 22.05.2016

Quote:
Originally Posted by KevinExec
Посмотреть сообщение
Check the IP on registration and/or login, then save it to your database and make a command that retrieves the data from the field content and inputs it to a dialog which will be showed to you.
yes, how do i make a command that retrieves the data from the field.
i have no idea :3


Re: Check for accounts - iKevin - 22.05.2016

Quote:
Originally Posted by justjamie
Посмотреть сообщение
yes, how do i make a command that retrieves the data from the field.
i have no idea :3
We're here to help, not to write the code for you. I've told you what you have to do, now find out yourself how and do it. You wont learn otherwise.


Re: Check for accounts - justjamie - 22.05.2016

Quote:
Originally Posted by KevinExec
Посмотреть сообщение
We're here to help, not to write the code for you. I've told you what you have to do, now find out yourself how and do it. You wont learn otherwise.
i know.
i think i didn't correctly say the question i think.
When i do something like this:
PHP код:
IRCCMD:checkip(botidchannel[], user[], host[], params[])
{
new 
query[128],playerip[32];
format(query,sizeof(query),"SELECT * FROM ipbanned WHERE ip ='%s'",playerip);
mysql_function_query(dbhandle,query,true,"","");
return 
1;

Then it's only going to check the ip's.
What do i do after that?
How do i get the info further.


Re: Check for accounts - iKevin - 22.05.2016

What info? You can make a function and use cache_get_field_content and store it to strings, then display a dialog with these strings.


Re: Check for accounts - justjamie - 22.05.2016

Quote:
Originally Posted by KevinExec
Посмотреть сообщение
What info? You can make a function and use cache_get_field_content and store it to strings, then display a dialog with these strings.
ah.
Dont i have to use something like this?
for (i=0;i<MAX_PLAYERS;i++)


Re: Check for accounts - justjamie - 22.05.2016

PHP код:
IRCCMD:checkip(botidchannel[], user[], host[], params[])
{
if(!
IsEchoChannel(channel)) return iNoticeuserIRC_WRONG_CHANNEL);
new 
query[128],temp_username[35],temp_ip[40],string[128];
if(
sscanf(params"s"temp_ip)) return iEchoUse("!checkip [ IP ADRESS ]");
format(query,sizeof(query),"SELECT * FROM user WHERE regip ='%s'",temp_ip);
mysql_function_query(dbhandle,query,true,"","");
cache_get_field_content(0,"username",temp_username);
format(string,sizeof(string),"%s",temp_username);
iEcho(string);
return 
1;

Right now i got this.

When i do !checkip 127.0.0.1, nothing happends.
(127.0.0.1 is registered to 2 users in the db)