Jump to content

A quick question about "or".


Galton

Recommended Posts

Hello, I want to check if the player is holding a uzi or tec9;

if getPedWeapon(client) == 32 or 28 then 

everything else works fine, but my code only works if I'm holding tec9, not uzi. ( 32 = tec9, 28 = uzi)

sadly google didn't help at all.

thanks in advance.

Link to comment
The code is correct :|

this is my code:

function uziCheck () 
local uzistat = getPedStat(client,75) 
if getPedWeapon(client) == 32 or getPedWeapon(client) == 28  then 
    if uzistat == 500 then 
    setPedStat (client, 75, 1000) 
--  outputChatBox ("test: uzi stat: 1000", client)   
    reloadPedWeapon (client) 
    else 
--  outputChatBox ("test: uzi stat: 500", client)        
    setPedStat (client, 75, 500) 
    reloadPedWeapon (client) 
    end 
else 
outputChatBox ("You must be holding Tec9/Uzi in order to change your Tec9/Uzi stat", client) end 
end 

I'm trying to see if I made a mistake, but it looks fine to me.

Edited by Guest
Link to comment
it works perfectly fine when I'm holding tec9. I tried replacing 32 with something else and it also works fine

I see the problem, that is not a problem haha, what happens is you're looking for the player by clicking verify that the player has the gun in his hand.

EDIT: try this

if getPedWeapon(client, 4) == 32 or getPedWeapon(client, 4) == 28  then 

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