spam join message bug
#1

When joining the server it goes like:
Код:
[JOIN] banned
[JOIN] banned
[JOIN] banned
[JOIN] banned
[JOIN] banned
[JOIN] banned
But then 100 times
pawn Код:
new string[128];
  new IP[16];
  for(new i=0; i<MAX_PLAYERS; i++)
  for(new z=0; z<MAX_PLAYERS; z++)
    if(UserUD[i][admin] > 1)
    {
    GetPlayerIp(playerid, IP, 16);
    GetPlayerName(playerid,UserUD[playerid][accname],128);
    format(string, sizeof(string), "[JOIN] %s IP: %d", UserUD[playerid][accname],IP);
    SendClientMessage(i,red, string);
    }
    else if(UserUD[z][admin] == 0)
    {
    GetPlayerName(playerid,UserUD[playerid][accname],128);
    format(string, sizeof(string), "[JOIN] %s", UserUD[playerid][accname]);
    SendClientMessage(z,red, string);
  }
Reply
#2

First of all, why would you want this?

Код:
for(new i=0; i<MAX_PLAYERS; i++)
  for(new z=0; z<MAX_PLAYERS; z++)
They does the same

And, if you want the message to only show to you, then use

Код:
format(string, sizeof(string), "[JOIN] %s", UserUD[playerid][accname]);
SendClientMessage(playerid,red, string);
or if all on the server

Код:
format(string, sizeof(string), "[JOIN] %s", UserUD[playerid][accname]);
SendClientMessageToAll(red, string);
Reply
#3

I want it to show to the admins only message with ip, and to normal players without ip..
Reply
#4

pawn Код:
new string[128];
    new IP[16];
    GetPlayerIp(playerid, IP, 16);
    GetPlayerName(playerid,UserUD[playerid][accname],128);
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(UserUD[i][admin] > 1)
        {
            format(string, sizeof(string), "[JOIN] %s IP: %d", UserUD[playerid][accname],IP);
            SendClientMessage(i,red, string);
        }
        else if(UserUD[i][admin] == 0)
        {
            format(string, sizeof(string), "[JOIN] %s", UserUD[playerid][accname]);
            SendClientMessage(i,red, string);
        }
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)