18.08.2018, 17:50
Calisthenics already gave you an answer - however, tell us the name of your "users" table and the column name that you use for phone numbers.
EDIT: Untested code - here's an example of how it could be done:
EDIT: Untested code - here's an example of how it could be done:
PHP код:
mysql_format(g_SQL, query, sizeof query, "UPDATE IGNORE "#TABLE_USERS" SET `PhoneNumber` = %i WHERE `UserID` = %i", phone_number, user_id);
mysql_pquery(g_SQL, query, "OnPhoneNumberUpdate", "ii", playerid, phone_number);
forward OnPhoneNumberUpdate(playerid, phone_number);
public OnPhoneNumberUpdate(playerid, phone_number) {
if (cache_affected_rows() != -1) { // Since -1 refers to an error
// Tell player there phone number was updated
pInfo[playerid][PhoneNumber] = phone_number;
return 1;
}
// Tell player the phone number is already in use
return 1;
}