SA-MP Forums Archive
Need help with command - 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: Need help with command (/showthread.php?tid=620903)



Need help with command - IceBilizard - 04.11.2016

Hello all today i have a problem with my records commands it will show player IP and their accounts on the IP so i am having the issue if i use this command with playerid its working good but i have added a function like if any one getting record through player ip example

/arecords 182.182 so its not getting the records with matching ip here is my code please help me to fix it.


PHP код:
CMD:arecords(playerid, params[])
{
    new 
givedplayerid, pIP[256], playersname[25], str[256], options[128], str2[256];
    if (
adlvl[playerid] < 3) return 0;
    if (
sscanf(params, "s[128]", options))
    {
        
SendClientMessage(playerid, COLOR_WHITE, "Usage: /arecords [options]");
        
SendClientMessage(playerid, COLOR_WHITE, "OPTIONS: IP | playerid");
        return 
1;
    }
    else if(!
strcmp(options, "IP", true, 2))
    {
        if(
sscanf(params, "s[128]s[128]", options, pIP))
        {
            
SendClientMessage(playerid, COLOR_WHITE, "Usage: /arecords IP [IP Address]");
            return 
1;
        }
        
//format(str,sizeof(str),"|- IP: %s's Records -|", pIP);
        //SendClientMessage(playerid,-1,str);
            
new File: file = fopen("Records.txt", io_read), idxx=1;
            while(
fread(file, str))
            {
                    
format(str, sizeof(str), "%s", str);
                    if (
strcmp(str, pIP, false) == 0)
                    {
                        
format(str2, sizeof(str2), "%s", str);
                        
SendClientMessage(playerid, COLOR_ORANGE, str2);
                        
idxx ++;
                    }
            }
    }
    return 
1;
} 



Re: Need help with command - justice96 - 04.11.2016

Use MySQL instead of INI. I know what you expected. If you check ip address 127.0.0.1 it'll shows player name who has the same IP?


Re: Need help with command - IceBilizard - 04.11.2016

it will show all records with that ip

EDIT: Fixed it.