• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua How to check if a player has an addon tfs 1.2

gudan garam

Advanced OT User
Joined
Feb 13, 2011
Messages
353
Solutions
17
Reaction score
172
Location
São Paulo.
The title is self explanatory but, whats the function to check if a player has an addon on tfs 1.2?

I know how to check for a mount
Code:
player:hasMount(mountID)
how would it be for addons?
 
You can use player:hasOutfit(player:getSex() == PLAYERSEX_FEMALE and femaleLooktype or maleLookType).
I didn't quite understand the parameters you put, can I do it like this?

Code:
if offer_type == 'addon' then
    if player:hasOutfit(item_id, 3) and player:hasOutfit(item_count, 3) then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Error! You already have this addon.')
    else
       player:addOutfitAddon(item_id, 3)
        player:addOutfitAddon(item_count, 3)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You received '.. item_name ..' addons.')

The item_id is the outfit id for male and the item_count for the female and I put (item_id, 3) because I think this is the way to check of he has all the addons, or i don't need that?
 
I didn't quite understand the parameters you put, can I do it like this?

Code:
if offer_type == 'addon' then
    if player:hasOutfit(item_id, 3) and player:hasOutfit(item_count, 3) then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Error! You already have this addon.')
    else
       player:addOutfitAddon(item_id, 3)
        player:addOutfitAddon(item_count, 3)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'You received '.. item_name ..' addons.')

The item_id is the outfit id for male and the item_count for the female and I put (item_id, 3) because I think this is the way to check of he has all the addons, or i don't need that?
yes you can do it that way
but i suggest you dont use those variable names for looktypes cause it's confusing
 
Back
Top