How to spawn via Dialog
#1

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
Reply
#2

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

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
Reply
#4

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
Reply
#5

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

Reply
#6

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
Reply
#7

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

Reply
#8

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;
}
Reply
#9

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

                    }
Reply
#10

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

                    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)