SA-MP Forums Archive
thus aint wurk - 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: thus aint wurk (/showthread.php?tid=596038)



thus aint wurk - yvoms - 11.12.2015

Hey guys, i wanted to limit registrations to max 3 accounts on 1 IP, so i wrote this check,
Код:
		new pIP[16];
		GetPlayerIp(playerid, pIP, sizeof(pIP));
		mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `IP` = '%s'", pIP);
		mysql_tquery(mysql, query, "", "");
		new numrows = cache_num_rows();
		if(numrows >= 3) return SendClientMessage(playerid, COLOR_WHITE, "{ff387a}[Server]:{ffffff} You have reached the max registered accounts on this IP, please use your previous account.");
However its not working, i placed this at OnPlayerConnect


Re: thus aint wurk - Abagail - 11.12.2015

That is not how threaded queries work(mysql_tquery).

pawn Код:
new pIP[16];
        GetPlayerIp(playerid, pIP, sizeof(pIP));
        mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `IP` = '%s'", pIP);
        mysql_tquery(mysql, query, "OnRegistrationCheck", "d", playerid);
pawn Код:
forward OnRegistrationCheck(playerid);
public OnRegistrationCheck(playerid)
{
      if(cache_get_row_count() >= 3) return SendClientMessage(playerid, COLOR_WHITE, "{ff387a}[Server]:{ffffff} You have reached the max registered accounts on this IP, please use your previous account.");
   
      // put the rest of the code here
      return 1;
}



Re: thus aint wurk - yvoms - 11.12.2015

So, i have to forward it?
where would i place the actual query now?


Re: thus aint wurk - Denying - 11.12.2015

You leave the format and query at the same spot. However, you check the amount of rows returned inside the public.


Re: thus aint wurk - yvoms - 13.12.2015

This is not working. i've tried it all possible ways.


Re: thus aint wurk - yvoms - 13.12.2015

Anyone any idea on how to fix this issue,
I tried some stuff but it just aint working unfortunately.