Little help with connect message
#1

Hello guys, I have been working on this little bit for my admins to see, it shows the IP of the player who has joined the server but to other players it doesn't, this is what the code looks like
pawn Код:
new str[22 + MAX_PLAYER_NAME], ip[16];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(str, sizeof(str), "%s has joined the server", pname);
    SendClientMessageToAll(gray, str);
    {
    else
    }
    GetPlayerIp(ID,ip,sizeof(ip));
    GetPlayerName(playerid, pname, sizeof(pname));
    format(str, sizeof(str), "%s has joined the server (%s)", pname, ip);
    SendMessageToAdmins(gray, str);
    {
and I get this error
Quote:

C:\Users\BLACK\Desktop\Test\filterscripts\Accounts 0.8.pwn(273) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

if you're able to help that would be great!
Reply
#2

waht is dat dude ..
PHP код:
{
        else

Try looking again arrange your code .. and post the error line where is it
Reply
#3

HMm what? All I want to know what is wrong and how I would be able to fix it, I want it to show to admins as:
Quote:

Player has connected to the server (IP)

But to normal players it would be
Quote:

Player has connected to the server

Reply
#4

Just change the brackets

Код:
}
    else
    {
Reply
#5

Don't you need an "if" first to use an "else"?
Reply
#6

LeXuZ, you could use a "for" command on OnPlayerConnect callback to send the player's IP info to online administrators.

Also, this piece of code you are showing is wrong. As stated above, you need to use "if" condition before using "else".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)