Some Warnings
#1

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 0);
		SendClientMessageToAll(0xAA3333AA, "Someone has got the emo flu");
		return 1;
	}
	if (strcmp("/cmds", cmdtext, true, 10) == 0)
		SendClientMessage(playerid, 0xAA3333AA, "/buyguns /kill /heal /armor /freeguns");
		return 1;
	{
	if (strcmp("/heal", cmdtext, true, 10) == 0)
		SetPlayerHealth(playerid, 100);
		SendClientMessage(playerid, 0xAA3333AA, "You Have been healed wait 5 minutes until another heal");
		return 1;
	}
	if (strcmp("/armor", cmdtext, true, 10) == 0)
		SetPlayerArmour(playerid, 100);
		SendClientMessage(playerid, 0xAA3333AA, "You have restored your armor wait 5 more minutes for another");
		return 1;
	{
	if (strcmp("/freeguns", cmdtext, true, 10) == 0)
		GivePlayerWeapon(playerid, 29, 9999);
		GivePlayerWeapon(playerid, 27, 9999);
		SendClientMessage(playerid, 0xAA3333AA, "You have got free guns wait an hour more minutes for more");
		return 1;
     }
	return 0;
}
help me this is warnings tell me how to remove the warnings or please do it for me


C:\Users\Adrian\Desktop\CNR\gamemodes\Ls-Dm.pwn(245) : warning 217: loose indentation
C:\Users\Adrian\Desktop\CNR\gamemodes\Ls-Dm.pwn(246) : warning 225: unreachable code
C:\Users\Adrian\Desktop\CNR\gamemodes\Ls-Dm.pwn(246) : warning 217: loose indentation
C:\Users\Adrian\Desktop\CNR\gamemodes\Ls-Dm.pwn(249) : warning 217: loose indentation
C:\Users\Adrian\Desktop\CNR\gamemodes\Ls-Dm.pwn(252) : warning 225: unreachable code
C:\Users\Adrian\Desktop\CNR\gamemodes\Ls-Dm.pwn(254) : warning 217: loose indentation
C:\Users\Adrian\Desktop\CNR\gamemodes\Ls-Dm.pwn(256) : warning 225: unreachable code
C:\Users\Adrian\Desktop\CNR\gamemodes\Ls-Dm.pwn(256) : warning 217: loose indentation
C:\Users\Adrian\Desktop\CNR\gamemodes\Ls-Dm.pwn(259) : warning 217: loose indentation
C:\Users\Adrian\Desktop\CNR\gamemodes\Ls-Dm.pwn(263) : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


10 Warnings.
Reply
#2

You forgot " { " after
pawn Код:
if (strcmp("/cmds", cmdtext, true, 10) == 0)

//and
if (strcmp("/heal", cmdtext, true, 10) == 0)

//and
if (strcmp("/armor", cmdtext, true, 10) == 0)

//and
if (strcmp("/freeguns", cmdtext, true, 10) == 0)
Reply
#3

Please see this page for an explanation on loose indentation: https://sampwiki.blast.hk/wiki/Errors_Li...se_indentation

Your first if statement is correct, but the ones after that do not have a bracket in the correct location and you are missing a closing bracket. For example, this:
Код:
if (strcmp("/cmds", cmdtext, true, 10) == 0)
		SendClientMessage(playerid, 0xAA3333AA, "/buyguns /kill /heal /armor /freeguns");
		return 1;
	{
Should be this:
Код:
if (strcmp("/cmds", cmdtext, true, 10) == 0)
{
	SendClientMessage(playerid, 0xAA3333AA, "/buyguns /kill /heal /armor /freeguns");
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)