PDA

View Full Version : Player isn't connected problem


Problems
08/07/2016, 03:05 PM
I use this under the commands
if(ID == INVALID_PLAYER_ID)
{
format(string,sizeof(string),"{808080}[SERVER]{FFFFFF} The Player ID (%d) is not connected to the server.",ID);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}

But with some IDs[Most IDs] it keeps say this while the players are connected.

Problems
08/07/2016, 03:50 PM
I really need this urgently so sorry for bumping.

Dusan01
08/07/2016, 03:52 PM
try using it like this: if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"{808080}[SERVER]{FFFFFF} The Player ID (%d) is not connected to the server.",ID);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}

Problems
08/07/2016, 04:18 PM
I think there is a problem in such a plugin maybe?

Sjn
08/07/2016, 05:18 PM
I experienced this once few years back, found out it was caused by the outdated sscanf include/plugin. If you aren't using the latest version, try updating it, maybe?

Problems
08/07/2016, 07:03 PM
I updated to this (http://forum.sa-mp.com/showthread.php?t=602923) but still also sometimes there are problems with IDs that says they aren't connected

ReshiramZekrom
08/07/2016, 08:13 PM
Did you introduce something new into your gamemode recently? Or did you load a new fs?

Stinged
08/07/2016, 08:39 PM
Did you try what Dusan01 said?

INVALID_PLAYER_ID = 65535

Even if ID 5 (for example) isn't online, 5 will never be equal to 65535.

Problems
08/07/2016, 08:59 PM
Did you try what Dusan01 said?

INVALID_PLAYER_ID = 65535

Even if ID 5 (for example) isn't online, 5 will never be equal to 65535.

Is that after a new update or something? Cause it used to work before

Stinged
08/07/2016, 09:20 PM
Which specifier are you using (u, r, i..)

I just tested the "u" and "r" specifier, and it seems that they set the variable value as INVALID_PLAYER_ID if the ID isn't connected.
But if you're using the "i" specifier, then it won't return the value as 65535.

Problems
08/07/2016, 09:29 PM
I'm using the u but I changed to !IsPlayerConnected and I'll test.

Problems
08/07/2016, 09:39 PM
Still the same problem there,Some IDs works and when they reconnect the ID get bugged and sometimes they work again.

Problems
08/07/2016, 11:16 PM
I'm using this https://github.com/maddinat0r/sscanf/releases but still there are some bugs with some players even in IsPlayerConnected !?

Problems
09/07/2016, 02:22 AM
Sorry for bumping, But any idea , guys!?

Problems
09/07/2016, 04:02 PM
Bump!

JuzDoiT
09/07/2016, 04:51 PM
i sugget you this

new TargetID;

if(!IsPlayerConnected(TargetID) || TargetID == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_ERROR, "That Player Is Not Connected.");
return 1;
}

Problems
09/07/2016, 06:08 PM
You just changed the name from ID to TargetID it's not going to fix it
Am I using the right version of sscanf?

Misiur
09/07/2016, 06:27 PM
Yes, that's the latest release. Show us 5 lines before and after that check

Problems
09/07/2016, 11:19 PM
Example
dcmd_getstats(playerid,params[])
{
new ID;
if(sscanf(params, "u", ID))
{
SendClientMessage(playerid,COLOR_WHITE,"{808080}[SERVER]{FFFFFF}: /getstats (Player Name/ID)");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"{808080}[SERVER]{FFFFFF} The Player ID (%d) is not connected to the server. You cannot kick them.",ID);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
if(IsSpawned[playerid] != 1)
{
SendClientMessage(playerid,COLOR_WHITE,"{808080}[SERVER]{FFFFFF} This player must be spawned in order to be able to use this command on them.");
return 1;
}
ShowPlayerDialog(playerid,DIALOG_STATS, DIALOG_STYLE_MSGBOX,"{53C506}Stats",GetPlayerStats(ID),"Close","");
return true;
}
It there any plugin/include that maybe is responsible for this?

Problems
10/07/2016, 01:37 PM
Bump?

Problems
18/07/2016, 09:30 AM
Bump