Still dosent work.
pawn Код:
stock SaveStats(playerid)
{
new Query[128];
format(Query,sizeof(Query),"UPDATE `users` SET `Score`= %i, `AdminLevel`= %i WHERE `Username` = '%s'", GetPlayerScore(playerid),PlayerInfo[playerid][pAdmin], GetPName(playerid));
mysql_query(Query);
return 1;
}
stock LoginPlayer(playerid,const password[])
{
new EscapedText[60], Query[80];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
mysql_real_escape_string(password, EscapedText);
format(Query,sizeof(Query),"SELECT * FROM `users` WHERE `Username` = '%s' AND `Password` = '%s'",name,EscapedText);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
SendClientMessage(playerid,COLOR_RED,"You have been logged in!");
LoadStats(playerid);
}
else
{
SendClientMessage(playerid,RED,"Wrong password!");
Kick(playerid);
}
mysql_free_result();
return 1;
}
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Welcome to Island Survival", "{FFFFFF}Welcome to {FF0000}Island Survival:RP\n{FFFFFF}You are about to make an account here!\n\n\n{00FF00}Type in your password you want!", "Register", "Leave");
}
else
{
LoginPlayer(playerid,inputtext);
}
OnPlayerConnect
new Query[80],pNamE[24];
GetPlayerName(playerid,pNamE,24);
format(Query,sizeof(Query),"SELECT `Username` FROM `users` WHERE `Username` = '%s' LIMIT 1;",pNamE);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Welcome back!", "Welcome back to Island Survival!\n\nType in your password below to login", "Login", "Leave");
}
else
{
ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "Welcome to Island Survival", "{FFFFFF}Welcome to {FF0000}Island Survival:RP\n{FFFFFF}You are about to make an account here!\n\n\n{00FF00}Type in your password you want!", "Register", "Leave");
}
mysql_free_result();
enum pInfo
{
Username[23],
Password[24],
pAdmin,
pHelper,
pScore,
pWaterBottle,
pOthers,
pFaction,
pRank,
pLeader,
pSurvivors,
pFishingNet,
pBoar,
pBoarMeat,
pNote,
pRope,
pFruit,
pFishingRod,
pSkin,
pMale,
pFemale,
pPlayTime,
pWater,
pFish,
pHeroin,
pMatches,
pWood,
pBerry,
pWhiskey,
pMask,
pClothes,
pFishDone,
pMute,
pRmute,
pJailed,
pJailTime,
pRespect,
pCoOwner,
pHunter,
pDrugAddict,
pDoctor,
pThief,
pFisher,
pTech,
pGun,
pAmmo,
pAmmo2,
pAmmo3,
pAmmo4,
pAmmo5,
pGun2,
pGun3,
pGun4,
pGun5,
Float:pPos_x,
Float:pPos_y,
Float:pPos_z,
pVip,
pWalkieTalkie,
pWalkieBroken,
pChoosenTeam,
pRelationShip,
pRelationWith[125],
pInt,
pWarn,
pSlots,
pBackPack,
pSlotsFree,
pBan,
}
new PlayerInfo[MAX_PLAYERS][pInfo];