Script problem
#1

What is the problem here...
http://pastebin.com/dxaEK2nx

error 017: undefined symbol "apple"
Reply
#2

Try with this:

pawn Код:
dcmd_heal(playerid, params[])
    {
        new apple;
        apple = SetPlayerHealth(player1, 100);
        new player1 = strval(tmp);
        new id;
        if (sscanf(params, "u", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
        else
        {
        apple(playerid);
        }
       
        return 1;

    }
Reply
#3

Sorry, try with this command:

pawn Код:
dcmd_heal(playerid,params[]) {
    if(gTeam[playerid] == TEAM_MEDICS) {
        new tmp[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
        if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /heal [playerid]");
        new player1 = strval(tmp), string[128];
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            format(string, sizeof(string), "You has healed %s for $80.", pName(player1)); SendClientMessage(playerid,blue,string);
            if(player1 != playerid) { format(string,sizeof(string),"%s has healed you for $80.", pName(playerid)); SendClientMessage(player1,blue,string); }
            return SetPlayerHealth(player1, 100); GivePlayerMoney(playerid, 80);
        } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
 } else return SendClientMessage(playerid,red,"Only medics can use this command!");
}
Reply
#4

Here is a good method,
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(heal, 4, cmdtext);
    return 0;
}

dcmd_heal(playerid, params[])
{
    new id Float:amount;
    if (sscanf(params, "df", id,amount))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /heal <playerid> <amount>");
    if(id != INVALID_PLAYER_ID)
    {
        if(amount <= 100.0 && amount >= 1)
        {
            SetPlayerHealth(id,amount);
            return 1;
        }
        else return SendClientMessage(playerid, 0xFF0000AA, "Error: Invalid Amount");
    }
    else return SendClientMessage(playerid, 0xFF0000AA, "Error: Player not found");
}
Not tested but should work.

Edit: Delete that apple fuction all it does is returns 2. Unless for some reason you need that, I cant see why though.
This
pawn Код:
stock apple(playerid)
{
    return 1+1;
}
Might aswell be
pawn Код:
stock apple(playerid)
{
    return 2;
}
Reply
#5

No guys it isn't the actual could I am looking at it, its the error I get when I try to call a function.
Reply
#6

In that case i don't know whats wrong try putting your functions at bottom of script not at top.(mght not work but worth a try)
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)