Correct me if im wrong pls - 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: Correct me if im wrong pls (
/showthread.php?tid=331253)
Correct me if im wrong pls -
spd_sahil - 04.04.2012
this is a stock i made for getting id of a particluar inputted IP
pawn Код:
stock GetIPId(ip[])
{
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
new IPtest[256];
GetPlayerIp(i,IPtest,sizeof(IPtest));
if(!strcmp(ip,IPtest,true))
{
return i;
}
}
}
return -1;
}
Re: Correct me if im wrong pls -
eesh - 04.04.2012
nothing wrong in it. Change new IPtest[256]; to new IPtest[16];
Re: Correct me if im wrong pls -
spd_sahil - 04.04.2012
this doesnt seem to work but
pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(success)
{
new id = GetIPId(ip);
for(new k;k<MAX_PLAYERS;k++)
{
if(IsPlayerAdmin(k))
{
new string[256];
GetPlayerName(id,string,sizeof(string));
format(string,sizeof(string),"Rcon Login Success | %s has logged in | Ip - %s",string,ip);
SendClientMessage(k,COLOR_ADMIN,string);
print(string);
}
}
}
return 1;
}
Re: Correct me if im wrong pls -
eesh - 04.04.2012
try
pawn Код:
stock GetIPId(ip[])
{
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
new IPtest[16];
GetPlayerIp(i,IPtest,sizeof(IPtest));
if(strfind(ip,IPtest,true) != -1)
{
return i;
}
}
}
return -1;
}
Re: Correct me if im wrong pls -
spd_sahil - 04.04.2012
the onrconloginattemp aint working still , with your version of the stock