adding some lines problem
#1

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

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

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

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

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)