Created
April 13, 2017 19:58
-
-
Save DouglasSherk/7088b3ef920ba70eb0bd9fda4303b32c to your computer and use it in GitHub Desktop.
HWRP - Withdrawing from bank account
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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