mysql aka stuff
#1

Well, i was wondering i know that to check the player's aka with his ip i should type on mysql query something like that
PHP код:
"SELECT * FROM `PLAYERS` WHERE `IP` = '%s'" 
but i don't actually understand how do i make it inside a command, do i need to make an enum? do i need to make a forward/public functions or whatever ? lol
Reply
#2

PHP код:
//R41
new query[256];
mysql_format(Databasequerysizeof(query), "SELECT * FROM `PLAYERS` WHERE `IP` = '%s'"
mysql_tquery(Databasequery); 
Reply
#3

Quote:
Originally Posted by willbedie
Посмотреть сообщение
PHP код:
//R41
new query[256];
mysql_format(Databasequerysizeof(query), "SELECT * FROM `PLAYERS` WHERE `IP` = '%s'" 
Exactly, i've already made if it was that easy look at that command

PHP код:
CMD:whois(playeridparams[])
{
    if(
connected[playerid] == true) return GameTextForPlayer(playerid"~r~Spawn First"50005);
    if(
pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1"{C3C3C3}(INFO) You don't have the priviliges to use this command.");
    {
            new 
str[500], targetip[16], country[32], isp[32], city[32];
            if(
sscanf(params"u"target)) return SendClientMessage(playerid, -1"{c3c3c3}(INFO) /whois [id]");
            
GetPlayerIp(targetip16);
            
GetIPCountry(ipcountrysizeof country);
            
GetIPISP(ipispsizeof isp);
            
GetIPCity(ipcitysizeof city);
            
GetPlayerIp(target,ip,sizeof(ip));
            
format(strsizeof(str), "{EFB509}(INFO) %s's ip is ''%s'' connected from ''%s''"PlayerName[target], ip[target], country[target]);
               
SendClientMessage(playerid, -1str);
             
mysql_format(DatabaseDB_Querysizeof(DB_Query), "SELECT * FROM `PLAYERS` WHERE `IP` = '%s'"bla bla what to put);
              
format(strsizeof(str), "{EFB509}(INFO) %s is also known as: %s"blabla what to put);
    }
    return 
1;

Just to understand better what do you put after ", ??
Reply
#4

PHP код:
new query[256], IPAddress[60];
GetPlayerIp(playeridIPAddresssizeof(IPAddress));
mysql_format(Databasequerysizeof(query), "SELECT * FROM `PLAYERS` WHERE (`IP` = '%s')"IPAddress);
mysql_tquery(Databasequery); 
Reply
#5

Oh lol, i'll try

edit: and what do you should put on sendclientmessage ?
Reply
#6

Quote:
Originally Posted by wallen
Посмотреть сообщение
Oh lol, i'll try

edit: and what do you should put on sendclientmessage ?
Do you want to send the ip as a message to a player?
Reply
#7

Quote:
Originally Posted by willbedie
Посмотреть сообщение
Do you want to send the ip as a message to a player?
I only want to show all the nickname's used by a certain player
Reply
#8

Quote:
Originally Posted by wallen
Посмотреть сообщение
I only want to show all the nickname's used by a certain player
PHP код:
format(stringsizeof(string), "%s"pIpAddress);
SendClientMessage(playerid, -1string); 
You can simply use string for that
Reply
#9

Quote:
Originally Posted by willbedie
Посмотреть сообщение
PHP код:
format(stringsizeof(string), "%s"pIpAddress);
SendClientMessage(playerid, -1string); 
You can simply use string for that
But from what i read it's supposed to view only IP numbers, while i want the nickname or just i dont understand?
Reply
#10

@wallen, you can try the code below, it's untested though.

PHP код:
stock GetIP(playerid)
{
    new 
allplayerip[33],
    
playerip[33],
    
count 0;
    
GetPlayerIp(playeridplayersipsizeof(playersip));
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) && !IsPlayerNPC(i) && != playerid)
        {
            
GetPlayerIp(iallplayeripplayersiptrue) == 0count++;
        }
    }
    return 
count;

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)