Jump to content

About getWeaponAmmo


Recommended Posts

Posted

getWeaponAmmo is used for custom weapons, not players.

You must use:

getPedWeapon 
getPedTotalAmmo 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Use the minigun weapon slot ( get it from the wiki page ), then check if he has the minigun on the slot.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

getPedWeapon returns the weapon ID, just check if it's 38.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)

i tried to but i dont understand how to... could you tell me? how to do that if the weapon > 5 it goes to 1

**for set the ammo i think i must use trigger and giveweapon in serverside no?**

Edited by Guest
Posted

Show me how you did it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
function ( ) 
if getPedTotalAmmo ( getLocalPlayer(), 7 ) > 1 then 
triggerServerEvent("lol", getLocalPlayer()) 
end 
end 
setTimer(, 100, 0) 

server

  
addEvent("lol") 
addEventHandler("lol", root, 
giveWeapon(source, 38, 1) 
end 
) 

as u see it's a madness

And no idea yet how to get the weapon minigun =/

Posted
function ( ) 
    local weapon = getPedWeapon ( localPlayer, 7 ) 
    if ( weapon == 38 ) then 
        if ( getPedTotalAmmo ( localPlayer, 7 ) > 1 ) then 
            triggerServerEvent ( "lol", localPlayer ) 
        end 
    end 
end 
setTimer ( , 100, 0 ) 

Using a timer isn't an efficient method though.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You could use the onClientPlayerWeaponSwitch event instead, so when he switches to the minigun, it'll trigger.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Example:

if ( money == 200 ) then 
-- Do something 
elseif ( money == 400 ) then 
-- Do something else 
end 

And you can keep using it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

ok :D

oh i tried the script with onClientPlayerWeaponSwitch event instead setTimer but it says this in debug:

ERROR: Client (GamerDeMTA) triggered serverside event lol, but event is not marked aas remotly triggerable

Posted

Post the script.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Client side

  
addEventHandler("onClientPlayerWeaponSwitch", getRootElement(),  
function ( ) 
    local weapon = getPedWeapon ( source, 7 ) 
    if ( weapon == 38 ) then 
        if ( getPedTotalAmmo ( source, 7 ) > 1 ) then 
            triggerServerEvent ( "lol", source ) 
        end 
    end 
end 
) 

serverside

addEvent("lol") 
addEventHandler("lol", getRootElement(), 
function ( ) 
giveWeapon ( source, 38, 1 ) 
end 
) 

Posted
addEvent("lol") 

Change that to:

addEvent ( "lol", true ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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