Few errors, can't fix it, help!
#1

Yo guys, I've been doing some work on a new kind of dialog, but I can't seem to fix some certain errors.
Please help me out here :/


Код:
        new giveplayerid = ReturnUser(inputtext);
        new HistoryString[1024];
        new giveplayer[MAX_PLAYER_NAME];
        new sext;
        giveplayer = GetPlayerNameEx(giveplayerid);
        new marriedto[128];
        marriedto = PlayerInfo[giveplayerid][pMarriedTo];
        new pmarriedto[MAX_PLAYER_NAME];
        pmarriedto = GetPlayerNameEx(marriedto); //Here is 92178
        new married[20];
        strmid(married, PlayerInfo[giveplayerid][pMarriedTo], 0, strlen(PlayerInfo[giveplayerid][pMarriedTo]), 255);
        if(PlayerInfo[pmarriedto][pSex] == 1) { sext = "Husband"; } else { sext = "Wife"; } //92181
        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;
        }
    }


Код:
.pwn(92178) : error 035: argument type mismatch (argument 1)
(92181) : error 033: array must be indexed (variable "pmarriedto")
.pwn(92181) : error 006: must be assigned to an array
.pwn(92181) : error 006: must be assigned to an array
.pwn(92181) : fatal error 107: too many error messages on one line

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


5 Errors.
Please help me out, thanks
Reply
#2

pawn Код:
new giveplayerid = ReturnUser(inputtext);
        new HistoryString[1024];
        new giveplayer[MAX_PLAYER_NAME];
        new sext[8];
        format(giveplayer,sizeof(giveplayer), "%s", GetPlayerNameEx(giveplayerid));
        new marriedto[MAX_PLAYER_NAME];
        format(marriedto,sizeof(marriedto), "%s", PlayerInfo[giveplayerid][pMarriedTo]);
        new pmarriedto[MAX_PLAYER_NAME];
        format(pmarriedto,sizeof(pmarriedto), "%s", GetPlayerNameEx(marriedto)); //Here is 92178
        new married[20];
        strmid(married, PlayerInfo[giveplayerid][pMarriedTo], 0, strlen(PlayerInfo[giveplayerid][pMarriedTo]), 255);
        if(PlayerInfo[pmarriedto][pSex] == 1) { format(sext,sizeof(sext),"Husband"); } else { format(sext,sizeof(sext),"Wife"); } //92181
        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;
        }
    }
Make sure "pMarriedTo" in your enum is arrayed. Ex:

pawn Код:
enum YourEnum
{
     bla,
     bla,
     bla,
     pMarriedTo[MAX_PLAYER_NAME],
     bla,
     bla,
 ...
}
Reply
#3

pmarriedto is some kind of string I use to define it, the point I actually want is that the system gets the gender of the person who "giveplayerid" is married to.
Reply
#4

Just saw I made a mistake by using pmarriedto, while that's been used to define who the person is married to in the .ini file... I still don't know how to format this line tho':
Код:
        if(PlayerInfo[marriedto][pSex] == 1) { format(sext,sizeof(sext),"Husband"); } else { format(sext,sizeof(sext),"Wife"); } //92181
Reply
#5

Someone?
Reply
#6

You need an array to store strings.
Код:
 if(PlayerInfo[pmarriedto][pSex] == 1) { sext[24]  = "Husband"; } else { sext[24] = "Wife"; }
Reply
#7

Tried that:
pawn Код:
C:\Users\Gebruiker\Desktop\LVCRP lol\nycrpv10(1).pwn(92191) : error 033: array must be indexed (variable "marriedto")
C:\Users\Gebruiker\Desktop\LVCRP lol\nycrpv10(1).pwn(92191) : error 032: array index out of bounds (variable "sext")
C:\Users\Gebruiker\Desktop\LVCRP lol\nycrpv10(1).pwn(92191) : error 006: must be assigned to an array
C:\Users\Gebruiker\Desktop\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.
pawn Код:
if(PlayerInfo[marriedto][pSex] == 1) { sext[24]  = "Husband"; } else { sext[24] = "Wife"; } //92181
Reply
#8

*BUMP*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)