Help not showing logs
#1

Код:
					format(string,sizeof(string), "Name:%s\r\n",Name, (result));
					format(string,sizeof(string), "Date:(%d/%d/%d)[%d:%d:%d]\r\n",d,m,y,h,mi,s, (result));
					format(string,sizeof(string), "Reason:%s\r\n",Reason, (result));
					format(string,sizeof(string), "Banned By:%s\r\n",AdminName, (result));
Reply
#2

Use, strcat.

Exemple:

pawn Код:
new dia1[50], dia2[50];
format(dia1, sizeof(dia1), " Playerid %d\n", playerid); strcat(dia2, dia1);
format(dia1, sizeof(dia1), " Money %d", GetPlayerMoney(playerid)); strcat(dia2, dia1);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Dialog", dia2, "Okay", "");
Reply
#3

in dis command


Код:
// Bans a player for (days, hours, minutes, seconds)
COMMAND:ban(playerid, params[])
{
    new string[128];
    new result[128];
    new y, m, d;
    new h,mi,s;
    getdate(y,m,d);
    gettime(h,mi,s);
	// Setup local variables
	new PlayerToBan, Days, Hours, Reason[128], TotalBanTime, Msg[128], Name[24], AdminName[24];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/ban", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 3
		if (APlayerData[playerid][PlayerLevel] >= 3)
		{
			if (sscanf(params, "uiis[128]", PlayerToBan, Days, Hours, Reason))
				SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/ban <PlayerToBan> <Days> <Hours> <Reason>\"");
			else
			{
				if (IsPlayerConnected(PlayerToBan))
				{
					// Get the names of the player and the admin who executed the ban
					GetPlayerName(playerid, AdminName, sizeof(AdminName));
					GetPlayerName(PlayerToBan, Name, sizeof(Name));

					// Increase the number of bans
					APlayerData[PlayerToBan][Bans]++;
					// Calculate the total bantime (when the player can login again)
					TotalBanTime = (Days * 86400) + (Hours * 3600) + gettime();
					// Check if this is the player's 5th ban
					if (APlayerData[PlayerToBan][Bans] == 5)
						APlayerData[PlayerToBan][BanTime] = 2147483640; // Make the ban permanent (as high as it can go)
					else
						APlayerData[PlayerToBan][BanTime] = TotalBanTime; // Store this value for the player

					// Inform the player about his ban
					// Check if this is the player's 5th ban
					if (APlayerData[PlayerToBan][Bans] == 5)
					{
						format(Msg, 128, "You have been banned permanently by %s, this was your 5th ban", AdminName);
						SendClientMessage(PlayerToBan, 0x808080FF, Msg);
					}
					else
					{
						format(Msg, 128, "You have been banned by %s for %i days and %i hours", AdminName, Days, Hours);
						SendClientMessage(PlayerToBan, 0xFF0000AA, Msg);
						format(Msg, 128, "Reason: %s", Reason);
						SendClientMessage(PlayerToBan, 0xFF0000AA, Msg);
						format(Msg, 128, "You've been banned %i times now, 5th time is permament", APlayerData[PlayerToBan][Bans]);
						SendClientMessage(PlayerToBan, 0xFF0000AA, Msg);
					}

					// Kick the player (his data will be saved)
					Kick(PlayerToBan);

					// Inform everybody else which player was banned and for how long
					format(string,sizeof(string), "Name:%s\r\n",Name, (result));
					format(string,sizeof(string), "Date:(%d/%d/%d)[%d:%d:%d]\r\n",d,m,y,h,mi,s, (result));
					format(string,sizeof(string), "Reason:%s\r\n",Reason, (result));
					format(string,sizeof(string), "Banned By:%s\r\n",AdminName, (result));
					BanLog(string);
                    format(Msg, 128, "%s %s has banned %s for %i days and %i hours", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name, Days, Hours);
					SendClientMessageToAll(0xAA3333AA, Msg);
				}
			}
		}
		else
		    return 0;
	}
	else
	    return 0;

	return 1;
}
Reply
#4

I use strcat for my command lists. For example, this works perfectly...

pawn Код:
CMD:acmds(playerid, params[])
{
    new
        szMainString[1600]
    ;
   
    strcat(szMainString, ""#CELB"/(a)dmin\t\t\t "#CEW"will allow you to speak with other admins\n");
    strcat(szMainString, ""#CELB"/kick [nick/id] [reason]\t\t"CEW" will kick a player from the server\n");
    strcat(szMainString, ""#CELB"/ban [nick/id]\t\t\t"#CEW" will ban a player from the server\n");
   
    ShowPlayerDialog(playerid, diagACMDS, DIALOG_STYLE_MSGBOX, "Admin Commands",  szMainString, "OK", "");
    return 1;
}
Reply
#5

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
in dis command


Код:
// Bans a player for (days, hours, minutes, seconds)
COMMAND:ban(playerid, params[])
{
    new string[128];
    new result[128];
    new y, m, d;
    new h,mi,s;
    getdate(y,m,d);
    gettime(h,mi,s);
	// Setup local variables
	new PlayerToBan, Days, Hours, Reason[128], TotalBanTime, Msg[128], Name[24], AdminName[24];

	// Send the command to all admins so they can see it
	SendAdminText(playerid, "/ban", params);

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 3
		if (APlayerData[playerid][PlayerLevel] >= 3)
		{
			if (sscanf(params, "uiis[128]", PlayerToBan, Days, Hours, Reason))
				SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/ban <PlayerToBan> <Days> <Hours> <Reason>\"");
			else
			{
				if (IsPlayerConnected(PlayerToBan))
				{
					// Get the names of the player and the admin who executed the ban
					GetPlayerName(playerid, AdminName, sizeof(AdminName));
					GetPlayerName(PlayerToBan, Name, sizeof(Name));

					// Increase the number of bans
					APlayerData[PlayerToBan][Bans]++;
					// Calculate the total bantime (when the player can login again)
					TotalBanTime = (Days * 86400) + (Hours * 3600) + gettime();
					// Check if this is the player's 5th ban
					if (APlayerData[PlayerToBan][Bans] == 5)
						APlayerData[PlayerToBan][BanTime] = 2147483640; // Make the ban permanent (as high as it can go)
					else
						APlayerData[PlayerToBan][BanTime] = TotalBanTime; // Store this value for the player

					// Inform the player about his ban
					// Check if this is the player's 5th ban
					if (APlayerData[PlayerToBan][Bans] == 5)
					{
						format(Msg, 128, "You have been banned permanently by %s, this was your 5th ban", AdminName);
						SendClientMessage(PlayerToBan, 0x808080FF, Msg);
					}
					else
					{
						format(Msg, 128, "You have been banned by %s for %i days and %i hours", AdminName, Days, Hours);
						SendClientMessage(PlayerToBan, 0xFF0000AA, Msg);
						format(Msg, 128, "Reason: %s", Reason);
						SendClientMessage(PlayerToBan, 0xFF0000AA, Msg);
						format(Msg, 128, "You've been banned %i times now, 5th time is permament", APlayerData[PlayerToBan][Bans]);
						SendClientMessage(PlayerToBan, 0xFF0000AA, Msg);
					}

					// Kick the player (his data will be saved)
					Kick(PlayerToBan);

					// Inform everybody else which player was banned and for how long
					format(string,sizeof(string), "Name:%s\r\n",Name, (result));
					format(string,sizeof(string), "Date:(%d/%d/%d)[%d:%d:%d]\r\n",d,m,y,h,mi,s, (result));
					format(string,sizeof(string), "Reason:%s\r\n",Reason, (result));
					format(string,sizeof(string), "Banned By:%s\r\n",AdminName, (result));
					BanLog(string);
                    format(Msg, 128, "%s %s has banned %s for %i days and %i hours", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name, Days, Hours);
					SendClientMessageToAll(0xAA3333AA, Msg);
				}
			}
		}
		else
		    return 0;
	}
	else
	    return 0;

	return 1;
}
Sorry, I thought you were using dialog.

Finally, use the format and then immediately SendClientMessage.

Here's an example:

pawn Код:
new text[100];
format(text, sizeof(text), " Playerid %d ", playerid);
SendClientMessage(playerid, -1, text);
format(text, sizeof(text), " Money %d ", GetPlayerMoney(playerid));
SendClientMessage(playerid, -1, text);
Remove the \n and \r, not necessary in SendClientMessage...
Reply
#6

?? That's stats...
Reply
#7

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
?? That's stats...
Just an example of how to do in your script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)