[MDC System] - [HELP]
#1

Hello.
First, for people who doesn't know what MDC means, it's Mobile Data Compter (Police Database).
Second, my problem.
I want that in the /mdc it will show the person's warrants (more than 1).
There's a way to do this like this.
pWarrants1
pWarrants2
pWarrants3
pWarrants4
pWarrants5
But, it's very long and stupid.
So, I'm asking if you guys know another way?
By the way, I'm using MySQL.
Reply
#2

pWarrants[6]?

I love arrays.
Reply
#3

It could be used on each player, and be saved into the MySQL Database?
If you can give me an example please.
Reply
#4

pawn Код:
new query[256],
    plName[25];
GetPlayerName(playerid, plName, 24);
for( new w = 0; w < 6; w++ )
{
    format(query, sizeof(query), " UPDATE ґaccountsґ SET warrant%d=ґ%sґ WHERE user=ґ%sґ", w, pWarrants[w], plName);
    mysql_query(query);
}
I am pretty newb in MySQL, so this will include some errors, but you get the point.
Reply
#5

About the MySQL I know, what about the array, this is what I should write?
Код:
enum playervEnum {
pWarrants[6]
}
And then when someone post one warrant so..
Код:
pData[playerid][pWarrants[1]] = "test"
That would show an error.
Reply
#6

I would suggest making it a normal array, out of the enum.
pawn Код:
new pWarrants[MAX_PLAYERS][10][64];
reset the pWarrants on connect -
pawn Код:
public OnPlayerConnect(playerid)
{
    for(new w=0;w < 11; w++)
    {
        format(pWarrants[playerid][w], 63, " ");
    }
}
to add a warrant, use

pawn Код:
CMD:suspect(playerid, params[])
{
    // sscanf stuff, access checks, etc.
    for(new w=0;w < 11; w++)
    {
        if(strlen(pWarrants[target][w]) && w != 10) continue;
        if(strlen(pWarrants[target][w]) && w == 10) SendClientMessage(playerid, -1, "   This player already has maximum amount of warrants.");
        format(pWarrants[target][w], 63, input);
    }
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)