/checkooc - Carlito's Rp
#1

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
Reply
#2

pawn Код:
if (OOCStatus = 0)


if (OOCStatus == 1)
Reply
#3

Код:
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;
	}
Reply
#4

why did you put this

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

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.
Reply
#6

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;
}
Reply
#7

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"
Reply
#8

Код:
Depends situation
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)