Command helping
#1

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
Reply
#2

Please, show the code
Reply
#3

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);

Reply
#4

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.
Reply
#5

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

EDIT: Nvm i was stupid.

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

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;
}
Reply
#8

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

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...?
Reply
#10

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


Forum Jump:


Users browsing this thread: 2 Guest(s)