Jump to content

GiveWeapon


CodX

Recommended Posts

Hello !
I try to make a script who give a minigun with 1000 ammo but when i execute the command he give me minigun if one ammo.

I'm sorry for my english, i'm from Romanian and the text is the same.

function vreau (thePlayer, commandName, weaponID, ammo)
    if (exports.integration:isPlayerLeadAdmin(thePlayer) or exports.integration:isPlayerLeadScripter(thePlayer)) then
	outputChatBox ("Ai primit 1 minigun cu 1000 de gloante.", source, 255, 255 ,0)
        giveWeapon (thePlayer, 38, 500)
        setWeaponAmmo (thePlayer, 38, 500)
  end
end
addCommandHandler ("give", vreau)

 

 

Meta:

<meta>
   <script src="script.lua" type="server" />
   <script src="script.lua" type="client" />
</meta>

 

Edited by CodX
Link to comment
  • Moderators

I don't understand your question, please rewrite last part.
 

Not required:

setWeaponAmmo (thePlayer, 38, 500)

 

Change:

giveWeapon (thePlayer, 38, 1000, true)

 

 

Adding the script to two sides is not correct, unless you know what you are doing.

<meta>
   <script src="script.lua" type="server" />
   <!--<script src="script.lua" type="client" />-->
</meta>

 

 

Edited by IIYAMA
Link to comment
addCommandHandler("giveweapon",function(player, weapon, ammo)

   if (exports.integration:isPlayerLeadAdmin(player) or exports.integration:isPlayerLeadScripter(player)) then

      if weapon then

           if tonumber(ammo) then

              giveWeapon(player, weapon, ammo)

          end

    end

end

end)

 

Link to comment

 

8 hours ago, TheMOG said:

addCommandHandler("giveweapon",function(player, weapon, ammo)

   if (exports.integration:isPlayerLeadAdmin(player) or exports.integration:isPlayerLeadScripter(player)) then

      if weapon then

           if tonumber(ammo) then

              giveWeapon(player, weapon, ammo)

          end

    end

end

end)

 

Don't work, is the same, he give me only one bullet.

He says: You have been given a 'Minigun'(500) by Vladus_Griffin.

 

 

 

 

 

===================================================================================================================================

10 hours ago, IIYAMA said:

I don't understand your question, please rewrite last part.
 

Not required:

setWeaponAmmo (thePlayer, 38, 500)

 

Change:


giveWeapon (thePlayer, 38, 1000, true)

 

 

Adding the script to two sides is not correct, unless you know what you are doing.


<meta>
   <script src="script.lua" type="server" />
   <!--<script src="script.lua" type="client" />-->
</meta>

 

 

I change the script but is the same problem.

 

function vreau (thePlayer, commandName, weaponID, ammo)
    if (exports.integration:isPlayerLeadAdmin(thePlayer) or exports.integration:isPlayerLeadScripter(thePlayer)) then
	outputChatBox ("Ai primit 1 minigun cu 500 gloante.", thePlayer, 255, 255 ,0)
        giveWeapon (thePlayer, 38, 500, true)
  end
end
addCommandHandler ("give", vreau)

 

Edited by CodX
Link to comment
5 minutes ago, IIYAMA said:

But what is the problem? I don't know what to look for.

So, when I execute the command he give me the weapon. minigun, but that weapon contains only one bullet and, from script, he need to give me 500 bullets.

Link to comment

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