02.11.2009, 20:34
Ok, So i have my scirpt and when i /register it works fine then when i login it says "password does not match account" even tho i'm sure i've typed the password right. Can anyone find the bug in this scirpt, I've been working on it and i just can't find it. If you need anymore info please let me know.
Код:
if(strcmp(cmd, "/regnick", true) == 0 || strcmp(cmd, "/register", true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /register [password]"); return 1; } new passlength = strlen(tmp); if(passlength > 10) { SendClientMessage(playerid, COLOR_RED, "Sorry, passwords must be smaller than 10 letters"); return 1; } if (gPlayerAccount[playerid] == 1) { SendClientMessage(playerid, COLOR_GRAD1, " That name is registered"); return 1; } gPlayerAccount[playerid] = 1; strmid(PlayerInfo[playerid][pPassword], tmp, 1, strlen(cmdtext), 255); //Encript(PlayerInfo[playerid][pPassword]); GetPlayerName(playerid, playername, sizeof(playername)); format(string, sizeof(string), "%s.cer", playername); PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]; new File: file = fopen(string, io_read); if (file) { SendClientMessage(playerid, COLOR_GRAD1, " That nick is registered"); fclose(file); return 1; } printf("%s has created an account.", playername); new File:hFile; hFile = fopen(string, io_append); new var[32];// format(var, 32, "%sn", PlayerInfo[playerid][pPassword]);fwrite(hFile, var); format(var, 32, "%d pCashn", PlayerInfo[playerid][pCash]);fwrite(hFile, var); format(var, 32, "%d pAccountn", PlayerInfo[playerid][pAccount]);fwrite(hFile, var); format(var, 32, "%d pAdminn", PlayerInfo[playerid][pAdmin]);fwrite(hFile, var); format(var, 32, "%d pLeveln", PlayerInfo[playerid][pLevel]);fwrite(hFile, var); format(var, 32, "%d pExpn", PlayerInfo[playerid][pExp]);fwrite(hFile, var); format(var, 32, "%d gPupgraden", PlayerInfo[playerid][gPupgrade]);fwrite(hFile, var); format(var, 32, "%d pKillsn", PlayerInfo[playerid][pKills]);fwrite(hFile, var); format(var, 32, "%d pLJn", PlayerInfo[playerid][pLJ]);fwrite(hFile, var); format(var, 32, "%d pIJn", PlayerInfo[playerid][pIJ]);fwrite(hFile, var); format(var, 32, "%d pSRn", PlayerInfo[playerid][pSR]);fwrite(hFile, var); format(var, 32, "%d pWAn", PlayerInfo[playerid][pWA]);fwrite(hFile, var); format(var, 32, "%d pPENn", PlayerInfo[playerid][pPEN]);fwrite(hFile, var); format(var, 32, "%d pGun1n", PlayerInfo[playerid][pGun1]);fwrite(hFile, var); format(var, 32, "%d pGun2n", PlayerInfo[playerid][pGun2]);fwrite(hFile, var); format(var, 32, "%d pGun3n", PlayerInfo[playerid][pGun3]);fwrite(hFile, var); format(var, 32, "%d pGun4n", PlayerInfo[playerid][pGun4]);fwrite(hFile, var); format(var, 32, "%d pGun5n", PlayerInfo[playerid][pGun5]);fwrite(hFile, var); format(var, 32, "%d pGun6n", PlayerInfo[playerid][pGun6]);fwrite(hFile, var); format(var, 32, "%d pAmmo1n", PlayerInfo[playerid][pAmmo1]);fwrite(hFile, var); format(var, 32, "%d pAmmo2n", PlayerInfo[playerid][pAmmo2]);fwrite(hFile, var); format(var, 32, "%d pAmmo3n", PlayerInfo[playerid][pAmmo3]);fwrite(hFile, var); format(var, 32, "%d pAmmo4n", PlayerInfo[playerid][pAmmo4]);fwrite(hFile, var); format(var, 32, "%d pAmmo5n", PlayerInfo[playerid][pAmmo5]);fwrite(hFile, var); format(var, 32, "%d pAmmo6n", PlayerInfo[playerid][pAmmo6]);fwrite(hFile, var); format(var, 32, "%f pSHealthn", PlayerInfo[playerid][pSHealth]);fwrite(hFile, var); format(var, 32, "%f pHealthn", PlayerInfo[playerid][pHealth]);fwrite(hFile, var); format(var, 32, "%f pPos_xn", PlayerInfo[playerid][pPos_x]);fwrite(hFile, var); format(var, 32, "%f pPos_yn", PlayerInfo[playerid][pPos_y]);fwrite(hFile, var); format(var, 32, "%f pPos_zn", PlayerInfo[playerid][pPos_z]);fwrite(hFile, var); if(accountplay) { PlayerInfo[playerid][pInt] = 0; } format(var, 32, "%d pIntn", PlayerInfo[playerid][pInt]);fwrite(hFile, var); format(var, 32, "%d pLocaln", PlayerInfo[playerid][pLocal]);fwrite(hFile, var); format(var, 32, "%d pTeamn", PlayerInfo[playerid][pTeam]);fwrite(hFile, var); format(var, 32, "%d pModeln", PlayerInfo[playerid][pModel]);fwrite(hFile, var); format(var, 32, "%d pPnumbern", PlayerInfo[playerid][pPnumber]);fwrite(hFile, var); format(var, 32, "%d pPhousekeyn", PlayerInfo[playerid][pPhousekey]);fwrite(hFile, var); format(var, 32, "%d pPbiskeyn", PlayerInfo[playerid][pPbiskey]);fwrite(hFile, var); format(var, 32, "%d pGangn", PlayerInfo[playerid][pKills]);fwrite(hFile, var); format(var, 32, "%d pGleadern", PlayerInfo[playerid][pGleader]);fwrite(hFile, var); format(var, 32, "%d pServicen", PlayerInfo[playerid][pService]);fwrite(hFile, var); format(var, 32, "%d pSleadern", PlayerInfo[playerid][pSleader]);fwrite(hFile, var); format(var, 32, "%d pRealAdminn", PlayerInfo[playerid][pRealAdmin]);fwrite(hFile, var); format(var, 32, "%d pTOSn", PlayerInfo[playerid][pTOS]);fwrite(hFile, var); format(var, 32, "%d pJobn", PlayerInfo[playerid][pJob]);fwrite(hFile, var); format(var, 32, "%d pGLicensen", PlayerInfo[playerid][pGLicense]);fwrite(hFile, var); format(var, 32, "%d pDLicensen", PlayerInfo[playerid][pDLicense]);fwrite(hFile, var); format(var, 32, "%d pResignn", PlayerInfo[playerid][pResign]);fwrite(hFile, var); format(var, 32, "%d pFLicensen", PlayerInfo[playerid][pFLicense]);fwrite(hFile, var); format(var, 32, "%d pAlcaholn", PlayerInfo[playerid][pAlcahol]);fwrite(hFile, var); format(var, 32, "%d pDPointsn", PlayerInfo[playerid][pDPoints]);fwrite(hFile, var); format(var, 32, "%d pGPointsn", PlayerInfo[playerid][pGPoints]);fwrite(hFile, var); format(var, 32, "%d pSuspendedn", PlayerInfo[playerid][pSuspended]);fwrite(hFile, var); format(var, 32, "%d pPaycheckn", PlayerInfo[playerid][pPaycheck]);fwrite(hFile, var); format(var, 32, "%d pDrugsn", PlayerInfo[playerid][pDrugs]);fwrite(hFile, var); format(var, 32, "%d pResetn", PlayerInfo[playerid][pReset]);fwrite(hFile, var); format(var, 32, "%d pCKeyn", PlayerInfo[playerid][pCKey]);fwrite(hFile, var); format(var, 32, "%d pHotwiren", PlayerInfo[playerid][pHotwire]);fwrite(hFile, var); format(var, 32, "%d pDonationn", PlayerInfo[playerid][pDonation]);fwrite(hFile, var); format(var, 32, "%d pCLicensen", PlayerInfo[playerid][pCLicense]);fwrite(hFile, var); format(var, 32, "%d pStrengthn", PlayerInfo[playerid][pStrength]);fwrite(hFile, var); format(var, 32, "%d pTLicensen", PlayerInfo[playerid][pTLicense]);fwrite(hFile, var); fclose(hFile); GameTextForPlayer(playerid, "SERVER: Next time you connect type /login password to log in", 5000, 3); justreg[playerid] = 1; OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]); return 1; }