SA-MP Forums Archive
help with "unintended assignment" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help with "unintended assignment" (/showthread.php?tid=346517)



help with "unintended assignment" - MarkoN - 28.05.2012

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.



Re: help with "unintended assignment" - FalconX - 28.05.2012

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


Re: help with "unintended assignment" - ReneG - 28.05.2012

Код:
==
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.


Re: help with "unintended assignment" - MarkoN - 28.05.2012

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