SA-MP Forums Archive
[HELP] Problems with a log - 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] Problems with a log (/showthread.php?tid=204235)



[HELP] Problems with a log - Larsey123IsMe - 29.12.2010

Something is wrong with the GetPlayerIP...
pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\PlayerConnectLog.pwn(49) : error 017: undefined symbol "playerid"
pawn Код:
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);
}



Re: [HELP] Problems with a log - Joe Staff - 29.12.2010

Your callback "ConnectLog" doesn't have a playerid parameter.

pawn Код:
forward ConnectLog(playerid,string[]);
public ConnectLog(playerid,string[])
{
    //Your code
}
//To use
ConnectLog(playerid,"This is going to be logged");



Re: [HELP] Problems with a log - Larsey123IsMe - 29.12.2010

And if i want to make a ban log?

pawn Код:
#define BAN_LOG     "BanLog/Banned.log"
forward BanLog(string[]);
pawn Код:
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);
}
EXAMPLE BAN:
pawn Код:
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;
}



AW: [HELP] Problems with a log - Extremo - 29.12.2010

Then its simply:
pawn Код:
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);
}
pawn Код:
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;
}



Re: [HELP] Problems with a log - Larsey123IsMe - 29.12.2010

pawn Код:
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



Re: [HELP] Problems with a log - Mean - 29.12.2010

Use a Loop.
pawn Код:
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!");
}
just an example usage.


Re: [HELP] Problems with a log - Larsey123IsMe - 29.12.2010

Quote:
Originally Posted by Mean
Посмотреть сообщение
Use a Loop.
pawn Код:
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!");
}
just an example usage.
How? :P


Re: [HELP] Problems with a log - [03]Garsino - 29.12.2010

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);
}
What you do is that you simply replace the "playerid" parameter in the code by "i" when calling the function


Re: [HELP] Problems with a log - Larsey123IsMe - 29.12.2010

Thanks