[Errors] Array issues.
#1

Yo guys, been having this problem for over a week now, I just can't seem to fix it, I hope one of you can help me out here.

Errors:
pawn Код:
C:\Users\Bradley\Documents\LVCRP lol\nycrpv10(1).pwn(92191) : error 033: array must be indexed (variable "marriedto")
C:\Users\Bradley\Documents\LVCRP lol\nycrpv10(1).pwn(92191) : error 032: array index out of bounds (variable "sext")
C:\Users\Bradley\Documents\LVCRP lol\nycrpv10(1).pwn(92191) : error 006: must be assigned to an array
C:\Users\Bradley\Documents\LVCRP lol\nycrpv10(1).pwn(92191) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Piece of the script where the error occured:
pawn Код:
if(dialogid == FBI_CHECK && response)
    {
        new giveplayerid = ReturnUser(inputtext);
        new HistoryString[1024];
        new giveplayer[MAX_PLAYER_NAME];
        new sext[24];
        format(giveplayer,sizeof(giveplayer), "%s", GetPlayerNameEx(giveplayerid));
        new marriedto[MAX_PLAYER_NAME];
        format(marriedto,sizeof(marriedto), "%s", PlayerInfo[giveplayerid][pMarriedTo]);
//        new imarriedto[MAX_PLAYER_NAME];
//        format(imarriedto,sizeof(imarriedto), "%s", GetPlayerNameEx(marriedto));
        new married[20];
        strmid(married, PlayerInfo[giveplayerid][pMarriedTo], 0, strlen(PlayerInfo[giveplayerid][pMarriedTo]), 255);
        if(PlayerInfo[marriedto][pSex] == 1) { sext[24]  = "Husband"; } else { sext[24] = "Wife"; } // THIS IS THE LINE OF THE ERRORS
        if(giveplayerid != INVALID_PLAYER_ID)
        {
            format(string, sizeof(string), "Name : %s\n", GetPlayerNameEx(giveplayerid));
            strcat(HistoryString, string, sizeof(HistoryString));
            format(string, sizeof(string), "Crime : %s\n", PlayerCrime[giveplayerid][pAccusedof]);
            strcat(HistoryString, string, sizeof(HistoryString));
            format(string, sizeof(string), "Claimant : %s\n", PlayerCrime[giveplayerid][pVictim]);
            strcat(HistoryString, string, sizeof(HistoryString));
            format(string, sizeof(string), "Reported : %s\n", PlayerCrime[giveplayerid][pAccusing]);
            strcat(HistoryString, string, sizeof(HistoryString));
            format(string, sizeof(string), "Accused : %s\n", PlayerCrime[giveplayerid][pBplayer]);
            strcat(HistoryString, string, sizeof(HistoryString));
            format(string, sizeof(string), "Phone Number: : %d\n", PlayerInfo[giveplayerid][pPnumber]);
            strcat(HistoryString, string, sizeof(HistoryString));
            format(string, sizeof(string), "House Address 1 : MDC Address Code - %d\n", PlayerInfo[giveplayerid][pPhousekey]);
            strcat(HistoryString, string, sizeof(HistoryString));
            format(string, sizeof(string), "House Address 2 : MDC Address Code - %d\n", PlayerInfo[giveplayerid][pPhousekey2]);
            strcat(HistoryString, string, sizeof(HistoryString));
            format(string, sizeof(string), "%s : %s\n", sext, married);
            strcat(HistoryString, string, sizeof(HistoryString));

            if(PlayerInfo[giveplayerid][pProbationTime] != 0)
            {
                format(string, sizeof(string), "Probation : %d minutes left\n", PlayerInfo[giveplayerid][pProbationTime]);
                strcat(HistoryString, string, sizeof(HistoryString));
            }
            for(new i=0; i<MAX_PLAYERVEHICLES; i++)
            {
                if(PlayerVehicleInfo[giveplayerid][i][pvTicket] != 0)
                {
                    format(string, sizeof(string), "Vehicle registration: %d | Vehicle Name: %s | Ticket: $%d.\n",PlayerVehicleInfo[giveplayerid][i][pvId],GetVehicleName(PlayerVehicleInfo[giveplayerid][i][pvId]),PlayerVehicleInfo[giveplayerid][i][pvTicket]);
                    strcat(HistoryString, string, sizeof(HistoryString));
                }
            }
            new text1[20];
            new text2[20];
            new text3[20];
            new text4[20];
            if(PlayerInfo[giveplayerid][pCarLic] == 0) { text1 = "Not Passed"; }
            if(PlayerInfo[giveplayerid][pCarLic] == 1) { text1 = "Passed"; }
            if(PlayerInfo[giveplayerid][pCarLic] == 2) { text1 = "Suspended"; }
            if(PlayerInfo[giveplayerid][pCarLic] == 3) { text1 = "Cancelled"; }
            if(PlayerInfo[giveplayerid][pFlyLic]) { text4 = "Passed"; } else { text4 = "Not Passed"; }
            if(PlayerInfo[giveplayerid][pBoatLic]) { text2 = "Passed"; } else { text2 = "Not Passed"; }
            if(PlayerInfo[giveplayerid][pGunLic]) { text3 = "Passed"; } else { text3 = "Not Passed"; }
            format(string, sizeof(string), "-Drivers License: %s.\n", text1);
            strcat(HistoryString, string, sizeof(HistoryString));
            format(string, sizeof(string), "-Flying License: %s.\n", text4);
            strcat(HistoryString, string, sizeof(HistoryString));
            format(string, sizeof(string), "-Sailing License: %s.\n", text2);
            strcat(HistoryString, string, sizeof(HistoryString));
            format(string, sizeof(string), "-Weapon License: %s.\n", text3);
            strcat(HistoryString, string, sizeof(HistoryString));
            ShowPlayerDialog(playerid, FBI_CHECK_END, DIALOG_STYLE_LIST, "FBI-MDC | Criminal History", HistoryString, "OK", "Cancel");
            format(string, sizeof(string), " DISPATCH: %s has run a check for warrants on %s ", GetPlayerNameEx(playerid), giveplayer);
            SendRadioMessage(1, COLOR_DBLUE, string);
            SendRadioMessage(2, COLOR_DBLUE, string);
            SendRadioMessage(3, COLOR_DBLUE, string);
            return 1;
        }
        else
        {
            ShowPlayerDialog(playerid, MDC_END_ID, DIALOG_STYLE_MSGBOX, "NY-MDC - Logged in | ERROR ", "There is no record of that person.", "OK", "Cancel");
            return 1;
        }
    }

I'll HIGHLY appreciate it if you just send the fix in the replies, instead of telling me how I need to fix it, cause I think I won't completely understand how, as I'm not a VERY experienced scripter.
Thanks,
- Bradley
Reply
#2

why you use sext[24] again ? just use sext

pawn Код:
if(PlayerInfo[marriedto][pSex] == 1) { sext = "Husband"; } else { sext = "Wife"; } // TRY THIS NOW
Reply
#3

Tried it, it gives me the following error:
Код:
C:\Users\Bradley\Documents\LVCRP lol\nycrpv10(1).pwn(92191) : error 033: array must be indexed (variable "marriedto")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
pawn Код:
new giveplayerid = ReturnUser(inputtext);
        new HistoryString[1024];
        new giveplayer[MAX_PLAYER_NAME];
        new sext[24];
        format(giveplayer,sizeof(giveplayer), "%s", GetPlayerNameEx(giveplayerid));
        new marriedto[MAX_PLAYER_NAME];
        format(marriedto,sizeof(marriedto), "%s", PlayerInfo[giveplayerid][pMarriedTo]);
//        new imarriedto[MAX_PLAYER_NAME];
//        format(imarriedto,sizeof(imarriedto), "%s", GetPlayerNameEx(marriedto));
        new married[20];
        strmid(married, PlayerInfo[giveplayerid][pMarriedTo], 0, strlen(PlayerInfo[giveplayerid][pMarriedTo]), 255);
        if(PlayerInfo[marriedto][pSex] == 1) { sext = "Husband"; } else { sext = "Wife"; } // [ON THIS LINE]
        if(giveplayerid != INVALID_PLAYER_ID)
Reply
#4

I think it has to do with marriedto being a string, but needs to be defined as a player, but I dont know how...
Reply
#5

Anyone?
Reply
#6

show us that where you defined marriedto
Reply
#7

It's right up the first post. and the other post of mine.
Reply
#8

try only
pawn Код:
new marriedto;
Reply
#9

Then it doesn't define that
Код:
marriedto
should be defined as the person who
Код:
giveplayerid
is married to in the
Код:
[pMarriedTo]
, does it?
Reply
#10

Ooh nevermind, missunderstood your suggestion back there, I'll try it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)