dini help
#1

Hello,

I got 4 Errors with compiling this.

pawn Код:
C:\Users\Stefan Dorst\Desktop\Volcom Rp\gamemodes\SRP.pwn(13984) : error 029: invalid expression, assumed zero
C:\Users\Stefan Dorst\Desktop\Volcom Rp\gamemodes\SRP.pwn(13984) : warning 215: expression has no effect
C:\Users\Stefan Dorst\Desktop\Volcom Rp\gamemodes\SRP.pwn(13984) : error 001: expected token: ";", but found ")"
C:\Users\Stefan Dorst\Desktop\Volcom Rp\gamemodes\SRP.pwn(13984) : error 029: invalid expression, assumed zero
C:\Users\Stefan Dorst\Desktop\Volcom Rp\gamemodes\SRP.pwn(13984) : 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 Код:
command(oprison, playerid, params[])
{
    new Name[128], string[128], time, Reason[128];
    if(sscanf(params, "zdz", Name, time, Reason))
    {
        if(Player[playerid][AdminLevel] >= 1 || Player[playerid][Moderator] >= 1)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /oprison [name] [time] [reason]");
            SendClientMessage(playerid, GREY, "NOTE: This command is CaSe SeNsItIvE.");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 1 || Player[playerid][Moderator] >= 1)
        {
            if(strlen(Name) >= 3 && strlen(Name) < MAX_PLAYER_NAME+1)
            {
                format(string, sizeof(string), "Accounts/%s.ini", Name);
                if(fexist(string))
                {
                        dini_IntSet(string, "PrisonDuration", time*60);
                        dini_IntSet(string, "PrisonID", 1);
                        dini_IntSet(string, "Muted", 1);
                        dini_IntSet(string, "APrisons", +1);
                        dini_Set(string, "Note", Reason);
                        format(string, sizeof(string), "Prison: %s has been prisoned by %s, reason: %s (%d minutes).", Name, GetName(playerid), Reason, time);
                        SendClientMessageToAll(RED, string);
                        format(string, sizeof(string), "%s has offine prisoned %s", GetName(playerid), Name);
                        SendToAdmins(ADMINORANGE, string, 0);
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "Account not found.");
                }
            }
        }
    }
}
Its if a player goes offline to avoid prison, then he can still get prisoned but, I want to show his prisons in stats so it has to count 1 on it.

Anyone help?
Reply
#2

APrisons is how many times he enters prison ?
pawn Код:
dini_IntSet(string, "APrisons", +1);
to
Not Sure .
pawn Код:
dini_IntSet(string, "APrisons", ++);
Reply
#3

pawn Код:
C:\Users\Stefan Dorst\Desktop\Volcom Rp\gamemodes\SRP.pwn(13984) : error 029: invalid expression, assumed zero
C:\Users\Stefan Dorst\Desktop\Volcom Rp\gamemodes\SRP.pwn(13984) : error 022: must be lvalue (non-constant)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Reply
#4

Show to me the Error line.
Reply
#5

Here, take this, I think it will work.
pawn Код:
command(oprison, playerid, params[])
{
    new Name[128], string[128], time, Reason[128];
    if(sscanf(params, "uds[128]", Name, time, Reason))
    {
        if(Player[playerid][AdminLevel] >= 1 || Player[playerid][Moderator] >= 1)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /oprison [name] [time] [reason]");
            SendClientMessage(playerid, GREY, "NOTE: This command is CaSe SeNsItIvE.");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 1 || Player[playerid][Moderator] >= 1)
        {
            if(strlen(Name) >= 3 && strlen(Name) < MAX_PLAYER_NAME+1)
            {
                format(string, sizeof(string), "Accounts/%s.ini", Name);
                if(fexist(string))
                {
                        dini_IntSet(string, "PrisonDuration", time*60);
                        dini_IntSet(string, "PrisonID", 1);
                        dini_IntSet(string, "Muted", 1);
                        dini_IntSet(string, "APrisons", +1);
                        dini_Set(string, "Note", Reason);
                        format(string, sizeof(string), "Prison: %s has been prisoned by %s, reason: %s (%d minutes).", Name, GetName(playerid), Reason, time);
                        SendClientMessageToAll(RED, string);
                        format(string, sizeof(string), "%s has offine prisoned %s", GetName(playerid), Name);
                        SendToAdmins(ADMINORANGE, string, 0);
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "Account not found.");
                }
            }
        }
    }
}
Reply
#6

pawn Код:
new p;
                        p=dini_Int(string,"APrisions");
                        dini_IntSet(string, "APrisons", p+1);
Reply
#7

Quote:
Originally Posted by [NWA]Hannes
Посмотреть сообщение
Here, take this, I think it will work.
pawn Код:
command(oprison, playerid, params[])
{
    new Name[128], string[128], time, Reason[128];
    if(sscanf(params, "uds[128]", Name, time, Reason))
    {
        if(Player[playerid][AdminLevel] >= 1 || Player[playerid][Moderator] >= 1)
        {
            SendClientMessage(playerid, WHITE, "SYNTAX: /oprison [name] [time] [reason]");
            SendClientMessage(playerid, GREY, "NOTE: This command is CaSe SeNsItIvE.");
        }
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 1 || Player[playerid][Moderator] >= 1)
        {
            if(strlen(Name) >= 3 && strlen(Name) < MAX_PLAYER_NAME+1)
            {
                format(string, sizeof(string), "Accounts/%s.ini", Name);
                if(fexist(string))
                {
                        dini_IntSet(string, "PrisonDuration", time*60);
                        dini_IntSet(string, "PrisonID", 1);
                        dini_IntSet(string, "Muted", 1);
                        dini_IntSet(string, "APrisons", +1);
                        dini_Set(string, "Note", Reason);
                        format(string, sizeof(string), "Prison: %s has been prisoned by %s, reason: %s (%d minutes).", Name, GetName(playerid), Reason, time);
                        SendClientMessageToAll(RED, string);
                        format(string, sizeof(string), "%s has offine prisoned %s", GetName(playerid), Name);
                        SendToAdmins(ADMINORANGE, string, 0);
                }
                else
                {
                    SendClientMessage(playerid, WHITE, "Account not found.");
                }
            }
        }
    }
}
Its totaly the same, so same errors as above.


Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
pawn Код:
new p;
                        p=dini_Int(string,"APrisions");
                        dini_IntSet(string, "APrisons", p+1);
Worked Thanks, (Reputation given)
Reply
#8

Quote:
Originally Posted by Stefand
Посмотреть сообщение
Its totaly the same, so same errors as above.
Its not the same, you had the name (the first parameter) as a optional string wich i changed, and the reason was a optional so it wouldnt work that way. So the reason wasnt indexed wich caused you to get errors.
Get your facts right before stating anything next time, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)