12.08.2012, 17:36
Hello, guys.
Just creating myself a challenge for the time being for creating logs for a gamemode.
Basically I want logs to be created each time someone connects or disconnects to the server. Currently I have made it so that does appear, but I want to go the extra step and tell me if they logged out with any weapons, and if so what ones.
An example of someone disconnecting:
Bob disconnected from the server. (Quit)
That is how it currently looks. But I want it so it shows if someone logged out with let's say a Desert Eagle.
It would look like this if they had one on them:
Bob disconnected from the server with a Desert Eagle [15 Ammo]. (Quit)
Here's what it looks like at the moment, but it does not show that a player had a weapon on him:
Just creating myself a challenge for the time being for creating logs for a gamemode.
Basically I want logs to be created each time someone connects or disconnects to the server. Currently I have made it so that does appear, but I want to go the extra step and tell me if they logged out with any weapons, and if so what ones.
An example of someone disconnecting:
Bob disconnected from the server. (Quit)
That is how it currently looks. But I want it so it shows if someone logged out with let's say a Desert Eagle.
It would look like this if they had one on them:
Bob disconnected from the server with a Desert Eagle [15 Ammo]. (Quit)
Here's what it looks like at the moment, but it does not show that a player had a weapon on him:
Код:
new File:lFile = fopen("Logs/connections.log", io_append), logData[178], fyear, fmonth, fday, fhour, fminute, fsecond, pip[16]; getdate(fyear, fmonth, fday); gettime(fhour, fminute, fsecond); GetPlayerIp(playerid, pip, sizeof(pip)); new weapons[13][2]; for (new i = 0; i<13; i++) { GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]); if(weapons[i][0] != 0 && weapons[i][1] != 0) { format(logData, sizeof(logData),"%02d-%02d-%04d [%02d:%02d:%02d] %s disconnected from the server with weapons %d with %d ammo\r\n", fmonth, fday, fyear, fhour, fminute, fsecond, GetName(playerid), weapons[i][0], weapons[i][1]); fwrite(lFile, logData); fclose(lFile); } else { switch(reason) { case 0: format(logData, sizeof(logData),"%02d-%02d-%04d [%02d:%02d:%02d] %s disconnected from the server. (Timed Out)\r\n", fmonth, fday, fyear, fhour, fminute, fsecond, GetName(playerid)); case 1: format(logData, sizeof(logData),"%02d-%02d-%04d [%02d:%02d:%02d] %s disconnected from the server. (Quit)\r\n", fmonth, fday, fyear, fhour, fminute, fsecond, GetName(playerid)); case 2: format(logData, sizeof(logData),"%02d-%02d-%04d [%02d:%02d:%02d] %s disconnected from the server. (Kicked/Banned)\r\n", fmonth, fday, fyear, fhour, fminute, fsecond, GetName(playerid)); } fwrite(lFile, logData); fclose(lFile); } }