07.05.2017, 17:30
Hello! I have a weird problem, take a look at this code:
But this is what it outputs:
What can I do?
PHP код:
enum P {
name,
password,
ip,
activated,
banned,
score,
totalMatches,
kills,
deaths
};
new P_DATA[MAX_PLAYERS][P];
public OnPlayerSpawn(playerid)
{
//(Name, Password, IP, Activated, Banned, Score, TotalMatches, Kills, Deaths)
new Query[256], DBResult: Result, pName[MAX_PLAYER_NAME], IP[16], Field[30];
GetPlayerName(playerid, pName, sizeof(pName));
format(Query, sizeof(Query), "SELECT * FROM Accounts WHERE Name = '%s';", pName);
Result = db_query(Database, Query);
SetTimer("ConnectTimer", 2000, false);
db_get_field_assoc(Result, "Name", Field, 30);
P_DATA[playerid][name] = GetPlayerName(playerid, pName, sizeof(pName));
db_get_field_assoc(Result, "IP", Field, 30);
P_DATA[playerid][ip] = GetPlayerIp(playerid, IP, sizeof(IP));
db_get_field_assoc(Result, "Banned", Field, 30);
P_DATA[playerid][banned] = strval(Field);
db_get_field_assoc(Result, "Score", Field, 30);
P_DATA[playerid][score] = strval(Field);
db_get_field_assoc(Result, "TotalMatches", Field, 30);
P_DATA[playerid][totalMatches] = strval(Field);
db_get_field_assoc(Result, "Kills", Field, 30);
P_DATA[playerid][kills] = strval(Field);
db_get_field_assoc(Result, "Deaths", Field, 30);
P_DATA[playerid][deaths] = strval(Field);
db_free_result(Result);
return 1;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(clickedid == TDEditor_TD[8])
{
//(Name, Password, IP, Activated, Banned, Score, TotalMatches, Kills, Deaths)
new str[1000];
format(str, sizeof(str), "{FFFFFF}Name:{FF9900} %s\n{FFFFFF}IP:{FF9900} %s\n{FFFFFF}Kills:{FF9900} %d\n{FFFFFF}Deaths:{FF9900} %d\n{FFFFFF}Total matches played:{FF9900} %d\n{FFFFFF}Score:{FF9900} %d\n",
P_DATA[playerid][name],
P_DATA[playerid][ip],
P_DATA[playerid][kills],
P_DATA[playerid][deaths],
P_DATA[playerid][totalMatches],
P_DATA[playerid][score]
);
printf("%s", P_DATA[playerid][name]);
ShowPlayerDialog(playerid, DIALOG_STATS_1, DIALOG_STYLE_MSGBOX, "{19a8ea}[Stats]", str, "OK", "");
}
return 1;
}
What can I do?