16.07.2011, 14:29
I made a command.
And look what happens:
Database: http://imageshack.us/photo/my-images/29/errorem.png/
Message : http://imageshack.us/f/121/samp033uy.png/
pawn Код:
if(!strcmp(cmdtext, "/number", true))
{
new query[256], DBResult:Result;
format(query, sizeof(query), "SELECT * FROM `Users` WHERE `Name` = '%s'", ReturnName(playerid));
Result = db_query(iDatabase, query);
if(!db_num_rows(Result))
{
new number[10];
number[0] = '0';
number[1] = '7';
number[2] = (1 + random(8)) + '0';
for(new i = 3; i < 10; i++)
number[i] = random(10) + '0';
format(query, sizeof(query), "INSERT INTO `Users` (`Name`,`Number`) VALUES('%s','%s')", ReturnName(playerid), DB_Escape(number));
db_free_result(db_query(iDatabase, query));
format(query, 128, "Name: %s | Phone number: %s", ReturnName(playerid), DB_Escape(number));
SendClientMessage(playerid, -1, query);
}
return 1;
}
Database: http://imageshack.us/photo/my-images/29/errorem.png/
Message : http://imageshack.us/f/121/samp033uy.png/