Jump to content

Invisible car for ONE player - how to do it?


Recommended Posts

Hello again today and and immediately I turn to the problem - invisible car only for one player who is an administrator in addition. Exactly - how to do this? I'm trying with this code, but it's not work properly + I don't know how to check, if the player is administrator or not:

function invisibility(source) 
    if(getElementAlpha(source) > 200) 
    then 
        setElementAlpha(getPedOccupiedVehicle(source), 0) 
        outputChatBox("#FF0000Your car is now invisible.", source, 0, 255, 0, true) 
    else 
        setElementAlpha(getPedOccupiedVehicle(source), 255) 
        outputChatBox("#FF0000Your car is now visible.", source, 0, 255, 0, true) 
    end 
end 
addCommandHandler("v_inv", invisibility) 

So, how to do it?

Edited by Guest
Link to comment

Yeah, that would be a good solution if I really need to hide the car in front of player (a strange idea, I know), but unfortunately not what I meant, precisely writing, I mean that - when a player is in the car, script sets setElementAlpha for him car, player IS in the vehicle and can drive this vehicle normally. I'm sorry for that, I don't make myself clear.

Link to comment

or you could use:

setElementVisibleTo 

anyways, try this:

function invisibility(source) 
    if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("admin"))then 
        outputChatBox("Sorry, but you can't use this command!",source) 
        return 
    end 
    local sourceVeh = getPedOccupiedVehicle(source) 
    if getElementAlpha(sourceVeh) > 200 then 
        setElementAlpha(sourceVeh, 0) 
        outputChatBox("#FF0000Your car is now invisible.", source, 0, 255, 0, true) 
    else 
        setElementAlpha(sourceVeh, 255) 
        outputChatBox("#FF0000Your car is now visible.", source, 0, 255, 0, true) 
    end 
end 
addCommandHandler("v_inv", invisibility) 

Link to comment

Line 2: aclGetGroup("admin")?

 function invisibility(source) 
    if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup("Admin"))then 
        outputChatBox("Sorry, but you can't use this command!",source) 
        return 
    end 
    local sourceVeh = getPedOccupiedVehicle(source) 
    if getElementAlpha(sourceVeh) > 200 then 
        setElementAlpha(sourceVeh, 0) 
        outputChatBox("#FF0000Your car is now invisible.", source, 0, 255, 0, true) 
    else 
        setElementAlpha(sourceVeh, 255) 
        outputChatBox("#FF0000Your car is now visible.", source, 0, 255, 0, true) 
    end 
end 
addCommandHandler("v_inv", invisibility) 
  

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