C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\PlayerConnectLog.pwn(49) : error 017: undefined symbol "playerid"
public ConnectLog(string[])
{
new Year, Month, Day;
getdate(Year, Month, Day);
new PlayerIP[16];
GetPlayerIp(playerid, PlayerIP, sizeof(PlayerIP));
new entry[256];
format(entry, sizeof(entry), "[%02d.%02d.%d] {%d} %s\r\n",Day, Month, Year, PlayerIP, string);
new File:hFile;
hFile = fopen(CONNECT_LOG, io_append);
fwrite(hFile, entry);
fclose(hFile);
}
forward ConnectLog(playerid,string[]);
public ConnectLog(playerid,string[])
{
//Your code
}
//To use
ConnectLog(playerid,"This is going to be logged");
#define BAN_LOG "BanLog/Banned.log"
forward BanLog(string[]);
public BanLog(string[])
{
new Year, Month, Day;
getdate(Year, Month, Day);
new PlayerIP[16];
GetPlayerIp(playerid, PlayerIP, sizeof(PlayerIP));
new entry[256];
format(entry, sizeof(entry), "[%02d.%02d.%d] {%d} %s\r\n",Day, Month, Year, PlayerIP, string);
new File:hFile;
hFile = fopen(BAN_LOG, io_append);
fwrite(hFile, entry);
fclose(hFile);
}
public OnPlayerSpawn(playerid)
{
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Ban Log: %s(%d) spanwned to fast", name, playerid);
BanLog(string);
return 1;
}
public BanLog(playerid, string[])
{
new Year, Month, Day;
getdate(Year, Month, Day);
new PlayerIP[16];
GetPlayerIp(playerid, PlayerIP, sizeof(PlayerIP));
new entry[256];
format(entry, sizeof(entry), "[%02d.%02d.%d] {%d} %s\r\n",Day, Month, Year, PlayerIP, string);
new File:hFile;
hFile = fopen(BAN_LOG, io_append);
fwrite(hFile, entry);
fclose(hFile);
}
public OnPlayerSpawn(playerid)
{
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Ban Log: %s(%d) spanwned to fast", name, playerid);
BanLog(playerid, string); // playerid equals to the playerid of the banned person, make sure to log this before you ban the user!
return 1;
}
How to change the:
playerid
to
i
because im making a anticheat code atm... and it wont work with playerid...
---argument type mismatch (argument 1)--- If i change to i
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 15.0, x, y, z)) return SendClientMessage(playerid, COLOR, "Yay! You are in range!");
}
Use a Loop.
pawn Код:
|
// Use stocks for functions, not callbacks (unless you're going to use a timer to call the callback)
stock BanLog(playerid, string[])
{
new Year, Month, Day;
getdate(Year, Month, Day);
new PlayerIP[16];
GetPlayerIp(playerid, PlayerIP, sizeof(PlayerIP));
new entry[256];
format(entry, sizeof(entry), "[%02d.%02d.%d] {%s} %s\r\n",Day, Month, Year, PlayerIP, string);
new File:hFile;
hFile = fopen(BAN_LOG, io_append);
fwrite(hFile, entry);
fclose(hFile);
}