Jump to content

Recommended Posts

Posted

ola,

queria saber como posso verificar se um jogador tem uma arma certa ( no caso pistola)?

eu tentei algumas função diferentes mas nao consegui

local ammo = getPedAmmoInClip ( hitElement, 2 ) 
if (ammo > 0) then 
giveWeapon(hitElement, 22, 5, true) 

560x95_FFFFFF_09FF00_050505_000000.png

"Querer não é poder, mas tentar é avançar"!

Posted
getPedWeapon(thePed, 2) 

Use getPedTotalAmmo com o slot da pistola se quiser verificar a munição da arma do ped.

Mas lembre-se que primeiro você deve verificar se o ped tem essa arma.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
local arma = getPedWeapon (  thePed, 2 ) 
if arma then 
local ammo getPedTotalAmmo (  thePed, 2 ) 
if ammo then 

retorna o slot, mas o slot pode ser uma das 3 armas diferentes. como poderia saber se esse slot tem pistola?

560x95_FFFFFF_09FF00_050505_000000.png

"Querer não é poder, mas tentar é avançar"!

Posted

getPedWeapon Retorna o ID da arma, não retorna o slot.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
local arma = getPedWeapon (  thePed, 2 ) 
if (arma == 22) then 
local ammo = getPedTotalAmmo (  thePed, 2 ) 
if (ammo >0) then 

então isto pode funcionar?

560x95_FFFFFF_09FF00_050505_000000.png

"Querer não é poder, mas tentar é avançar"!

Posted

Deve funcionar.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

obrigado novamente! (desculpe pela duvida boba, pensei que fosse dificil verificar a arma do jogador :oops: )

560x95_FFFFFF_09FF00_050505_000000.png

"Querer não é poder, mas tentar é avançar"!

Posted

De nada.

Consulte bem o MTA Wiki sempre tiver alguma dúvida, principalmente, tente fazer o script por você mesmo (você pode estar sempre fazendo isso, mas procure evitar ao máximo abrir um tópico por pequenas dúvidas, abra um tópico quando realmente precisar).

Please do not PM me with scripting related question nor support, use the forums instead.

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