Command helping
#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


Messages In This Thread
Command helping - by Diti1 - 13.01.2015, 12:11
Re: Command helping - by JonathanFeitosa - 13.01.2015, 12:19
Re: Command helping - by Diti1 - 13.01.2015, 12:25
Re: Command helping - by CalvinC - 13.01.2015, 14:27
Re: Command helping - by Diti1 - 13.01.2015, 14:46
Re: Command helping - by CalvinC - 13.01.2015, 15:03
Re: Command helping - by HY - 13.01.2015, 15:14
Re: Command helping - by Diti1 - 13.01.2015, 17:00
Re: Command helping - by CalvinC - 13.01.2015, 17:14
Re: Command helping - by Diti1 - 13.01.2015, 17:46

Forum Jump:


Users browsing this thread: 1 Guest(s)