22.07.2012, 11:39
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; }
Код:
#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; }
Код:
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];