Jump to content

skin event?


jkub

Recommended Posts

Posted

is there any event for a player changing skins because i need it for a team script im workin on..

function cop1 ( thePlayer ) 
local skin = getPlayerSkin ( thePlayer ) 
    if ( skin == 280 ) then 
        setPlayerTeam ( thePlayer, police ) 
    else return end 
end 
  

Posted

your best bet would be to hack this in yourself. You could do it like this, by importing this into every resource that sets skins:

  
addEvent"onPlayerSkinChange" 
local mta_setPlayerSkin = setPlayerSkin 
  
function setPlayerSkin ( player, id ) 
    local set = mta_setPlayerSkin ( player, id ) 
    if ( set ) then 
        triggerEvent ( "onPlayerSkinChange", player, id ) 
    end 
    return set 
end 
  

It would be tidier to create a skinchange.lua and seperate it there. To use the event you could simply adapt what you've already written:

function cop1 ( skin ) 
    if ( skin == 280 ) then 
        setPlayerTeam ( source, police ) 
    else return end 
end 
addEventHandler ( "onPlayerSkinChange", getRootElement(), cop1 ) 
  

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...