[HELP]Warrant system
#1

Hey guys i'm having a problem making a warrant system,how can i make it with out haveing to do pWarrant1[256];
pWarrant2[256];
and so like if the person ready has 1 warrant
It wil make another warrant for them with out replacing the warrant that he already has.And can you guy please give me a example thanks.
Reply
#2

pawn Код:
pWarrant1[128];
Reply
#3

I'm saying with out having to do that.
Reply
#4

Anyone?
Reply
#5

Try
new Warrant[total_warrants][256];

like

new Warrant[6][256];
Reply
#6

Ok will do.
Reply
#7

Ok i did that this is what i get heres a pic


You see how i give 2 warrants and it rewrites the first warrant i gave him to the 2nd one instead of makeing a new line showing the 1st warrant and 2nd one.Heres the code
pawn Код:
if(dialogid == DACCT13)

    {
        if (response == 1)

        {
            new giveplayerid;
            new dstring[256];
            new sendername[MAX_PLAYER_NAME];
            giveplayerid = ReturnUser(inputtext);
            GetPlayerName(giveplayerid, sendername, sizeof(sendername));
            GiveNameSpace(sendername);
            for(new i = 0; i < TOTAL_RECORDS; i ++ ) {
            Warrants[giveplayerid][wWantedFor] = Warrant[i][50];
            }

       
       
       
            format(dstring, sizeof(dstring), "WarrantID: %d\r\nWarrant %s\r\n%s\r\n%s\r\nGive By %s",
            Warrants[giveplayerid][wPId],Warrant[0],Warrant[1],Warrant[2],Warrants[giveplayerid][wGivenBy]);
            ShowPlayerDialog(playerid,DACCT13,DIALOG_STYLE_MSGBOX,"MOBILE DATA COMPUTER",dstring,"Select","Cancel");




    }
pawn Код:
new Warrant[TOTAL_RECORDS][256];
pawn Код:
#define TOTAL_RECORDS 50
Reply
#8

Sorry for the early bump this will be the last one,but can someone show me how to fix this thanks.
Reply
#9

Well if you want it for all players, and you want multiple ones, and you want it to be a string, there's no other way you could do it. Pawn doesn't support 3D arrays so something like...

pawn Код:
new Warrants[MAX_PLAYERS][6][128];
Is not possible. I would probably just do it like this.

pawn Код:
new Warrant0[MAX_PLAYERS][128];
new Warrant1[MAX_PLAYERS][128];
new Warrant2[MAX_PLAYERS][128];
new Warrant3[MAX_PLAYERS][128];
Whenever you issue a warrant, just check the string length of each variable until you find an empty one and use that to store their new warrant. And don't forget to set the strings to "" when you remove the warrants.
Reply
#10

A bit like backwardsman97 said,
you can put like Warrant1, Warrant2, Warrant3 - 6 in the user file, and use playerid in the Warrant, not sure how to explain it exactly but I hope you get what I mean.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)