YSI\y_ini Login&Register sistem. 4 Errors finished Help please.
#1

Helo

Im working on Login and Register sistem i have finished sistem but i have 4 errors :

http://pastebin.com/dgQRjmRu Here is codes . Help

Thanks all .
Reply
#2

Hello.

It'd be good if you show the error and post the code in tags since no one will read the code carefully for errors.. you need to elaborate and take some pain since its your problem not ours.

Regards.
Reply
#3

Код:
Errors 4:
 
Login.pwn(44) : warning 209: function "LoadUser_data" should return a value
Login.pwn(47) : error 001: expected token: ";", but found "-identifier-"
Login.pwn(47) : error 017: undefined symbol "playername"
Login.pwn(47) : warning 215: expression has no effect
Login.pwn(47) : error 001: expected token: ";", but found "]"
Login.pwn(47) : fatal error 107: too many error messages on one line
 
Hole script i will mark with // coloms that have errors u have nubmer of colom here so help xD :) .Ty
 
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
 
#include <a_samp>
#include <zcmd>
#include <YSI\y_ini>
 
#define FILTERSCRIPT
#if defined FILTERSCRIPT
 
#define MAX_PLAYER 50
 
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
 
#define COLOR_WHITE "(FFFFFF)"
#define COLOR_RED "(F81313)"
#define COLOR_GREEN "(00FF22)"
#define COLOR_LIGHTBLUE "(00CED1)"
 
#define PATH "/Accounts/%s.ini"
#pragma tabsize 0
 
enum pInfo
{
         pPass,
         pCash,
         pAdmin,
         pScore,
         pBankmoney,
         pBanned
}
new PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
        INI_Int("Cash",PlayerInfo[playerid][pCash]);
        INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
        INI_Int("Score",PlayerInfo[playerid][pScore]);
        INI_Int("Bankmoney",PlayerInfo[playerid][pBankmoney]);
        INI_Int("Banned",PlayerInfo[playerid][pBanned]);
}
stock UserPath(playerid)
{
                 new string[128]playername,[MAX_PLAYER_NAME];
                 GetPlayerName(playerid,playername,sizeof(playername));
                 format(string,sizeof(string),PATH,playername);
                 return string;
}
stock udb_hash(buf[])
{
        new length*strlen(buf);
        new s1 = 1;
        new s2 = 2;
        new n;
        for (n=0); n<length; n++)
        {
                s1 = (s1 + buf[n]) % 65521;
                s2 = (s2 + s1)     % 65521;
     }
     return (s2 << 16) + s1;
 {
main()
{
        print("\n----------------------------------");
        print("-----|Gamemode by:ProfinuxSRB|------");
        print("----------------------------------\n");
}
 
#endif
 
public OnGameModeInit()
{
        // Don't use these lines if it's a filterscript
        SetGameModeText("Blank Script");
        AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
        return 1;
}
 
public OnGameModeExit()
{
        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,"Prijava:","Molimo vas upisite vasu sifru za bi se prijavili!","Prijava","Izadji");
        }
        else
        {
                 ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Registruj:","Molimo vas registrujte vas nalog,upisite vasu sifru!","Registuj","Izadji");
        }
       
        return 1;
}
 
public OnPlayerDisconnect(playerid, reason)
{
        new INT:FILE = INT_Open(UserPath(playerid);
        INI_SetTag(File,"data");
        INI_WriteText(File,"Cash",GetPlayerMoney(playerid);
    INI_WriteText(File,"Admin",PlayerInfo[pAdmin]);
        INI_WriteText(File,"Score",GetPlayerScore(playerid);
        INI_WriteText(File,"Banmoney",PlayerInfo(playerid)[pBankmoney]);
        INI_WriteText(File,"Banned",PlayerInfo(playerid)[pBanned]);
        return 1;
}
 
{
        if (strcmp("/mycommand", cmdtext, true, 10) == 0)
        {
                // Do something here
                return 1;
        }
        return 0;
}
 
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,"Registruj:","Sifra netacna,upisi novu sifru!","Registruj","Izadji");
                                 new INI:File = INI_Open(UserPath(playerid));
                                  INI_SetTag(file,"data");
                                  INI_WriteInt(File,"Sifra",udb_hash(inputtext));
                                  INI_WriteInt(File,"Cesh",0);
                                  INI_WriteInt(File,"Admin",0);
                                  INI_WriteInt(File,"Score",0);
                                  INT_WriteInt(File,"Bankmoney",0);
                                  INT_WriteInt(File,"Banned",0);
                         }
                   }
           case DIALOG_REGISTER:
           {
                           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,PlayeInfo(playerid)[pScore]);
                                                  SendClientMessange(playerid,-1,"Uspesno ste se prijavili na vas nalog,uzivajte!");
                                         }
                                         else
                                         {
                                                  ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Prijava:","Sifra netacna,pokusajte ponovo!","Prijava","Izadji");
                                         }
                                  }
                           }
                   }
     }
 
 
 
        return 1;
}
Reply
#4

use this
you defined playername like this " playername,[MAX_PLAYER_NAME];" and you didnt returned in loaduser_Data

pawn Код:
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
        INI_Int("Cash",PlayerInfo[playerid][pCash]);
        INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
        INI_Int("Score",PlayerInfo[playerid][pScore]);
        INI_Int("Bankmoney",PlayerInfo[playerid][pBankmoney]);
        INI_Int("Banned",PlayerInfo[playerid][pBanned]);
        return 1;
}

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

Now i have error on this line ...

Код:
{
	new string[128],playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername)); =this line ... 
	format(string,sizeof(string),PATH,playername);
	return string;
Its all good i dont se error here ...
Errors are

(50) : error 029: invalid expression, assumed zero
(50) : error 035: argument type mismatch (argument 2)
(50) : error 020: invalid symbol name ""
Reply
#6

Does it work like that?
PHP код:
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof playername);
format(string,sizeof string,"/Accounts/%s.ini",playername);
return 
string
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)