SA-MP Forums Archive
Command helping - 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: Command helping (/showthread.php?tid=557265)



Command helping - Diti1 - 13.01.2015

hey boys
after 2 days ive tried to make a command for my script
but i failed cuz i got alot of errors and deleted the whole
script as it was unusefull and please if someone wants me to help
i will show what command i want please tell me if you can make it or not

command would be :getaccounts[IP] - this to show all ip accounts on server.
Thanks
sorry for my bad english


Re: Command helping - JonathanFeitosa - 13.01.2015

Please, show the code


Re: Command helping - Diti1 - 13.01.2015

as i said ive deleted xD but now i have only this You can help me to make it ? pls i will give u teamviewer if u want
Quote:

COMMAND:getaccounts(playerid, params[])
{
if(PlayerInfo[playerid][power]< 20) return SendClientError(playerid,CANT_USE_CMD);




Re: Command helping - CalvinC - 13.01.2015

I made a quick command you can take a look at, with info.
Replace the loop if you have the foreach include.
pawn Код:
CMD:getaccounts(playerid, params[])
{
    new string[128], ip = GetPlayerIp(playerid, ip, sizeof(ip)), name = GetPlayerName(playerid, name, sizeof(name)); // We define the "ip" and "name" that we use in the string underneath
    for(new i; i < MAX_PLAYERS; i++) // Then we loop through all players on the server
    {
        format(string, sizeof(string), "Name: %s | IP: %s", name(i), ip(i)); // The for each player, we format a string with the "name" and "ip" we created above
        SendClientMessage(playerid, -1, string); // Then as final, for each player there is, we send the formatted string to the playerid that used the command
    }
    return 1;
}
You can also use your own stocks instead of "name" and "ip" if you have any.

EDIT: Loop was bugged, fixed. Sorry.


Re: Command helping - Diti1 - 13.01.2015

this wont show all accounts that the player has registerd on server
You know how to do it ?


Re: Command helping - CalvinC - 13.01.2015

EDIT: Nvm i was stupid.

Don't know how to do that, im not good with data/saving/loading systems.


Re: Command helping - HY - 13.01.2015

pawn Код:
CMD:getaccounts(playerid, params[])
{
    new name[MAX_PLAYER_NAME], IP[20], string[128];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerName(i, name, sizeof(name));
            GetPlayerIp(i, IP, 20);
            format(string, sizeof(string), "Name: %s, IP: %s.", name, IP);
            SendClientMessage(playerid, -1, string);
        }
    }
    return 1;
}



Re: Command helping - Diti1 - 13.01.2015

i meant it to example /getaccounts 192.168.... and after this to show admin the player that have accounts registed on server :P


Re: Command helping - CalvinC - 13.01.2015

I understand what your point is.
/getaccounts [IP], and then it shows a list of all players that has that IP. All registered players, not only those online.
What is your saving method? SQLite, MySQL, .ini files...?


Re: Command helping - Diti1 - 13.01.2015

Calvin bro i will give teamviewer and login ok ? :P