Disconnect message error
#1

Hey all, I tried adding a D/C message to my script as my server doesnt have one. And I got this lovely error:

C:\Server\gfscript.pwn(3044) : error 017: undefined symbol "reason"

Info: Its a GF edit. Heres the D/C script I use:

Код:
}
  new pName[MAX_PLAYER_NAME], string[56];
  GetPlayerName(playerid, pName, sizeof(pName));
  switch(reason)
  {
    case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pName);
    case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pName);
    case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", pName);
  }
}
Reply
#2

is it under onplayerdisconnect?
Reply
#3

Yep

Код:
public OnPlayerDisconnect(playerid)

{
  new pName[MAX_PLAYER_NAME], string[56];
  GetPlayerName(playerid, pName, sizeof(pName));
  switch(reason)
  {
    case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pName);
    case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pName);
    case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", pName);
  }
  SendClientMessageToAll(0xAAAAAAAA, string);
 //  return 1;

//{
Reply
#4

Define "reason" -.-
Reply
#5

how?
Reply
#6

change
pawn Код:
public OnPlayerDisconnect(playerid)
to
pawn Код:
public OnPlayerDisconnect(playerid,reason)
Reply
#7

try
Код:
public OnPlayerDisconnect(playerid, reason)
edit: guess i was a bit slow ^^,
Reply
#8

thanks guys works perfectly now
Reply
#9

Quote:
Originally Posted by Packer5
thanks guys works perfectly now
your welcome.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)