Jump to content

Explosive bullets


CapY

Recommended Posts

Posted

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 .

Posted

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 
) 

Posted

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 
) 

Posted

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.

Posted

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 
) 

Posted

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 ) 

Posted

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 ) 

Posted

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 ) 

Posted

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) 

Posted

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.

Posted

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
Posted

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 ;)

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