SA-MP Forums Archive
Pickup Help - 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: Pickup Help (/showthread.php?tid=251481)



Pickup Help - captainjohn - 27.04.2011

Hi I am getting these errors and warning from ym script.

Код:
(76) : error 028: invalid subscript (not an array or too many subscripts): "armourpickup"
(78) : warning 217: loose indentation
(80) : error 010: invalid function or declaration
(57) : warning 204: symbol is assigned a value that is never used: "armourpickup"
Here is my code for OnPlayerPickUpPickup:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == healthpickup)
    {
        SendClientMessage(playerid, COLOR_RED, "You are now healed, you cannot collect this again until after death.");
        SetPlayerHealth(playerid, 100);
    }
    else if(pickupid == (armourpickup)
    { // Line 76
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Your armour has been refilled, you cannot collect this again until after death.");
        SetPlayerArmour(playerid, 100); // Line 78
    }
    return 1; // Line 80
}

Line 57, this is under OnGameModeInit
pawn Код:
armourpickup = CreatePickup(1242, 3, -2245.4641, 2301.4973, 4.9700, -1);



I have these defined at the top:
pawn Код:
// Variables
new healthpickup;
new armourpickup;

So whats wrong with this then?


Re: Pickup Help - (SF)Noobanatior - 27.04.2011

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == healthpickup)
    {
        SendClientMessage(playerid, COLOR_RED, "You are now healed, you cannot collect this again until after death.");
        SetPlayerHealth(playerid, 100);
    }
    else if(pickupid == armourpickup)//<------------
    { // Line 76
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "Your armour has been refilled, you cannot collect this again until after death.");
        SetPlayerArmour(playerid, 100); // Line 78
    }
    return 1; // Line 80
}
take the bracket out here like i have done


Re: Pickup Help - captainjohn - 27.04.2011

Such a simple mistake and a simple solution.

Thanks.