/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
AND this
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
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
!= 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.
Re: /checkooc - Carlito's Rp -
xfelipex - 07.08.2010
Re: /checkooc - Carlito's Rp -
Kar - 07.08.2010
Quote:
Originally Posted by xfelipex
|
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