SA-MP Forums Archive
How to spawn via Dialog - 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: How to spawn via Dialog (/showthread.php?tid=366820)



How to spawn via Dialog - Healian - 07.08.2012

Hi guys i need help please , i want to replace the old char selection with a Dialog one

here is an explanation with pictures

The old Spawn System



What i want




So what i need is to click Select to spawn my character rather than the Spawn , Cuz i need the char selection to be a dialog rather than the OLD System


Re: How to spawn via Dialog - Blunt - 07.08.2012

On Player Spawn, add a dialog that has the spawn process response.


Re: How to spawn via Dialog - Healian - 07.08.2012

i think you dont understand me

In the first picture you select the character then click SPAWN , so you find yourself in the game

What i want to do is to select the character via the Dialog then when click Select , i find myself in the game

OnPlayerSpawn is for doing some process after you already spawned in the game


Re: How to spawn via Dialog - FalconX - 07.08.2012

Quote:
Originally Posted by Healian
Посмотреть сообщение
Hi guys i need help please , i want to replace the old char selection with a Dialog one

here is an explanation with pictures




So what i need is to click Select to spawn my character rather than the Spawn , Cuz i need the char selection to be a dialog rather than the OLD System
This is just an example you can make something better by using this method.

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    ShowPlayerDialog( playerid, DIALOG_SPAWN_CLASS, DIALOG_STYLE_LIST, "Select Your Class:-", "CLASS 1\nCLASS2\nCLASS 3", "Select", "Cancel" );
    return 1;
}

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_SPAWN_CLASS:
        {
            if( response )
            {
                switch( listitem )
                {
                    case 0: // Class 1
                    {
                                 // add your spawn positions.. or w.e

                    }
                    case 1: //class 2
                    {
                    }
                    case 2: // class 3
                    {
                    }
                    // and soo on
                }
            }
            else
            {
                ShowPlayerDialog( playerid, DIALOG_SPAWN_CLASS, DIALOG_STYLE_LIST, "Select Your Class:-", "CLASS 1\nCLASS2\nCLASS 3", "Select", "Cancel" );
            }
        }
    }
    return 1;
}
Remember you will need the following at the top of your script:

pawn Код:
#define DIALOG_SPAWN_CLASS ( 1000 )
Hope this example helps.

Regards,
FalconX


Re: How to spawn via Dialog - Healian - 07.08.2012

Could you explain me what this do ?
pawn Код:
#define DIALOG_SPAWN_CLASS ( 1000 )
and what is ( 1000 )


Also i want to get rid of this thing




Re: How to spawn via Dialog - FalconX - 07.08.2012

Quote:
Originally Posted by Healian
Посмотреть сообщение
Could you explain me what this do ?
pawn Код:
#define DIALOG_SPAWN_CLASS ( 1000 )
and what is ( 1000 )
This is the dialogid which is assigned on your SPAWN dialog so when a player clicks on any item on the list it goes to the callback OnDialogResponse and it checks if the dialog id is same then it proceeds the function.

Hope this clears some confusion

You can learn about dialog by the following link:-

https://sampwiki.blast.hk/wiki/How_to_Create_a_Dialog

Regards,
FalconX


Re: How to spawn via Dialog - Healian - 07.08.2012

Quote:
Originally Posted by FalconX
Посмотреть сообщение
This is the dialogid which is assigned on your SPAWN dialog so when a player clicks on any item on the list it goes to the callback OnDialogResponse and it checks if the dialog id is same then it proceeds the function.

Hope this clears some confusion

Regards,
FalconX
So 1000 is the dialog ID

also i want to totally remove this thing




Re: How to spawn via Dialog - FalconX - 07.08.2012

Quote:
Originally Posted by Healian
Посмотреть сообщение
So 1000 is the dialog ID

also i want to totally remove this thing

Hmm, As far as I know they are not removable but try using a text-draws boxes full of black colour and you can remove that ))

Or you can do something like the following?

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
   TogglePlayerSpectating(playerid, 1);
   return 1;
}

public OnPlayerSpawn(playerid)
{
   TogglePlayerSpectating(playerid, 0);
   return 1;
}



Re: How to spawn via Dialog - Healian - 07.08.2012

I am so sorry but can you tell me an idea what to add here so when case 0 is executed i find myself spawned like normal

pawn Код:
case 0: // Class 1
                    {
                                 // add your spawn positions.. or w.e

                    }



Re: How to spawn via Dialog - FalconX - 07.08.2012

Quote:
Originally Posted by Healian
Посмотреть сообщение
I am so sorry but can you tell me an idea what to add here so when i case 0 is executed i find myself spawned like normal

pawn Код:
case 0: // Class 1
                    {
                                 // add your spawn positions.. or w.e

                    }
You can add your spawn positions like:

for class 1 you can do this:

pawn Код:
case 0: // Class 1
                    {
                                 SetPlayerPos( playerid, X , Y, Z ); // you can add your own X Y Z positions by using /rs or /save ingame and find it in Documents > GTA files > SAMP > savepositons.txt

                    }