[HELP] RCON and PLAYERID (PLEASE) - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] RCON and PLAYERID (PLEASE) (
/showthread.php?tid=129201)
[HELP] RCON and PLAYERID (PLEASE) -
Jack321 - 21.02.2010
Please, help-me!
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(!success)
{
}
else
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
SendRMsg(playerid,COLOR2, "You has logged as RCON Adminitrator. Account: %s", PlayerName(playerid));
}
}
message not appears, and my error is: undefined symbol 'playerid', how to fix it?
Re: [HELP] RCON and PLAYERID (PLEASE) -
pyrodave - 21.02.2010
Try this, its untested, although it should work (unless theres a typo somewhere)
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(success) //why (!success) when just (success) ?
{
new PlayerIP[16]; //you need to compare the IP, not the name, max IP length is 16
for(new i=0; i<MAX_PLAYERS; i++) //loop through all the players
{
if(IsPlayerConnected(i))
{
GetPlayerIP(i, PlayerIP, 16);
if(!strcmp(PlayerIP,ip)) //compare the players ip to the login attempt
{
SendRMsg(i,COLOR2, "You have logged as an RCON Administrator. Account: %s", PlayerName(i)); //send the player who logged in a message (and fixed spelling of "Administrator")
break; //break out of the loop, you have found the player, so stop looping
}
}
}
}
return 1;
}
Indentation has gone a little crazy, sorry 'bout that.
Not sure also how your PlayerName function works, the
pawn Код:
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
Might have been required, but I took it that they wern't going to be needed, depends on how your PlayerName function works.
Re: [HELP] RCON and PLAYERID (PLEASE) -
Jack321 - 27.02.2010
not functioned!
Re: [HELP] RCON and PLAYERID (PLEASE) -
[HiC]TheKiller - 27.02.2010
Quote:
Originally Posted by JackNight
not functioned!
|
Do you mean it didn't work?
Re: [HELP] RCON and PLAYERID (PLEASE) -
Jack321 - 27.02.2010
yes, the message has showing to all players! This can't. the message showing for only player.
Re: [HELP] RCON and PLAYERID (PLEASE) -
Correlli - 27.02.2010
You have a code on this page -
https://sampwiki.blast.hk/wiki/OnRconLoginAttempt