Turbe$Z

Why not working takeplayermoney?

Recommended Posts

function giveWeaponsOnSpawn0 ( )
    giveWeapon ( source, 31, 3000 ) -- Gives the M4 weapon with 200 ammo
	takePlayerMoney ( source, 20 )
	else
	outputChatBox("You do not have enough money.", source, 255, 0, 0, false)
end
addEvent( "giveweaponm4", true )
addEventHandler( "giveweaponm4", root, giveWeaponsOnSpawn0 )

what wrong in this?

Share this post


Link to post

There is no 'if' statement for 'else' at line 4. Try this:

function giveWeaponsOnSpawn0 ( )
  if getPlayerMoney(source) >= 20 then
    giveWeapon ( source, 31, 3000 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 20 )
  else
    outputChatBox("You do not have enough money.", source, 255, 0, 0, false)
  end
end
addEvent( "giveweaponm4", true )
addEventHandler( "giveweaponm4", root, giveWeaponsOnSpawn0 )

 

Share this post


Link to post
11 minutes ago, Gravestone said:

There is no 'if' statement for 'else' at line 4. Try this:


function giveWeaponsOnSpawn0 ( )
  if getPlayerMoney(source) >= 20 then
    giveWeapon ( source, 31, 3000 ) -- Gives the M4 weapon with 200 ammo
    takePlayerMoney ( source, 20 )
  else
    outputChatBox("You do not have enough money.", source, 255, 0, 0, false)
  end
end
addEvent( "giveweaponm4", true )
addEventHandler( "giveweaponm4", root, giveWeaponsOnSpawn0 )

 

thanks

Share this post


Link to post

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.