SA-MP Forums Archive
why dosnt this work? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: why dosnt this work? (/showthread.php?tid=188457)



why dosnt this work? - dark_clown - 07.11.2010

this dosnt register it dosnt create a dini
i dont get any errors or warnings
pawn Код:
dcmd_register(playerid,params[])
{
    #pragma unused params
    new file[128],n[MAX_PLAYER_NAME];
    GetPlayerName(playerid,n,MAX_PLAYER_NAME);
    format(file,sizeof(file),"MyAdmin/Users/%s.ini",n);
    if(dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are already registered!");
    if(PInfo[playerid][Regged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already registered!");
    if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,red,"You are already registered, and logged in!");
    ShowPlayerDialog(playerid,10,DIALOG_STYLE_INPUT,"Register","Welcome \n We see you want to register\nPlease enter a password below","Register","Cancel");
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new file[128],n[MAX_PLAYER_NAME];
    GetPlayerName(playerid,n,MAX_PLAYER_NAME);
    format(file,sizeof(file),"MyAdmin/Users/%s.ini",n);
    if(dialogid == 9)
    {
        dini_Create(file);
        dini_Set(file,"Password",inputtext);
        dini_IntSet(file,"Regged",1);
        dini_IntSet(file,"Logged",0);
        dini_IntSet(file,"Level",0);
        dini_IntSet(file,"Muted",0);
        dini_IntSet(file,"Jailed",0);
        dini_IntSet(file,"Frozen",0);
        dini_IntSet(file,"Skin",0);
        dini_IntSet(file,"Dueling",0);
        dini_IntSet(file,"Score",GetPlayerScore(playerid));
        SendClientMessage(playerid,LIGHTBLUE,"Congratulations, you have just registered, please /login");
        PInfo[playerid][Regged] = 1;
        }
    return 1;
}



Re: why dosnt this work? - willsuckformoney - 07.11.2010

You have the folders?


Re: why dosnt this work? - dark_clown - 07.11.2010

ofc i hade it all in just one command
but i wanted to change in to a dialog
but in the cmd was working, why isnt it working in the dialog?


Re: why dosnt this work? - DeathOnaStick - 07.11.2010

Quote:
Originally Posted by dark_clown
Посмотреть сообщение
ofc i hade it all in just one command
but i wanted to change in to a dialog
but in the cmd was working, why isnt it working in the dialog?
Am i blind or does it have to be 'if(dialogid==10)'?


Re: why dosnt this work? - dark_clown - 07.11.2010

well yah ur not blind why?
i putted
Quote:

ShowPlayerDialog(playerid,10,DIALOG_STYLE_INPUT,"R egister","Welcome \n We see you want to register\nPlease enter a password below","Register","Cancel");

does it matter any number i put?


Re: why dosnt this work? - DeathOnaStick - 07.11.2010

Quote:
Originally Posted by dark_clown
Посмотреть сообщение
well yah ur not blind why?
i putted

does it matter any number i put?
It has to be the number of the dialog that you created. Here it is the number 10.

[gay]This forum requires that you wait 120 seconds between posts. Please try again in 30 seconds.[/gay]


Re: why dosnt this work? - dark_clown - 07.11.2010

where do i create?
pawn Код:
new dialog 10?
on the top?
but the dialog appears it just dosnt create the dini
edit: 100 posts


Re: why dosnt this work? - DeathOnaStick - 07.11.2010

Quote:
Originally Posted by dark_clown
Посмотреть сообщение
where do i create?
pawn Код:
new dialog 10?
on the top?
but the dialog appears it just dosnt create the dini
It doesn't create the dini because the dialogid is not 9.

You've got:

pawn Код:
if(dialogid == 9)
but due to the fact that you used

pawn Код:
ShowPlayerDialog(playerid,10,DIALOG_STYLE_INPUT,"Register","Welcome \n We see you want to register\nPlease enter a password below","Register","Cancel");
it has to be like

pawn Код:
if(dialogid == 10)
This might help you, too. Watch the second parameter.


Re: why dosnt this work? - dark_clown - 07.11.2010

lol i saw it but still it dosnt work


Re: why dosnt this work? - The_Moddler - 07.11.2010

pawn Код:
dcmd_register(playerid,params[])
{
    #pragma unused params
    new file[128],n[MAX_PLAYER_NAME];
    GetPlayerName(playerid,n,MAX_PLAYER_NAME);
    format(file,sizeof(file),"MyAdmin/Users/%s.ini",n);
    if(dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are already registered!");
    if(PInfo[playerid][Regged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already registered!");
    if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,red,"You are already registered, and logged in!");
    ShowPlayerDialog(playerid,10,DIALOG_STYLE_INPUT,"Register","Welcome \n We see you want to register\nPlease enter a password below","Register","Cancel");
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new file[128],n[MAX_PLAYER_NAME];
    GetPlayerName(playerid,n,MAX_PLAYER_NAME);
    format(file,sizeof(file),"MyAdmin/Users/%s.ini",n); //Make sure you have those folders
    if(dialogid == 10) //It must be 10, like they told you.
    {
        if(response) //You forgot this.
        {
            dini_Create(file);
            dini_Set(file,"Password",inputtext);
            dini_IntSet(file,"Regged",1);
            dini_IntSet(file,"Logged",0);
            dini_IntSet(file,"Level",0);
            dini_IntSet(file,"Muted",0);
            dini_IntSet(file,"Jailed",0);
            dini_IntSet(file,"Frozen",0);
            dini_IntSet(file,"Skin",0);
            dini_IntSet(file,"Dueling",0);
            dini_IntSet(file,"Score",GetPlayerScore(playerid));
            SendClientMessage(playerid,LIGHTBLUE,"Congratulations, you have just registered, please /login");
            PInfo[playerid][Regged] = 1;
        }
        else
        {
            SendClientMessage(playerid,LIGHTBLUE,"You canceled the register!");
        }
    }
    return 1;
}



Re: why dosnt this work? - dark_clown - 07.11.2010

Quote:
Originally Posted by The_Moddler
Посмотреть сообщение
pawn Код:
dcmd_register(playerid,params[])
{
    #pragma unused params
    new file[128],n[MAX_PLAYER_NAME];
    GetPlayerName(playerid,n,MAX_PLAYER_NAME);
    format(file,sizeof(file),"MyAdmin/Users/%s.ini",n);
    if(dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are already registered!");
    if(PInfo[playerid][Regged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already registered!");
    if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,red,"You are already registered, and logged in!");
    ShowPlayerDialog(playerid,10,DIALOG_STYLE_INPUT,"Register","Welcome \n We see you want to register\nPlease enter a password below","Register","Cancel");
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new file[128],n[MAX_PLAYER_NAME];
    GetPlayerName(playerid,n,MAX_PLAYER_NAME);
    format(file,sizeof(file),"MyAdmin/Users/%s.ini",n); //Make sure you have those folders
    if(dialogid == 10) //It must be 10, like they told you.
    {
        if(response) //You forgot this.
        {
            dini_Create(file);
            dini_Set(file,"Password",inputtext);
            dini_IntSet(file,"Regged",1);
            dini_IntSet(file,"Logged",0);
            dini_IntSet(file,"Level",0);
            dini_IntSet(file,"Muted",0);
            dini_IntSet(file,"Jailed",0);
            dini_IntSet(file,"Frozen",0);
            dini_IntSet(file,"Skin",0);
            dini_IntSet(file,"Dueling",0);
            dini_IntSet(file,"Score",GetPlayerScore(playerid));
            SendClientMessage(playerid,LIGHTBLUE,"Congratulations, you have just registered, please /login");
            PInfo[playerid][Regged] = 1;
        }
        else
        {
            SendClientMessage(playerid,LIGHTBLUE,"You canceled the register!");
        }
    }
    return 1;
}
it still dosnt create the dini


Re: why dosnt this work? - dark_clown - 07.11.2010

please help


Re: why dosnt this work? - WillyP - 07.11.2010

pawn Код:
dcmd_register(playerid,params[])
{
    #pragma unused params
    new file[128],n[MAX_PLAYER_NAME];
    GetPlayerName(playerid,n,MAX_PLAYER_NAME);
    format(file,sizeof(file),"MyAdmin/Users/%s.ini",n);
    if(dini_Exists(file)) return SendClientMessage(playerid,YELLOW,"You are already registered!");
   {
    if(PInfo[playerid][Regged] == 1) return SendClientMessage(playerid,LIGHTBLUE,"You are already registered!");
    if(PInfo[playerid][Logged] == 1) return SendClientMessage(playerid,red,"You are already registered, and logged in!");
    }
    else
    {
         ShowPlayerDialog(playerid,10,DIALOG_STYLE_INPUT,"Register","Welcome \n We see you want to register\nPlease enter a password below","Register","Cancel");
     }
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new file[128],n[MAX_PLAYER_NAME];
    GetPlayerName(playerid,n,MAX_PLAYER_NAME);
    format(file,sizeof(file),"MyAdmin/Users/%s.ini",n); //Make sure you have those folders
    if(dialogid == 10) //It must be 10, like they told you.
    {
        if(response) //You forgot this.
        {
            dini_Create(file);
            dini_Set(file,"Password",inputtext);
            dini_IntSet(file,"Regged",1);
            dini_IntSet(file,"Logged",0);
            dini_IntSet(file,"Level",0);
            dini_IntSet(file,"Muted",0);
            dini_IntSet(file,"Jailed",0);
            dini_IntSet(file,"Frozen",0);
            dini_IntSet(file,"Skin",0);
            dini_IntSet(file,"Dueling",0);
            dini_IntSet(file,"Score",GetPlayerScore(playerid));
            SendClientMessage(playerid,LIGHTBLUE,"Congratulations, you have just registered, please /login");
            PInfo[playerid][Regged] = 1;
        }
        else
        {
            SendClientMessage(playerid,LIGHTBLUE,"You canceled the register!");
        }
    }
    return 1;
}



Re: why dosnt this work? - The_Moddler - 07.11.2010

Make sure that you have the folders with their capital letters and well spelled!