SA-MP Forums Archive
adding some lines problem - 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: adding some lines problem (/showthread.php?tid=286960)



adding some lines problem - KissOfDeath - 01.10.2011

im having a very simple problem, im trying too add some /suicide but i got some errors
this is the 1st command healme
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/heal", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 100);
		return 1;
	}
	return 0;
}
it work but when ill add this stuff it will have error.
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/heal", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 100);
		return 1;
	}
		if (strcmp("/suicide", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 0);
		return 1;
	}
	return 0;
}
here the error
Код:
C:\Users\kyle\Desktop\tdm server\gamemodes\Untitled.pwn(149) : warning 217: loose indentation
C:\Users\kyle\Desktop\tdm server\gamemodes\Untitled.pwn(154) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.



Re: adding some lines problem - Kingunit - 01.10.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/heal", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 100);
        return 1;
    }

    if (strcmp("/suicide", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 0);
        return 1;
    }
    return 0;
}



Re: adding some lines problem - Wesley221 - 01.10.2011

https://sampforum.blast.hk/showthread.php?tid=256961
If you read that tutorial, youre able to indent your code properly and know how to fix the warning.


Re: adding some lines problem - Jafet_Macario - 01.10.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/heal", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 100);
        return 1;
    }
    if (strcmp("/suicide", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 0);
        return 1;
    }
    return 0;
}
https://sampwiki.blast.hk/wiki/Errors_Li...tion_.28217.29


Re: adding some lines problem - DRIFT_HUNTER - 01.10.2011

Its not errors its just warnings
You need to lineup
pawn Код:
if (strcmp("/heal", cmdtext, true, 10) == 0)
and
pawn Код:
if (strcmp("/suicide", cmdtext, true, 10) == 0)
So it will look....like....
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/heal", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 100);
        return 1;
    }
    if (strcmp("/suicide", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 0);
        return 1;
    }
    return 0;
}



Re: adding some lines problem - KissOfDeath - 01.10.2011

oh thank you!.. im just trying to script a very simple fun server, thanks haha