Jump to content

GiveWeapon


CodX

Recommended Posts

Posted (edited)

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
  • Moderators
Posted (edited)

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

 

Posted (edited)

 

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

  • Moderators
Posted (edited)

You sure you don't run a gamemode with anti cheat next to it?

And you aren't trying to give the weapon clientside?

Edited by IIYAMA
  • Moderators
Posted

Try to run the play gamemode instead of roleplay and test the script. Most roleplay gamemodes do have anti weapon cheat.

Posted
35 minutes ago, IIYAMA said:

Try to run the play gamemode instead of roleplay and test the script. Most roleplay gamemodes do have anti weapon cheat.

In map editor on "Full Test Mode" it work.

hkENfWA.jpg

Posted
1 hour ago, IIYAMA said:

You sure you don't run a gamemode with anti cheat next to it?

And you aren't trying to give the weapon clientside?


Meta:
 

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

 

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