RemoveBuildingForPlayer

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 18:58, 6 December 2011
Smithy (Talk | contribs)

← Previous diff
Current revision
OstGot (Talk | contribs)

Line 1: Line 1:
{{Scripting}} {{Scripting}}
-{{Title}} 
- 
-{{Description|Removes a standard San Andreas model for a single player within a specified range.}} 
{{AddedIn0.3d|function}} {{AddedIn0.3d|function}}
 +
 +{{Description|Removes a standard San Andreas model for a single player within a specified range.}}
{{Parameters|playerid, modelid, Float:fX, Float:fY, Float:fZ, Float:fRadius}} {{Parameters|playerid, modelid, Float:fX, Float:fY, Float:fZ, Float:fRadius}}
Line 12: Line 11:
{{Param|Float:fY|The Y coordinate around which the objects will be removed.}} {{Param|Float:fY|The Y coordinate around which the objects will be removed.}}
{{Param|Float:fZ|The Z coordinate around which the objects will be removed.}} {{Param|Float:fZ|The Z coordinate around which the objects will be removed.}}
-{{Param|Float:fRadius|The radius. Objects within this radius from the coordinates above will be removed.}}+{{Param|Float:fRadius|The radius around the specified point to remove objects with the specified model.}}
{{NoReturn}} {{NoReturn}}
 +{{Notes2|
 +* There appears to be a limit of around 1000 lines/objects. There is no workaround.
 +* When removing the same object for a player, they will crash. Commonly, players crash when reconnecting to the server because the server removes buildings on OnPlayerConnect.}}
-{{note|You cannot natively restore objects removed with RemoveBuildingForPlayer, however the Global Remove Building include produced by funky1234 (link below) supports this.}}+{{note|This function also removes [https://gtamods.com/wiki/OCCL OCCL] zones irrespective of the specified model.}}
-{{note2|When an object is removed, the LOD (low detail, 'blurred') version of said object will appear. These must also be removed. JernejL's Map Editor support this (link below).}}+
-funky1234's Global Remove Building include: http://forum.sa-mp.com/showthread.php?p=1551937+
-JernejL's Map Editor: http://forum.sa-mp.com/showthread.php?t=282801+{{Example}}
 +<pawn>
 +public OnPlayerConnect(playerid)
 +{
 + // When the player connects, objects with model 615 will be removed within a
 + // range of 200.0 from the point 0.0, 0.0, 0.0, which is the center of San Andreas.
 + RemoveBuildingForPlayer(playerid, 615, 0.0, 0.0, 0.0, 200.0);
 + return 1;
 +}
 +</pawn>
 +{{Note|In SA-MP 0.3.7 you can use -1 for the modelid to remove all objects within the specified radius.}}
 +{{Example}}
<pawn> <pawn>
public OnPlayerConnect(playerid) public OnPlayerConnect(playerid)
{ {
- // When the player connects model "615" which is veg_tree3 will be deleted within a range of 200.0 + // When the player connects, all map objects will be removed.
- // from the point: 0.0, 0.0, 0.0, which is the center of San Andreas.+ RemoveBuildingForPlayer(playerid, -1, 0.0, 0.0, 0.0, 6000.0);
- RemoveBuildingForPlayer(playerid, 615, 0.0, 0.0, 0.0, 200.0);+
return 1; return 1;
} }
</pawn> </pawn>
 +
 +===External Links===
 +* [http://forum.sa-mp.com/showthread.php?t=282801 JernejL's Map Editor]
{{RelatedFunctions}} {{RelatedFunctions}}

Current revision



RemoveBuildingForPlayer was added in SA-MP 0.3d This function was added in SA-MP 0.3d and will not work in earlier versions!


Description:

Removes a standard San Andreas model for a single player within a specified range.


Parameters:
(playerid, modelid, Float:fX, Float:fY, Float:fZ, Float:fRadius)
playeridThe ID of the player to remove the objects for.
modelidThe model to remove.
Float:fXThe X coordinate around which the objects will be removed.
Float:fYThe Y coordinate around which the objects will be removed.
Float:fZThe Z coordinate around which the objects will be removed.
Float:fRadiusThe radius around the specified point to remove objects with the specified model.


Return Values:

This function does not return any specific values.


Image:32px-Circle-style-warning.png

Important
Notes

  • There appears to be a limit of around 1000 lines/objects. There is no workaround.
  • When removing the same object for a player, they will crash. Commonly, players crash when reconnecting to the server because the server removes buildings on OnPlayerConnect.


Image:32px-Ambox_warning_orange.png

Note

This function also removes OCCL zones irrespective of the specified model.


Example Usage:

public OnPlayerConnect(playerid)
{
    // When the player connects, objects with model 615 will be removed within a
    // range of 200.0 from the point 0.0, 0.0, 0.0, which is the center of San Andreas.
    RemoveBuildingForPlayer(playerid, 615, 0.0, 0.0, 0.0, 200.0);
    return 1;
}
Image:32px-Ambox_warning_orange.png

Note

In SA-MP 0.3.7 you can use -1 for the modelid to remove all objects within the specified radius.


Example Usage:

public OnPlayerConnect(playerid)
{
    // When the player connects, all map objects will be removed.
    RemoveBuildingForPlayer(playerid, -1, 0.0, 0.0, 0.0, 6000.0);
    return 1;
}

External Links

Related Functions

The following functions may be helpful as they relate to this function in one way or another.

Personal tools