01.07.2012, 03:14
(
Последний раз редактировалось PCheriyan007; 04.07.2012 в 17:51.
)
Thanks for the help. Converting to MySQL since there is far more support and tutorials there (ironically it isn't native to SA-MP but oh well).
stock RegisterPlayer(playerid, password[])
{
new
query[2048],
DBResult:queryResult,
playerIP[24],
hashpass[129],
string[128]
;
WP_Hash(hashpass, sizeof(hashpass), password);
GetPlayerIp(playerid, playerIP, sizeof(playerIP));
format(query, sizeof(query), "INSERT INTO `"TABLE_NAME"` (`Password`, `PlayerIP`, `Money`, `BankMoney`) VALUES ('%s', '%s', 7500, 5000) WHERE Username = '%s'", hashpass, playerIP, PlayerName(playerid));
printf("Success: %s", query);
queryResult = db_query(serverDB, query);
db_free_result(queryResult);
GivePlayerMoney(playerid, (7500 - GetPlayerMoney(playerid)));
PlayerInfo[playerid][BankMoney] = 5000;
PlayerInfo[playerid][AdminLevel] = 0;
PlayerInfo[playerid][RegularPlayer] = 0;
PlayerInfo[playerid][SavedWantedLevel] = 0;
PlayerInfo[playerid][SavedJailTime] = 0;
PlayerInfo[playerid][RobRank] = 0;
PlayerInfo[playerid][RapeRank] = 0;
PlayerInfo[playerid][DrugDealerRank] = 0;
PlayerInfo[playerid][GunDealerRank] = 0;
PlayerInfo[playerid][HitmanRank] = 0;
PlayerInfo[playerid][MedicRank] = 0;
PlayerInfo[playerid][MechanicRank] = 0;
PlayerInfo[playerid][BountyHunterRank] = 0;
PlayerInfo[playerid][KidnapperRank] = 0;
PlayerInfo[playerid][TerroristRank] = 0;
PlayerInfo[playerid][HasBriefcase] = 0;
PlayerInfo[playerid][BriefcaseMoney] = 0;
PlayerInfo[playerid][BriefcaseC4] = 0;
PlayerInfo[playerid][BriefcaseWeaponSlot1] = 0;
PlayerInfo[playerid][BriefcaseWeaponAmmoSlot1] = 0;
PlayerInfo[playerid][BriefcaseWeaponSlot2] = 0;
PlayerInfo[playerid][BriefcaseWeaponAmmoSlot2] = 0;
PlayerInfo[playerid][BriefcaseWeaponSlot3] = 0;
PlayerInfo[playerid][BriefcaseWeaponAmmoSlot3] = 0;
PlayerInfo[playerid][CanUseSWAT] = 0;
PlayerInfo[playerid][CanUseFBI] = 0;
PlayerInfo[playerid][CanUseArmy] = 0;
PlayerInfo[playerid][Tazes] = 0;
PlayerInfo[playerid][Cuffs] = 0;
PlayerInfo[playerid][Arrests] = 0;
PlayerInfo[playerid][SWATRank] = 0;
PlayerInfo[playerid][FBIRank] = 0;
PlayerInfo[playerid][ArmyRank] = 0;
PlayerInfo[playerid][GrottiOwner] = 0;
PlayerInfo[playerid][WangCarsOwner] = 0;
PlayerInfo[playerid][OttosAutosOwner] = 0;
PlayerInfo[playerid][AutobahnOwner] = 0;
PlayerInfo[playerid][AerobahnOwner] = 0;
PlayerInfo[playerid][HydrobahnOwner] = 0;
PlayerInfo[playerid][LSDrugHouseOwner] = 0;
PlayerInfo[playerid][SFDrugHouseOwner] = 0;
PlayerInfo[playerid][LVDrugHouseOwner] = 0;
printf("Hashed: %s Output: %s", password, hashpass);
if(!PlayerHasAccount(playerid))
{
SendClientMessage(playerid, COLOR_WHITE, "{FF0000}ERROR: {FFFFFF}Your account was not created. Please contact an {33CCFF}Administrator {FFFFFF}regarding this matter right away!");
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration Required", "This server requires that you register an account before playing.\n{FF0000}ERROR: {A9C4E4}Your account was not created.", "Register", "Quit");
}
else
{
format(string, sizeof(string), "You have successfully registered on [SArcr] using the password: {33CCFF}%s", password);
SendClientMessage(playerid, COLOR_WHITE, string);
SendClientMessage(playerid, COLOR_WHITE, "Now, simply log in to confirm.");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Authentication Required", "Congratulations, you have successfully registered on [SArcr]!\nBefore playing you must login\nPlease enter your password in the box below.", "Login", "Quit");
}
/*format(string, sizeof(string), "You have successfully registered on [SArcr] using the password: {33CCFF}%s", password);
SendClientMessage(playerid, COLOR_WHITE, string);
SendClientMessage(playerid, COLOR_WHITE, "Now, simply log in to confirm.");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Authentication Required", "Congratulations, you have successfully registered on [SArcr]!\nBefore playing you must login\nPlease enter your password in the box below.", "Login", "Quit");*/
}