Jump to content

Gun shop help


K4stic

Recommended Posts

Problem; the i buy the weapon it's ok but after buy weapon and buy the ammo it's say me "First you need to have an Silenced" pls Help me

-- Server side

-- Buy the weapon 
addEvent ("buySilenced", true) 
addEventHandler ("buySilenced", getRootElement(), 
    function ( id, cost, munic ) 
    if (getPlayerMoney ( source ) >= tonumber( cost ) ) then 
        outputChatBox ("YOU HAVE BUY Silenced", source, 0, 255, 0, false) 
        takePlayerMoney ( source, tonumber( cost ) ) 
        giveWeapon( source, tonumber( id ), tonumber( munic ) ) 
        setAccountData ( getPlayerAccount ( source ), "ownSilenced" ) 
    else 
        outputChatBox ("Your money not enough to buy this Weapon", source, 255, 0, 0, false) 
        end 
    end 
) 
  
-- Buy the ammo for weapon 
addEvent ("buyAmmoSilenced", true) 
addEventHandler ("buyAmmoSilenced", getRootElement(), 
    function ( id, cost, munic ) 
        if (getPlayerMoney ( source ) >= tonumber( cost ) ) and getAccountData ( getPlayerAccount ( source ), "ownSilenced" ) then 
            outputChatBox ("You bought Silenced ammo", source, 0, 255, 0, false) 
            takePlayerMoney (source, tonumber ( cost ) ) 
            giveWeaponAmmo(source,tonumber( id ), tonumber( munic ) ) 
        elseif (getPlayerMoney (source) >= tonumber(cost)) and ( not getAccountData ( getPlayerAccount ( source ), "ownSilenced" ) ) then 
            outputChatBox ("First you need to have an Silenced", source, 255, 0, 0, false) 
        elseif (getPlayerMoney (source) < tonumber(cost)) and getAccountData ( getPlayerAccount ( source ), "ownSilenced" ) then 
            outputChatBox ("Your money not enough to buy this item", source, 255, 0, 0, false) 
        else outputChatBox ("YOU NEED FIRST BUY Silenced GUN THEN AMMO FOR Silenced", source, 255, 0, 0, false) 
        end 
    end 
) 

Link to comment
so what wrong i do? o.O
setAccountData ( getPlayerAccount ( source ), "ownSilenced" ) 

bool setAccountData ( account theAccount, string key, string value ) 

You can see what is wrong?

This function require 3 argument, but you have only two.

Link to comment

i make this for buy weapon

setAccountData ( getPlayerAccount ( source ), "ownSilenced", "true" ) 

and use this at buy ammo

getAccountData ( getPlayerAccount( source ), "ownSilenced" ) == "true" 

So Big Thx you TAPL :)

Edited by Guest
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...