TheBull Posted August 22, 2015 Share Posted August 22, 2015 Helloo I tried to make a script which can replace the current hydra to a customized one for (VIP) players only ,The script didn't work I would really appreciate if you guys help me , Here is my code : local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then txd = engineLoadTXD("hydra.txd") engineImportTXD(txd, 520) dff = engineLoadDFF("hydra.dff", 560) engineReplaceModel(dff, 520) end and the error is : ERROR:Hydra\replace.lua:1: attempt to call global "getPlayerAccount" (a nil value) Link to comment
HUNGRY:3 Posted August 22, 2015 Share Posted August 22, 2015 isObjectInACLGroup is server side so does getAccountName , getPlayerAccount and aclGetGroup so you should trigger event to check if he's in acl Link to comment
TheBull Posted August 22, 2015 Author Share Posted August 22, 2015 Hmm , I didn't understand since i'm new in scripting , could you give me an example? Link to comment
Dealman Posted August 22, 2015 Share Posted August 22, 2015 To be more descriptive; you're trying to use server-side functions in a client-side script. You'll need to do the ACL check in a server-sided script, and if they are listed as a VIP - then you can use triggerClientEvent to replace their vehicle model. Also make sure the thePlayer variable is a player element, and not returning nil. Link to comment
JR10 Posted August 22, 2015 Share Posted August 22, 2015 https://wiki.multitheftauto.com/wiki/Sc ... de_scripts Link to comment
TheBull Posted August 23, 2015 Author Share Posted August 23, 2015 Hmm,Here's what i made : Server : function vipReplaceModele () local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then end triggerServerEvent ( "onReplace", resourceRoot ) end Client : function replaceModele () txd = engineLoadTXD("hydra.txd") engineImportTXD(txd, 520) dff = engineLoadDFF("hydra.dff", 520) engineReplaceModel(dff, 520) end addEvent( "onReplace", true ) addEventHandler( "onReplace", resourceRoot, replaceModele ) But it didn't work tho,there are no errors. Link to comment
HUNGRY:3 Posted August 23, 2015 Share Posted August 23, 2015 Server function vipReplaceModele (thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then end end addEvent( "onReplace", true ) addEventHandler( "onReplace", root, vipReplaceModele ) client function replaceModele () triggerServerEvent("onReplace",localPlayer) txd = engineLoadTXD("hydra.txd") engineImportTXD(txd, 520) dff = engineLoadDFF("hydra.dff", 520) engineReplaceModel(dff, 520) end addEventHandler("onPlayerLogin",root,replaceModele) Link to comment
TheBull Posted August 23, 2015 Author Share Posted August 23, 2015 Still not working,no errors appeared. Link to comment
JR10 Posted August 23, 2015 Share Posted August 23, 2015 function vipReplaceModele (_, acc) local accName = getAccountName (acc ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then triggerClientEvent (source, "onReplace", root ) end end addEventHandler('onPlayerLogin', root, vipReplaceModele) function replaceModele () local txd = engineLoadTXD("hydra.txd") engineImportTXD(txd, 520) local dff = engineLoadDFF("hydra.dff", 520) engineReplaceModel(dff, 520) end addEvent( "onReplace", true ) addEventHandler( "onReplace", root, replaceModele ) Link to comment
TheBull Posted August 23, 2015 Author Share Posted August 23, 2015 It works perfectly,but the one i want is that vip players have their own hydra, and when a vip player see a player who's not vip he will see him in the normal hydra,not the customized one which the vip player have,and the same situation to the non-vip player. Link to comment
JR10 Posted August 23, 2015 Share Posted August 23, 2015 You can replace models for certain players, however, you can't replace certain vehicles, you have to replace all the vehicles of the same model. 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