ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 1860

help add sprx

by benito92 - 11-26-2018 - 04:48 PM
#1
Somebody could help me add the sample of the ip exit the city and the company of the ip??
Reply
#2
(11-26-2018 - 04:48 PM)benito92 Wrote: Somebody could help me add the sample of the ip exit the city and the company of the ip??

add this for ur sprx














#include <sys/sys_time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/timer.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <netex/net.h>
#include <netex/errno.h>
#include <string.h>
#include <sys/ppu_thread.h>
#include <netex\libnetctl.h>
#include <inttypes.h>  
#include <string.h>
#include <sys/sys_time.h>
#include <sys/time_util.h>
#include <stdarg.h>
#include <assert.h>
#include <sys/process.h>
#include <sys/memory.h>
#include <sys/timer.h>
#include <sys/return_code.h>
#include <sys/prx.h>
#include <stddef.h>
#include <math.h>
#include <stdarg.h>
#include <cellstatus.h>
#include <typeinfo>
#include <vector>
#include <pthread.h>
#include <locale.h>
#include <cell/error.h>
#include <sys/paths.h>
#include <time.h>
#include <net\if_dl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <cell/cell_fs.h>
#include <cell/sysmodule.h>
#include <stdio.h>
#include <string.h>
#include <cell/fs/cell_fs_errno.h>
#include <cell/fs/cell_fs_file_api.h>
#include <ppu_intrinsics.h>
#include <cstdlib>
#include <cellstatus.h>
#include <sys/prx.h>
#include <sys/types.h>
#include <netdb.h> 
#include <sys/types.h>
#include <cell/cell_fs.h>
#include <sys/stat.h>
#include <cellstatus.h>
#include <sys/prx.h>
#include <sys/ppu_thread.h>
#include <string.h>
#include <sys/memory.h>
#include <sys/timer.h>
#include <sys/process.h>
#include <ppu_intrinsics.h>
#include <stdarg.h>
#include <stdio.h>
#include <cstdlib>
#include <math.h>
#include <sys/types.h>
#include <sys/types.h>
#include <cell/cell_fs.h>
#include "Dialog.h"
#include <sys/stat.h>
#pragma comment(lib, "net_stub")
#pragma comment(lib, "netctl_stub")
#define SERVER_PORT htons(80)
int Socket;
struct hostent *Host;
struct sockaddr_in SocketAddress;
char bufferReturn[10000];
char RequestBuffer[2000];
char *HookName;
char* remove_headers(char* request)
{
if (request == NULL) return NULL;
request = strstr(request, "\r\n\r\n");
if (request) request += 4;
return request;
}
char IPResolverV1[50000];
bool buffchek = false;
void IPResolverV(char *ip1, char *ip2, char *ip3, char *ip4)
{
Host = gethostbyname("ip-api.com");
SocketAddress.sin_addr.s_addr = *((unsigned long*)Host->h_addr);
SocketAddress.sin_family = AF_INET;
SocketAddress.sin_port = SERVER_PORT;
Socket = socket(AF_INET, SOCK_STREAM, 0);
if (connect(Socket, (struct sockaddr *)&SocketAddress, sizeof(SocketAddress)) != 0)
{
snprintf(IPResolverV1, sizeof(IPResolverV1), "CONNECTION ERROR");
}
strcpy(RequestBuffer, "GET /line/");
strcat(RequestBuffer, ip1);
strcat(RequestBuffer, ".");
strcat(RequestBuffer, ip2);
strcat(RequestBuffer, ".");
strcat(RequestBuffer, ip3);
strcat(RequestBuffer, ".");
strcat(RequestBuffer, ip4);
strcat(RequestBuffer, "?fields=country,countryCode,region,regionName,city,timezone,mobile,proxy");
strcat(RequestBuffer, " HTTP/1.0\r\nHOST: ");
strcat(RequestBuffer, "ip-api.com");
strcat(RequestBuffer, "\r\n\r\n");
send(Socket, RequestBuffer, strlen(RequestBuffer), 0);
while (recv(Socket, bufferReturn, 10000, 0) > 0)
{
snprintf(IPResolverV1, sizeof(IPResolverV1), "%s", remove_headers(bufferReturn));
buffchek = true;
}
}

call:
variables:
char IPResolverIPs[3][8000];


on player info:

int p1 = (ip & 0xff000000) >> 24;
int p2 = (ip & 0x00ff0000) >> 16;
int p3 = (ip & 0x0000ff00) >> 8;
int p4 = (ip & 0x000000ff) >> 0;

sprintf(IPResolverIPs[0], "%i", p1);//p1/2/3/4 is for set ip to IPResolverIPs
sprintf(IPResolverIPs[1], "%i", p2);
sprintf(IPResolverIPs[2], "%i", p3);
sprintf(IPResolverIPs[3], "%i", p4);

char *indisponible = "Not Found \nNot Found \nNot Found \nNot Found \nNot Found \nNot Found \nNot Found \nNot Found ";
if (buffchek)
{
PrintText(IPResolverV1, 0, x, y, 0.35f, 0.35f, 255, 255, 255, 255);
}
else
{
PrintText(indisponible, 0, x, y, 0.35f, 0.35f, 255, 255, 255, 255);
}


on client list:

snprintf(IPResolverV1, sizeof(IPResolverV1), NULL);

on option:

addOption("GeoLocation Player");
case 1: 
if (IPResolverIPs[0] != NULL && IPResolverIPs[1] != NULL && IPResolverIPs[2] != NULL && IPResolverIPs[3] != NULL)
{
     IPResolverV(IPResolverIPs[0], IPResolverIPs[1], IPResolverIPs[2], IPResolverIPs[3]);
}
break;


Download File: https://drive.google.com/file/d/1cE4LKmQ...sp=sharing

Any Problem Contact me On Skype: Fabio Dev 
Reply

Users browsing: 2 Guest(s)