SA-MP Forums Archive
Remake (Connect message) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Remake (Connect message) (/showthread.php?tid=235369)



Remake (Connect message) - Unknown123 - 05.03.2011

Can someone remake this? it bugs my MySQL things..
And when my brother(Abc123) connect it says Unknown123
pawn Код:
public OnPlayerConnect(playerid)
{
    new servername[25], string[128];
    GetServerVarAsString("hostname", servername, sizeof(servername));
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i) || PlayerData[i][AdminLevel] > 1)
        {
            format(string, sizeof(string), "%s(%d) Has Joined %s. (IP: %s)", PlayerName(i), i, servername, PlayerIP(i));
            SendClientMessage(i, COLOR_GREY, string);
            SendDeathMessage(playerid, INVALID_PLAYER_ID, 200);
            return 1;
        }
        else
        {
            format(string, sizeof(string), "%s(%d) Has Joined %s.", PlayerName(i), i, servername);
            SendClientMessage(i, COLOR_GREY, string);
            SendDeathMessage(playerid, INVALID_PLAYER_ID, 200);
            return 1;
        }
    }
}
Extra:
pawn Код:
stock PlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}



Re: Remake (Connect message) - HyperZ - 05.03.2011

pawn Код:
public OnPlayerConnect(playerid)
{
    new servername[25], string[128];
    GetServerVarAsString("hostname", servername, sizeof(servername));
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i) || PlayerData[i][AdminLevel] > 1)
        {
            format(string, sizeof(string), "%s(%d) Has Joined %s. (IP: %s)", PlayerName, playerid, servername, PlayerIP(playerid));
            SendClientMessage(i, COLOR_GREY, string);
            SendDeathMessage(playerid, INVALID_PLAYER_ID, 200);
            return 1;
        }
        else
        {
            format(string, sizeof(string), "%s(%d) Has Joined %s.", PlayerName, playerid, servername);
            SendClientMessage(i, COLOR_GREY, string);
            SendDeathMessage(playerid, INVALID_PLAYER_ID, 200);
            return 1;
        }
    }
}



Re: Remake (Connect message) - Unknown123 - 05.03.2011

Quote:
Originally Posted by Clive
Посмотреть сообщение
pawn Код:
public OnPlayerConnect(playerid)
{
    new servername[25], string[128];
    GetServerVarAsString("hostname", servername, sizeof(servername));
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i) || PlayerData[i][AdminLevel] > 1)
        {
            format(string, sizeof(string), "%s(%d) Has Joined %s. (IP: %s)", PlayerName, playerid, servername, PlayerIP(playerid));
            SendClientMessage(i, COLOR_GREY, string);
            SendDeathMessage(playerid, INVALID_PLAYER_ID, 200);
            return 1;
        }
        else
        {
            format(string, sizeof(string), "%s(%d) Has Joined %s.", PlayerName, playerid, servername);
            SendClientMessage(i, COLOR_GREY, string);
            SendDeathMessage(playerid, INVALID_PLAYER_ID, 200);
            return 1;
        }
    }
}
At the format lines
Код:
C:\Users\Unknown123\Documents\Server\gamemodes\Unknown.pwn(544) : error 076: syntax error in the expression, or invalid function call
C:\Users\Unknown123\Documents\Server\gamemodes\Unknown.pwn(551) : error 076: syntax error in the expression, or invalid function call
Edit: Thnaks, Fixed


Re: Remake (Connect message) - HyperZ - 05.03.2011

Ohh srry try this:
pawn Код:
public OnPlayerConnect(playerid)
{
    new servername[25], string[128];
    new pName2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName2, MAX_PLAYER_NAME);
    GetServerVarAsString("hostname", servername, sizeof(servername));
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerAdmin(i))
        {
            format(string, sizeof(string), "%s(%d) Has Joined %s. (IP: %s)", pName2, playerid, servername, PlayerIP(playerid));
            SendClientMessage(i, 0, string);
            SendDeathMessage(playerid, INVALID_PLAYER_ID, 200);
        }
        else
        {
            format(string, sizeof(string), "%s(%d) Has Joined %s.", pName2, playerid, servername);
            SendClientMessage(i, 0, string);
            SendDeathMessage(playerid, INVALID_PLAYER_ID, 200);
        }
    }
    return 1;
}



Re: Remake (Connect message) - Unknown123 - 05.03.2011

Thanks :P ^^


Re: Remake (Connect message) - HyperZ - 05.03.2011

Quote:
Originally Posted by Unknown123
Посмотреть сообщение
Thanks :P ^^
No Problem.