Question

вот это у меня  в логах:

Спойлер

[01:09:48 02/22/22] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0') (Query: "INSERT INTO `users` (`name`,`password`,`money`) VALUES ('Andrey_Riskov','123123','500')")
[01:09:48 02/22/22] [ERROR] cache_get_field_content_int - invalid datatype
[01:17:38 02/22/22] [WARNING] cache_get_field_content_int - no active cache
[01:17:38 02/22/22] [WARNING] cache_get_field_content_int - no active cache
[01:21:16 02/22/22] [WARNING] cache_get_field_content_int - no active cache
[01:21:16 02/22/22] [WARNING] cache_get_field_content_int - no active cache
[01:23:57 02/22/22] [WARNING] cache_get_field_content_int - no active cache
[01:23:57 02/22/22] [WARNING] cache_get_field_content_int - no active cache
[01:28:53 02/22/22] [WARNING] cache_get_field_content_int - no active cache
[01:28:53 02/22/22] [WARNING] cache_get_field_content_int - no active cache
[15:26:29 02/22/22] [WARNING] cache_get_field_content_int - no active cache
[15:26:29 02/22/22] [WARNING] cache_get_field_content_int - no active cache
[15:32:20 02/22/22] [WARNING] cache_get_field_content_int - no active cache
[15:32:20 02/22/22] [WARNING] cache_get_field_content_int - no active cache
 

Код:

#define MAX_PASSWORD 24
enum player{
id[60],
name,
pPassword,
money[100]
};
new p_info[MAX_PLAYERS][player];
public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid,p_info[playerid][name],24);
    new query[120];
    format(query,sizeof(query),"SELECT * FROM `users` WHERE `name` = '%s'",p_info[playerid][name]);
    mysql_function_query(sql,query,true,"check","i",playerid);
    clear_vars(playerid);
}
//в конце мода
forward check(playerid);
public check(playerid)
{
    new rows,fields;
    cache_get_data(rows,fields);
    if(!rows)
    {
        ShowPlayerDialog(playerid, D_REG, DIALOG_STYLE_INPUT, "рег""введите пароль ниже""ок""отмена");
    }
    else
    {
        cache_get_field_content(0,"password",p_info[playerid][pPassword],sql,MAX_PASSWORD);
        ShowPlayerDialog(playerid,D_LOG,DIALOG_STYLE_INPUT,"Àâòîðèçàöèÿ íàõóé","äà - êðóòî","ïðîäîëæèòü","íåà");
    }
    return 1;
    
}
forward loading_acc(playerid);
public loading_acc(playerid)
{
    p_info[playerid][id] = cache_get_field_content_int(0,"id",sql);
    p_info[playerid][money] = cache_get_field_content_int(0,"money",sql);
    return 1;
}
stock save_acc(playerid)
{
    new query[120];
    format(query,sizeof(query),"UPDATE `users` SET `money` = '%d'", p_info[playerid][money]);
}
forward spawn(playerid);
public spawn(playerid)
{
    SpawnPlayer(playerid);
    SetPlayerPos(playerid,1872.2830,2236.6929,15.2729);
    SetPlayerSkin(playerid,30);
    GivePlayerMoney(playerid,p_info[playerid][money]);
}
stock clear_vars(playerid)
{
    p_info[playerid][id] = 0;
    p_info[playerid][name] = EOS;
    p_info[playerid][pPassword] = EOS;
    p_info[playerid][money] = 0;
}

OnDialogResponse

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case D_REG:{
        if(!response) return ShowPlayerDialog(playerid,D_REG,DIALOG_STYLE_INPUT,"Регистрация","да - круто","продолжить","неа");
        if(strlen(inputtext) == 0return ShowPlayerDialog(playerid,D_REG,DIALOG_STYLE_INPUT,"Регистрация ","да - крутсо","продолжить","неа");
        if(strlen(inputtext) < 3 || strlen(inputtext) > 24return ShowPlayerDialog(playerid,D_REG,DIALOG_STYLE_INPUT,"Регистрация","мин 3 макс 24","продолжить","неа");
        GetPlayerName(playerid,p_info[playerid][name],24);
        new query[100];
        format(query,sizeof(query),"INSERT INTO `users` (`name`,`password`,`money`) VALUES ('%s','%s','500')",p_info[playerid][name],inputtext,p_info[playerid][money]);
        mysql_tquery(sql,query,"loading_acc","i",playerid);
        strmid(p_info[playerid][pPassword],inputtext,0,strlen(inputtext),30);
        }
        case D_LOG:{
        if(!response) return ShowPlayerDialog(playerid,D_LOG,DIALOG_STYLE_INPUT,"Регистрация","да - круто","продолжить","неа");
        if(strlen(inputtext) == 0return ShowPlayerDialog(playerid,D_LOG,DIALOG_STYLE_INPUT,"Регистрация","да - крутсо","продолжить","неа");
        if(strlen(inputtext) < 3 || strlen(inputtext) > 24return ShowPlayerDialog(playerid,D_LOG,DIALOG_STYLE_INPUT,"Регистрация","мин 3 макс 24","продолжить","неа");
        if(!strcmp(p_info[playerid][pPassword],inputtext,false,24))
        {
            SetTimerEx("spawn",5,false,"i",playerid);
            spawn(playerid);
            loading_acc(playerid);
        }
        else
        {
            ShowPlayerDialog(playerid,D_LOG,DIALOG_STYLE_INPUT,"Авторизация ,"ниправильно!!!!!!!!","продолжить","неа");
        }

        }
    }
    return 1;
}

 

Share this post


Link to post

0 answers to this question

There have been no answers to this question yet

Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0