argument type mismatch
#1

Hello, since my registration system got bugged, im trying to make it in a command, here is:

pawn Код:
CMD:register(playerid, params[])
{
        if(!params[0]) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /register [password]");
        new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof name);
        new file[128];
        format(file, sizeof(file), "/Users/%s.ini", name);
        new INI:handler = INI_Open(file);
        INI_SetTag(file,"data");
        INI_WriteInt(file,"Password",udb_hash(params));
        INI_WriteInt(file,"Cash",0);
        INI_WriteInt(file,"Admin",0);
        INI_WriteInt(file,"Kills",0);
        INI_WriteInt(file,"Deaths",0);
        INI_WriteInt(file,"NoPm",0);
        INI_WriteInt(file,"Mute",0);
        INI_WriteInt(file,"Vip",0);
        INI_WriteInt(file,"C4",0);
        INI_WriteInt(file,"Banned",0);
        INI_WriteInt(file,"Cookies",0);
        INI_WriteInt(file,"Warn",0);
        INI_WriteInt(file, "RegisterDate_day", Day);
        INI_WriteInt(file, "RegisterDate_mon", Month);
        INI_WriteInt(file, "RegisterDate_year",Year);
        INI_WriteInt(file, "RegisterDate_hour",Hour);
        INI_WriteInt(file, "RegisterDate_min", Minute);
        INI_WriteInt(file, "RegisterDate_sec", Second);
        INI_WriteInt(file, "Min", 0);
        INI_WriteInt(file, "Hour", 0);
        INI_WriteInt(file, "Sec", 0);
        INI_WriteInt(file, "Jailed", 0);
        INI_WriteInt(file, "Logged", 0);
        INI_WriteInt(file, "AdminActions", 0);
        INI_WriteInt(file, "Rank", 0);
        INI_Close(handler);
        new string[128]; format(string, sizeof(string), "You have successfully registered your account with the password \'%s\'. You have been automatically logged in.", params);
        return SendClientMessage(playerid, red, string);
}
But i get: error 035: argument type mismatch (argument 1)

Starting from:
pawn Код:
INI_SetTag(file,"data");
to
pawn Код:
INI_WriteInt(file, "Rank", 0);
What's wrong with that?
Reply
#2

While getting player name, I think you've done mistakes with brackets and thats why it starts popping out errors from where you've used the name variable. Your code:
pawn Код:
GetPlayerName(playerid,name,sizeof name);
Must be:
pawn Код:
GetPlayerName(playerid,name,sizeof(name));
Reply
#3

Same errors.
Reply
#4

INI_SetTag(handler,...); - Instead of using 'file' in INI functions, use handler and try.

Edit: Edited script.
pawn Код:
CMD:register(playerid, params[])
{
        if(!params[0]) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /register [password]");
        new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name));
        new file[128];
        format(file, sizeof(file), "/Users/%s.ini", name);
        new INI:handler = INI_Open(file);
        INI_SetTag(handler,"data");
        INI_WriteInt(handler,"Password",udb_hash(params));
        INI_WriteInt(handler,"Cash",0);
        INI_WriteInt(handler,"Admin",0);
        INI_WriteInt(handler,"Kills",0);
        INI_WriteInt(handler,"Deaths",0);
        INI_WriteInt(handler,"NoPm",0);
        INI_WriteInt(handler,"Mute",0);
        INI_WriteInt(handler,"Vip",0);
        INI_WriteInt(handler,"C4",0);
        INI_WriteInt(handler,"Banned",0);
        INI_WriteInt(handler,"Cookies",0);
        INI_WriteInt(handler,"Warn",0);
        INI_WriteInt(handler, "RegisterDate_day", Day);
        INI_WriteInt(handler, "RegisterDate_mon", Month);
        INI_WriteInt(handler, "RegisterDate_year",Year);
        INI_WriteInt(handler, "RegisterDate_hour",Hour);
        INI_WriteInt(handler, "RegisterDate_min", Minute);
        INI_WriteInt(handler, "RegisterDate_sec", Second);
        INI_WriteInt(handler, "Min", 0);
        INI_WriteInt(handler, "Hour", 0);
        INI_WriteInt(handler, "Sec", 0);
        INI_WriteInt(handler, "Jailed", 0);
        INI_WriteInt(handler, "Logged", 0);
        INI_WriteInt(handler, "AdminActions", 0);
        INI_WriteInt(handler, "Rank", 0);
        INI_Close(handler);
        new string[128]; format(string, sizeof(string), "You have successfully registered your account with the password \'%s\'. You have been automatically logged in.", params);
        return SendClientMessage(playerid, red, string);
}
Reply
#5

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
INI_SetTag(handler,...); - Instead of using 'file' in INI functions, use handler and try.
Same....
Reply
#6

This works?
pawn Код:
CMD:register(playerid, params[])
{
        if(!params[0]) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /register [password]");
        new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name));
        new file[128];
        format(file, sizeof(file), "/Users/%s.ini", name);
        new INI:handler = INI_Open(file);
        INI_SetTag(handler,"data");
        INI_WriteInt(handler,"Password",udb_hash(params));
        INI_WriteInt(handler,"Cash",0);
        INI_WriteInt(handler,"Admin",0);
        INI_WriteInt(handler,"Kills",0);
        INI_WriteInt(handler,"Deaths",0);
        INI_WriteInt(handler,"NoPm",0);
        INI_WriteInt(handler,"Mute",0);
        INI_WriteInt(handler,"Vip",0);
        INI_WriteInt(handler,"C4",0);
        INI_WriteInt(handler,"Banned",0);
        INI_WriteInt(handler,"Cookies",0);
        INI_WriteInt(handler,"Warn",0);
        INI_WriteInt(handler, "RegisterDate_day", Day);
        INI_WriteInt(handler, "RegisterDate_mon", Month);
        INI_WriteInt(handler, "RegisterDate_year",Year);
        INI_WriteInt(handler, "RegisterDate_hour",Hour);
        INI_WriteInt(handler, "RegisterDate_min", Minute);
        INI_WriteInt(handler, "RegisterDate_sec", Second);
        INI_WriteInt(handler, "Min", 0);
        INI_WriteInt(handler, "Hour", 0);
        INI_WriteInt(handler, "Sec", 0);
        INI_WriteInt(handler, "Jailed", 0);
        INI_WriteInt(handler, "Logged", 0);
        INI_WriteInt(handler, "AdminActions", 0);
        INI_WriteInt(handler, "Rank", 0);
        INI_Close(handler);
        new string[128]; format(string, sizeof(string), "You have successfully registered your account with the password \'%s\'. You have been automatically logged in.", params);
        return SendClientMessage(playerid, red, string);
}
Reply
#7

Yes is working, i just need last help, i made /login cmd:

pawn Код:
CMD:login(playerid, params[])
(
    if(udb_hash(params) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    SetPlayerCash(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
                    SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pRank]);
                    PlayerInfo[playerid][pLogged] = 1;
                }
                else
                {
                    SCM(playerid,0x0080C0FF,"Wrong login.");
                }
                return 1;
)
(3862 -- 3863) : error 029: invalid expression, assumed zero
(3863) : error 029: invalid expression, assumed zero
(3863) : fatal error 107: too many error messages on one line

Thanks very much.

3863:

pawn Код:
if(udb_hash(params) == PlayerInfo[playerid][pPass])
Reply
#8

This would fix, I guess:
pawn Код:
if(udb_hash(params[0]) == PlayerInfo[playerid][pPass])
If it don't, please show your enum.
Reply
#9

Still using udb... ? However lol,

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
This would fix, I guess:
pawn Код:
if(udb_hash(params[0]) == PlayerInfo[playerid][pPass])
If it don't, please show your enum.
Nope lol, you can't compare two strings like that. You should know that.

I really don't use udb but try it.
pawn Код:
CMD:login(playerid, params[])
{
    new
        Pass[64]
    ;
    if(sscanf(params), "s", Pass[64])) return SendClientMessage(playerid, -1, "Usage: /login [Password]");
    if(strlen(Pass) > 64) return SendClientMessage(playerid, -1, "Pass can't exceed 64 chars...");
    if(!strcmp(udb_hash(Pass)), PlayerInfo[playerid][pPassword]) // Replace with your var.
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        SetPlayerCash(playerid, PlayerInfo[playerid][pCash]);
        SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
        SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pRank]);
        PlayerInfo[playerid][pLogged] = 1;
    }
    else
    {
        SendClientMessage(playerid, -1, "Wrong pass..."), Kick(playerid);
    }
    return 1;
}
NOTE: UDB is not a real hash btw.
Reply
#10

Quote:
Originally Posted by Mr_DjolE
Посмотреть сообщение
Still using udb... ? However lol,



Nope lol, you can't compare two strings like that. You should know that.

I really don't use udb but try it.
Was using udb just for test, i added Whirlpool, and edited the /login with this.

pawn Код:
CMD:login(playerid, params[])
{
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),params);
            if(!strcmp(hashpass,PlayerInfo[playerid][pPass]))
            (
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    SetPlayerCash(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerScore(playerid, PlayerInfo[playerid][pKills]);
                    SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pRank]);
                    PlayerInfo[playerid][pLogged] = 1;
            }
            else
            {
            SCM(playerid,0x0080C0FF,"Wrong login.");
            }
            return 1;
)
I just get this errors now:

(3857 -- 385 : error 001: expected token: ")", but found ";"
(3864) : error 010: invalid function or declaration
(386 : error 010: invalid function or declaration

3857-3858:

pawn Код:
(
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
3864:

pawn Код:
else
3868:

pawn Код:
return 1;
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)