Uhh need some help with spawning player under Dialog
#1

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

bump!
Reply
#3

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

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

Then use SetSpawnInfo then SpawnPlayer

Might be usefull: How to remove spawn buttons
Reply
#6

Thank you mate
Reply
#7

This made me laugh....

switch(PlayerInfo[playerid][pMale])

Why would you need a switch for a true/false?
Reply
#8

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)