help with "unintended assignment"
#1

Well,
I never got these errors before, so i don't know how to fix them, here's the part of the script :
pawn Код:
if(!strcmp(cmdtext,"/acmds",true)) {
    if(Admin[playerid] = 1 )
    {
    ShowPlayerDialog(playerid,22,DIALOG_STYLE_MSGBOX,"Admin Commands level 1","/spawncar [vehiclename] - Spawns a vehicle\n/as [text] -\n/fixit - fixes vehicle\n/healme\n/adgateo - open, /adgatec - close ; the gate\n/abase - teleports you to the admin base\n/jail [playerid] - jails the player\n/unjail [playerid] - unjails the player\n/kick [playerid] [reason]","Close","");
    }
    else if(Admin[playerid] = 2 )
    {
    ShowPlayerDialog(playerid,23,DIALOG_STYLE_MSGBOX,"Admin Commands level 2","/minigun - gives you a minigun\n/gmx - restarts the server\n/spawncar [vehiclename] - Spawns a vehicle\n/as [text] -\n/fixit - fixes vehicle\n/healme\n/adgateo - open, /adgatec - close ; the gate\n/abase - teleports you to the admin base\n/jail [playerid] - jails the player\n/unjail [playerid] - unjails the player\n/kick [playerid] [reason]","Close","");
    }
    else if(Admin[playerid] = 3 )
    {
    ShowPlayerDialog(playerid,24,DIALOG_STYLE_MSGBOX,"Admin Commands level 3","/minigun - gives you a minigun\n/spawncar [vehiclename] - Spawns a vehicle\n/as [text] -\n/fixit - fixes vehicle\n/healme\n/adgateo - open, /adgatec - close ; the gate\n/abase - teleports you to the admin base\n/jail [playerid] - jails the player\n/unjail [playerid] - unjails the player\n/kick [playerid] [reason]","Close","");
    }
    else if(Admin[playerid] < 1 )
    {
    SendClientMessage(playerid, COLOR_RED, "[LS-GW] You are not an admin!");
    }
    return 1;
    }
Error lines :
pawn Код:
C:\Users\Marko\Desktop\SAmp0.3eSERVER\gamemodes\TestGM.pwn(1714) : warning 211: possibly unintended assignment
C:\Users\Marko\Desktop\SAmp0.3eSERVER\gamemodes\TestGM.pwn(1718) : warning 211: possibly unintended assignment
C:\Users\Marko\Desktop\SAmp0.3eSERVER\gamemodes\TestGM.pwn(1722) : warning 211: possibly unintended assignment
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Warnings.
Reply
#2

pawn Код:
if(!strcmp(cmdtext,"/acmds",true))
{
    if(Admin[playerid] == 1)
    {
        ShowPlayerDialog(playerid,22,DIALOG_STYLE_MSGBOX,"Admin Commands level 1","/spawncar [vehiclename] - Spawns a vehicle\n/as [text] -\n/fixit - fixes vehicle\n/healme\n/adgateo - open, /adgatec - close ; the gate\n/abase - teleports you to the admin base\n/jail [playerid] - jails the player\n/unjail [playerid] - unjails the player\n/kick [playerid] [reason]","Close","");
    }
    else if(Admin[playerid] == 2)
    {
        ShowPlayerDialog(playerid,23,DIALOG_STYLE_MSGBOX,"Admin Commands level 2","/minigun - gives you a minigun\n/gmx - restarts the server\n/spawncar [vehiclename] - Spawns a vehicle\n/as [text] -\n/fixit - fixes vehicle\n/healme\n/adgateo - open, /adgatec - close ; the gate\n/abase - teleports you to the admin base\n/jail [playerid] - jails the player\n/unjail [playerid] - unjails the player\n/kick [playerid] [reason]","Close","");
    }
    else if(Admin[playerid] == 3)
    {
        ShowPlayerDialog(playerid,24,DIALOG_STYLE_MSGBOX,"Admin Commands level 3","/minigun - gives you a minigun\n/spawncar [vehiclename] - Spawns a vehicle\n/as [text] -\n/fixit - fixes vehicle\n/healme\n/adgateo - open, /adgatec - close ; the gate\n/abase - teleports you to the admin base\n/jail [playerid] - jails the player\n/unjail [playerid] - unjails the player\n/kick [playerid] [reason]","Close","");
    }
    else if(Admin[playerid] < 1)
    {
        SendClientMessage(playerid, COLOR_RED, "[LS-GW] You are not an admin!");
    }
    return 1;
}
in "IF" statement you must put two equal signs so check if it's the required number. For more info you can always click the following link:-

https://sampwiki.blast.hk/wiki/Control_Structures
-FalconX
Reply
#3

Код:
==
Is used to compare values.

Example
pawn Код:
new a = 5;
if(a == 5)
{
    print("a is 5");
    return 1;
}
When you are using "="

One equal sign assigns a value.

Read more here.
Reply
#4

well that was easy ... and i knew i forgot something , thanks anyway...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)