AddCharModel

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 08:48, 31 December 2018
RoboN1X (Talk | contribs)

← Previous diff
Revision as of 09:44, 31 December 2018
RoboN1X (Talk | contribs)

Next diff →
Line 8: Line 8:
{{Param|baseid|The base [[Skins:All|skin model ID]] to use (behavior of the character.)}} {{Param|baseid|The base [[Skins:All|skin model ID]] to use (behavior of the character.)}}
{{Param|newid|The new skin model ID ranged from 20000 to 30000 (10000 slots) to be used later with [[SetPlayerSkin]]}} {{Param|newid|The new skin model ID ranged from 20000 to 30000 (10000 slots) to be used later with [[SetPlayerSkin]]}}
-{{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]]).}}
{{ReturnsSuccess}} {{ReturnsSuccess}}
 +
 +{{Note|'''useartwork''' must be enabled first in [[Server.cfg#Custom_models|server settings]] in order for this to work}}
{{Example|Using '''artconfig.txt'''}} {{Example|Using '''artconfig.txt'''}}

Revision as of 09:44, 31 December 2018



This function was added in SA-MP 0.3.DL R1 and will not work in earlier versions!


Description:

Adds a new custom character 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.


Parameters:
(baseid, newid, dffname[], txdname[])
baseidThe base skin model ID to use (behavior of the character.)
newidThe new skin model ID ranged from 20000 to 30000 (10000 slots) to be used later with SetPlayerSkin
dffnameName of the .dff model collision file located in models server folder by default (artpath setting).
txdnameName of the .txd model texture file located in models server folder by default (artpath setting).


Return Values:

  • 1: The function executed successfully.
  • 0: The function failed to execute.


Image:32px-Ambox_warning_orange.png

Note

useartwork must be enabled first in server settings in order for this to work


Example Usage: Using artconfig.txt

AddCharModel(305, 20001, "lvpdpc2.dff", "lvpdpc2.txd");
AddCharModel(305, 20002, "lapdpd2.dff", "lapdpd2.txd");

Example Usage: Pawn Script

public OnGameModeInit()
{
	AddCharModel(305, 20001, "lvpdpc2.dff", "lvpdpc2.txd");
	AddCharModel(305, 20002, "lapdpd2.dff", "lapdpd2.txd");
	return 1;
}
Image:32px-Circle-style-warning.png

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.

Template:GetPlayerCustomSkin