Jump to content

Command to set skin


tim260

Recommended Posts

he community poeple :D,

i was wondering if i make a acl group called "Military" can i make a command that only that people can use in fact the command i was thinking about = "/mduty" when they do that there military skin should be turned on and there has to be a message "You are now on duty" and ofcorse the other command "/moffduty" self explanatory i think ;p. Can someone tell me the functions etc i have to use or send me a partal script so i can edit it im new to scripting so its all still a bit had for me :D

Thanks in advance for helping :D

Link to comment

Functions

setPedSkin 
outputChatBox 
isObjectInACLGroup 

Handlers

addCommandHandler 

The Code

function militarySkin() 
    local account = getAccountName(getPlayerAccount(player)) 
     
    if isObjectInACLGroup("user." .. account, aclGetGroup("Military")) then 
        setPedSkin(player, 287) 
        outputChatBox("You are now on duty as a Military Soldier!", player, 0, 255, 0, false) 
    else 
        outputChatBox("You must be in Military to use this command!", player, 255, 0, 0, false) 
    end 
end 
addCommandHandler("mduty", militarySkin) 

Link to comment

'player' should be defined as the first parameter

Use isGuestAccount to avoid errors ( check if the player is logged in the account before getting the account name ).

setPedSkin is deprecated, use setElementModel.

 function militarySkin( player ) 
     if ( isGuestAccount ( getPlayerAccount ( getPlayerAccount ( player ) ) ) ) then 
     return 
          end 
    local account = getAccountName(getPlayerAccount(player)) 
    if isObjectInACLGroup("user." .. account, aclGetGroup("Military")) then 
        setElementModel(player, 287) 
        outputChatBox("You are now on duty as a Military Soldier!", player, 0, 255, 0, false) 
            else 
        outputChatBox("You must be in Military to use this command!", player, 255, 0, 0, false) 
      end 
end 
addCommandHandler("mduty", militarySkin) 

Link to comment

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...