So i have a plugin and it sends data to mySQL.
But i would like the plugin to update the nickname if i change it.
If my nickname ingame is Player 1 and i change it to Player 2 then mySQL doesnt update to the new nickname.
Can someone check these parts of the code and see if it has some errors or something?
Here are parts from the plugin which i think should change the nickname in mySQL but it doesnt.
PHP Code:
new Team[33], OldName[33][32]
PHP Code:
public client_infochanged(id)
{
new newname[32],oldname[32]
get_user_info(id, "name", newname,31)
get_user_name(id, oldname, 31)
if(!equali(newname, oldname))
{
OldName[id] = oldname;
MySQL_UpdateName(id);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
PHP Code:
public MySQL_UpdateName(id) {
replace_all(OldName[id], 32, "'", "\'");
replace_all(OldName[id], 32, "^"", "\^"");
formatex( MySQL_Query, charsmax( MySQL_Query ), "UPDATE `online_players` SET `username` = '%s' WHERE `username` = '%s'", get_user_name_ex(id), OldName[id] )
SQL_ThreadQuery(MySQL_Tuple, "SQL_TrashHandler", MySQL_Query);
}
PHP Code:
stock get_user_name_ex(id)
{
new szName[33];
get_user_name(id, szName, charsmax(szName));
replace_all(szName, charsmax(szName), "'", "\'");
replace_all(szName, charsmax(szName), "^"", "\^"");
return szName;
}