PDA

View Full Version : dini help


Stefand
21/06/2012, 11:28 AM
Hello,

I got 4 Errors with compiling this.



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.



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?

Saw®
21/06/2012, 11:37 AM
APrisons is how many times he enters prison ?
dini_IntSet(string, "APrisons", +1);
to
Not Sure .
dini_IntSet(string, "APrisons", ++);

Stefand
21/06/2012, 11:40 AM
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.

Saw®
21/06/2012, 11:44 AM
Show to me the Error line.

[NWA]Hannes
21/06/2012, 12:07 PM
Here, take this, I think it will work. :)
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.");
}
}
}
}
}

[MM]RoXoR[FS]
21/06/2012, 12:17 PM
new p;
p=dini_Int(string,"APrisions");
dini_IntSet(string, "APrisons", p+1);

Stefand
21/06/2012, 12:35 PM
Hannes;1936854']Here, take this, I think it will work. :)
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.


RoXoR[FS];1936868']
new p;
p=dini_Int(string,"APrisions");
dini_IntSet(string, "APrisons", p+1);


Worked Thanks, (Reputation given)

[NWA]Hannes
21/06/2012, 01:05 PM
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.