Linux_Shines Posted October 4, 2012 Share Posted October 4, 2012 (edited) 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 October 4, 2012 by Guest Link to comment
TwiX! Posted October 4, 2012 Share Posted October 4, 2012 https://wiki.multitheftauto.com/wiki/SetElementDimension use [lua] [ /lua] tags Link to comment
TAPL Posted October 5, 2012 Share Posted October 5, 2012 https://wiki.multitheftauto.com/wiki/IsObjectInACLGroup Link to comment
Linux_Shines Posted October 5, 2012 Author Share Posted October 5, 2012 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
sockz Posted October 5, 2012 Share Posted October 5, 2012 use 'player' as element argument Link to comment
Jaysds1 Posted October 7, 2012 Share Posted October 7, 2012 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
Linux_Shines Posted October 7, 2012 Author Share Posted October 7, 2012 When I'm copy your code, Jaysds1, and write in console debugscript 3, it says (when I load script, console don't display any error, but when I write command /v_inv, the error below is showing): attempt to call global 'getPlayerAccount' (a nil value) Link to comment
Jaysds1 Posted October 7, 2012 Share Posted October 7, 2012 is the script server-sided? Link to comment
Linux_Shines Posted October 7, 2012 Author Share Posted October 7, 2012 No, it's client-sided. Link to comment
Jaysds1 Posted October 7, 2012 Share Posted October 7, 2012 change it to server-sided please Link to comment
Linux_Shines Posted October 7, 2012 Author Share Posted October 7, 2012 Yeah, it resolved my issue for which I thank you, but now when I write "/v_inv", I've got an message "Sorry, but you can't use this command!", even thought I'm admin. I must add this script to acl.xml or what? Link to comment
GTX Posted October 7, 2012 Share Posted October 7, 2012 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now