Problem with The Password Saving
#1

i have problem guys on Password Saving i use Y_INI
ZCMD, SSCANF to make my admin system.
i test today my admin system and modify it
when i register i type my password.
but when i reconnect and login it says
incorrect password. My password should be work.

i check my scriptfiles and my account

WTF. i saw something bad instead of my password it became 187367946
Please Help Me Guys Help Me

Anyway i get the tutorial from Here:

http://forum.sa-mp.com/showthread.ph...ighlight=Y_INI

CODE:

pawn Code:
//
//       Xtreme Admin System V1.0
//               Made By
//    [SP]Mr.Kakashi[WP] & GAMER_PS2
//        Copyright 2011 - 2016
//

#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#include <sscanf2>
#include <XKA>

enum pInfo
{
    pPass,
    pCash,
    pScore,
    pAdmin,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];

forward LoadUser_data(playerid,name[],value[]);

#define DIALOG_REGISTER 451
#define DIALOG_LOGIN 452

#define PATH "Server/Users/%s.ini"

//============================================================================//

#define red "{FF002B}"
#define pink "{FF00D9}"
#define purple "{DFA7F2}"
#define blue "{A1C2FF}"
#define green "{3DE3B1}"
#define yellow "{FAF623}"
#define black "{69670C}"
#define orange "{F2C80C}"
#define ice "{03F2FF}"
#define white "{FFFFFF}"
#define lime "{00FF40}"

#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_RED 0xFF0000FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_DARKRED 0x660000AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_VIOLET 0x9955DEEE
#define COLOR_LIGHTRED 0xFF99AADD
#define COLOR_SEAGREEN 0x00EEADDF
#define COLOR_GRAYWHITE 0xEEEEFFC4
#define COLOR_LIGHTNEUTRALBLUE 0xabcdef66
#define COLOR_GREENISHGOLD 0xCCFFDD56
#define COLOR_LIGHTBLUEGREEN 0x0FFDD349
#define COLOR_NEUTRALBLUE 0xABCDEF01
#define COLOR_LIGHTCYAN 0xAAFFCC33
#define COLOR_LEMON 0xDDDD2357
#define COLOR_MEDIUMBLUE 0x63AFF00A
#define COLOR_NEUTRAL 0xABCDEF97
#define COLOR_BLACK 0x00000000
#define COLOR_NEUTRALGREEN 0x81CFAB00
#define COLOR_DARKGREEN 0x12900BBF
#define COLOR_LIGHTGREEN 0x24FF0AB9
#define COLOR_DARKBLUE 0x300FFAAB
#define COLOR_BLUEGREEN 0x46BBAA00
#define COLOR_PINK 0xFF66FFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_DARKRED 0x660000AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_PURPLE 0x800080AA
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_RED1 0xFF0000AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BROWN 0x993300AA
#define COLOR_CYAN 0x99FFFFAA
#define COLOR_TAN 0xFFFFCCAA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_KHAKI 0x999900AA
#define COLOR_LIME 0x99FF00AA
#define COLOR_SYSTEM 0xEFEFF7AA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD1 0xB4B5B7FF

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("        Xtreme Administration V1.0.0    ");
    print("            Made by Mr.Kakashi          ");
    print("          Copyright 2011 - 2016         ");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#endif

public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""white"Login",""red"Note:"white"If this is not your account please leave to this account and create your own one.\n\n"white"Type your password below to login to your account","Login","Exit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""white"Register",""red"Note:"white"If you crash ingame your account will be save.\n\n"white"Type the password below to create new account","Register","Exit");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"DATA FILES");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Close(File);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInfo[killerid][pKills]++;
    PlayerInfo[playerid][pDeaths]++;
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""white"Register",""red"Note:"white"If you crash ingame your account will be save.\n\n"white"Type the password below to create new account","Register","Exit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"DATA FILES");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
                INI_WriteInt(File,"Score",GetPlayerScore(playerid));
                INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
                INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
                INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SendClientMessage(playerid, COLOR_GREEN, "You have successfully register.");
            }
        }

        case DIALOG_LOGIN:
        {
            if (!response) return Kick (playerid);
            if(response)
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
                    SendClientMessage(playerid, COLOR_GREEN, "You have successfully login to your account.");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""white"Login",""red"You have entered an incorrect password.\n"white"Type your password below to login.","Login","Exit");
                }
                return 1;
            }
        }
    }
    return 1;
}

//==========================COMMANDS==========================//

CMD:get(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
       new targetid, string[128];
       if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /get <playerid/name>");
       if(!IsPlayerConnected(targetid) && targetid != INVALID_PLAYER_ID && targetid != playerid)
       {
           new AdminName[24];
           new pName[24];
           GetPlayerName(playerid,AdminName,128);
           GetPlayerName(targetid,pName,128);
           format(string, sizeof(string), "You have been teleported to Administrator %s.",AdminName);
           SendClientMessage(targetid,COLOR_BLUE,string);
           format(string, sizeof(string), "%s has been teleport to you.",pName);
           SendClientMessage(targetid,COLOR_GREEN,string);
           SetPlayerInterior(targetid,GetPlayerInterior(playerid));
           new Float:TPX, Float:TPY, Float:TPZ;
           GetPlayerPos(playerid, TPX, TPY, TPZ);
           SetPlayerPos(targetid, TPX, TPY, TPZ+1);
       }
       else return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected or its yourself.");
    }
    else return SendClientMessage(playerid,COLOR_RED, "ERROR: You must be Administrator Level 2 to use this command");
    return 1;
}

CMD:kick(playerid, params[])
{
    new pid;
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        if(sscanf(params, "us[128]", pid, params[2])) return SendClientMessage(playerid,COLOR_RED, "USAGE: /kick <playerid/name> <reason>");
        if(!IsPlayerConnected(pid) && pid != INVALID_PLAYER_ID && pid != playerid)
        {
           new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180];
           GetPlayerName(pid, paramname, sizeof(paramname));
           GetPlayerName(playerid, adminname, sizeof(adminname));
           format(string, sizeof(string), "Administrator %s has kicked %s <Reason: %s>",adminname,paramname, params[2]);
           SendClientMessageToAll(COLOR_RED, string);
           format(string, sizeof(string), "You have been kicked by Administrator %s <Reason: %s>", paramname, params[2]);
           SendClientMessage(pid,COLOR_RED, string);
           format(string, sizeof(string), "You kicked %s <Reason: %s>", paramname, params[2]);
           SendClientMessage(playerid,COLOR_GREEN, string);
           Kick(pid);
        }
        else return SendClientMessage(playerid,COLOR_RED, "ERROR: Player is not connected or its yourself.");
    }
    else return SendClientMessage(playerid,COLOR_RED, "ERROR: You must be Administrator Level 2 to use this command");
    return 1;
}

CMD:kill(playerid,params[])
{
    SetPlayerHealth(playerid, 0);
    PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
    PlayerInfo[playerid][pDeaths]++;
    return 1;
}

CMD:suicide(playerid,params[])
{
    SetPlayerHealth(playerid, 0);
    PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
    PlayerInfo[playerid][pDeaths]++;
    return 1;
}

CMD:forcerules(playerid, params[])
{
    new pid;
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        if(sscanf(params, "us[128]", pid, params[2])) return SendClientMessage(playerid,COLOR_RED, "USAGE: /forcerules <playerid/name> <reason>");
        if(!IsPlayerConnected(pid) && pid != INVALID_PLAYER_ID && pid != playerid)
        {
           new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180];
           GetPlayerName(pid, paramname, sizeof(paramname));
           GetPlayerName(playerid, adminname, sizeof(adminname));
           format(string, sizeof(string), "Administrator %s has force to read rules %s <Reason: %s>",adminname,paramname, params[2]);
           SendClientMessageToAll(COLOR_RED, string);
           format(string, sizeof(string), "You have been force to read rules by Administrator %s <Reason: %s>", paramname, params[2]);
           SendClientMessage(pid,COLOR_RED, string);
           format(string, sizeof(string), "You force to read rules %s <Reason: %s>", paramname, params[2]);
           SendClientMessage(playerid,COLOR_GREEN, string);
           ShowPlayerDialog(pid,3, DIALOG_STYLE_MSGBOX, "Rules:", "1.)Do Not Hack/Cheat/Mods\n2.)Respect Admins/Players\n3.)Ask To Be Admin if we are Hiring\n4.)No Insulting/Flamming\n5.)Dont AFK on Spawn Areas\n6.)Dont Team Carjack\n7.)Dont Team Kill\n\nIf you break those rules you may Punishment by Our Server Administrators", "Accept", "Ignore");
        }
        else return SendClientMessage(playerid,COLOR_RED, "ERROR: Player is not connected or its yourself.");
    }
    else return SendClientMessage(playerid,COLOR_RED, "ERROR: You must be Administrator Level 2 to use this command");
    return 1;
}

//============================================================================//

stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
Reply
#2

Yours:
Changed:

pPass,
pPass[128],

INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_String("Password",PlayerInfo[playerid][pPass]);

INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteString(File,"Password",inputtext);

if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
if(strcmp(inputtext, PlayerInfo[playerid][pPass], true) == 1)

Use the search to find the ones your made, and replace them with the bolded fixed ones... Post further errors below, cause I probably got it wrong too... I don't know what file saving system you're using.

But your problem is your password variable is numbers and not a string.
Reply
#3

Quote:
Originally Posted by TheLazySloth
View Post
Yours:
Changed:

pPass,
pPass[128],

INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_String("Password",PlayerInfo[playerid][pPass]);

INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteString(File,"Password",inputtext);

if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
if(strcmp(inputtext, PlayerInfo[playerid][pPass], true) == 1)

Use the search to find the ones your made, and replace them with the bolded fixed ones... Post further errors below, cause I probably got it wrong too... I don't know what file saving system you're using.

But your problem is your password variable is numbers and not a string.
2 Errors Found.

Code:
H:\GTA San Andreas\My SAMP Server 2\filterscripts\Admin.pwn(123) : error 017: undefined symbol "INI_String"
H:\GTA San Andreas\My SAMP Server 2\filterscripts\Admin.pwn(228) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#4

INI_String("Password",PlayerInfo[playerid][pPass], 128);

Whats on line 228?
Reply
#5

This is on the line 228:

Code:
INI_WriteString(File,"Password",udb_hash(inputtext));
Reply
#6

INI_WriteString(File, "Password", inputtext);

Thats all?
Reply
#7

Yes thats all

Tell me again or pls help me edit my script
Reply
#8

I would help you edit your script, or even teach you Pawn, but I need to know what do I get out of it?
Reply
#9

no just help me edit the script and fix the errors
Reply
#10

Got contact info? PM me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)