SA-MP Forums Archive
Player 1 is not online but he is (ONLY PLAYERID 1) - 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)
+--- Thread: Player 1 is not online but he is (ONLY PLAYERID 1) (/showthread.php?tid=568851)



Player 1 is not online but he is (ONLY PLAYERID 1) [SOLVED] - J0sh... - 25.03.2015

Hi, nobody can use commands on a player with the id 1, I don't know why...

pawn Код:
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player is not online.");
Everybody else 0 & 2+ can be affected by commands.

Solved


Re: Player 1 is not online but he is (ONLY PLAYERID 1) - -=Dar[K]Lord=- - 26.03.2015

Try this...

Код:
if(!IsPlayerConnected(id))return SendClientMessage(playerid,COLOR_RED,"Player is not online");



Re: Player 1 is not online but he is (ONLY PLAYERID 1) - J0sh... - 26.03.2015

Quote:
Originally Posted by -=Dar[K]Lord=-
Посмотреть сообщение
Try this...

Код:
if(!IsPlayerConnected(id))return SendClientMessage(playerid,COLOR_RED,"Player is not online");
I have this check on some commands also. So I don't think that would work.


Re: Player 1 is not online but he is (ONLY PLAYERID 1) - X337 - 26.03.2015

deleted


Re: Player 1 is not online but he is (ONLY PLAYERID 1) - Abagail - 26.03.2015

It's possible the ID isn't being set properly. Are you using sscanf? It'd be useful in more code was shown within the context.


Re: Player 1 is not online but he is (ONLY PLAYERID 1) - J0sh... - 26.03.2015

pawn Код:
new id;
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "/test [id]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player is not online.");



Re: Player 1 is not online but he is (ONLY PLAYERID 1) - X337 - 26.03.2015

I think you defined INVALID_PLAYER_ID to ID 1


Re: Player 1 is not online but he is (ONLY PLAYERID 1) - J0sh... - 26.03.2015

How is that possible? I haven't defined anything along the lines "INVALID_PLAYER_ID" I just checked, twice.


Re: Player 1 is not online but he is (ONLY PLAYERID 1) - Abagail - 26.03.2015

If you use the "u" specifier you should not be using INVALID_PLAYER_ID. For that, you'd want to operate with "d", however simply change it to an IsPlayerConnected statement.

pawn Код:
if(IsPlayerConnected(playerid)) // ...



Re: Player 1 is not online but he is (ONLY PLAYERID 1) - J0sh... - 26.03.2015

Hmmm, I'll check it.

EDIT: Thank you!