SA-MP Forums Archive
I Need Help - 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)
+--- Thread: I Need Help (/showthread.php?tid=360040)



I Need Help - God'Z War - 16.07.2012

[Problem fixed]


Re: I Need Help - Captain_Mani - 16.07.2012

You mean registration box?

^If so, here is it:

First make sure you go to:
scriptfiles --> make a new folder named 'Players'.

Then:

Add this under public OnPlayerConnect(playerid)
Код:
{

	TogglePlayerSpectating(playerid,1);
	new string[256], name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,name,sizeof(name));
	format(string,256,"Players/%s.ini",name);
	if(fexist(string))
{
   	ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Welcome back to the server! Please Login using your current used password!","Login","Exit");
}
	else
{
	ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Register","Welcome to the server! Please Register here with your password!","Register","Exit");
}
	return 1;
}

Add this under public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
Код:
{
    switch(dialogid)
{
    case 1:
    {
        if(response==1)
        {
            if(strcmp(ReadPlayer(1,playerid),inputtext,false)!=0)
            {
                SendClientMessage(playerid,COLOR_WHITE,"Your password was invalid! Please try again!");
                ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Welcome back to the server! Please Login using your current used password!","Login","Exit");
            }

            else TogglePlayerSpectating(playerid,0);
        }
        else Kick(playerid);
    }
    case 2:
    {
        if(response==1)
        {
            WritePlayer(inputtext,playerid,true);
            TogglePlayerSpectating(playerid,0);
        }
        else Kick(playerid);
    }
}
	return 1;
}
Add this at the very bottom of your script:
Код:
ReadPlayer(line,playerid)
{
    new string[256],name[MAX_PLAYER_NAME];
    new File:player;
    GetPlayerName(playerid,name,sizeof(name));
    format(string,256,"Players/%s.ini",name);
    player = fopen(string, io_read);
    for(new i=1; i<=line; i++)
    {
        fread(player,string);
        if(line==i)
        {fclose(player); return string;}
    }
    return string;
}

WritePlayer(text[],playerid, bool:filestart)
{
    new string[256],name[MAX_PLAYER_NAME];
    new File:player;
    GetPlayerName(playerid,name,sizeof(name));
    format(string,256,"Players/%s.ini",name);
    player = fopen(string, io_append);
    if(filestart)
    {
        fwrite(player,text);
    }
    else
    {
        format(string,256,"\n%s",text);
        fwrite(player,string);
    }
    fclose(player);
}



Re: I Need Help - God'Z War - 16.07.2012

hmm not register box its an teleporting dialog box


Re: I Need Help - Captain_Mani - 16.07.2012

Give me the coordinates of the places you want to teleport.


Re: I Need Help - God'Z War - 16.07.2012

This is the dialog Box
pawn Код:
if(dialogid == DIALOGID0+38)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    TimedTele(playerid, "Sf", -2631.3875,1392.5801,11.3191,  0, 6);
                }
                case 1:
                {
                    TimedTele(playerid, "Ls", 395.8828,-1960.3933,7.8593,  0, 6);
                }
                case 2:
                {
                    TimedTele(playerid, "LV", 395.8828,-1960.3933,7.8593,  0, 6);
                }
                case 3:
                {
                    TimedTele(playerid, "Tierra", -2264.3723,2300.4082,4.8202,  0, 6);
                }
                case 4:
                {
                    TimedTele(playerid, "Red County", 862.0703,-586.4109,18.0597,  0, 6);
                }
            }
        }
        return 0;

    }
pawn Код:
ShowPlayerDialog(playerid, DIALOGID0+38, DIALOG_STYLE_LIST, "Spawns Selection", "  SF \nLS \nLV \nTierra \nRed Country ","Select", "Close");



Re: I Need Help - Andi_Evandy - 16.07.2012

pawn Код:
if(dialogid == DIALOGID0+38)
    {
        if(response)
        {
            switch(listitem)
            {
                case 0:
                {
                    TimedTele(playerid, "Sf", -2631.3875,1392.5801,11.3191,  0, 6);
                }
                case 1:
                {
                    TimedTele(playerid, "Ls", 395.8828,-1960.3933,7.8593,  0, 6);
                }
                case 2:
                {
                    TimedTele(playerid, "LV", 395.8828,-1960.3933,7.8593,  0, 6);
                }
                case 3:
                {
                    TimedTele(playerid, "Tierra", -2264.3723,2300.4082,4.8202,  0, 6);
                }
                case 4:
                {
                    TimedTele(playerid, "Red County", 862.0703,-586.4109,18.0597,  0, 6);
                }
            }
        }
        else
        {
            ShowPlayerDialog(playerid, DIALOGID0+38, DIALOG_STYLE_LIST, "Spawns Selection", "  SF \nLS \nLV \nTierra \nRed Country ","Select", "Close");
        }
        return 0;
    }



Re: I Need Help - Captain_Mani - 16.07.2012

Add this under public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

Код:
{
   if(dialogid == DIALOGID0+38)
    {
        if(response==1)
        {
            switch(listitem)
            {
                case 0:
                {
                    SetPlayerPos(playerid, -2631.3875,1392.5801,11.3191);
                }
                case 1:
                {
                    SetPlayerPos(playerid, 395.8828,-1960.3933,7.8593);
                }
                case 2:
                {
                    SetPlayerPos(playerid, 395.8828,-1960.3933,7.8593);
                }
                case 3:
                {
                    SetPlayerPos(playerid, -2264.3723,2300.4082,4.8202);
                }
                case 4:
                {
                    SetPlayerPos(playerid, 862.0703,-586.4109,18.0597);
                }
            }
        }
    }
   return 1;
}



Re: I Need Help - God'Z War - 16.07.2012

Thnz Mate +REP