manve1 Posted August 21, 2012 Share Posted August 21, 2012 hey guys, how could i make this script only work for admins? i have tryied using wiki and from other scripts, but it didn't help please help me addCommandHandler("getguard", function(p) if(ablauf[p] == true) then return end ablauf[p] = true local x, y, z = getElementPosition(p) ped[p] = createPed(164, x, y+1, z) setElementData(ped[p], "besitzer", getPlayerName(p)) setElementData(ped[p], "bodyguard", true) giveWeapon(ped[p], 25, 99999, true) setPedStat (ped[p], 72, 999) addEventHandler("onPedWasted", ped[p], function() local ped = source setTimer(destroyElement, 1000, 1, ped) ablauf[p] = false end) end) thanx for any help. Link to comment
Vision Posted August 21, 2012 Share Posted August 21, 2012 addCommandHandler("getguard", function(p) if isObjectInACLGroup ( "user." ..getAccountName ( getPlayerAccount ( p ) ), aclGetGroup ( "Admin" ) ) then if(ablauf[p] == true) then return end ablauf[p] = true local x, y, z = getElementPosition(p) ped[p] = createPed(164, x, y+1, z) setElementData(ped[p], "besitzer", getPlayerName(p)) setElementData(ped[p], "bodyguard", true) giveWeapon(ped[p], 25, 99999, true) setPedStat (ped[p], 72, 999) addEventHandler("onPedWasted", ped[p], function() local ped = source setTimer(destroyElement, 1000, 1, ped) ablauf[p] = false end) end end) Link to comment
manve1 Posted August 21, 2012 Author Share Posted August 21, 2012 addCommandHandler("getguard", function(p) if isObjectInACLGroup ( "user." ..getAccountName ( getPlayerAccount ( p ) ), aclGetGroup ( "Admin" ) ) then if(ablauf[p] == true) then return end ablauf[p] = true local x, y, z = getElementPosition(p) ped[p] = createPed(164, x, y+1, z) setElementData(ped[p], "besitzer", getPlayerName(p)) setElementData(ped[p], "bodyguard", true) giveWeapon(ped[p], 25, 99999, true) setPedStat (ped[p], 72, 999) addEventHandler("onPedWasted", ped[p], function() local ped = source setTimer(destroyElement, 1000, 1, ped) ablauf[p] = false end) end end) dont work Link to comment
Perfect Posted August 21, 2012 Share Posted August 21, 2012 addCommandHandler("getguard", function(p) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if(ablauf[p] == true) then return end ablauf[p] = true local x, y, z = getElementPosition(p) ped[p] = createPed(164, x, y+1, z) setElementData(ped[p], "besitzer", getPlayerName(p)) setElementData(ped[p], "bodyguard", true) giveWeapon(ped[p], 25, 99999, true) setPedStat (ped[p], 72, 999) addEventHandler("onPedWasted", ped[p], function() local ped = source setTimer(destroyElement, 1000, 1, ped) ablauf[p] = false end) end) Link to comment
manve1 Posted August 21, 2012 Author Share Posted August 21, 2012 addCommandHandler("getguard", function(p) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if(ablauf[p] == true) then return end ablauf[p] = true local x, y, z = getElementPosition(p) ped[p] = createPed(164, x, y+1, z) setElementData(ped[p], "besitzer", getPlayerName(p)) setElementData(ped[p], "bodyguard", true) giveWeapon(ped[p], 25, 99999, true) setPedStat (ped[p], 72, 999) addEventHandler("onPedWasted", ped[p], function() local ped = source setTimer(destroyElement, 1000, 1, ped) ablauf[p] = false end) end) this dont work too and the script is server sided. Link to comment
sockz Posted August 21, 2012 Share Posted August 21, 2012 syntax errors and the player argument is p, not thePlayer Link to comment
manve1 Posted August 21, 2012 Author Share Posted August 21, 2012 can you stop arguing and give me how it should be and should work with? here is debug: http://i.imgur.com/KsJmw.jpg Link to comment
Vision Posted August 21, 2012 Share Posted August 21, 2012 Try this ablauf = {} ped = {} addCommandHandler("getguard", function(p) if isObjectInACLGroup ( "user." ..getAccountName ( getPlayerAccount ( p ) ), aclGetGroup ( "Admin" ) ) then if(ablauf[p] == true) then return end ablauf[p] = true local x, y, z = getElementPosition(p) ped[p] = createPed(164, x, y+1, z) setElementData(ped[p], "besitzer", getPlayerName(p)) setElementData(ped[p], "bodyguard", true) giveWeapon(ped[p], 25, 99999, true) setPedStat (ped[p], 72, 999) addEventHandler("onPedWasted", ped[p], function() local ped = source setTimer(destroyElement, 1000, 1, ped) ablauf[p] = false end) end end) Link to comment
manve1 Posted August 21, 2012 Author Share Posted August 21, 2012 Try this ablauf = {} ped = {} addCommandHandler("getguard", function(p) if isObjectInACLGroup ( "user." ..getAccountName ( getPlayerAccount ( p ) ), aclGetGroup ( "Admin" ) ) then if(ablauf[p] == true) then return end ablauf[p] = true local x, y, z = getElementPosition(p) ped[p] = createPed(164, x, y+1, z) setElementData(ped[p], "besitzer", getPlayerName(p)) setElementData(ped[p], "bodyguard", true) giveWeapon(ped[p], 25, 99999, true) setPedStat (ped[p], 72, 999) addEventHandler("onPedWasted", ped[p], function() local ped = source setTimer(destroyElement, 1000, 1, ped) ablauf[p] = false end) end end) it works, thx 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