CMD:ip(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 1) {
if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /ip [playerid]");
new player1 = strval(params), string[128];
if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
CMDMessageToAdmins(playerid,"IP");
new tmp3[50]; GetPlayerIp(player1,tmp3,50);
format(string,sizeof(string),"\"%s's\" ip is '%s'", pName(player1), tmp3);
return SendClientMessage(playerid,blue,string);
} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
new name[MAX_PLAYER_NAME];
new string[60];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(string,sizeof(string),"SaveFolderForIP/%s.ini", name);
if(dini_Exists(string))
{
/*
If the file exist, get the IP stored inside.
*/
return true;
}
//top of scripts
#define strcpy(%0,%1) \
strcat((%0[0] = '\0', %0), %1)
#define MAX_PLAYERS_FILE 9000
new offlineplayerstr[64];
new tmpstr[64];
CMD:offlineinfo(playerid,params[])
{
if(PlayerInfo[playerid][Level] >= 1)
{
if(sscanf(params, "s[25]", offlineplayerstr)) return SendClientMessage(playerid, COLOR_RED1, "[SYSTEM][EXPLAIN] :/offlineinfo (playername)")
else
{
LoadPlayerInfoOffline();
SCM(playerid,COLOR_YELLOW,tmpstr);
}
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
LoadPlayerInfoOffline()
{
for (new i=0 ; i < MAX_PLAYERS_FILE ; i++)
{
new file[100];
new tmploadname[64],tmpip[28];
format(file,sizeof(file),"saveuser/%s.ini",offlineplayerstr);
if(!dini_Exists(file))
{
/*get player info blahg blah your condition
like example of this*/
strcpy(tmpip,dini_Get(file,"Player IP:"),28); //copy str need strcpy
format(tmpstr,sizeof(tmpstr),"Player Name %s , Player IP %s",offlineplayerstr,tmpip);
}
}
return tmpstr;
}
Why get IP ? its worse
Player IP can change everytime they leave or connect I prefer to load User Data Better its more worth try this ( this is example idea ) PHP код:
|
forward LoadPlayerInfoOffline();
LoadPlayerInfoOffline()
{
Doesn't need to public or stock...
A function alone will suffice. PHP код:
|
LoadPlayerInfoOffline()
{
You don't need to forward it even,
PHP код:
|
For someone who doesn't know, could you explain the difference?
|