quality Posted June 14, 2015 Share Posted June 14, 2015 (edited) 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 June 15, 2015 by Guest Link to comment
Dealman Posted June 14, 2015 Share Posted June 14, 2015 You can not use server-side functions and events in a client-side script. Link to comment
#RooTs Posted June 15, 2015 Share Posted June 15, 2015 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
xeon17 Posted June 15, 2015 Share Posted June 15, 2015 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
Baseplate Posted June 15, 2015 Share Posted June 15, 2015 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
#RooTs Posted June 15, 2015 Share Posted June 15, 2015 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
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