Skip to content

Instantly share code, notes, and snippets.

@DouglasSherk
Created April 13, 2017 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DouglasSherk/7088b3ef920ba70eb0bd9fda4303b32c to your computer and use it in GitHub Desktop.
Save DouglasSherk/7088b3ef920ba70eb0bd9fda4303b32c to your computer and use it in GitHub Desktop.
HWRP - Withdrawing from bank account
new authid[32], query[256]
get_user_authid(id,authid,31)
format( query, 255, "SELECT wallet FROM money WHERE steamid='%s'", authid)
result = dbi_query(dbc,query)
if( dbi_nextrow( result ) > 0 )
{
new buffer[32],wallet
dbi_field(result,1,buffer,31)
dbi_free_result(result)
wallet = str_to_num(buffer)
if(wallet < amount || amount == 0)
{
client_print(id,print_chat,"[Bank] You dont have enough money in your wallet!^n")
return PLUGIN_HANDLED
}
else
{
format( query, 255, "UPDATE money SET wallet=wallet-%i WHERE steamid='%s'", amount, authid)
dbi_query( dbc, query)
format( query, 255, "UPDATE money SET balance=balance+%i WHERE steamid='%s'", amount, authid)
dbi_query( dbc, query)
client_print( id, print_chat,"[Bank] You have deposited $%i in your bank balance^n", amount)
return PLUGIN_HANDLED
}
}
dbi_free_result(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment