I'm a pain in the ass.
#1

Quote:

E:\SA-MP Server\pawno\include\removebuilding.inc(5 : error 017: undefined symbol "slot"
E:\SA-MP Server\pawno\include\removebuilding.inc(59) : error 017: undefined symbol "slot"

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/enter", cmdtext, true, 10) == 0)
	{
    (IsPlayerInRangeOfPoint(playerid, 1.0, 172.66, -152.10, 1.72)); // checks if in range of the /enter point

        SetPlayerPos(playerid, 170.75, -153.94, 1.81); //Sets there new position
        RemoveObjectVar = RemoveBuilding(13200, 158.3594, -176.3047, 5.5703, 0.25);
		RemoveObjectVar2 = RemoveBuilding(12923, 158.3594, -176.3047, 5.5703, 0.25);
        return 1;
    }
   if (strcmp("/exit", cmdtext, true, 10) == 0)
   {
   if(IsPlayerInRangeOfPoint(playerid, 1.0, 170.85, -153.85, 1.48)) // Checks if near the exit door
    {
    	RestoreBuilding(RemoveObjectVar);
    	RestoreBuilding(RemoveObjectVar2);
        SetPlayerPos(playerid, 172.24, -152.26, 1.81);
    }
    return 1;
}
The .inc:
Код:
#if !defined MAX_REMOVED_OBJECTS
	#define MAX_REMOVED_OBJECTS 100
#endif

enum RemovedObjectsENUM {_model, Float:_oX, Float:_oY, Float:_oZ, Float:_orX, Float:_orY, Float:_orZ, Float:_oRadius, restored}
new RemovedObjects[MAX_REMOVED_OBJECTS][RemovedObjectsENUM];

/*
native RemoveBuilding(modelid, Float:oX, Float:oY, Float:oZ, Float:oRadius = 0.25, Float:orX = 0.0, Float:orY = 0.0, Float:orZ = 0.0);
native RestoreBuilding(slotid);
native RemoveSpecificBuilding(modelid);

native CountRemovedObjects();
*/

stock RemoveBuilding(modelid, Float:oX, Float:oY, Float:oZ, Float:oRadius = 0.25, Float:orX = 0.0, Float:orY = 0.0, Float:orZ = 0.0)
{
	for(new i; i < MAX_REMOVED_OBJECTS; i++)
	{
	    if(RemovedObjects[i][_model] != modelid) continue;
	    if(RemovedObjects[i][restored] != 0)
	    {
	        if((RemovedObjects[i][_oX] == oX) && (RemovedObjects[i][_oY] == oY) && (RemovedObjects[i][_oZ] == oZ))
	        {
	            DestroyObject(RemovedObjects[i][restored]);
	            RemovedObjects[i][restored] = 0;
	            RemovedObjects[i][_model] = 0;
	            return i;
	        }
	    }
	}

	new slot = GetObjectFreeSlot();
	if(slot == -1) return printf("\tCannot remove any more objects.\nIncrease MAX_REMOVED_OBJECTS in your script.\nIt is currently: %i", MAX_REMOVED_OBJECTS);
	
	RemovedObjects[slot][_model] = modelid;
	RemovedObjects[slot][_oX] = oX;
	RemovedObjects[slot][_oY] = oY;
	RemovedObjects[slot][_oZ] = oZ;
	RemovedObjects[slot][_oRadius] = oRadius;

	RemovedObjects[slot][_orX] = orX;
	RemovedObjects[slot][_orY] = orY;
	RemovedObjects[slot][_orZ] = orZ;

	for(new i; i < MAX_PLAYERS; i++)
	{
	    if(!IsPlayerConnected(i)) continue;
	    RemoveBuildingForPlayer(i, modelid, oX, oY, oZ, oRadius);
	}
	return slot;
}

stock RestoreBuilding(slotid)
{
	if(slotid < 0 || slotid > MAX_REMOVED_OBJECTS) return 0;
	if(RemovedObjects[slotid][_model] == 0) return 0;
	RemovedObjects[slot][restored] = CreateObject(RemovedObjects[slot][_model], RemovedObjects[slot][_oX], RemovedObjects[slot][_oY], RemovedObjects[slot][_oZ], RemovedObjects[slot][_orX], RemovedObjects[slot][_orY], RemovedObjects[slot][_orZ]);
	return RemovedObjects[slot][restored];
}

stock RemoveSpecificBuilding(modelid)
{
	return RemoveBuilding(modelid, 0.0, 0.0, 0.0, 10000.0);
}

forward REMOBJ_OnPlayerConnect(playerid);
public OnPlayerConnect(playerid)
{
	for(new i; i < MAX_REMOVED_OBJECTS; i++)
	{
	    if(RemovedObjects[i][_model] != 0) RemoveBuildingForPlayer(playerid, RemovedObjects[i][_model], RemovedObjects[i][_oX], RemovedObjects[i][_oY], RemovedObjects[i][_oZ], RemovedObjects[i][_oRadius]);
	}
	if(funcidx("REMOBJ_OnPlayerConnect") != -1) CallLocalFunction("REMOBJ_OnPlayerConnect", "i", playerid);
	return 1;
}
#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect REMOBJ_OnPlayerConnect

stock GetObjectFreeSlot()
{
	for(new i; i < MAX_REMOVED_OBJECTS; i++)
	{
	    if(RemovedObjects[i][_model] == 0) return i;
	}
	return -1;
}

stock CountRemovedObjects()
{
    new count = 0;
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] != 0) count++;
    }
	return count;
}
Line 58 & 59 of the .inc:
Код:
	RemovedObjects[slot][restored] = CreateObject(RemovedObjects[slot][_model], RemovedObjects[slot][_oX], RemovedObjects[slot][_oY], RemovedObjects[slot][_oZ], RemovedObjects[slot][_orX], RemovedObjects[slot][_orY], RemovedObjects[slot][_orZ]);
	return RemovedObjects[slot][restored];
Reply
#2

Try now

pawn Код:
#if !defined MAX_REMOVED_OBJECTS
    #define MAX_REMOVED_OBJECTS 100
#endif

enum RemovedObjectsENUM {_model, Float:_oX, Float:_oY, Float:_oZ, Float:_orX, Float:_orY, Float:_orZ, Float:_oRadius, restored}
new RemovedObjects[MAX_REMOVED_OBJECTS][RemovedObjectsENUM];

/*
native RemoveBuilding(modelid, Float:oX, Float:oY, Float:oZ, Float:oRadius = 0.25, Float:orX = 0.0, Float:orY = 0.0, Float:orZ = 0.0);
native RestoreBuilding(slotid);
native RemoveSpecificBuilding(modelid);

native CountRemovedObjects();
*/


stock RemoveBuilding(modelid, Float:oX, Float:oY, Float:oZ, Float:oRadius = 0.25, Float:orX = 0.0, Float:orY = 0.0, Float:orZ = 0.0)
{
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] != modelid) continue;
        if(RemovedObjects[i][restored] != 0)
        {
            if((RemovedObjects[i][_oX] == oX) && (RemovedObjects[i][_oY] == oY) && (RemovedObjects[i][_oZ] == oZ))
            {
                DestroyObject(RemovedObjects[i][restored]);
                RemovedObjects[i][restored] = 0;
                RemovedObjects[i][_model] = 0;
                return i;
            }
        }
    }
    new slot;
    slot = GetObjectFreeSlot();
    if(slot == -1) return printf("\tCannot remove any more objects.\nIncrease MAX_REMOVED_OBJECTS in your script.\nIt is currently: %i", MAX_REMOVED_OBJECTS);

    RemovedObjects[slot][_model] = modelid;
    RemovedObjects[slot][_oX] = oX;
    RemovedObjects[slot][_oY] = oY;
    RemovedObjects[slot][_oZ] = oZ;
    RemovedObjects[slot][_oRadius] = oRadius;

    RemovedObjects[slot][_orX] = orX;
    RemovedObjects[slot][_orY] = orY;
    RemovedObjects[slot][_orZ] = orZ;

    for(new i; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        RemoveBuildingForPlayer(i, modelid, oX, oY, oZ, oRadius);
    }
    return slot;
}

stock RestoreBuilding(slotid)
{
    if(slotid < 0 || slotid > MAX_REMOVED_OBJECTS) return 0;
    if(RemovedObjects[slotid][_model] == 0) return 0;
    RemovedObjects[slot][restored] = CreateObject(RemovedObjects[slot][_model], RemovedObjects[slot][_oX], RemovedObjects[slot][_oY], RemovedObjects[slot][_oZ], RemovedObjects[slot][_orX], RemovedObjects[slot][_orY], RemovedObjects[slot][_orZ]);
    return RemovedObjects[slot][restored];
}

stock RemoveSpecificBuilding(modelid)
{
    return RemoveBuilding(modelid, 0.0, 0.0, 0.0, 10000.0);
}

forward REMOBJ_OnPlayerConnect(playerid);
public OnPlayerConnect(playerid)
{
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] != 0) RemoveBuildingForPlayer(playerid, RemovedObjects[i][_model], RemovedObjects[i][_oX], RemovedObjects[i][_oY], RemovedObjects[i][_oZ], RemovedObjects[i][_oRadius]);
    }
    if(funcidx("REMOBJ_OnPlayerConnect") != -1) CallLocalFunction("REMOBJ_OnPlayerConnect", "i", playerid);
    return 1;
}
#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect REMOBJ_OnPlayerConnect

stock GetObjectFreeSlot()
{
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] == 0) return i;
    }
    return -1;
}

stock CountRemovedObjects()
{
    new count = 0;
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] != 0) count++;
    }
    return count;
}
Reply
#3

Even worse

Quote:

E:\SA-MP Server\pawno\include\RemoveBuilding.inc(16) : error 070: rational number support was not enabled
E:\SA-MP Server\pawno\include\RemoveBuilding.inc(6 : warning 235: public function lacks forward declaration (symbol "OnPlayerConnect")
E:\SA-MP Server\pawno\include\RemoveBuilding.inc(72) : error 017: undefined symbol "RemoveBuildingForPlayer"
E:\SA-MP Server\pawno\include\RemoveBuilding.inc(74) : error 017: undefined symbol "funcidx"
E:\SA-MP Server\pawno\include\RemoveBuilding.inc(74) : error 017: undefined symbol "CallLocalFunction"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Reply
#4

Now it shout work everything i test and and i notice you forgot to put #include <a_samp> you have to put it on EVERY script

pawn Код:
#include <a_samp>

#if !defined MAX_REMOVED_OBJECTS
    #define MAX_REMOVED_OBJECTS 100
#endif

enum RemovedObjectsENUM {_model, Float:_oX, Float:_oY, Float:_oZ, Float:_orX, Float:_orY, Float:_orZ, Float:_oRadius, restored}
new RemovedObjects[MAX_REMOVED_OBJECTS][RemovedObjectsENUM];

/*
native RemoveBuilding(modelid, Float:oX, Float:oY, Float:oZ, Float:oRadius = 0.25, Float:orX = 0.0, Float:orY = 0.0, Float:orZ = 0.0);
native RestoreBuilding(slotid);
native RemoveSpecificBuilding(modelid);

native CountRemovedObjects();
*/


stock RemoveBuilding(modelid, Float:oX, Float:oY, Float:oZ, Float:oRadius = 0.25, Float:orX = 0.0, Float:orY = 0.0, Float:orZ = 0.0)
{
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] != modelid) continue;
        if(RemovedObjects[i][restored] != 0)
        {
            if((RemovedObjects[i][_oX] == oX) && (RemovedObjects[i][_oY] == oY) && (RemovedObjects[i][_oZ] == oZ))
            {
                DestroyObject(RemovedObjects[i][restored]);
                RemovedObjects[i][restored] = 0;
                RemovedObjects[i][_model] = 0;
                return i;
            }
        }
    }
    new slot;
    slot = GetObjectFreeSlot();
    if(slot == -1) return printf("\tCannot remove any more objects.\nIncrease MAX_REMOVED_OBJECTS in your script.\nIt is currently: %i", MAX_REMOVED_OBJECTS);

    RemovedObjects[slot][_model] = modelid;
    RemovedObjects[slot][_oX] = oX;
    RemovedObjects[slot][_oY] = oY;
    RemovedObjects[slot][_oZ] = oZ;
    RemovedObjects[slot][_oRadius] = oRadius;

    RemovedObjects[slot][_orX] = orX;
    RemovedObjects[slot][_orY] = orY;
    RemovedObjects[slot][_orZ] = orZ;

    for(new i; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        RemoveBuildingForPlayer(i, modelid, oX, oY, oZ, oRadius);
    }
    return slot;
}

stock RestoreBuilding(slotid)
{
    if(slotid < 0 || slotid > MAX_REMOVED_OBJECTS) return 0;
    if(RemovedObjects[slotid][_model] == 0) return 0;
    RemovedObjects[slot][restored] = CreateObject(RemovedObjects[slot][_model], RemovedObjects[slot][_oX], RemovedObjects[slot][_oY], RemovedObjects[slot][_oZ], RemovedObjects[slot][_orX], RemovedObjects[slot][_orY], RemovedObjects[slot][_orZ]);
    return RemovedObjects[slot][restored];
}

stock RemoveSpecificBuilding(modelid)
{
    return RemoveBuilding(modelid, 0.0, 0.0, 0.0, 10000.0);
}

forward REMOBJ_OnPlayerConnect(playerid);
public OnPlayerConnect(playerid)
{
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] != 0) RemoveBuildingForPlayer(playerid, RemovedObjects[i][_model], RemovedObjects[i][_oX], RemovedObjects[i][_oY], RemovedObjects[i][_oZ], RemovedObjects[i][_oRadius]);
    }
    if(funcidx("REMOBJ_OnPlayerConnect") != -1) CallLocalFunction("REMOBJ_OnPlayerConnect", "i", playerid);
    return 1;
}
#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect REMOBJ_OnPlayerConnect

stock GetObjectFreeSlot()
{
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] == 0) return i;
    }
    return -1;
}

stock CountRemovedObjects()
{
    new count = 0;
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] != 0) count++;
    }
    return count;
}
Reply
#5

It's not a script, it's an include, yet If I place the a_samp, same problem occurs:
E:\SA-MP Server\pawno\include\removebuilding.inc(60) : error 017: undefined symbol "slot"
E:\SA-MP Server\pawno\include\removebuilding.inc(61) : error 017: undefined symbol "slot"
Reply
#6

Quote:
Originally Posted by Peter Alex
Посмотреть сообщение
It's not a script, it's an include, yet If I place the a_samp, same problem occurs:
E:\SA-MP Server\pawno\include\removebuilding.inc(60) : error 017: undefined symbol "slot"
E:\SA-MP Server\pawno\include\removebuilding.inc(61) : error 017: undefined symbol "slot"
It not mater is include or script you have to use that include everywere and are you sure you copy from my last post i dont get any errors
Reply
#7

The errors occur when compiling the gamemode.

Here's what I try to compile in the gamemode:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/enter", cmdtext, true, 10) == 0)
	{
    (IsPlayerInRangeOfPoint(playerid, 1.0, 172.66, -152.10, 1.72)); // checks if in range of the /enter point

        SetPlayerPos(playerid, 170.75, -153.94, 1.81); //Sets there new position
        RemoveObjectVar = RemoveBuilding(13200, 158.3594, -176.3047, 5.5703, 0.25);
		RemoveObjectVar2 = RemoveBuilding(12923, 158.3594, -176.3047, 5.5703, 0.25);
        return 1;
    }
   if (strcmp("/exit", cmdtext, true, 10) == 0)
   {
   if(IsPlayerInRangeOfPoint(playerid, 1.0, 170.85, -153.85, 1.48)) // Checks if near the exit door
    {
    	RestoreBuilding(RemoveObjectVar);
    	RestoreBuilding(RemoveObjectVar2);
        SetPlayerPos(playerid, 172.24, -152.26, 1.81);
    }
    return 1;
}
Reply
#8

Try this
pawn Код:
#if !defined MAX_REMOVED_OBJECTS
    #define MAX_REMOVED_OBJECTS 100
#endif

enum RemovedObjectsENUM {_model, Float:_oX, Float:_oY, Float:_oZ, Float:_orX, Float:_orY, Float:_orZ, Float:_oRadius, restored}
new RemovedObjects[MAX_REMOVED_OBJECTS][RemovedObjectsENUM];

/*
native RemoveBuilding(modelid, Float:oX, Float:oY, Float:oZ, Float:oRadius = 0.25, Float:orX = 0.0, Float:orY = 0.0, Float:orZ = 0.0);
native RestoreBuilding(slotid);
native RemoveSpecificBuilding(modelid);

native CountRemovedObjects();
*/


stock RemoveBuilding(modelid, Float:oX, Float:oY, Float:oZ, Float:oRadius = 0.25, Float:orX = 0.0, Float:orY = 0.0, Float:orZ = 0.0)
{
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] != modelid) continue;
        if(RemovedObjects[i][restored] != 0)
        {
            if((RemovedObjects[i][_oX] == oX) && (RemovedObjects[i][_oY] == oY) && (RemovedObjects[i][_oZ] == oZ))
            {
                DestroyObject(RemovedObjects[i][restored]);
                RemovedObjects[i][restored] = 0;
                RemovedObjects[i][_model] = 0;
                return i;
            }
        }
    }

    new slot = GetObjectFreeSlot();
    if(slot == -1) return printf("\tCannot remove any more objects.\nIncrease MAX_REMOVED_OBJECTS in your script.\nIt is currently: %i", MAX_REMOVED_OBJECTS);
   
    RemovedObjects[slot][_model] = modelid;
    RemovedObjects[slot][_oX] = oX;
    RemovedObjects[slot][_oY] = oY;
    RemovedObjects[slot][_oZ] = oZ;
    RemovedObjects[slot][_oRadius] = oRadius;

    RemovedObjects[slot][_orX] = orX;
    RemovedObjects[slot][_orY] = orY;
    RemovedObjects[slot][_orZ] = orZ;

    for(new i; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        RemoveBuildingForPlayer(i, modelid, oX, oY, oZ, oRadius);
    }
    return slot;
}

stock RestoreBuilding(slotid)
{
    if(slotid < 0 || slotid > MAX_REMOVED_OBJECTS) return 0;
    if(RemovedObjects[slotid][_model] == 0) return 0;
    RemovedObjects[slotid][restored] = CreateObject(RemovedObjects[slotid][_model], RemovedObjects[slotid][_oX], RemovedObjects[slotid][_oY], RemovedObjects[slotid][_oZ], RemovedObjects[slotid][_orX], RemovedObjects[slotid][_orY], RemovedObjects[slotid][_orZ]);
    return RemovedObjects[slotid][restored];
}

stock RemoveSpecificBuilding(modelid)
{
    return RemoveBuilding(modelid, 0.0, 0.0, 0.0, 10000.0);
}

forward REMOBJ_OnPlayerConnect(playerid);
public OnPlayerConnect(playerid)
{
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] != 0) RemoveBuildingForPlayer(playerid, RemovedObjects[i][_model], RemovedObjects[i][_oX], RemovedObjects[i][_oY], RemovedObjects[i][_oZ], RemovedObjects[i][_oRadius]);
    }
    if(funcidx("REMOBJ_OnPlayerConnect") != -1) CallLocalFunction("REMOBJ_OnPlayerConnect", "i", playerid);
    return 1;
}
#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect REMOBJ_OnPlayerConnect

stock GetObjectFreeSlot()
{
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] == 0) return i;
    }
    return -1;
}

stock CountRemovedObjects()
{
    new count = 0;
    for(new i; i < MAX_REMOVED_OBJECTS; i++)
    {
        if(RemovedObjects[i][_model] != 0) count++;
    }
    return count;
}

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/enter", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, 172.66, -152.10, 1.72)) // checks if in range of the /enter point
        {
        SetPlayerPos(playerid, 170.75, -153.94, 1.81); //Sets there new position
        RemoveObjectVar = RemoveBuilding(13200, 158.3594, -176.3047, 5.5703,0.25,0,0,0);
        RemoveObjectVar2 = RemoveBuilding(12923, 158.3594, -176.3047, 5.5703,0.25,0,0,0);
        return 1;
        }
    }
   if (strcmp("/exit", cmdtext, true, 10) == 0)
   {
        if(IsPlayerInRangeOfPoint(playerid, 1.0, 170.85, -153.85, 1.48)) // Checks if near the exit door
        {
        SetPlayerPos(playerid, 172.24, -152.26, 1.81);
        RestoreBuilding(RemoveObjectVar);
        RestoreBuilding(RemoveObjectVar2);
        }
   }
    return 1;
}
Reply
#9

The compiling worked, however when I /exit the building, I get the following problem, which normally shouldn't happen:
Reply
#10

Can you tell me, what do you exactly want to do?

If you just want /enter and /exit , You should have used SetPlayerInterior ..

I dont get why you want to remove the building.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)