SA-MP Forums Archive
12 WARNINGS - 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: 12 WARNINGS (/showthread.php?tid=296664)



12 WARNINGS - vassilis - 12.11.2011

why this happens...
here are the warnings:
pawn Код:
(51) : warning 217: loose indentation
(52) : warning 217: loose indentation
(157) : warning 217: loose indentation
(1192) : warning 217: loose indentation
(1442) : warning 217: loose indentation
(1675) : warning 217: loose indentation
1709) : warning 217: loose indentation
(1719) : warning 211: possibly unintended assignment
(1723) : warning 211: possibly unintended assignment
(1731) : warning 211: possibly unintended assignment
(1734) : warning 211: possibly unintended assignment
(1739) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


12 Warnings.
lines of the warningsThe 1719-1739 lines
pawn Код:
public OnPlayerSpawn(playerid)
{
SetPlayerInterior(playerid, 0);
switch (Map) {
case 0: {
SendRconCommand("mapname cs_italy");
Loading(playerid);
if (gTeam[playerid] = TEAM_COUNTER)
{
SetPlayerPos(playerid, 716.8705,-2308.6211,107.9117);
}
if (gTeam[playerid] = TEAM_TERRO)
{
SetPlayerPos(playerid,684.1284,-2409.9363,107.1745);
}
}
case 1: {
SendRconCommand("mapname de_dust2");
Loading(playerid);
if (gTeam[playerid] = TEAM_COUNTER) {
SetPlayerPos(playerid,4427.6431,-1640.7981,22.3554);
}
if (gTeam[playerid] = TEAM_TERRO) {
SetPlayerPos(playerid, 4354.7001, -1682.3000, 25.5);
}
}
}
    return 1;
}
line 51-52:
pawn Код:
CreateDynamicObject(17859,23.88316000,1565.69921900,13.91923600,0.00000000,0.00000000,267.18080000);
CreateDynamicObject(5520,-17.94984800,1530.63769500,16.57575400,0.00000000,0.00000000,91.01420000); //
line 157:
pawn Код:
CreateDynamicObject(3095, 4355.2998046875, -1695.9000244141, 23.530000686646, 10, 0, 0);



Re: 12 WARNINGS - Vince - 12.11.2011

First bunch of 'Loose Indentation' warnings speak for themselves. This will help you out with those: http://*******/BW0H9. Second bunch of 'Unintended Assignment' warnings occur because comparisons in Pawn are done with the operator == (two equal signs), not just = (which is the assignment operator).


Re: 12 WARNINGS - AndreT - 12.11.2011

To fix the loose indentation, read what indentation is in the first place.


Re: 12 WARNINGS - grand.Theft.Otto - 12.11.2011

Here's the fixed indented, neat looking code. Amazing how much better it looks huh ?

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid, 0);
   
    switch (Map)
    {
        case 0:
        {
            SendRconCommand("mapname cs_italy");

            Loading(playerid);
           
            if (gTeam[playerid] = TEAM_COUNTER)
            {
                SetPlayerPos(playerid, 716.8705,-2308.6211,107.9117);
            }
            if (gTeam[playerid] = TEAM_TERRO)
            {
                SetPlayerPos(playerid,684.1284,-2409.9363,107.1745);
            }
        }
        case 1:
        {
            SendRconCommand("mapname de_dust2");

            Loading(playerid);
           
            if (gTeam[playerid] = TEAM_COUNTER)
            {
                SetPlayerPos(playerid,4427.6431,-1640.7981,22.3554);
            }
            if (gTeam[playerid] = TEAM_TERRO)
            {
                SetPlayerPos(playerid, 4354.7001, -1682.3000, 25.5);
            }
        }
    }
    return 1;
}



Re: 12 WARNINGS - IstuntmanI - 12.11.2011

Replace your code with the above user's code and change all
Код:
if (gTeam[playerid] =
to
Код:
if (gTeam[playerid] ==



Re: 12 WARNINGS - Kostas' - 12.11.2011

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid, 0);
    switch (Map) {
        case 0:
        {
            SendRconCommand("mapname cs_italy");
            Loading(playerid);
            if (gTeam[playerid] == TEAM_COUNTER) {
                SetPlayerPos(playerid, 716.8705,-2308.6211,107.9117);
            }
            if (gTeam[playerid] == TEAM_TERRO) {
                SetPlayerPos(playerid,684.1284,-2409.9363,107.1745);
            }
        }
        case 1:
        {
            SendRconCommand("mapname de_dust2");
            Loading(playerid);
            if (gTeam[playerid] == TEAM_COUNTER) {
                SetPlayerPos(playerid,4427.6431,-1640.7981,22.3554);
            }
            if (gTeam[playerid] == TEAM_TERRO) {
                SetPlayerPos(playerid, 4354.7001, -1682.3000, 25.5);
            }
        }
    }
    return 1;
}
Edit: costel_nistor96 was faster


Re: 12 WARNINGS - grand.Theft.Otto - 12.11.2011

Ah yes, I was going to add all the == signs but I got carried away with indenting lol


Re: 12 WARNINGS - vassilis - 12.11.2011

actually it wasnt that the problem it was that i forgot to add "#pragma tabsize 0 " :P


Re: 12 WARNINGS - Vince - 12.11.2011

Quote:
Originally Posted by vassilis
Посмотреть сообщение
actually it wasnt that the problem it was that i forgot to add "#pragma tabsize 0 " :P

Tabsize 0 is not a solution! It's a workaround for lazy people like you. I guarantee that you'll regret it later on.


Re: 12 WARNINGS - vassilis - 12.11.2011

Quote:
Originally Posted by Vince
Посмотреть сообщение

Tabsize 0 is not a solution! It's a workaround for lazy people like you. I guarantee that you'll regret it later on.
who told you i am "lazy" ?huh? but when i added it it compiled it ..