AddSimpleModelTimed
From SA-MP Wiki
(Difference between revisions)
Revision as of 09:00, 31 December 2018 RoboN1X (Talk | contribs) (wrong function in example) ← Previous diff |
Revision as of 09:48, 31 December 2018 RoboN1X (Talk | contribs) (note) Next diff → |
||
Line 9: | Line 9: | ||
{{Param|baseid|The base [[Game_Object_ID_List|object model ID]] to use.}} | {{Param|baseid|The base [[Game_Object_ID_List|object model ID]] to use.}} | ||
{{Param|newid|The new object model ID ranged from -1000 to -30000 (29000 slots) to be used later with [[CreateObject]] or [[CreatePlayerObject]].}} | {{Param|newid|The new object model ID ranged from -1000 to -30000 (29000 slots) to be used later with [[CreateObject]] or [[CreatePlayerObject]].}} | ||
- | {{Param|dffname|Name of the '''.dff''' model collision file located in <tt>models</tt> server folder.}} | + | {{Param|dffname|Name of the '''.dff''' model collision file located in <tt>models</tt> server folder by default ([[Server.cfg#Custom_models|artpath setting]]).}} |
- | {{Param|txdname|Name of the '''.txd''' model texture file located in <tt>models</tt> server folder.}} | + | {{Param|txdname|Name of the '''.txd''' model texture file located in <tt>models</tt> server folder by default ([[Server.cfg#Custom_models|artpath setting]]).}} |
{{Param|timeon|The [[SetWorldTime|world game time (hour)]] this object will appear}} | {{Param|timeon|The [[SetWorldTime|world game time (hour)]] this object will appear}} | ||
{{Param|timeoff|The [[SetWorldTime|world game time (hour)]] this object will disappear}} | {{Param|timeoff|The [[SetWorldTime|world game time (hour)]] this object will disappear}} | ||
Line 16: | Line 16: | ||
{{ReturnsSuccess}} | {{ReturnsSuccess}} | ||
- | {{Note|When virtualworld is set, the [[OnPlayerFinishedDownloading|models will be downloaded once the player enters the specific world]]}} | + | {{Note| |
+ | * '''useartwork''' must be enabled first in [[Server.cfg#Custom_models|server settings]] in order for this to work | ||
+ | * When virtualworld is set, the [[OnPlayerFinishedDownloading|models will be downloaded once the player enters the specific world]]}} | ||
{{Example|Pawn Script}} | {{Example|Pawn Script}} |
Revision as of 09:48, 31 December 2018
Description:
Adds a new custom simple object model for download. The model files will be stored in player's Documents\GTA San Andreas User Files\SAMP\cache under the Server IP and Port folder in a CRC-form file name.
(virtualworld, baseid, newid, dffname[], txdname[], timeon, timeoff)
virtualworld | The virtual world ID to make the model available at. Use -1 for all worlds. |
baseid | The base object model ID to use. |
newid | The new object model ID ranged from -1000 to -30000 (29000 slots) to be used later with CreateObject or CreatePlayerObject. |
dffname | Name of the .dff model collision file located in models server folder by default (artpath setting). |
txdname | Name of the .txd model texture file located in models server folder by default (artpath setting). |
timeon | The world game time (hour) this object will appear |
timeoff | The world game time (hour) this object will disappear |
Return Values:
- 1: The function executed successfully.
- 0: The function failed to execute.
Note |
|
Example Usage: Pawn Script
public OnGameModeInit() { AddSimpleModelTimed(-1, 19379, -2000, "wallzzz.dff", "wallzzz.txd", 9, 18); // This wall only renders from 9:00 am to 6:00 pm return 1; }
Warning | There are currently no restrictions on when you can call this function, but be aware that if you do not call them inside OnFilterScriptInit/OnGameModeInit, you run the risk that some players, who are already on the server, may not have downloaded the models. |
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.
- OnPlayerFinishedDownloading: Called when a player finishes downloading custom models.