GEO-IP Leave Message
#1

I have downloaded GEO-IP and i am trying to make an exit message along with the entry message

so far this is what i have come up with

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
  new Country[256];
  new IP[256];
  new mess[256];
    new
    string[64],
    name[MAX_PLAYER_NAME];
  GetPlayerName(playerid,name,MAX_PLAYER_NAME);

  switch(reason)
  {
    case 0: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid);
    case 1: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid);
    case 2: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid);
  }
  SendClientMessageToAll(COLOR_JOIN,string);
  return 1;
}
but i get these errors upon compile
Код:
C:\Users\richard\Desktop\samp 0.3 R4\filterscripts\IP.pwn(147) : error 001: expected token: ",", but found ";"
C:\Users\richard\Desktop\samp 0.3 R4\filterscripts\IP.pwn(148) : error 001: expected token: ",", but found ";"
C:\Users\richard\Desktop\samp 0.3 R4\filterscripts\IP.pwn(149) : error 001: expected token: ",", but found ";"
for these lines
pawn Код:
case 0: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid);
    case 1: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid);
    case 2: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid);
This is the whole script
Click Here

Does anyone know how to fix it so it works with "Left the Server" messages or am i just wasting my time?
Reply
#2

Quote:
Originally Posted by Ritchie999
pawn Код:
case 0: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid);
    case 1: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid);
    case 2: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid);
Change to:
pawn Код:
case 0: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid));
    case 1: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid));
    case 2: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid));
You forgot to close the format function - )
Reply
#3

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by Ritchie999
pawn Код:
case 0: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid);
    case 1: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid);
    case 2: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid);
Change to:
pawn Код:
case 0: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid));
    case 1: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid));
    case 2: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid));
You forgot to close the format function - )
Wow.. Thank you very much

i have been sitting here for 10 minutes editing the script and fixing these errors

--[Edit]--

Ah also one more thing, would i be able to set it up to get a reason why the player has left?
example
pawn Код:
case 0: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid)) (Timed out)",name);
    case 1: format(mess,sizeof(mess),"
%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid)) (Leaving)",name);
    case 2: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ]",GetPName(playerid),Country,IP,GetPlayerPing(playerid)) (Kicked/Banned)",name);
Код:
C:\Users\richard\Desktop\samp 0.3 R4\filterscripts\IP.pwn(147) : error 001: expected token: ";", but found "("
C:\Users\richard\Desktop\samp 0.3 R4\filterscripts\IP.pwn(147) : error 017: undefined symbol "Timed"
C:\Users\richard\Desktop\samp 0.3 R4\filterscripts\IP.pwn(147) : error 017: undefined symbol "out"
C:\Users\richard\Desktop\samp 0.3 R4\filterscripts\IP.pwn(147) : fatal error 107: too many error messages on one line
Reply
#4

For a reason:
Replace your code with this one:
pawn Код:
case 0: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ] (Timed out)",name,Country,GetPlayerPing(playerid));
    case 1: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ] (Leaving)",name,Country,GetPlayerPing(playerid));
    case 2: format(mess,sizeof(mess),"%s left the server [ Country: %s | Ping: %i ] (Kicked/Banned)",name,Country,GetPlayerPing(playerid));
Hope it works..
Reply
#5

I done that, compiles without errors
but when someone leaves the game it doesnt show a message
it just shows a blank space
Reply
#6

Quote:
Originally Posted by Ritchie999
I done that, compiles without errors
but when someone leaves the game it doesnt show a message
it just shows a blank space
That's because you're sending a message as string array but you actually formatted mess array.
Reply
#7

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by Ritchie999
I done that, compiles without errors
but when someone leaves the game it doesnt show a message
it just shows a blank space
That's because you're sending a message as string array but you actually formatted mess array.
How can i make it send the message when someone leaves?
Reply
#8

Change this:
Quote:
pawn Код:
SendClientMessageToAll(COLOR_JOIN,string);
to:
pawn Код:
SendClientMessageToAll(COLOR_JOIN,mess);
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)