Checkbelt help.
#1

Hi!

I need some help with /checkbelt (/kontrolliv88d).
I'm getting some errors with the command.

The command:
pawn Код:
dcmd_kontrolliv88d(playerid, params[])
{
    if(!IsACop(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "Sa ei ole politseinik / Kapo!");
   
   
    new string[128];
    new otherId;
    if(sscanf(params, "u", otherId))
    {
        SendClientMessage(playerid, COLOR_WHITE, "KASUTUS: /kontrollivццd [mдngija[ID]/Osanimest]");
        otherId = playerid;
    }
    if (!IsPlayerConnected(otherId) || otherId == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GRAD1, "Mдngijat ei ole serveris");
    if(GetDistanceBetweenPlayers(playerid, otherId) > 5.0)          return SendClientMessage(playerid, COLOR_GRAD1, "Sa oled liiga kaugel.");
    {
(33835)     if(KasutajaInfo[otherId][pTurvavoo] = 0);
        {
            format(string, sizeof(string), "ASD");
        }
(33839)     else if(KasutajaInfo[otherId][pTurvavoo] = 1);
        {
            format(string, sizeof(string), "DSA");
        }
    }
}
The errors:
pawn Код:
C:\Program Files (x86)\Rockstar Games\GTASanAndreas\SAMP Server\gamemodes\uusnrp.pwn(33835) : warning 211: possibly unintended assignment
C:\Program Files (x86)\Rockstar Games\GTASanAndreas\SAMP Server\gamemodes\uusnrp.pwn(33835) : error 036: empty statement
C:\Program Files (x86)\Rockstar Games\GTASanAndreas\SAMP Server\gamemodes\uusnrp.pwn(33839) : error 029: invalid expression, assumed zero
C:\Program Files (x86)\Rockstar Games\GTASanAndreas\SAMP Server\gamemodes\uusnrp.pwn(33839) : warning 215: expression has no effect
C:\Program Files (x86)\Rockstar Games\GTASanAndreas\SAMP Server\gamemodes\uusnrp.pwn(33839) : error 001: expected token: ";", but found "if"
C:\Program Files (x86)\Rockstar Games\GTASanAndreas\SAMP Server\gamemodes\uusnrp.pwn(33839) : warning 211: possibly unintended assignment
C:\Program Files (x86)\Rockstar Games\GTASanAndreas\SAMP Server\gamemodes\uusnrp.pwn(33839) : error 036: empty statement
C:\Program Files (x86)\Rockstar Games\GTASanAndreas\SAMP Server\gamemodes\uusnrp.pwn(33839) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
Reply
#2

if(KasutajaInfo[otherId][pTurvavoo] == 0)

would be correct
Reply
#3

The problem is that your checks are always true if the compiler is able to assign the value to the variable. If you change those assignment operators to the double assignment (as ikey07 said above me, but I'd like to explain WHY this is) then your code should not have an assignment (possibly unintended assignment). The rest of your errors come from this little assignment.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)