"a variable is assigned to itself" - never happened to me before, am I being retarded?
#1

When I'm compiling this code, I'm getting "a variable is assigned to itself" errors on the marked lines. What's strange about this, is that I've been inverting booleans like this for ages and it has always worked before. Why isn't it working here though?

pawn Код:
enum seaded
{
    sATMRaha,
   
    bool:sBKanal,
    bool:sOOCKanal,
}
new Seaded[seaded];

if (strfind(inputtext, "/o kanal", true) != -1)
{
    Success(playerid, "/o kanal %s!", (Seaded[sOOCKanal] = !Seaded[sOOCKanal]) ? ("suletud") : ("avatud")); // error
        UuendaSeaded();
    ShowServerSettings(playerid);
}
   
else if (strfind(inputtext, "/b kanal", true) != -1)
{
    Success(playerid, "/b kanal %s!", (Seaded[sBKanal] = !Seaded[sBKanal]) ? ("suletud") : ("avatud")); // error
    UuendaSeaded();
    ShowServerSettings(playerid);
}
Reply
#2

Kar reported this few months ago: https://github.com/Zeex/pawn/issues/78

Booleans that are not defined in an enumerator still work with that method.
Reply
#3

They also work with a 2-dimensional array. As I can see, there's no solution to this yet, so I guess I'll have to create a workaround to keep it nice and short.

Edit: done

pawn Код:
Invert(&bool:value) return (value = !value);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)