umar4911

  • Hero Member
  • Creating own server!
  • Posts: 527
SetSkin and onPlayerSkinChange
«  »
if you change your skin using player.Skin = skin; your weapon resets. In order to avoid that, add this in your script:

Code: [Select]
function CPlayer::SetSkin(skin) {
    local slot = this.Slot;
    this.Skin = skin;
    this.Slot = slot;
}

Now use:
Code: [Select]
player.SetSkin(skinid)



onPlayerSkinChange
If you want this event, use:

Code: [Select]
function CPlayer::SetSkin(skin) {
    local slot = this.Slot, oldskin = this.Skin;
    this.Skin = skin;
    this.Slot = slot;
  onPlayerSkinChange(this, oldskin, skin)
}

Event:
Code: [Select]
function onPlayerSkinChange(player, OldSkin, NewSkin) {
}
I am gamer, programmer and hacker. Try to find me!
xD

Sebastian

  • VC:MP Beta Tester
  • Something like this: hga hga hga
  • Posts: 1,143
Re: SetSkin and onPlayerSkinChange
« Reply #1,  »
Just a note: no matter what,  because of the weapon change,  event onPlayerWeaponChange will be called.
(so be aware of that if you have code in that event)

Btw,  player.Pos also calls the event. At least,  that one puts back the weapon in your hand.