20.09.2012, 14:46
Hello, Im trying to make something in my command that saves the date at the PMLog together with the message
pawn Код:
command(pm, playerid, params[])
{
new string[128],string1[128],string2[128],string3[128], message[128], id;
new Year, Month, Day, Date[128];
new Year1, Month1, Day1, Date1[128];
if(sscanf(params, "uz", id, message))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /pm [playerid] [message]");
}
else
{
if(IsPlayerConnectedEx(id))
{
if(strlen(message) >= 1)
{
if(Player[id][PMsEnabled] == 1)
{
getdate(Year, Month, Day);
format(string1, sizeof(string1), "[%02d/%02d/%d] ", Day, Month, Year);
format(string, sizeof(string), "((PM to %s(ID: %d): %s)) ", GetName(id), id, message);
SendClientMessage(playerid, YELLOW, string);
Date[128] = strcat(string1, string);
PMsLog(Date);
getdate(Year1, Month1, Day1);
format(string2, sizeof(string2), "[%02d/%02d/%d] ", Day, Month, Year);
format(string3, sizeof(string3), "((PM to %s(ID: %d): %s)) ", GetName(playerid), playerid, message);
SendClientMessage(id, YELLOW, string);
Date1[128] = strcat(string2, string3);
PMsLog(Date1);
}
else
{
SendClientMessage(playerid, WHITE, "That player has disabled PMs!");
}
}
else
{
SendClientMessage(playerid, WHITE, "SYNTAX: /pm [playerid] [message]");
}
}
else
{
SendClientMessage(playerid, WHITE, "That player is not connected or isn't logged in.");
}
}
return 1;
}
Код:
C:\Users\Stefan Dorst\Desktop\Scratch RolePlay\gamemodes\RP.pwn(979) : error 032: array index out of bounds (variable "Date") C:\Users\Stefan Dorst\Desktop\Scratch RolePlay\gamemodes\RP.pwn(986) : error 032: array index out of bounds (variable "Date1") Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 2 Errors.