08.04.2011, 16:44
hi guys...
im trying to make a /deposit command
the problem is that i want to make it working that you enter /deposit amount for example 1255 it will remove the amount from your current money and update into your bank. The problem is that nothing happens. Not even errors / warnings.
im trying to make a /deposit command
the problem is that i want to make it working that you enter /deposit amount for example 1255 it will remove the amount from your current money and update into your bank. The problem is that nothing happens. Not even errors / warnings.
pawn Код:
CMD:deposit(playerid,params[])
{
new money,pname[24],string[128],bankcash;
if(sscanf(params,"d",money)) return SendClientMessage(playerid,COLOR_ERROR,"USAGE: /deposit amount");
if(InBank[playerid])
{
if(IsPlayerInDynamicCP(playerid,sfschalter))
{
format(Query,sizeof(Query),"SELECT * FROM `users` WHERE username='%s'",pname);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
new line[512];
if(mysql_fetch_row(line)) //Fetches the line
{
new data[13];//The data strings
new data2[10]; //The data variables
sscanf(line, "p|ds[24]s[60]dddddd",data2[1], data[1],data[2],data2[2],data2[3],data2[4],data2[5],data2[6],data2[7]); //Splits the line with sscanf
bankcash = data2[5];
money += bankcash ; // here should the money ( amount) be aggregated with the bank money which comes from the database
mysql_free_result(); // dont know if its needed in here or not
format(Query,sizeof(Query),"UPDATE `users` SET `bankcash` = '%d' WHERE username='%s'",bankcash,pname);
mysql_query(Query);
SendClientMessage(playerid,0x8F8F8FAA,"_|San Fierro - Bank|_");
format(string,sizeof(string),"You deposited $%d into your account",money);
SendClientMessage(playerid,0x333333AA,string);
SendClientMessage(playerid,0x8F8F8FAA,"Transfer done");
GivePlayerMoney(playerid,-money);
}
}
}
else
{
SendClientMessage(playerid,COLOR_ERROR,"You are not in the Checkpoint");
return 1;
}
}
else
{
SendClientMessage(playerid,COLOR_ERROR,"You are not at the Bank");
return 1;
}
return 1;
}