Galton Posted March 23, 2015 Posted March 23, 2015 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.
Enargy, Posted March 23, 2015 Posted March 23, 2015 (edited) EDIT: use: if getPedWeapon(client) == 32 or getPedWeapon(client) == 28 then instead of: if getPedWeapon(client) == 32 or 28 then Edited March 23, 2015 by Guest
Galton Posted March 23, 2015 Author Posted March 23, 2015 use: if ( getPedWeapon(client) == 32 or getPedWeapon(client) == 28 ) then instead of: if getPedWeapon(client) == 32 or 28 then thanks for replying. sadly it didn't fix the problem.
Galton Posted March 23, 2015 Author Posted March 23, 2015 (edited) 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 March 23, 2015 by Guest
Enargy, Posted March 23, 2015 Posted March 23, 2015 (edited) EDIT: Some error in debugscript? remember that if the function is executed by a command it is obvious you did not add the player in the function. function (client) -- Bla bla end Edited March 23, 2015 by Guest
Galton Posted March 23, 2015 Author Posted March 23, 2015 it's server side, uziCheck function is executed by clicking a gui button. it works perfectly fine when I'm holding tec9. I tried replacing 32 with something else and it also works fine.
Enargy, Posted March 23, 2015 Posted March 23, 2015 (edited) it's server side, uziCheck function is executed by clicking a gui button. MY WRONG. Edited March 23, 2015 by Guest
Enargy, Posted March 23, 2015 Posted March 23, 2015 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
Galton Posted March 23, 2015 Author Posted March 23, 2015 even tho restarting the resource didn't help (apparently), I tried restarting my server and now it works fine. weird. anyway, thanks for your help.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now