Another problem (Shame on me : l)
#1

pawn Код:
COMMAND:recruit(playerid,params[])
{
    new f[60];
    if(PlayerInfo[playerid][pFrank] <9) return SendClientMessage(playerid,COLOR_GREY,"You have to be rank 9 in a faction to use this command");
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_GREY,"/recruit [playerid]");
    GetPlayerName(playerid,Name,sizeof(Name));
    f = dini_Get(file, "Faction");
    format(String,sizeof(String),"You are invited for %s by %s",f,Name);
    ShowPlayerDialog(playerid,FINVITE,DIALOG_STYLE_MSGBOX,"Invited",String,"","");
    return 1;
}
Код:
C:\Users\Bart\Desktop\infinityrp\gamemodes\infinityrp.pwn(510) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Error line
pawn Код:
f = dini_Get(file, "Faction");
Reply
#2

I get that error a lot. I cant remember how i fix it though. But I think this should work.

pawn Код:
COMMAND:recruit(playerid,params[])
{
    if(PlayerInfo[playerid][pFrank] <9) return SendClientMessage(playerid,COLOR_GREY,"You have to be rank 9 in a faction to use this command");
    if(sscanf(params,"u",id)) return SendClientMessage(playerid,COLOR_GREY,"/recruit [playerid]");
    GetPlayerName(playerid,Name,sizeof(Name));
    format(String,sizeof(String),"You are invited for %s by %s",dini_Get(file, "Faction");,Name);
    ShowPlayerDialog(playerid,FINVITE,DIALOG_STYLE_MSGBOX,"Invited",String,"","");
    return 1;
}
Reply
#3

Thanks it works. Yes, I have this error alot as well this evening.
Reply
#4

Your array size needs to be MAX_STRING when using dini_Get, otherwise it will return that error.
Reply
#5

How to do this with this line?
PlayerInfo[id][pFinvitedfor] = dini_Get(file, "Faction");
Reply
#6

pawn Код:
strmid(PlayerInfo[id][pFinvitedfor], dini_Get(file, "Faction"), false, strlen(dini_Get(file, "Faction")), 64);
I'm sure i thought you this 3 times now .>,

strmid is faster than format
Reply
#7

Haha sorry.
Thanks, it works. I think I should take some rest because my brains are working for 20% now xD

Byebye.
Reply
#8

Just to add to that, the way I prevent that error is to set the array size to 260, for some reason it works with 260 and above.

I know my post is 5 hours late but it might help someone.....
Reply
#9

That's to hard...
I'd just do a simple format
pawn Код:
format(PlayerInfo[id][pFinvitedfor], sizeof(PlayerInfo[id][pFinvitedfor]),"%s",dini_Get(file, "Faction")
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)