Register & Login Errors
#1

Hello Guys Can u help me to Fix this ThiS??

Код:
Register.pwn(113) : error 017: undefined symbol "UserPath"
Register.pwn(115) : error 035: argument type mismatch (argument 1)
Register.pwn(115) : error 017: undefined symbol "bExtra"
Register.pwn(115) : warning 215: expression has no effect
Register.pwn(115) : error 029: invalid expression, assumed zero

Код:
This All Of "OnPlayerConnect" Errors There!!!!
PHP код:
public OnPlayerConnect(playerid)
{
    if(
fexist(UserPath(playerid))
    {
       
INI_ParseFile(playerid),"LoadUser_%s",.bExtra true,.extra playerid);
       
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login:","Plesae Enter Your Password to log in your account!","Login","Quit");
    }
    else
    {
       
ShowPlayerDialog(playeridDIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register:","Plesae Enter You'r new Password For Register!","Register","Quit");
    }
    return 
1;

Help me to Fix this !!
Reply
#2

Try this:

PHP код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid); 
Also as JasperM said, You missed one ) so it must be like this:
PHP код:
if(fexist(UserPath(playerid))) 
Reply
#3

Код:
if(fexist(UserPath(playerid))
That's also missing one ")" on the end. Besides that, look at the comment above me, because

Код:
INI_ParseFile(playerid),"LoadUser_%s",.bExtra = true,.extra = playerid);
Is obviously wrong. There is one ")" too much behind the first playerid, and I guess your playerid is not your filename.
Reply
#4

Quote:
Originally Posted by oMa37
Посмотреть сообщение
Try this:

PHP код:
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid); 
Look i try to Type

PHP код:
new UserPath[MAX_PLAYERS]; 
The Errors is changed .... and now 4 errors Look for this New Errors

PHP код:
Register.pwn(115) : error 012invalid function callnot a valid address
Register
.pwn(115) : warning 215expression has no effect
Register
.pwn(115) : error 001expected token";"but found ")"
Register.pwn(115) : error 029invalid expressionassumed zero 
For Onplayerconnect

Код:
public OnPlayerConnect(playerid)
{
	if(fexist(UserPath(playerid)))
	{
      INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
       ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login:","Plesae Enter Your Password to log in your account!","Login","Quit");
    }
    else
    {
	   ShowPlayerDialog(playerid, DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register:","Plesae Enter Your new Password For Register!","Register","Quit");
    }
	return 1;
}
i Try your code i thing its worked.. help me for this

the Line 115 is

Код HTML:
if(fexist(UserPath(playerid)))
Reply
#5

That's not how you define the path lol
it's something like this:
PHP код:
//Top of your script
#define PATH "%s.ini" // change it if you want .. 
//Somewhere else
stock UserPath(playerid)
{
    new 
string[128],playername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,playername,sizeof(playername));
    
format(string,sizeof(string),PATH,playername);
    return 
string;

Reply
#6

This i did !! Look i show u the LoadUser - UserPath - udb_hash

PHP код:
public LoadUser_date[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;

[/PHP]
PHP код:
stock UserPath(playerid)
{
    new 
string[128],playername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,playername,sizeof(playername));
    
format(string,sizeof(string),PATH,playername);
    return 
string;

PHP код:
stock udb_hash(buf[])
{
    new 
length=strlen(buf);
    new 
s1 1;
    new 
s2 0;
    new 
n;
    for (
n=0n<lengthn++)
    {
       
s1 = (s1 buf[n]) % 65521;
       
s2 = (s2 s1)     % 65521;
    }
    return (
s2 << 16) + s1;

Nothing Wrong Right?
Reply
#7

use INI_String for the password.
and fix the public ..

PHP код:
public LoadUser_date(playerid,name[],value[]) 

   
INI_String("Password",PlayerInfo[playerid][pPass], 129); 
   
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

Reply
#8

Its not work bro i try many times I Thing wrong in OnDialogResponse

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
       case 
DIALOG_REGISTER:
            if(!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register:","Password invaild,type new password!","Register","Quit");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"date");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Score",0);
                
INI_WriteInt(File,"Bankmoney",0);
                
INI_WriteInt(File,"Banned",0);
                
INI_Close(File);
            }
        }
        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,-1,"You've succsefully logged in your account!");
               }
               else
               {
                  
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login:","Password incorrect,type agian!","Login!","Quit!");
               }
            }
         }
      }

    return 
1;

Код:
something error??
Reply
#9

Try this
And show me all the errors if you got.

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_REGISTER:
        {
          if(!
response) return Kick(playerid);
          if(
response)
          {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register:","Password invaild,type new password!","Register","Quit");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"date");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Score",0);
                
INI_WriteInt(File,"Bankmoney",0);
                
INI_WriteInt(File,"Banned",0);
                
INI_Close(File);
          }
        }
        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,-1,"You've succsefully logged in your account!");
               }
               else 
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login:","Password incorrect,type agian!","Login!","Quit!");
            }
         }
      }
    return 
0;

Reply
#10

Quote:
Originally Posted by oMa37
Посмотреть сообщение
Try this
And show me all the errors if you got.

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_REGISTER:
        {
          if(!
response) return Kick(playerid);
          if(
response)
          {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register:","Password invaild,type new password!","Register","Quit");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"date");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Score",0);
                
INI_WriteInt(File,"Bankmoney",0);
                
INI_WriteInt(File,"Banned",0);
                
INI_Close(File);
          }
        }
        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,-1,"You've succsefully logged in your account!");
               }
               else 
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login:","Password incorrect,type agian!","Login!","Quit!");
            }
         }
      }
    return 
0;

Its worked But 100% 100% 100% The bug in OnPlayerConnect Becuase all Errors there

PHP код:
public OnPlayerConnect(playerid)
{
    if(
fexist(UserPath(playerid)))
    {
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
          
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
         
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 
1;

I HATE THIS SHIT .....
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)