08.11.2016, 19:20
Hello, i tried to add a cash log command and after i added it i got that errors
Код:
3085>> udb_Exists(bans, "CREATE TABLE IF NOT EXISTS `BANNED` (`NAME`, `IP`, `REASON`, `ADMIN`, `DATE`, `TIME`)"); 3086>> udb_Exists(bans, "CREATE TABLE IF NOT EXISTS `CARLOG` (`ID`, `PLAYER`, `DATE`, `TIME`, `ACTION`)"); 3087>> udb_Exists(bans, "CREATE TABLE IF NOT EXISTS `CASHLOG` (`PLAYER1`, `PLAYER2`, `DATE`, `TIME`, `CASH`)");
Код:
67549 >> udb_Exists(bans, "CREATE TABLE IF NOT EXISTS `CASHLOG` (`PLAYER1`, `PLAYER2`, `DATE`, `TIME`, `CASH`)");
Код:
3 errors here 67553>> format(string,sizeof(string),"[Admins]: %s(id:%d) transfered %d to %s(id:%d)",sendername, playerid, Moneys, giveplayer, giveplayerid);
Код:
CMD:gc(playerid,params[]) { new Moneys,giveplayerid,giveplayer[MAX_PLAYER_NAME],sendername[MAX_PLAYER_NAME],playerMoney[MAX_PLAYERS],string[64]; if (sscanf(params, "ud",giveplayerid, Moneys)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /gc [playerid] [amount]"); // if (!IsNumeric(giveplayerid)) giveplayerid = ReturnPlayerID(giveplayerid); if (IsPlayerConnected(giveplayerid)) { if(cashgiver[giveplayerid] == 1) return SendClientMessage(playerid,red,"ERROR: That person has blocked cash receipt!"); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); playerMoney[playerid] = GetPlayerMoney(playerid); if (Moneys > 0 && playerMoney[playerid] >= Moneys) { GivePlayerMoney(playerid, (-Moneys)); GivePlayerMoney(giveplayerid, Moneys); format(string, sizeof(string), "You have sent %s (id: %d), $%d.", giveplayer,giveplayerid, Moneys); SendClientMessage(playerid, green, string); format(string, sizeof(string), "You have recieved $%d from %s (id: %d).", Moneys, sendername, playerid); SendClientMessage(giveplayerid, green, string); udb_Exists(bans, "CREATE TABLE IF NOT EXISTS `CASHLOG` (`PLAYER1`, `PLAYER2`, `DATE`, `TIME`, `CASH`)"); printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, Moneys, giveplayer, giveplayerid); // format(string,sizeof(string),"%s has transfered %d to %s",sendername,Moneys,giveplayer); format(string,sizeof(string),"[Admins]: %s(id:%d) transfered %d to %s(id:%d)",sendername, playerid, Moneys, giveplayer, giveplayerid); format(Exists, sizeof(Exists), "INSERT INTO `CASHLOG` (`PLAYER1`, `PLAYER2`, `DATE`, `TIME`, `CASH`) VALUES ('%s', '%s', '%s', '%s', '%d')", pName(playerid),pName(giveplayerid), datestring, timestring, Moneys); MessageToAdmins(COLOR_WHITE , string); SaveToFile("CashTransfersLog",string); print(string); } else { SendClientMessage(playerid, COLOR_BRIGHTRED, "Invalid transaction amount.");}} else { format(string, sizeof(string), "ID:%d is not an active player.", giveplayerid); SendClientMessage(playerid, COLOR_BRIGHTRED, string);} return 1;}
Код:
CMD:cashlog(playerid,params[]) { if(isnull(params)) return SendClientMessage(playerid,red,"USAGE: /cashlog [name]"); new Exists[240],stringzz[2300],count = 0; format(Exists, sizeof(Exists), "SELECT * FROM `CASHLOG` WHERE `PLAYER1` LIKE '%%%s%%' OR `PLAYER2` LIKE '%%%s%%' ORDER BY `DATE`, `TIME` DESC LIMIT 10", params, params); new DBResult:Result = udb_Exists(bans, Exists); if(db_num_rows(Result)) { new CarId[MAX_PLAYER_NAME], PlayerDude[MAX_PLAYER_NAME], CDate[MAX_PLAYER_NAME], CTime[MAX_PLAYER_NAME],ActionTaken[MAX_PLAYER_NAME]; do { db_get_field_assoc(Result, "PLAYER1", CarId, sizeof(CarId)); db_get_field_assoc(Result, "PLAYER2", PlayerDude, sizeof(PlayerDude)); db_get_field_assoc(Result, "DATE", CDate, sizeof(CDate)); db_get_field_assoc(Result, "TIME", CTime, sizeof(CTime)); db_get_field_assoc(Result, "CASH", ActionTaken, sizeof(ActionTaken)); format(stringzz, sizeof(stringzz), "%s{FFFFFF}Sender: {00FF00}%s | {FFFFFF}Receiver: {00FF00}%s | {FFFFFF}Date & Time: {00FF00}%s - %s | {FFFFFF}Cash: {00FF00}%s\n",stringzz,CarId, PlayerDude, CDate, CTime, ActionTaken); ShowPlayerDialog( playerid, DIALOG_CASHLIST2,DIALOG_STYLE_MSGBOX, "{FFFF00}Cash Logs",stringzz, "Close", "" ); count++; } while(db_next_row(Result)); } else ShowPlayerDialog( playerid, DIALOG_CASHLIST2, DIALOG_STYLE_MSGBOX, "{FFFF00}Cash Logs", "No results found.", "Close",""); db_free_result(Result); Exists = "\0"; return 1; }