06.03.2017, 08:48
(
Последний раз редактировалось dugi; 06.03.2017 в 09:31.
)
Quote:
Seems like it's not getting past this line: if(!strcmp(aName, szFieldName)) {
try to print something random on the console, and tell us if it prints out that text: for example: it works. If it doesn't work, it means smt is wrong. Put it in that areea: {strcmp...} |
PHP код:
CMD:delaccount(playerid, params[]){
new aName[MAX_PLAYER_NAME], szFieldName[MAX_PLAYER_NAME], query[256], string[128];
if(Character[playerid][Admin] < 4) return System_Scm(playerid, PERMISSIONONLY, TYPE_ERROR);
CMD:delaccount(playerid, params[]){
new aName[MAX_PLAYER_NAME], szFieldName[MAX_PLAYER_NAME], query[256], string[128];
if(Character[playerid][Admin] < 4) return System_Scm(playerid, "You do not have permission to perform this command.", TYPE_ERROR);
if(sscanf(params, "s[24]", aName)) return System_Scm(playerid, "/delaccount [Account Name]", TYPE_NOTICE);
foreach(new i: Player){
if(!strcmp(aName, GetPlayerNameEx(playerid))) {
print("Being Used");
format(string, sizeof(string), "Account [%s] is being used by Player ID [%d]", aName, i);
System_Scm(playerid, string, TYPE_ERROR);
return 1;
}
}
new rows;
cache_get_row_count(rows);
for(new row = 0; row < rows; row++){
cache_get_value_name(row, "Username", szFieldName, 24);
printf("%s - %s", aName, szFieldName);
if(!strcmp(aName, szFieldName)) {
print("Found");
mysql_format(MHandle, query, sizeof(query), "DELETE FROM `character` WHERE (`Username` = '%e') LIMIT 1", aName);
mysql_query(MHandle, query);
format(string, sizeof(string), "[%s] deleted [%s]", GetPlayerNameEx(playerid), aName);
foreach(new i: Player) {
if(Character[i][Admin] > 0) System_Scm(playerid, string, TYPE_SUCCESS);
}
return 1;
}
}
print("Can't find");
format(string, sizeof(string), "Can't find account [%s]", aName);
System_Scm(playerid, string, TYPE_ERROR);
return 1;
}

Now i edit something and when I fill the online player name, it says 'Being Used', and when I fill the offline player name, it says 'Can't find' although that name is exist in my database.
It also doesn't print "%s - %s", so why? It has no condition to be allowed to perform.
I have printed the total tows onto the console.
Quote:
cache_get_row_count(rows); printf("%d", rows); |
Does it get the total rows failed? How can i make it gets succesfully?