SA-MP Forums Archive
Need little help in Scripting. Just little. - 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: Need little help in Scripting. Just little. (/showthread.php?tid=368835)



Need little help in Scripting. Just little. - iOmar - 14.08.2012

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??


Re: Need little help in Scripting. Just little. - iOmar - 14.08.2012

Anyone Please....


Re: Need little help in Scripting. Just little. - xtreamer - 14.08.2012

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


Re: Need little help in Scripting. Just little. - Godfather[TR] - 14.08.2012

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)


Re: Need little help in Scripting. Just little. - iOmar - 14.08.2012

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.



Re: Need little help in Scripting. Just little. - Kindred - 14.08.2012

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.



Re: Need little help in Scripting. Just little. - iOmar - 14.08.2012

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


Re: Need little help in Scripting. Just little. - CROSS_Hunter - 14.08.2012

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


Re: Need little help in Scripting. Just little. - Kindred - 14.08.2012

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.


Re: Need little help in Scripting. Just little. - CROSS_Hunter - 14.08.2012

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