Jump to content

admin weapon[SOLVED]


quality

Recommended Posts

function giveWeapon() 
local theDude = isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) 
givePedWeapon ( theDude, 36, 5000, true) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),giveWeapon) 

I have this as my client.lua

in meta is like this:

What am I doing wrong? I just need on spawn as admin to get a weapon. Thanks

Edited by Guest
Link to comment

try this

Server Side

function giveWeapon() 
local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
           givePedWeapon ( thePlayer, 36, 5000, true) 
     end 
addEventHandler("onPlayerSpawn",getRootElement(),giveWeapon) 

Link to comment

givePedWeapon is a client-side function which also works only on peds and not on players.

Use this instead, it should work.

function weapon() 
local theDude = isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) 
giveWeapon ( theDude, 36, 5000, true) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),weapon) 

Link to comment
local theDude = isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) 

Really?

function giveTheWeapon() 
    local accName = getAccountName(getPlayerAccount(source)) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup("Admin")) then 
        giveWeapon (source, 36, 5000, true) 
    end 
end 
addEventHandler("onPlayerSpawn", root, giveTheWeapon) 

Server-sided. ;)

Link to comment

Sorry, it is, to be ( giveWeapon ) and not ( givePedWeapon )

my example

function giveWeapon() 
local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
           giveWeapon ( source, 36, 5000, true) 
     end 
addEventHandler("onPlayerSpawn",getRootElement(),giveWeapon) 

sorry :(

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