SA-MP Forums Archive
Another problem (Shame on me : l) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Another problem (Shame on me : l) (/showthread.php?tid=264637)



Another problem (Shame on me : l) - bartje01 - 26.06.2011

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");



Re: Another problem (Shame on me : l) - willsuckformoney - 26.06.2011

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;
}



Re: Another problem (Shame on me : l) - bartje01 - 26.06.2011

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


Re: Another problem (Shame on me : l) - Revolutionary Roleplay - 27.06.2011

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


Re: Another problem (Shame on me : l) - bartje01 - 27.06.2011

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


Re: Another problem (Shame on me : l) - Donya - 27.06.2011

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


Re: Another problem (Shame on me : l) - bartje01 - 27.06.2011

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

Byebye.


Re: Another problem (Shame on me : l) - Tee - 27.06.2011

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.....


Re: Another problem (Shame on me : l) - FireCat - 27.06.2011

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")