SA-MP Forums Archive
/checkooc - Carlito's Rp - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /checkooc - Carlito's Rp (/showthread.php?tid=166217)



/checkooc - Carlito's Rp - Ritchie999 - 07.08.2010

Really stupid question to ask, but here i go..

I'm making a command, /checkooc. Which, well, you can see for yourself basically what it does.

Код:
	if(strcmp(cmd, "/checkooc", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if (OOCStatus = 0)
			{
				SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "OOC Is Currently Disabled");
			}
			else
			{
			if (OOCStatus = 1)
			{
				SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "OOC Is Currenly Enabled");
			}
		}
		}
		return 1;
	}
It works, BUT, when OOC is disabled it still comes back with "OOC Is Currently Enabled"
Any idea what im doing wrong?

I also get this warning twice

Код:
warning 211: possibly unintended assignment
From this

Код:
if (OOCStatus = 0)
AND this

Код:
if (OOCStatus = 1)
Help would be much appreciated, Thank you

~Ritchie


Re: /checkooc - Carlito's Rp - Kar - 07.08.2010

pawn Код:
if (OOCStatus = 0)


if (OOCStatus == 1)



Re: /checkooc - Carlito's Rp - xfelipex - 07.08.2010

Код:
if(strcmp(cmd, "/checkooc", true) == 0)
	{
            new block[MAX_PLAYERS];
	    if(IsPlayerConnected(playerid))
	       {
			if (block[playerid]=0)
			{
				SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "OOC Is Currently Disabled");
 			        block[playerid]=1;
                        }
			else if(block[playerid=1)
			{
				SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "OOC Is Currenly Enabled");
			}
		
		}
		return 1;
	}



Re: /checkooc - Carlito's Rp - Kar - 07.08.2010

why did you put this

pawn Код:
block[playerid]=1;
its a check if ooc is on not a turn off and on cmd..


Re: /checkooc - Carlito's Rp - JaTochNietDan - 07.08.2010

When comparing variables in Pawn you need two equal signs to simulate if equal to. Like so

pawn Код:
if(strcmp(cmd, "/checkooc", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (OOCStatus == 0)
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "OOC Is Currently Disabled");
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "OOC Is Currenly Enabled");
            }
        }
        return 1;
    }
There's also no need for an extra check, since you already know if it's not 0 it must be enabled.


Re: /checkooc - Carlito's Rp - xfelipex - 07.08.2010

Just added cause it'd block, as example of my mini-mission FS :
Код:
if(strcmp("/mission",cmdtext, true, 10) == 0) {
{
new block[MAX_PLAYERS];
SendClientMessage(playerid,color,"lol");
block[playerid]=1;
}
else if(block[playerid=1) {
return SendClientMessage(playerid,color,"Mission already running") // so, 'd block
}
return 1;
}



Re: /checkooc - Carlito's Rp - Kar - 07.08.2010

or you could switch else with

pawn Код:
if (OOCStatus != 0)
!= Means if oocstatus does not = 0 its on.

i'd rather use that you could use JaTochNietDan's To But Its Just A Suggestion so when i look through my codes i wanna see the thing straight up not elses <.<

feli theres no point in that.. he just wanted to check if its on or off.
Код:
"Check"



Re: /checkooc - Carlito's Rp - xfelipex - 07.08.2010

Код:
Depends situation



Re: /checkooc - Carlito's Rp - Kar - 07.08.2010

Quote:
Originally Posted by xfelipex
Посмотреть сообщение
Код:
Depends situation
lol what?


Re: /checkooc - Carlito's Rp - Ritchie999 - 07.08.2010

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
When comparing variables in Pawn you need two equal signs to simulate if equal to. Like so

pawn Код:
if(strcmp(cmd, "/checkooc", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (OOCStatus == 0)
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "OOC Is Currently Disabled");
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "OOC Is Currenly Enabled");
            }
        }
        return 1;
    }
There's also no need for an extra check, since you already know if it's not 0 it must be enabled.
Works perfectly. Thank you