SA-MP Forums Archive
Uhh need some help with spawning player under 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: Uhh need some help with spawning player under Dialog (/showthread.php?tid=482783)



Uhh need some help with spawning player under Dialog - Scrillex - 22.12.2013

so here is my spawn system:
OnPlayerSpawn:
pawn Код:
if(PlayerInfo[playerid][pArrived] == 0)
    {
        SetPlayerPos(playerid, 1773.8523, -1905.5093, 13.5501);
    }
    if(PlayerInfo[playerid][pArrived] == 1)
    {
        SetPlayerPos(playerid, 1772.1746, -1962.3596, 14.1172);
    }
    if(PlayerInfo[playerid][pArrived] == 2)
    {
        SetPlayerPos(playerid, 1685.6259, -2238.5376, 13.5469);
    }
    if(PlayerInfo[playerid][pMale] == 1)
    {
        femaleskins = random(sizeof(FEMALESKIN));
        SetPlayerSkin(playerid, femaleskins);
        PlayerInfo[playerid][pChar] = femaleskins;
    }
    if(PlayerInfo[playerid][pMale] == 0)
    {
        maleskins = random(sizeof(MALESKIN));
        SetPlayerSkin(playerid, maleskins);
        PlayerInfo[playerid][pChar] = maleskins;
    }
I want to put this under :

pawn Код:
case DIALOG_CITIZEN:
        {
            if (!response) return  ShowPlayerDialog(playerid,DIALOG_CITIZEN, DIALOG_STYLE_LIST,"Which countrys Citizen you are?", "USA \nCanada \nRussia \nChina \nEurope", "Select", "Close");
            if(response)
            switch(listitem)
            {
                case 0:
                {
                    PlayerInfo[playerid][pCitizen] = 0;
                }
                case 1:
                {
                    PlayerInfo[playerid][pCitizen] = 1;
                }
                case 2:
                {
                    PlayerInfo[playerid][pCitizen] = 2;
                }
                case 3:
                {
                    PlayerInfo[playerid][pCitizen] = 3;
                }
                case 4:
                {
                    PlayerInfo[playerid][pCitizen] = 4;
                }
            }
            return 1;
        }
Thank you for your time..
With best regards Scrillex..

(Just some time was off scripting.. So I for got a lot..


Re: Uhh need some help with spawning player under Dialog - Scrillex - 23.12.2013

bump!


Re: Uhh need some help with spawning player under Dialog - xVIP3Rx - 23.12.2013

I think you want this ?
pawn Код:
case DIALOG_CITIZEN:
{
    if (!response) return  ShowPlayerDialog(playerid,DIALOG_CITIZEN, DIALOG_STYLE_LIST,"Which countrys Citizen you are?", "USA \nCanada \nRussia \nChina \nEurope", "Select", "Close");
    if(response) PlayerInfo[playerid][pCitizen] = listitem;
    return 1;
}
If not then can you explain more.. Do you want to put the first code in a switch ?
like dat ?
pawn Код:
switch(PlayerInfo[playerid][pArrived])
{
    case 0: SetPlayerPos(playerid, 1773.8523, -1905.5093, 13.5501);
    case 1: SetPlayerPos(playerid, 1772.1746, -1962.3596, 14.1172);
    case 2: SetPlayerPos(playerid, 1685.6259, -2238.5376, 13.5469);
}
switch(PlayerInfo[playerid][pMale])
{
    case 0:
    {
        maleskins = random(sizeof(MALESKIN));
        SetPlayerSkin(playerid, maleskins);
        PlayerInfo[playerid][pChar] = maleskins;
    }
    case 1:
    {
        femaleskins = random(sizeof(FEMALESKIN));
        SetPlayerSkin(playerid, femaleskins);
        PlayerInfo[playerid][pChar] = femaleskins;
    }
}



Re: Uhh need some help with spawning player under Dialog - Scrillex - 23.12.2013

Yeah but the thing is I'm thinking to put it under DIALOG_CITIZEN like .. after it player spawns automatically without pressing spawn button..

Thank you for your replay.


Re: Uhh need some help with spawning player under Dialog - xVIP3Rx - 23.12.2013

Then use SetSpawnInfo then SpawnPlayer

Might be usefull: How to remove spawn buttons


Re: Uhh need some help with spawning player under Dialog - Scrillex - 23.12.2013

Thank you mate


Re: Uhh need some help with spawning player under Dialog - Pottus - 23.12.2013

This made me laugh....

switch(PlayerInfo[playerid][pMale])

Why would you need a switch for a true/false?


Re: Uhh need some help with spawning player under Dialog - xVIP3Rx - 23.12.2013

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
This made me laugh....

switch(PlayerInfo[playerid][pMale])

Why would you need a switch for a true/false?
Maybe he have another sex (Gay ) ?
I just typed it as his script..he wasn't using a bool, thats a tip for him.

Quote:
Originally Posted by Scrillex
Посмотреть сообщение
pawn Код:
if(PlayerInfo[playerid][pArrived] == 0)
    {
        SetPlayerPos(playerid, 1773.8523, -1905.5093, 13.5501);
    }
    if(PlayerInfo[playerid][pArrived] == 1)
    {
        SetPlayerPos(playerid, 1772.1746, -1962.3596, 14.1172);
    }
    if(PlayerInfo[playerid][pArrived] == 2)
    {
        SetPlayerPos(playerid, 1685.6259, -2238.5376, 13.5469);
    }
    if(PlayerInfo[playerid][pMale] == 1)
    {
        femaleskins = random(sizeof(FEMALESKIN));
        SetPlayerSkin(playerid, femaleskins);
        PlayerInfo[playerid][pChar] = femaleskins;
    }
    if(PlayerInfo[playerid][pMale] == 0)
    {
        maleskins = random(sizeof(MALESKIN));
        SetPlayerSkin(playerid, maleskins);
        PlayerInfo[playerid][pChar] = maleskins;
    }
Also a little question please.. What's different about bools/variable except "true/false"/"Whatever value", It saves Memory ? Didn't find a clear explanation..


Re: Uhh need some help with spawning player under Dialog - Pottus - 23.12.2013

There is no difference really it is more or less for syntax purposes but if you really want to save memory you can use char arrays please read here in fact read everything it's a plethora of good practices.

https://sampforum.blast.hk/showthread.php?tid=216730


Re: Uhh need some help with spawning player under Dialog - Ada32 - 23.12.2013

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
but if you really want to save memory you can use..
bit arrays. better yet, you can use ysi's player-optimized bit arrays (y_playerarray) to do the job