Azortharion Posted November 5, 2012 Posted November 5, 2012 So basically I just installed the bbullets resource (exploding bullets), and I want to make it admin-only. I am a -COMPLETE IDIOT-, so please treat me as such when you explain, what I have tried so far: - adding "command.bbullets" to the admin ACL rights. - adding "resource.blowing_bullets" to the admin ACL Have found some scripts that I put into the resource's code, but well. I am doing it completely wrong. Original code, server.lua function bulletexplosion (hitX, hitY, hitZ) createExplosion ( hitX, hitY, hitZ, 2 ) end addEventHandler("bulletboom",getRootElement(),bulletexplosion) end I added the following piece of code to the top of that script, as in this piece: { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "This command can only be used by an admin!!"); - I added the same piece of code to the top of the client.lua script. The server.lua script: bBullets = false function enableBlowingbullets() if (bBullets == false)then bBullets = true outputChatBox("Blowing Bullets has been enabled.", 0, 255, 0) outputChatBox("type /bbullets to disable them.", 0, 255, 0) else bBullets = false outputChatBox("Blowing Bullets has been disabled.", 255, 0, 0) outputChatBox("type /bbullets to enable them.", 255, 0, 0) end end addCommandHandler("bbullets", enableBlowingbullets) public OnPlayerCommandText(playerid, cmdtext[]) { function weaponfired (weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "This command can only be used by an admin!!"); if (bBullets == true)then triggerServerEvent ("bulletboom", source, hitX, hitY, hitZ ) end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer (), weaponfired ) -- So as you probably figured out I am a helpless retard. I tried searching, I really did but either I didn't understand any of the code I was reading, or the fancy words accompanying those. So how do I make the command "bbullets" of the resource blowing_bullets available ONLY TO ADMINS? Also, how do I make a command to trigger my godmode script on and off? This is the godmode script: local godModeState = false addCommandHandler ( "godmode", function ( ) if ( exports.global:isPlayerSuperAdmin ( localPlayer ) ) then -- You had forgot to define 'localPlayer' and forgot about 'then'. godModeState = ( not godModeState ) outputChatBox ( "God Mode is now ".. ( godModeState and "Enabled" or "Disabled" ) ..".", 0, 255, 0 ) end end ) function togdamage ( attacker, weapon, bodypart ) if ( godModeState ) then cancelEvent ( ) end end addEventHandler ( "onClientPlayerDamage", localPlayer, togdamage ) proDRIFT Freeroam, come join our community! IP: 176.9.79.179:22043
Anderl Posted November 5, 2012 Posted November 5, 2012 I didn't know MTA used the "shitty" Pawn "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
NeuTroN152 Posted September 3, 2013 Posted September 3, 2013 Same problem i tried to make it admin only too ... i modifed acl and permissions , i have the saaaaaaame problem
Moderators IIYAMA Posted September 3, 2013 Moderators Posted September 3, 2013 what the hell for function is this: isPlayerSuperAdmin ? Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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