else { QuemReferenciou(playerid); SendClientMessage(playerid, COLOR_LIGHTRED, "THIS PLAYER IS NOT FOUND!"); }
else if(dialogid == 28) { new nlocalreffer[30]; if(!response) { SendClientMessage(playerid, -1, "YOU SELECT NO... SO NO ONE REFFER YOU!"); nlocalreffer = "Empty"; reffer[playerid] = nlocalreffer; firstlogin[playerid] = false; ChangeClass(playerid); } else if(response) { if(!strlen(inputtext)) { SendClientMessage(playerid, -1, "YOU DONT WRITE A NAME... SO NO ONE REFFER YOU!"); nlocalreffer = "Empty"; reffer[playerid] = nlocalreffer; firstlogin[playerid] = false; ChangeClass(playerid); } else { format(nlocalreffer, sizeof nlocalreffer, inputtext); if(!strcmp(nlocalreffer, PlayerName(playerid), true)) { SendClientMessage(playerid, COLOR_LIGHTRED, "YOU CAN NOT PUT YOUR OWN NAME!"); QuemReferenciou(playerid); return 1; } else { // sucesso new Nameid[30], refferquery[160]; format(nlocalreffer, sizeof nlocalreffer, inputtext); mysql_format(ConnectMYSQL, refferquery, sizeof refferquery, "SELECT `Username` FROM accounts WHERE Username = '%s' LIMIT 1", Nameid); mysql_tquery(ConnectMYSQL, refferquery, "CheckRefferExist", "iss", playerid, Nameid, nlocalreffer); } } } }
forward CheckRefferExist(playerid, nrinput[30]); public CheckRefferExist(playerid, nrinput[30]) { if(cache_get_row_count(ConnectMYSQL) == 1) { reffer[playerid] = nrinput; new string[80]; format(string, sizeof(string), "Your reffer: %s!", reffer[playerid] ); SendClientMessage(playerid, COLOR_LIGHTRED, string); firstlogin[playerid] = false; ChangeClass(playerid); } else { QuemReferenciou(playerid); SendClientMessage(playerid, COLOR_LIGHTRED, "THIS PLAYER IS NOT FOUND!"); } return 1; }
forward QuemReferenciou(playerid); public QuemReferenciou(playerid) { ShowPlayerDialog(playerid,28, DIALOG_STYLE_INPUT, "Reffer", "A player from the server called you here to play?\nNo? Leave this question blank box\nYes? Insert him name inside box!\n\n\nCall people to play here and earn rewards when your guest get some experience points\n====================================\n10 exp = 5.000$\n30 exp = 15.000$\n60 exp = 30.000$\n100 exp = 1 VIP days\n150 exp = 3 VIP days\n300 exp = 7 VIP days\n====================================", "Yes", "No"); }
cache_get_field_content(0, "Username", reffer[playerid], ConnectMYSQL, 124);
(MAYBE) you need this
PHP код:
|
forward QuemReferenciou(playerid); public QuemReferenciou(playerid) { ShowPlayerDialog(playerid,28, DIALOG_STYLE_INPUT, "Reffer", "A player from the server called you here to play?\nNo? Leave this question blank box\nYes? Insert him name inside box!\n\n\nCall people to play here and earn rewards when your guest get some experience points\n====================================\n10 exp = 5.000$\n30 exp = 15.000$\n60 exp = 30.000$\n100 exp = 1 VIP days\n150 exp = 3 VIP days\n300 exp = 7 VIP days\n====================================", "Yes", "No"); }
mysql_format(ConnectMYSQL, refferquery, sizeof refferquery, "SELECT `Username` FROM accounts WHERE Username = '%s' LIMIT 1", Nameid);
mysql_tquery(ConnectMYSQL, refferquery, "CheckRefferExist", "iss", playerid, Nameid, nlocalreffer); |
mysql_format(ConnectMYSQL, refferquery, sizeof(refferquery), "SELECT `Username` FROM accounts WHERE Username = '%s' LIMIT 1", inputtext);
mysql_tquery(ConnectMYSQL, refferquery, "CheckRefferExist", "iss", playerid, inputtext);
What is this Nameid?
Change it to inputtext or nlocalreffer And in your CheckRefferExist there are 2 params while you gave 3 in tquery PHP код:
|
You dont even ask if the player exsits.
I dont know your mysql plugin version so well, send me the code where you check if the username exists when a player is connecting to your server and i will fix the referrer problem for you. |
public OnPlayerConnect(playerid) { new query[512]; new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, MAX_PLAYER_NAME); mysql_format(ConnectMYSQL, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Username` = '%s'", Nome(playerid) ); //SELECT * FROM accounts WHERE Name = %s TROQUE PELA QUAL ESTA NO SEU BANCO DE DADOS mysql_function_query(ConnectMYSQL, query, true, "OnConnection","i",playerid);
forward OnConnection(playerid); public OnConnection(playerid) { new rows, fields; cache_get_data(rows, fields); if(rows) { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Your account has been found - Log-in", "Your account has been found in our database.\nPlease insert your password to continue.", "Log-in", "Quit"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Your account hasn't been found - Register", "Your account couldn't be found in our database.\nPlease insert a new password to complete the registration.", "Register", "Quit"); } return 1; }
else if(dialogid == 28)
{
new nlocalreffer[30];
if(!response)
{
SendClientMessage(playerid, -1, "YOU SELECT NO... SO NO ONE REFFER YOU!");
nlocalreffer = "Empty";
reffer[playerid] = nlocalreffer;
firstlogin[playerid] = false;
ChangeClass(playerid);
}
else if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, -1, "YOU DONT WRITE A NAME... SO NO ONE REFFER YOU!");
nlocalreffer = "Empty";
reffer[playerid] = nlocalreffer;
firstlogin[playerid] = false;
ChangeClass(playerid);
}
else
{
format(nlocalreffer, sizeof nlocalreffer, inputtext);
if(!strcmp(nlocalreffer, PlayerName(playerid), true))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "YOU CAN NOT PUT YOUR OWN NAME!");
QuemReferenciou(playerid);
return 1;
}
else
{ // sucesso
new query[160], refferername[MAX_PLAYER_NAME+1];
format(refferername,sizeof(refferername),"%s",inputtext);
mysql_format(ConnectMYSQL, query, sizeof(query), "SELECT Username FROM `accounts` WHERE `Username` = '%s'", refferername ); //SELECT * FROM accounts WHERE Name = %s TROQUE PELA QUAL ESTA NO SEU BANCO DE DADOS
mysql_function_query(ConnectMYSQL, query, true, "CheckRefferExist","is",playerid,refferername);
}
}
}
}