SA-MP Forums Archive
Repair Error - 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: Repair Error (/showthread.php?tid=489147)



Repair Error - DerickClark - 20.01.2014

I got errors from code.

pawn Код:
error 017: undefined symbol "AddARepairPickups"
warning 203: symbol is never used: "ARepairPickups"
warning 203: symbol is never used: "IsPlayerAtRepair"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.


pawn Код:
ARepairPickups(Float:x, Float:y, Float:z)
{
    for (new i; i < sizeof(ARepairPickups); i++)
    {
        if (ARepairPickups[i][PickupID] == 0)
        {
            ARepairPickups[i][PickupID] = CreatePickup(27, 1, x, y, z, 0);
            ARepairPickups[i][pux] = x;
            ARepairPickups[i][puy] = y;
            ARepairPickups[i][puz] = z;
            Create3DTextLabel(TXT_PickupRepair, 0xFFFFFFFF, x, y, z + 0.8, 30.0, 0);
            CreateDynamicMapIcon(x, y, z, 56, 0, 0, 0, -1, 300.0);
            break;
        }
    }
}
bool:IsPlayerAtRepair(playerid)
{

    for(new i; i != sizeof(ARepairPickups); i++)
        if(IsPlayerInRangeOfPoint(playerid, 2.5, ARepairPickups[i][pux], ARepairPickups[i][puy], ARepairPickups[i][puz]))
            return true;

    return false;
}
CMD:createrepair(playerid,params[])
{
   new Float:x, Float:y, Float:z;
   GetPlayerPos(playerid, x, y, z);
   AddARepairPickups(x, y, z);
   return 1;
}
CMD:repairtest(playerid, params[])
{
    if(GetPlayerVehicleSeat(playerid) != 0) SendClientMessage(playerid, 0xFF0000AA, "You are not a driver!");
    else if(!IsPlayerAtGasStation(playerid)) SendClientMessage(playerid, 0xFF0000AA, "You not at the repair place!");
    else{
        SetTimerEx("Repair", 5000, false, "i", playerid);
        TogglePlayerControllable(playerid, 0);
        GameTextForPlayer(playerid, TXT_PickupRepair, 3000, 4);
    }
    return 1;
}



Re: Repair Error - Rifa4life - 20.01.2014

Код:
AddARepairPickups
Dude, you're using a function that you haven't defined, I mean, the error message is self-explanatory. Perhaps you made a mistake and wrote
Код:
 ARepairPickups(Float:x, Float:y, Float:z)
instead of
Код:
AddARepairPickups(x, y, z);
since the former one seems to do exactly what the name of the latter suggests.


As regards the warnings, add "stock", so change your function headings to the following, compile and see if still gives you the same warning.
Код:
stock ARepairPickups(Float:x, Float:y, Float:z)
stock IsPlayerAtRepair(playerid)



Re: Repair Error - DerickClark - 20.01.2014

Thanks, but I get 1 errors

pawn Код:
(4507) : error 017: undefined symbol "AddARepairPickups"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
pawn Код:
CMD:createrepair(playerid,params[])
{
   new Float:x, Float:y, Float:z;
   GetPlayerPos(playerid, x, y, z);
   AddARepairPickups(x, y, z);
   return 1;
}



Re: Repair Error - Rifa4life - 20.01.2014

Have you defined that function? Or is this:
Код:
ARepairPickups(Float:x, Float:y, Float:z)
{
    for (new i; i < sizeof(ARepairPickups); i++)
    {
        if (ARepairPickups[i][PickupID] == 0)
        {
            ARepairPickups[i][PickupID] = CreatePickup(27, 1, x, y, z, 0);
            ARepairPickups[i][pux] = x;
            ARepairPickups[i][puy] = y;
            ARepairPickups[i][puz] = z;
            Create3DTextLabel(TXT_PickupRepair, 0xFFFFFFFF, x, y, z + 0.8, 30.0, 0);
            CreateDynamicMapIcon(x, y, z, 56, 0, 0, 0, -1, 300.0);
            break;
        }
    }
}
Supposed to be it? Because in the code you have shown, you haven't defined AddARepairPickups as such, but instead, you defined ARepairPickups. Plus, the latter is a variable, and you are using it as a function name.

Replace this:
Код:
ARepairPickups(Float:x, Float:y, Float:z)
{
    for (new i; i < sizeof(ARepairPickups); i++)
    {
        if (ARepairPickups[i][PickupID] == 0)
        {
            ARepairPickups[i][PickupID] = CreatePickup(27, 1, x, y, z, 0);
            ARepairPickups[i][pux] = x;
            ARepairPickups[i][puy] = y;
            ARepairPickups[i][puz] = z;
            Create3DTextLabel(TXT_PickupRepair, 0xFFFFFFFF, x, y, z + 0.8, 30.0, 0);
            CreateDynamicMapIcon(x, y, z, 56, 0, 0, 0, -1, 300.0);
            break;
        }
    }
}
With this:
Код:
AddARepairPickups(Float:x, Float:y, Float:z)
{
    for (new i; i < sizeof(ARepairPickups); i++)
    {
        if (ARepairPickups[i][PickupID] == 0)
        {
            ARepairPickups[i][PickupID] = CreatePickup(27, 1, x, y, z, 0);
            ARepairPickups[i][pux] = x;
            ARepairPickups[i][puy] = y;
            ARepairPickups[i][puz] = z;
            Create3DTextLabel(TXT_PickupRepair, 0xFFFFFFFF, x, y, z + 0.8, 30.0, 0);
            CreateDynamicMapIcon(x, y, z, 56, 0, 0, 0, -1, 300.0);
            break;
        }
    }
}



Re: Repair Error - DerickClark - 20.01.2014

it tought was a funtion


Re: Repair Error - Rifa4life - 20.01.2014

Код:
ARepairPickups
Is used in your code as a variable, and hence should be defined at the start of the gamemode.

enum aInfo
{
PickupID,
Float: pux,
Float: puy,
Float: puz,
Text3D: TextLabel
};
new ARepairPickups[MAX_REPAIR_PICKUPS][aInfo];

You don't have to use the last variable (TextLabel), but if you do, then exchange this:
Код:
Create3DTextLabel(TXT_PickupRepair, 0xFFFFFFFF, x, y, z + 0.8, 30.0, 0);
For this:
Код:
ARepairPickups[i][TextLabel] = Create3DTextLabel(TXT_PickupRepair, 0xFFFFFFFF, x, y, z + 0.8, 30.0, 0);
It will allow you to edit or delete the 3D label later on, if you need to. Also, you obviously need to #define MAX_REPAIR_PICKUPS at the start of your script.

Problem solved?


Re: Repair Error - DerickClark - 20.01.2014

Quote:
Originally Posted by Rifa4life
Посмотреть сообщение
Код:
ARepairPickups
Is used in your code as a variable, and hence should be defined at the start of the gamemode.

enum aInfo
{
PickupID,
Float: pux,
Float: puy,
Float: puz,
Text3D: TextLabel
};
new ARepairPickups[MAX_REPAIR_PICKUPS][aInfo];

You don't have to use the last variable (TextLabel), but if you do, then exchange this:
Код:
Create3DTextLabel(TXT_PickupRepair, 0xFFFFFFFF, x, y, z + 0.8, 30.0, 0);
For this:
Код:
ARepairPickups[i][TextLabel] = Create3DTextLabel(TXT_PickupRepair, 0xFFFFFFFF, x, y, z + 0.8, 30.0, 0);
It will allow you to edit or delete the 3D label later on, if you need to. Also, you obviously need to #define MAX_REPAIR_PICKUPS at the start of your script.

Problem solved?
icon now showing


Re: Repair Error - Rifa4life - 21.01.2014

So it creates a pickup but somewhere else?

Change:
Код:
CMD:createrepair(playerid,params[])
{
   new Float:x, Float:y, Float:z;
   GetPlayerPos(playerid, x, y, z);
   AddARepairPickups(x, y, z);
   return 1;
}
To:
Код:
CMD:createrepair(playerid,cmdtext[])
{
   #pragma unused cmdtext
   new Float:x, Float:y, Float:z;
   GetPlayerPos(playerid, x, y, z);
   AddARepairPickups(x, y, z);
   return 1;
}
Also, check this: https://sampwiki.blast.hk/wiki/Pickup_IDs because it seems that the pickup ID that you are trying to create doesn't exist so no pickup is displayed in the player's place.


Re: Repair Error - DerickClark - 21.01.2014

Quote:
Originally Posted by Rifa4life
Посмотреть сообщение
So it creates a pickup but somewhere else?

Change:
Код:
CMD:createrepair(playerid,params[])
{
   new Float:x, Float:y, Float:z;
   GetPlayerPos(playerid, x, y, z);
   AddARepairPickups(x, y, z);
   return 1;
}
To:
Код:
CMD:createrepair(playerid,cmdtext[])
{
   #pragma unused cmdtext
   new Float:x, Float:y, Float:z;
   GetPlayerPos(playerid, x, y, z);
   AddARepairPickups(x, y, z);
   return 1;
}
Also, check this: https://sampwiki.blast.hk/wiki/Pickup_IDs because it seems that the pickup ID that you are trying to create doesn't exist so no pickup is displayed in the player's place.
Thank you for help, glad you helped me out.


Re: Repair Error - Rifa4life - 21.01.2014

Works?