Jump to content

[HELP]Replacing models


TheBull

Recommended Posts

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

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

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

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

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