SA-MP Forums Archive
Script problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Script problem (/showthread.php?tid=164553)



Script problem - typedef - 31.07.2010

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

error 017: undefined symbol "apple"


Re: Script problem - cofy1 - 31.07.2010

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;

    }



Re: Script problem - cofy1 - 31.07.2010

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!");
}



Re: Script problem - iggy1 - 31.07.2010

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;
}



Re: Script problem - typedef - 01.08.2010

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.


Re: Script problem - iggy1 - 01.08.2010

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)