[FilterScript] Global player search
#1

GLOBAL PLAYER SEARCH
Input:
/find iljon
/find c3dr1c
/find redtom


Output:


Example: botinform.com:7797

pwn:
Код:
//1.1 SA:MP GPS - Global Player Search by Bombo

#include <a_samp>
#include <a_http>

#include "../include/gl_common.inc"


forward FindPlayer(index, code, data[]);
forward InsertPlayer(index, code, data[]);

new UName[]="test";
new Pass[]="test";

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Global Player Search by Bombo");
	print("--------------------------------------\n");

	SendClientMessageToAll(9424500, "\n--------------------------------------");
	SendClientMessageToAll(9424500, "Global search by Bombo");
	SendClientMessageToAll(9424500, "--------------------------------------\n");
	return 1;
}

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{
	new PlayerIP[16];
	new PlayerName[48];
	new http_msg[256];
	new str_id[8];

	GetPlayerIp(playerid, PlayerIP, sizeof(PlayerIP));

	http_msg = "Playerid=";
	valstr(str_id, playerid);
	strcat(http_msg, str_id);
	strcat(http_msg, "&CheckIP=");
	strcat(http_msg, PlayerIP);
	strcat(http_msg, "&Uname=");
	strcat(http_msg, UName);
	strcat(http_msg, "&Pwd=");
	strcat(http_msg, Pass);
	strcat(http_msg, "&PlayerName=");
	GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	strcat(http_msg, PlayerName);

    HTTP(0, HTTP_POST, "botinform.com:9797", http_msg, "InsertPlayer"); //insert player in database

	SendClientMessage(playerid, 9324500, "Type for search: /find nick");
	return 1;
}

public OnPlayerSpawn(playerid)
{
    SendClientMessage(playerid, 9324500, "Type for search: /find nick");
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256+1];
    new idx;

    cmd = strtok(cmdtext, idx);

    //if(!IsPlayerAdmin(playerid)) return 0; // this is an admin only script

	//command "/help"
    if(strcmp(cmd, "/help", true) == 0)
    {
        SendClientMessage(playerid, 9324500, "/find [nick] - global search!");
	    return 1;
    }

    //command /find [nick]
    if(strcmp(cmd, "/find", true) == 0)
    {
		new tmp[256];
		new http_msg[512];
		new str_id[8];

		tmp = strtok(cmdtext,idx);
		http_msg = "Playerid=";
		valstr(str_id, playerid);
		strcat(http_msg, str_id);
		strcat(http_msg, "&Uname=");
		strcat(http_msg, UName);
		strcat(http_msg, "&Pwd=");
		strcat(http_msg, Pass);
		strcat(http_msg, "&Search=");
		strcat(http_msg, tmp);

        SendClientMessage(playerid, 9324500, "Searching...");
        HTTP(0, HTTP_POST, "botinform.com:9797", http_msg, "FindPlayer");
        return 1;
    }
    return 0;
}

public FindPlayer(index, code, data[])
{
  new tmp[256];
  new len,i,j,k;
  new playerid;
  new num[8];

//  printf("%s", data);

  for(i = 0; i < sizeof(num); ++i)
	num[i] = '\0';

  k = 0;
  while(data[k] != ' ') //take playerid for answer
  {
	num[k] = data[k];
	k++;
  }

  playerid = strval(num);

  len = strlen(data);
  for(i = k+1, j = 0; i < len; ++i)
  {
	tmp[j] = data[i];
	if(tmp[j] == '\n' || tmp[j] == '\0')
	{
	  tmp[j] = '\0';
	  if(tmp[j-1] == '\r')
		tmp[j-1] = '\0';
      SendClientMessage(playerid, 11240000, tmp); //answer
      j = 0;
      continue;
	}
	j++;
  }
}

public InsertPlayer(index, code, data[])
{
  new tmp[1024];
  new len,i,j,k;
  new playerid;
  new num[8];

//  printf("%s", data);

  for(i = 0; i < sizeof(num); ++i)
	num[i] = '\0';

  k = 0;
  while(data[k] != ' ') //take playerid for answer
  {
	num[k] = data[k];
	k++;
  }

  playerid = strval(num);

  for(i = k+1, j = 0; i < 6; ++i)
  {
	tmp[j] = data[i];
  }

  len = strlen(data);
  for(i = k+1, j = 0; i < len; ++i)
  {
	tmp[j] = data[i];
	if(tmp[j] == '\n' || tmp[j] == '\0')
	{
	  tmp[j] = '\0';
      SendClientMessage(playerid, 11240000, tmp); //answer
      j = 0;
      continue;
    }
	j++;
  }
}
or html:
Код HTML:
<html>
<head>
<title>SA:MP Search</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
</head>
<body>
<div align=center>
<h2>SEARCH BY NICK</h2>
<FORM action="http://botinform.com:9797" method="post">
    <P>
    Nick: <INPUT type="text" name="Search">
    <INPUT type="submit" value="Search">
    <INPUT type="hidden" name="Browser">
    <INPUT type="hidden" name="Uname" value="test">
    <INPUT type="hidden" name="Pwd" value="test">
    </P>
 </FORM>
</div>
</body>
</html>
Trial version (10 requests).



Ask me (pm) for full version.

You can support this project:
Z841169965648 E226595298971 R211309231066
Reply
#2

WoW what a great script !! 9/10
Reply
#3

Really unique and something new, good job man.
Reply
#4

oh man you know this is f*cking awesome that can be help another admin
Reply
#5

Great job!
Reply
#6

what a nice thing dude
Reply
#7

nice filterscript and one suggestion: make it in dialogs and colourfull
Reply
#8

Great job! One of the best filterscripts i have seen released o.o
Reply
#9

Thanx you all!
I've add attached find.amx, find.pwn and find.htm in zip
Reply
#10

Best FS i've ever seen very very good job very creative.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)