error 047 - Help Me !
#1

How to fix this errors ?

Quote:

E:\Folder Dion\SA-MP\Server\0.3z\Freeroam\Y_INI Project\gamemodes\RgX.pwn(10287) : error 047: array sizes do not match, or destination array is too small
E:\Folder Dion\SA-MP\Server\0.3z\Freeroam\Y_INI Project\gamemodes\RgX.pwn(10297) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

This is the Code :
Код:
public StoreChatLine(playerid,text[])
{
	 for(new i = 0; i < MAX_CHAT_MSGS_STORE-1; i++)
	 ChatMessages[i] = ChatMessages[i+1];
	 format(Jstring,sizeof(Jstring),"%s(ID: %d): %s",GetName(playerid),playerid,text);
	 ChatMessages[MAX_CHAT_MSGS_STORE-1] = Jstring;
}

public StoreReport(playerid,reported,reason[])
{
     new hour,minute,second;
	 gettime(hour,minute,second);
	 for(new i = 0; i < MAX_REPORTS_STORE-1; i++)
	 Reports[i] = Reports[i+1];
	 format(Jstring,sizeof(Jstring),"%d:%d:%d - %s(ID: %d) Has Reported %s(ID: %d) |{FF0000} REASON: %s ",hour,minute,second,GetName(playerid),playerid,GetName(reported),reported,reason);
	 Reports[MAX_REPORTS_STORE-1] = Jstring;
}
Lines 10287 :
Код:
ChatMessages[MAX_CHAT_MSGS_STORE-1] = Jstring;
Lines 10297 :
Код:
Reports[MAX_REPORTS_STORE-1] = Jstring;
Please Help me !
Reply
#2

You can't copy strings that way. Also: you don't need the temporary string variable:

pawn Код:
format(Jstring,sizeof(Jstring),"%d:%d:%d - %s(ID: %d) Has Reported %s(ID: %d) |{FF0000} REASON: %s ",hour,minute,second,GetName(playerid),playerid,GetName(reported),reported,reason);
Reports[MAX_REPORTS_STORE-1] = Jstring;

//changes into

format(Reports[MAX_REPORTS_STORE-1],sizeof(Reports[]),"%d:%d:%d - %s(ID: %d) Has Reported %s(ID: %d) |{FF0000} REASON: %s ",hour,minute,second,GetName(playerid),playerid,GetName(reported),reported,reason);

//and
format(Jstring,sizeof(Jstring),"%s(ID: %d): %s",GetName(playerid),playerid,text);
ChatMessages[MAX_CHAT_MSGS_STORE-1] = Jstring;
//into
format(ChatMessages[MAX_CHAT_MSGS_STORE-1],sizeof(ChatMessages[]),"%s(ID: %d): %s",GetName(playerid),playerid,text);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)