CapY Posted August 16, 2011 Posted August 16, 2011 I have downloaded explosive bullets from community and i want to make it for members only , why this dont work ? Server: function bulletexplosion (hitX, hitY, hitZ) createExplosion ( hitX, hitY, hitZ, 2 ) end addEventHandler("bulletboom",getRootElement(),bulletexplosion) function ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "FGMembers" ) ) then addEvent("bulletboom",true) else cancelEvent("bulletboom",true) end end ) If client needed i will post it .
Jaysds1 Posted August 16, 2011 Posted August 16, 2011 So, you only want Members to use it??? Admins, Moderators, or Registered members?
JR10 Posted August 16, 2011 Posted August 16, 2011 Try this: function bulletexplosion (hitX, hitY, hitZ) createExplosion ( hitX, hitY, hitZ, 2 ) end function ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "FGMembers" ) ) then addEvent("bulletboom",true) addEventHandler("bulletboom",getRootElement(),bulletexplosion) end end )
CapY Posted August 16, 2011 Author Posted August 16, 2011 Jacob , that's dont work. And event is not triggered to client side ( do i need client anymore? ) Client: function weaponfired (weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) triggerServerEvent ("bulletboom", source, hitX, hitY, hitZ ) end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer (), weaponfired ) And on the server there is error on 5 line . '(name)' expected near '(' Server: function bulletexplosion (hitX, hitY, hitZ) createExplosion ( hitX, hitY, hitZ, 2 ) end function ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ( "user." .. playerName, aclGetGroup ( "FGMembers" ) ) then addEvent("bulletboom",true) addEventHandler("bulletboom",getRootElement(),bulletexplosion) end end )
JR10 Posted August 16, 2011 Posted August 16, 2011 That function is not attached to anything. here: function bulletexplosion (hitX, hitY, hitZ) createExplosion ( hitX, hitY, hitZ, 2 ) end addEventHandler("onPlayerLogin", root, function ( _, acc ) local accName = getAccountName ( acc ) if isObjectInACLGroup ( "user." .. getPlayerName(source), aclGetGroup ( "FGMembers" ) ) then addEvent("bulletboom",true) addEventHandler("bulletboom",getRootElement(),bulletexplosion) end end ) Of course client is needed. Now the player must log in, and it will check if he's in FGMembers.
CapY Posted August 16, 2011 Author Posted August 16, 2011 Why this trigger doesnt works ? function bulletexplosion (hitX, hitY, hitZ) triggerClientEvent("weaponfired",weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) createExplosion ( hitX, hitY, hitZ, 2 ) end addEventHandler("onPlayerLogin", root, function ( _, acc ) local accName = getAccountName ( acc ) if isObjectInACLGroup ( "user." .. getPlayerName(source), aclGetGroup ( "FGMembers" ) ) then addEvent("bulletboom",true) addEventHandler("bulletboom",getRootElement(),bulletexplosion) end end )
CapY Posted August 16, 2011 Author Posted August 16, 2011 What is not good now ? server: function bulletexplosion (hitX, hitY, hitZ) triggerClientEvent("onClientPlayerWeaponFire",weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) createExplosion ( hitX, hitY, hitZ, 2 ) end addEventHandler("onPlayerLogin", root, function ( _, acc ) local accName = getAccountName ( acc ) if isObjectInACLGroup ( "user." .. getPlayerName(source), aclGetGroup ( "FGMembers" ) ) then addEvent("bulletboom",true) addEventHandler("bulletboom",getRootElement(),bulletexplosion) end end ) client: function weaponfired (weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) triggerServerEvent ("bulletboom", source, hitX, hitY, hitZ ) end addEvent( "onClientPlayerWeaponFire", true ) addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer (), weaponfired )
JR10 Posted August 16, 2011 Posted August 16, 2011 DUDE, what in the world is this. Here: server: function bulletexplosion (hitX, hitY, hitZ) createExplosion ( hitX, hitY, hitZ, 2 ) end addEventHandler("onPlayerLogin", root, function ( _, acc ) local accName = getAccountName ( acc ) if isObjectInACLGroup ( "user." .. getPlayerName(source), aclGetGroup ( "FGMembers" ) ) then addEvent("bulletboom",true) addEventHandler("bulletboom",getRootElement(),bulletexplosion) end end ) client: function weaponfired (weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) triggerServerEvent ("bulletboom", source, hitX, hitY, hitZ ) end addEventHandler ( "onClientPlayerWeaponFire", root, weaponfired )
CapY Posted August 17, 2011 Author Posted August 17, 2011 Error : http://imageshack.us/f/52/exbullets.png/
JR10 Posted August 17, 2011 Posted August 17, 2011 server: function bulletexplosion (hitX, hitY, hitZ) if isObjectInACLGroup ( "user." .. getPlayerName(source), aclGetGroup ( "FGMembers" ) ) then createExplosion ( hitX, hitY, hitZ, 2 ) end end addEvent("bulletboom",true) addEventHandler("bulletboom",getRootElement(),bulletexplosion) client: function weaponfired (weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) triggerServerEvent ("bulletboom", source, hitX, hitY, hitZ ) end addEventHandler ( "onClientPlayerWeaponFire", root, weaponfired )
CapY Posted August 17, 2011 Author Posted August 17, 2011 Lol no errors , but explosive bullets dont work .
JR10 Posted August 17, 2011 Posted August 17, 2011 Then you are not in FGMembers. Or you are using a different name from your account name: server: function bulletexplosion (hitX, hitY, hitZ) if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "FGMembers" ) ) then createExplosion ( hitX, hitY, hitZ, 2 ) end end addEvent("bulletboom",true) addEventHandler("bulletboom",getRootElement(),bulletexplosion)
JR10 Posted August 17, 2011 Posted August 17, 2011 No, it's not. It was a wrong method already, but I was trying to fix your code.
CapY Posted August 17, 2011 Author Posted August 17, 2011 It works only when i care nick CapY or crocapy , otherwise it wont work on other nicks, no matter if they are logged in or not.
JR10 Posted August 17, 2011 Posted August 17, 2011 server: function bulletexplosion (hitX, hitY, hitZ) if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "FGMembers" ) ) then createExplosion ( hitX, hitY, hitZ, 2 ) end end addEvent("bulletboom",true) addEventHandler("bulletboom",getRootElement(),bulletexplosion) This will check for the player's account name, if it's in FGMembers it should work, if he's in FGMembers.
MTA Team qaisjp Posted August 18, 2011 MTA Team Posted August 18, 2011 capy, make a usersystem.then work with function getPlayerClass(p) return getElementData(p,"playerClass") or 1 end Use cannonballs system if you are going to use ths a lot
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