To just change a player's gani, you can use the setani(aniName,aniParams) function.
PHP Code:
//#CLIENTSIDE
//Example 1: Set the player's ani to sword.gani, pass no gani params
function onCreated(){
setani("sword",null);
}
PHP Code:
//#CLIENTSIDE
//Example 2: Set the player's ani to gralats.gani and pass "3" through as an aniparam, which picks the third gralat type, red gralats
function onCreated(){
setani("gralats",3);
}
If you want to replace a default gani, you can use the replaceani(defaultAniName,replaceName) function. It lets you totally replace a default animation like walk or idle with a different one. This is really useful for equipping items so that you can have custom idle and walk animations where the player is holding the item.
PHP Code:
//#CLIENTSIDE
function onCreated(){
replaceani("idle","carrystill");
replaceani("walk","carry");
}
That replaces your idle and walk animations with carry animations. To change them back to normal you would use the following code:
PHP Code:
//#CLIENTSIDE
function onCreated(){
replaceani("idle","idle");
replaceani("walk","walk");
}
Player attributes wouldn't be a great way to change the player's gani to display an equipped weapon, but you could use player attributes to hold the image name of their currently equipped weapon if you had a single gani that was set up to display many different weapons in it. Normally your best bet would be making different ganis for each different weapon though.