Noob Question *In Need Of Help ASAP*
#1

Why doesn't this work:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/Ikky Wikky Medicine *puke*", cmdtext, true, 27) == 0)
	{
		GetPlayerHealth(playerid) == < 99;
		{
		    SendClientMessage(playerid,0xFF0000,"Lies you has full health already!");
		    }
		}
		else
		GetPlayerHealth(playerid) == > 100;
		{
		    SendClientMessage(playerid,0xFF0000,"There ya go nub");
		    SetPlayerHealth(100);
		    GivePlayerMoney(playerid,-1337);
			}
		}
		return 1;
	}
	return 0;
}
Код:
C:\Users\hp\Desktop\Stuff\Server\filterscripts\GettyHealth.pwn(94) : warning 235: public function lacks forward declaration (symbol "OnPlayerPrivmsg")
C:\Users\hp\Desktop\Stuff\Server\filterscripts\GettyHealth.pwn(103) : warning 202: number of arguments does not match definition
C:\Users\hp\Desktop\Stuff\Server\filterscripts\GettyHealth.pwn(103) : error 029: invalid expression, assumed zero
C:\Users\hp\Desktop\Stuff\Server\filterscripts\GettyHealth.pwn(103) : warning 215: expression has no effect
C:\Users\hp\Desktop\Stuff\Server\filterscripts\GettyHealth.pwn(109) : warning 202: number of arguments does not match definition
C:\Users\hp\Desktop\Stuff\Server\filterscripts\GettyHealth.pwn(109) : error 029: invalid expression, assumed zero
C:\Users\hp\Desktop\Stuff\Server\filterscripts\GettyHealth.pwn(109) : warning 217: loose indentation
C:\Users\hp\Desktop\Stuff\Server\filterscripts\GettyHealth.pwn(109) : warning 215: expression has no effect
C:\Users\hp\Desktop\Stuff\Server\filterscripts\GettyHealth.pwn(112) : warning 202: number of arguments does not match definition
C:\Users\hp\Desktop\Stuff\Server\filterscripts\GettyHealth.pwn(116) : error 010: invalid function or declaration
C:\Users\hp\Desktop\Stuff\Server\filterscripts\GettyHealth.pwn(118) : error 010: invalid function or declaration
C:\Users\hp\Desktop\Stuff\Server\filterscripts\GettyHealth.pwn(121) : warning 235: public function lacks forward declaration (symbol "OnPlayerInfoChange")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
And ignore the warnings..
And don't troll plox
I want the guy to get full health only if his health is below 100
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Ikky Wikky Medicine *puke*", cmdtext, true, 27) == 0)
    {
        if(GetPlayerHealth(playerid) > 99)
        {
            SendClientMessage(playerid,0xFF0000,"Lies you has full health already!");
            }
        }
        else
        if(GetPlayerHealth(playerid)  < 99)
        {
            SendClientMessage(playerid,0xFF0000,"There ya go nub");
            SetPlayerHealth(playerid,100);
            GivePlayerMoney(playerid,-1337);
            }
        }
        return 1;
    }
    return 0;
}
Reply
#3

@blackwave: it will return errors due a extra bracket and it will also return SERVER: Unknown Command

@Post author: you need to learn to script
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Ikky Wikky Medicine *puke*", cmdtext, true) == 0)
    {
        if (GetPlayerHealth(playerid) > 94)
        {
            return SendClientMessage(playerid,0xFF0000,"Lies you has full health already!");
        }
        else if (GetPlayerHealth(playerid) < 100)
        {
            SendClientMessage(playerid,0xFF0000,"There ya go nub");
            SetPlayerHealth(playerid,100);
            GivePlayerMoney(playerid,-1337);
            return 1;
        }
    }
    return 0;
}
Reply
#4

Код:
if (strcmp("/Ikky Wikky Medicine *puke*", cmdtext, true, 10) == 0)
	{
        new Float:health;
    	GetPlayerHealth(playerid,health);
    	if (health > 100.0)
		{
		    SendClientMessage(playerid,0xFF0000,"Lies you has full health already!");
		    }
		}
		else
		{
		new Float:health;
        GetPlayerHealth(playerid,health);
    	if (health < 99.0)
		{
		    SendClientMessage(playerid,0xFF0000,"There ya go nub");
		    SetPlayerHealth(playerid, 100);
		    GivePlayerMoney(playerid,-1337);
			}
		}
		return 1;
	}
//Edit: Dam u both were faster D=
Reply
#5

Quote:
Originally Posted by [SU]Balli
Посмотреть сообщение
Код:
if (strcmp("/Ikky Wikky Medicine *puke*", cmdtext, true, 10) == 0)
	{
        new Float:health;
    	GetPlayerHealth(playerid,health);
    	if (health > 100.0)
		{
		    SendClientMessage(playerid,0xFF0000,"Lies you has full health already!");
		    }
		}
		else
		{
		new Float:health;
        GetPlayerHealth(playerid,health);
    	if (health < 99.0)
		{
		    SendClientMessage(playerid,0xFF0000,"There ya go nub");
		    SetPlayerHealth(playerid, 100);
		    GivePlayerMoney(playerid,-1337);
			}
		}
		return 1;
	}
//Edit: Dam u both were faster D=
it wouldn't work because it checks if player health is HIGHER THAN 100, that means if player health is 101 or higher, which is umpossible unless you have godmode. proper code would be
pawn Код:
if (health > 99) return health;
Reply
#6

Oh, didn't see that bracket.
Reply
#7

Thanks, and as I said I am a noob so don't be mad
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)