Need little help in Scripting. Just little.
#1

I did This:

pawn Код:
new AlreadyHealed[MAX_PLAYERS];
AlreadyHealed[playerid] == 0;  //Place this where you become the class, and when you die.

CMD:heal(playerid, params[])
{
    if(gPlayerClass[playerid] == MEDIC)
    {
        if(AlreadyHealed[playerid] == 0)
        {
            new Float:health;
            GetPlayerHealth(playerid, health);
            if(health <= 80) SetPlayerHealth(playerid, health + 20);
            else SetPlayerHealth(playerid, 100); //Prevents health going above 100.  If you want to enable  this, remove this line and the if statement above.
        }
        else return SendClientMessage(playerid, 0xFF0000FF, "Error: You already used your medic kit!");
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "Error: You are not a medic!");
}
But it is giving These Errors:

pawn Код:
D:\Games\UDCWAR~1\GAMEMO~1\Wars.pwn(115) : error 010: invalid function or declaration
D:\Games\UDCWAR~1\GAMEMO~1\Wars.pwn(1430) : warning 209: function "cmd_heal" should return a value
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Whats the Problem??
Reply
#2

Anyone Please....
Reply
#3

give us the lines, how should we know on what lines the problems are

For the start, your CMD should return 1.

So you need "return 1;" before the last bracket
Reply
#4

Omar, try use dcmd instead.

Also the error says that you ended up the command with a wrong return value, try different return values

EDIT: if you arrent using the params, then block it by typing pragma unused (if you know how to do)
Reply
#5

I am not understanding you GodFather.

I tried to Add Some Things. Now i add this:

pawn Код:
new AlreadyHealed[MAX_PLAYERS];

stock AlreadyHealed[playerid] == 0;

CMD:heal(playerid, params[])
{
    if(gPlayerClass[playerid] == MEDIC)
    {
        if(AlreadyHealed[playerid] == 0)
        {
            new Float:health;
            GetPlayerHealth(playerid, health);
            if(health <= 80) SetPlayerHealth(playerid, health + 20);
            else SetPlayerHealth(playerid, 100); //Prevents health going above 100.  If you want to enable  this, remove this line and the if statement above.
        }
        else return SendClientMessage(playerid, 0xFF0000FF, "Error: You already used your medic kit!");
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "Error: You are not a medic!");
}
It is Giving Now this Error:

pawn Код:
D:\Games\UDCWAR~1\GAMEMO~1\Wars.pwn(1417) : error 017: undefined symbol "playerid"
D:\Games\UDCWAR~1\GAMEMO~1\Wars.pwn(1432) : warning 209: function "cmd_heal" should return a value
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Reply
#6

You must really suck at scripting.

pawn Код:
new AlreadyHealed[MAX_PLAYERS];

CMD:heal(playerid, params[])
{
    if(gPlayerClass[playerid] == MEDIC)
    {
        if(AlreadyHealed[playerid] == 0)
        {
            new Float:health;
            GetPlayerHealth(playerid, health);
            if(health <= 80) SetPlayerHealth(playerid, health + 20);
            else SetPlayerHealth(playerid, 100); //Prevents health going above 100.  If you want to enable  this, remove this line and the if statement above.
        }
        else return SendClientMessage(playerid, 0xFF0000FF, "Error: You already used your medic kit!");
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "Error: You are not a medic!");
    return 1;
}
Read what I wrote in comments, or are you stupid?

pawn Код:
AlreadyHealed[playerid] == 0;  //Place this where you become the class, and when you die.
pawn Код:
//Place this where you become the class, and when you die.
pawn Код:
//Place this where you become the class, and when you die.
pawn Код:
//Place this where you become the class, and when you die.
pawn Код:
//Place this where you become the class, and when you die.
pawn Код:
//Place this where you become the class, and when you die.
pawn Код:
//Place this where you become the class, and when you die.
Reply
#7

pawn Код:
//Place this where you become the class, and when you die.
Bro i didn't understand This. Please Can u tell me?? yeah i am Suck in scripting
Reply
#8

pawn Код:
new AlreadyHealed[MAX_PLAYERS];

stock AlreadyHealed[playerid] == 0;

CMD:heal(playerid, params[])
{
    if(gPlayerClass[playerid] == MEDIC)
    {
        if(AlreadyHealed[playerid] == 0)
        {
            new Float:health;
            GetPlayerHealth(playerid, health);
            if(health <= 80) SetPlayerHealth(playerid, health + 20);
            else SetPlayerHealth(playerid, 100); //Prevents health going above 100.  If you want to enable  this, remove this line and the if statement above.
        }
        else return SendClientMessage(playerid, 0xFF0000FF, "Error: You already used your medic kit!");
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "Error: You are not a medic!");
return 1;
}
Here You GO
Reply
#9

Quote:
Originally Posted by CROSS_Hunter
Посмотреть сообщение
pawn Код:
new AlreadyHealed[MAX_PLAYERS];

stock AlreadyHealed[playerid] == 0;

CMD:heal(playerid, params[])
{
    if(gPlayerClass[playerid] == MEDIC)
    {
        if(AlreadyHealed[playerid] == 0)
        {
            new Float:health;
            GetPlayerHealth(playerid, health);
            if(health <= 80) SetPlayerHealth(playerid, health + 20);
            else SetPlayerHealth(playerid, 100); //Prevents health going above 100.  If you want to enable  this, remove this line and the if statement above.
        }
        else return SendClientMessage(playerid, 0xFF0000FF, "Error: You already used your medic kit!");
    }
    else return SendClientMessage(playerid, 0xFF0000FF, "Error: You are not a medic!");
return 1;
}
Here You GO
All you did was add return 1;, which is exactly what I did. You didn't even help him with the other error

@Omar, You really do not deserve reputation because you cannot even do a simple fucking thing.

Here

pawn Код:
public OnPlayerConnect(playerid)
{
    AlreadyHealed[playerid] == 0;
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    AlreadyHealed[playerid] == 0;
    return 1;
}
Learn English.
Reply
#10

Quote:
Originally Posted by Kindred
Посмотреть сообщение
All you did was add return 1;, which is exactly what I did. You didn't even help him with the other error

@Omar, You really do not deserve reputation because you cannot even do a simple fucking thing.

Here

pawn Код:
public OnPlayerConnect(playerid)
{
    AlreadyHealed[playerid] == 0;
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    AlreadyHealed[playerid] == 0;
    return 1;
}
Learn English.
Learn to be polite
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)