"Array sizes do not match, or destination array is too small"
#1

Can't see anything wrong with the code but I am getting the following error;
Код:
C:\Users\Greg\Desktop\Los Angeles\gamemodes\LARP.pwn(58797) : error 047: array sizes do not match, or destination array is too small
Lines
pawn Код:
else if(PlayerInfo[giveplayerid][pLeader] == 2) { ftext = "Federal Bureau of Investigation"; }
Reply
#2

show us your Enum of your PlayerInfo stats, and your PlayerInfo[players][enumeration]; variable
Reply
#3

pawn Код:
enum pInfo
{
    pKey[129],
    pLevel,
    pAdmin,
    pCookies,
    pDonateRank,
    gPupgrade,
    pConnectTime,
    pReg,
    pSex,
    pFirework1,
    pFirework2,
    pFirework3,
    pFirework,
    pAge,
    pOrigin,
    pCK,
    pCash,
    pHospital,
    pMuted,
    pPrisonReason[128],
    pPrisonedBy[MAX_PLAYER_NAME],
    pFlag[128],
    pRMuted,
    pRMutedTotal,
    pRMutedTime,
    pVMuted,
    pVMutedTime,
    pCMuted,
    pCMutedTime,
    pFactionModerator,
    pAdvisorModerator,
    pGangModerator,
    pExp,
    pAccount,
    pCrimes,
    pPaintTeam,
    pKills,
    pDeaths,
    pArrested,
    pWantedDeaths,
    pPhoneBook,
    pLottoNr,
    pFishes,
    pToggedVIPChat,
    pBiggestFish,
    pJob,
    pAutoTextReply[64],
    pPhonePrivacy,
    pJob2,
    pNMute,
    pNMuteTotal,
    pADMute,
    pADMuteTotal,
    pHelpMute,
    pPayCheck,
    pHeadValue,
    pJailed,
    pJailTime,
    pWRestricted,
    pMats,
    pBriefCase,
    pBCash,
    pBCrack,
    pBPot,
    pBMats,
    pPackages,
    pGM,
    pLeader,
    pMember,
    pDivision,
    pFMember,
    pSpeakerPhone,
    pRank,
    pChar,
    pStreetRep,
    pRepHandOut,
    pDetSkill,
    pSexSkill,
    pBoxSkill,
    pLawSkill,
    pMechSkill,
    pJackSkill,
    pCarSkill,
    pTruckSkill,
    pWantedLevel,
    pGunSkill,
    pGoods,
    pSMats,
    pPot,
    pCrack,
    pMeth,
    pSDrugs,
    pMInsure,
    pPcarkey,
    pPcarkey2,
    pPcarkey3,
    pBadgeNumber,
    pHasFakeBadge,
    pFakeBadge,
    pFakeRank,
    pBarricade,
    pHelper,
    pNewsSkill,
    pDrugsSkill,
    pArmsSkill,
    pSmugSkill,
    pCookSkill,
    pFishSkill,
    Float:pHealth,
    Float:pArmor,
    Float:pSArmor,
    Float:pSHealth,
    pInt,
    pLocal,
    pTeam,
    pModel,
    pPnumber,
    pPhousekey,
    pPhousekey2,
    pPbiskey,
    pPgaragekey,
    Float:pPos_x,
    Float:pPos_y,
    Float:pPos_z,
    Float:pPos_r,
    pCarLic,
    pFlyLic,
    pBoatLic,
    pFishLic,
    pGunLic,
    pGuns[12],
    pAGuns[12],
    pCarTime,
    pPayDay,
    pPayDayHad,
    pCDPlayer,
    pWins,
    pLoses,
    pAlcoholPerk,
    pDrugPerk,
    pMiserPerk,
    pPainPerk,
    pTraderPerk,
    pTut,
    pAdminDuty,
    pWarns,
    pAdjustable,
    pMarried,
    pC4,
    pC4Get,
    pC4Used,
    pMarriedTo[128],
    pLock,
    pLockCar,
    pSprunk,
    pCigar,
    pPole,
    pSpraycan,
    pFuelcan,
    pRope,
    pDice,
    pBombs,
    pDuty,
    pFightStyle,
    pIP[32],
    pLastActive[32],
    pBanned,
    pPermaBanned,
    pDisabled,
    pAccent,
    pCHits,
    pFHits,
    pCrates,
    pVW,
    pHouseInvite,
    pClothes,
    pRenting,
    pVehicles,
    pVehFile,
    pVehActive,
    pType1,
    pTempVIP,
    pBuddyInvited,
    pVIPInviteDay,
    pTokens,
    pPaintTokens,
    pType2,
    pType3,
    pType4,
    pType5,
    pDrugsTime,
    pLawyerTime,
    pGangWarn,
    pFactionBanned,
    pCSFBanned,
    pMechTime,
    pSexTime,
    pLawyerFreeTime,
    pGiftTime,
    pContractBy[32],
    pContractDetail[64],
    pBanAppealer,
    pShopTech,
    pUndercover,
    pTogReports,
    pRadio,
    pRadioFreq,
    pDutyHours,
    pAcceptedHelp,
    pAcceptReport,
    pTrashReport,
    pInsurance,
    pTriageTime,
    pVehicleKeys,
    pVehicleKeysFrom,
    pTaxiLicense,
    pTicketTime,
    pScrewdriver,
    pSmslog,
    pSmslog0[256],
    pSmslog1[256],
    pSmslog2[256],
    pSmslog3[256],
    pSmslog4[256],
    pSmslog5[256],
    pSmslog6[256],
    pSmslog7[256],
    pSmslog8[256],
    pSmslog9[256],
    pKillLog0[256],
    pKillLog1[256],
    pKillLog2[256],
    pKillLog3[256],
    pKillLog4[256],
    pKillLog5[256],
    pKillLog6[256],
    pKillLog7[256],
    pKillLog8[256],
    pKillLog9[256],
    pWristwatch,
    pSurveillance,
    pTire,
    pFirstaid,
    pRccam,
    pReceiver,
    pGPS,
    pSweep,
    pSweepLeft,
    pBugged,
    pCheckCash,
    pChecks,
    pWExists,
    Float:pWX,
    Float:pWY,
    Float:pWZ,
    pWVW,
    pWInt,
    pWValue,
    pWObject,
    pWTimer,
    pWSeeds,
    pWarrant[128],
    pJudgeJailTime,
    pJudgeJailType,
    pBeingSentenced,
    pProbationTime,
    pDMIndicators,
    pDMReport0[63],
    pDMReport1[63],
    pDMReport2[63],
    pDMReport3[63],
    pDMReport4[63],
    pDMReport5[63],
    pDMReport6[63],
    pDMReport7[63],
    pDMReport8[63],
    pDMReport9[63],
    pDMKills,
    pOrder,
    pOBlocked,
    pCallsAccepted,
    pPatientsDelivered,
    pLiveBanned,
    pFreezeBank,
    pServiceTime,
};
new PlayerInfo[MAX_PLAYERS+1][pInfo];
This?
Reply
#4

yes, but why do you have "MAX_PLAYERS+1"?

also, are you sure that is the line with the error? because everything seems fine, except for ^^.
Reply
#5

ERRORS:
Код:
C:\Users\Greg\Desktop\Los Angeles\gamemodes\LARP.pwn(48051) : warning 202: number of arguments does not match definition
C:\Users\Greg\Desktop\Los Angeles\gamemodes\LARP.pwn(58792) : error 047: array sizes do not match, or destination array is too small
C:\Users\Greg\Desktop\Los Angeles\gamemodes\LARP.pwn(58794) : error 047: array sizes do not match, or destination array is too small
C:\Users\Greg\Desktop\Los Angeles\gamemodes\LARP.pwn(58797) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Код:
C:\Users\Greg\Desktop\Los Angeles\gamemodes\LARP.pwn(58792) : error 047: array sizes do not match, or destination array is too small
pawn Код:
else if(PlayerInfo[giveplayerid][pLeader] == 2) { ftext = "Federal Bureau of Investigation"; }
Код:
C:\Users\Greg\Desktop\Los Angeles\gamemodes\LARP.pwn(58794) : error 047: array sizes do not match, or destination array is too small
pawn Код:
else if(PlayerInfo[giveplayerid][pLeader] == 4) { ftext = "Fire Department of San Andreas"; }
Код:
C:\Users\Greg\Desktop\Los Angeles\gamemodes\LARP.pwn(58797) : error 047: array sizes do not match, or destination array is too small
pawn Код:
else if(PlayerInfo[giveplayerid][pLeader] == 7) { ftext = "San Andreas Department of Public Safety"; }
Reply
#6

Use format().
Reply
#7

Quote:
Originally Posted by MP2
Посмотреть сообщение
Use format().
Sorry, what?
Reply
#8

Use format() to copy the string.

pawn Код:
format(dest, sizeof(dest), "%s", source);
I believe your method only works if the arrays are the exact same size, like so:

pawn Код:
new string[6];
string = "Hello"; // Hello is 5 characters, plus 1 'null-terminating' character
Reply
#9

Quote:
Originally Posted by MP2
Посмотреть сообщение
Use format() to copy the string.

pawn Код:
format(dest, sizeof(dest), "%s", source);
Can you tell me the code to input?
Reply
#10

To be honest you should use an array for this.

pawn Код:
new strJobTitles[][] = {
"Federal blah blah of investigatoitaeitodaeskl",
"Fire dept",
"Police",
"blah blah"
};
Then instead of 'ftext' use this:

pawn Код:
strJobTitles[PlayerInfo[giveplayerid][pLeader]]
Reply


Forum Jump:


Users browsing this thread: