Jamie_Mews Posted July 15, 2011 Share Posted July 15, 2011 addCommandHandler( "mend", function( thePlayer, commandName, who ) if exports.players:isLoggedIn( thePlayer ) then local inPD, factionID, factionName, factionTag = exports.factions:isPlayerInFactionType( thePlayer, 7 ) if inPD and factionTag then fixVehicle(getPedOccupiedVehicle(getPlayerFromName(who))) else outputChatBox( "(( You are not in a Government faction. ))", thePlayer, 255, 0, 0 ) end end end ) Im abit clueless with money. Id like the player who uses the command to lose 100$ from the command. Please Help Link to comment
Castillo Posted July 15, 2011 Share Posted July 15, 2011 addCommandHandler( "mend", function( thePlayer, commandName, who ) if exports.players:isLoggedIn( thePlayer ) then local inPD, factionID, factionName, factionTag = exports.factions:isPlayerInFactionType( thePlayer, 7 ) if inPD and factionTag then fixVehicle(getPedOccupiedVehicle(getPlayerFromName(who))) if getPlayerMoney(thePlayer) >= 100 then takePlayerMoney(thePlayer, 100) end else outputChatBox( "(( You are not in a Government faction. ))", thePlayer, 255, 0, 0 ) end end end ) Should check if the player has more than $100 or $100 and take it. Link to comment
AGENT_STEELMEAT Posted July 15, 2011 Share Posted July 15, 2011 You should ensure the player has the cash before fixing the vehicle: addCommandHandler( "mend", function( thePlayer, commandName, who ) if exports.players:isLoggedIn( thePlayer ) then local inPD, factionID, factionName, factionTag = exports.factions:isPlayerInFactionType( thePlayer, 7 ) if inPD and factionTag then if getPlayerMoney(thePlayer) >= 100 then takePlayerMoney(thePlayer, 100) fixVehicle(getPedOccupiedVehicle(getPlayerFromName(who))) else outputChatBox( "(( You don't have enough cash! ))", thePlayer, 255, 0, 0 ) end else outputChatBox( "(( You are not in a Government faction. ))", thePlayer, 255, 0, 0 ) end else outputChatBox( "(( You are not logged in! ))", thePlayer, 255, 0, 0 ) end end ) Link to comment
Castillo Posted July 15, 2011 Share Posted July 15, 2011 Well... since he said "lose" I suposed he wanted to do it anyway, without checking his/her money. Link to comment
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